|
| 1 | +--- |
| 2 | +title: "Breaking change: OpenSSL cryptographic primitives aren't supported on macOS" |
| 3 | +description: "Learn about the breaking change in .NET 10 where OpenSSL cryptographic primitives are no longer supported on macOS." |
| 4 | +ms.date: 06/23/2025 |
| 5 | +ai-usage: ai-assisted |
| 6 | +ms.custom: https://github.com/dotnet/docs/issues/46789 |
| 7 | +--- |
| 8 | +# OpenSSL cryptographic primitives are not supported on macOS |
| 9 | + |
| 10 | +Starting in .NET 10, OpenSSL-backed cryptographic primitives are no longer supported on macOS. <xref:System.Security.Cryptography.AesCcm?displayProperty=fullName> and classes that are specific to OpenSSL, such as <xref:System.Security.Cryptography.RSAOpenSsl?displayProperty=fullName>, now throw a <xref:System.PlatformNotSupportedException> on macOS. |
| 11 | + |
| 12 | +## Version introduced |
| 13 | + |
| 14 | +.NET 10 Preview 6 |
| 15 | + |
| 16 | +## Previous behavior |
| 17 | + |
| 18 | +Previously, classes that are specific to OpenSSL, such as <xref:System.Security.Cryptography.RSAOpenSsl?displayProperty=fullName>, worked on macOS if OpenSSL was available. |
| 19 | + |
| 20 | +<xref:System.Security.Cryptography.AesCcm?displayProperty=fullName> worked on macOS if OpenSSL was available. |
| 21 | + |
| 22 | +## New behavior |
| 23 | + |
| 24 | +Classes that are specific to OpenSSL, such as <xref:System.Security.Cryptography.RSAOpenSsl>, don't work on macOS even if OpenSSL is available, and a <xref:System.PlatformNotSupportedException> exception is thrown. |
| 25 | + |
| 26 | +<xref:System.Security.Cryptography.AesCcm> throws a <xref:System.PlatformNotSupportedException> exception. |
| 27 | + |
| 28 | +## Type of breaking change |
| 29 | + |
| 30 | +This is a [behavioral change](../../categories.md#behavioral-change). |
| 31 | + |
| 32 | +## Reason for change |
| 33 | + |
| 34 | +Support for the OpenSSL-backed primitives originated from .NET Core 1.0, where cryptography on macOS was implemented with OpenSSL. This wasn't ideal because a recent version of OpenSSL doesn't come on macOS, and acquiring and configuring OpenSSL on macOS was troublesome. In the .NET Core 2.0 timeframe, cryptography was moved to Apple's built-in functionality, so cryptographic functionality "just worked" without needing to acquire any additional components. |
| 35 | + |
| 36 | +The types that are suffixed as `OpenSsl` were left as being implemented by OpenSSL, and <xref:System.Security.Cryptography.AesCcm> doesn't have an implementation in Apple's cryptographic libraries. |
| 37 | + |
| 38 | +Supporting these OpenSSL-backed primitives on macOS has become more difficult as Apple has made it more difficult to load libraries from certain paths, and it complicates distributing software on macOS. |
| 39 | + |
| 40 | +## Recommended action |
| 41 | + |
| 42 | +If you're using OpenSSL-backed primitives without any specific intention of using OpenSSL, the recommendation is to use the factories that provide a macOS implementation: |
| 43 | + |
| 44 | +* `new DSAOpenSsl(...)` -> `DSA.Create(...)` |
| 45 | +* `new ECDiffieHellmanOpenSsl(...)` -> `ECDiffieHellman.Create(...)` |
| 46 | +* `new ECDsaOpenSsl(...)` -> `ECDsa.Create(...)` |
| 47 | +* `new RSAOpenSsl(...)` -> `RSA.Create(...)` |
| 48 | + |
| 49 | +<xref:System.Security.Cryptography.AesCcm?displayProperty=fullName> has no functional equivalent on macOS. Consider using a different cryptographic primitive, such as <xref:System.Security.Cryptography.AesGcm?displayProperty=fullName>, instead. |
| 50 | + |
| 51 | +## Affected APIs |
| 52 | + |
| 53 | +* <xref:System.Security.Cryptography.AesCcm?displayProperty=fullName> (all constructors) |
| 54 | +* <xref:System.Security.Cryptography.DSAOpenSsl?displayProperty=fullName> (all constructors) |
| 55 | +* <xref:System.Security.Cryptography.ECDiffieHellmanOpenSsl?displayProperty=fullName> (all constructors) |
| 56 | +* <xref:System.Security.Cryptography.ECDsaOpenSsl?displayProperty=fullName> (all constructors) |
| 57 | +* <xref:System.Security.Cryptography.RSAOpenSsl?displayProperty=fullName> (all constructors) |
| 58 | +* <xref:System.Security.Cryptography.SafeEvpPKeyHandle?displayProperty=fullName> (entire class) |
0 commit comments