diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2022-02-07 21:58:38 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-07 21:58:38 +0300 |
commit | 5efff4455082c6d920425b2e5199fd3c0360af80 (patch) | |
tree | e414d22725f261ba2fc1526e6731fd1bdd851acc /src/libraries | |
parent | 2453f0d4ec1c0938bd9f1f806baa0ff2cfbd48a6 (diff) |
[release/6.0] Update SAN test to account for OpenSSL 3 changes (#63951)
* Update SAN test to account for OpenSSL 3 changes.
* Fix test for browser
Co-authored-by: Kevin Jones <kevin@vcsjones.com>
Diffstat (limited to 'src/libraries')
-rw-r--r-- | src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs | 5 | ||||
-rw-r--r-- | src/libraries/System.Security.Cryptography.Encoding/tests/AsnEncodedData.cs | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs index 99492706f7e..ccb9d51bd66 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs @@ -55,6 +55,11 @@ namespace System GetOpenSslVersion() : throw new PlatformNotSupportedException(); + private static readonly Version s_openssl3Version = new Version(3, 0, 0); + public static bool IsOpenSsl3 => !IsOSXLike && !IsWindows && !IsAndroid && !IsBrowser ? + GetOpenSslVersion() >= s_openssl3Version : + false; + /// <summary> /// If gnulibc is available, returns the release, such as "stable". /// Otherwise returns "glibc_not_found". diff --git a/src/libraries/System.Security.Cryptography.Encoding/tests/AsnEncodedData.cs b/src/libraries/System.Security.Cryptography.Encoding/tests/AsnEncodedData.cs index 0f63a74998d..bb1b734a8e5 100644 --- a/src/libraries/System.Security.Cryptography.Encoding/tests/AsnEncodedData.cs +++ b/src/libraries/System.Security.Cryptography.Encoding/tests/AsnEncodedData.cs @@ -101,11 +101,12 @@ namespace System.Security.Cryptography.Encoding.Tests sanExtension); string s = asnData.Format(false); + bool isOpenSsl3 = PlatformDetection.IsOpenSsl3; string expected = string.Join( ", ", // Choice[0]: OtherName - "othername:<unsupported>", + isOpenSsl3 ? "othername: UPN::subjectupn1@example.org" : "othername:<unsupported>", // Choice[1]: Rfc822Name (EmailAddress) "email:sanemail1@example.org", // Choice[2]: DnsName @@ -123,7 +124,7 @@ namespace System.Security.Cryptography.Encoding.Tests // Choice[7]: IPAddress (IPv6) "IP Address:2001:DB8:AC10:FE01:0:0:0:0", // Choice[7]: IPAddress (unknown type) - "IP Address:<invalid>", + isOpenSsl3 ? "IP Address:<invalid length=15>" : "IP Address:<invalid>", // Choice[7]: IPAddress (IPv4, longer string) "IP Address:255.255.255.255", // Choice[7]: IPAddress (IPv4, medium string) |