-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement AES-GCM with CryptoKit on macOS #76490
Conversation
Tagging subscribers to this area: @dotnet/area-system-security, @vcsjones Issue DetailsThis implements AES-GCM using CryptoKit on macOS. Unlike ChaCha20Poly1305, CryptoKit has Opinions™ about the size of the authentication tag, namely that the authentication tag must be 16 bytes. Because .NET previously supported short authentication tags with OpenSSL, we will continue to fallback to OpenSSL if the authentication tag is short. However, CryptoKit is the preferred mechanism for AES-GCM. I considered having CryptoKit as the fallback if OpenSSL is not available, but that would mean that CryptoKit would never get exercised in CI since CI always has OpenSSL, and my general believe that the primary platform's implementation should be preferred. Closes #29811
|
bf1f47e
to
7b4a0be
Compare
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.macOS.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.macOS.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.macOS.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography/tests/AesGcmTests.cs
Outdated
Show resolved
Hide resolved
...braries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.NotSupported.cs
Show resolved
Hide resolved
Added When you commit this breaking change:
Tagging @dotnet/compat for awareness of the breaking change. |
src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Aead.cs
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AesGcm.macOS.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography/tests/AesGcmTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography/src/System.Security.Cryptography.csproj
Show resolved
Hide resolved
src/native/libs/System.Security.Cryptography.Native.Apple/pal_swiftbindings.swift
Outdated
Show resolved
Hide resolved
I agree that the failures don't look related (and that there's not really a sane universe in which they could be). |
Breaking change doc: dotnet/docs#32346 |
Any chance of this being backported to .NET 7, please? |
Almost certainly not for a couple of reasons. The first of which is that this is a breaking change. Breaking changes in servicing releases in my experience won't be accepted unless there is a very good reason to do so, such an API not doing what it is documented to do or causing customer harm. The second of which is that this change is dependent on #76317. That change makes changes to how native code is built for macOS, most notably by bumping the native macOS toolchain. That also feels inappropriate to do in a servicing release. But thanks for asking and I am glad (it seems) that this change will be useful for you in .NET 8. |
Yeah, it's gonna be great to have this :) Thank you for adding this. |
This implements AES-GCM using CryptoKit on macOS.
As discussed below, this is also a breaking change. While macOS previously supported encrypting and decrypting with "short" authentication tags when using OpenSSL, CryptoKit only supports 128-bit tags.
Closes #29811