From f55247d06d2389ff93d97138e18209119a0fd0a4 Mon Sep 17 00:00:00 2001 From: Kevin Jones Date: Tue, 18 Jul 2023 05:23:54 -0400 Subject: [PATCH] Improve text for OpenSsl primitives when OpenSSL is not available (#89046) * Improve text for OpenSsl primitives when OpenSSL is not available * Update src/libraries/System.Security.Cryptography/src/Resources/Strings.resx Co-authored-by: Stephen Toub --------- Co-authored-by: Stephen Toub --- .../System.Security.Cryptography/src/Resources/Strings.resx | 3 +++ .../src/System/Security/Cryptography/DSAOpenSsl.cs | 2 +- .../src/System/Security/Cryptography/ECDiffieHellmanOpenSsl.cs | 2 +- .../src/System/Security/Cryptography/ECDsaOpenSsl.cs | 2 +- .../src/System/Security/Cryptography/RSAOpenSsl.cs | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/libraries/System.Security.Cryptography/src/Resources/Strings.resx b/src/libraries/System.Security.Cryptography/src/Resources/Strings.resx index 300f3ec139037..e447937b7b6c3 100644 --- a/src/libraries/System.Security.Cryptography/src/Resources/Strings.resx +++ b/src/libraries/System.Security.Cryptography/src/Resources/Strings.resx @@ -810,6 +810,9 @@ OpenSSL is not supported on this platform. + + OpenSSL is required for algorithm '{0}' but could not be found or loaded. + Access is denied. diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSAOpenSsl.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSAOpenSsl.cs index e1805a2f99e9e..fe8cdca54eb4b 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSAOpenSsl.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/DSAOpenSsl.cs @@ -113,7 +113,7 @@ static partial void ThrowIfNotSupported() { if (!Interop.OpenSslNoInit.OpenSslIsAvailable) { - throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_AlgorithmNotSupported, nameof(DSAOpenSsl))); + throw new PlatformNotSupportedException(SR.Format(SR.PlatformNotSupported_CryptographyOpenSSLNotFound, nameof(DSAOpenSsl))); } } } diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellmanOpenSsl.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellmanOpenSsl.cs index 95c1bdf82a39e..1a3dc4b1a4008 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellmanOpenSsl.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDiffieHellmanOpenSsl.cs @@ -101,7 +101,7 @@ static partial void ThrowIfNotSupported() { if (!Interop.OpenSslNoInit.OpenSslIsAvailable) { - throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_AlgorithmNotSupported, nameof(ECDiffieHellmanOpenSsl))); + throw new PlatformNotSupportedException(SR.Format(SR.PlatformNotSupported_CryptographyOpenSSLNotFound, nameof(ECDiffieHellmanOpenSsl))); } } } diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsaOpenSsl.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsaOpenSsl.cs index 5e2d8f5fe271c..0887f0a9fb8a6 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsaOpenSsl.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/ECDsaOpenSsl.cs @@ -102,7 +102,7 @@ static partial void ThrowIfNotSupported() { if (!Interop.OpenSslNoInit.OpenSslIsAvailable) { - throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_AlgorithmNotSupported, nameof(ECDsaOpenSsl))); + throw new PlatformNotSupportedException(SR.Format(SR.PlatformNotSupported_CryptographyOpenSSLNotFound, nameof(ECDsaOpenSsl))); } } } diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAOpenSsl.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAOpenSsl.cs index b2ad115fd34d9..60fdd0ab1d61e 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAOpenSsl.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/RSAOpenSsl.cs @@ -94,7 +94,7 @@ static partial void ThrowIfNotSupported() { if (!Interop.OpenSslNoInit.OpenSslIsAvailable) { - throw new PlatformNotSupportedException(SR.Format(SR.Cryptography_AlgorithmNotSupported, nameof(RSAOpenSsl))); + throw new PlatformNotSupportedException(SR.Format(SR.PlatformNotSupported_CryptographyOpenSSLNotFound, nameof(RSAOpenSsl))); } } }