File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed
Common/tests/TestUtilities/System
System.Security.Cryptography/tests Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -51,9 +51,10 @@ public static partial class PlatformDetection
51
51
throw new PlatformNotSupportedException ( ) ;
52
52
53
53
private static readonly Version s_openssl3Version = new Version ( 3 , 0 , 0 ) ;
54
- public static bool IsOpenSsl3 => ! IsApplePlatform && ! IsWindows && ! IsAndroid && ! IsBrowser ?
55
- GetOpenSslVersion ( ) >= s_openssl3Version :
56
- false ;
54
+ private static readonly Version s_openssl3_4Version = new Version ( 3 , 4 , 0 ) ;
55
+
56
+ public static bool IsOpenSsl3 => IsOpenSslVersionAtLeast ( s_openssl3Version ) ;
57
+ public static bool IsOpenSsl3_4 => IsOpenSslVersionAtLeast ( s_openssl3_4Version ) ;
57
58
58
59
/// <summary>
59
60
/// If gnulibc is available, returns the release, such as "stable".
@@ -140,6 +141,18 @@ private static Version GetOpenSslVersion()
140
141
return s_opensslVersion ;
141
142
}
142
143
144
+ // The "IsOpenSsl" properties answer false on Apple, even if OpenSSL is present for lightup,
145
+ // as they are answering the question "is OpenSSL the primary crypto provider".
146
+ private static bool IsOpenSslVersionAtLeast ( Version minVersion )
147
+ {
148
+ if ( IsApplePlatform || IsWindows || IsAndroid || IsBrowser )
149
+ {
150
+ return false ;
151
+ }
152
+
153
+ return GetOpenSslVersion ( ) >= minVersion ;
154
+ }
155
+
143
156
private static Version ToVersion ( string versionString )
144
157
{
145
158
// In some distros/versions we cannot discover the distro version; return something valid.
Original file line number Diff line number Diff line change @@ -112,11 +112,13 @@ public static void TestSubjectAlternativeName_Unix()
112
112
113
113
string s = asnData . Format ( false ) ;
114
114
bool isOpenSsl3 = PlatformDetection . IsOpenSsl3 ;
115
+ bool isOpenSsl3_4 = PlatformDetection . IsOpenSsl3_4 ;
115
116
116
117
string expected = string . Join (
117
118
", " ,
118
119
// Choice[0]: OtherName
119
- isOpenSsl3 ? "othername: UPN::subjectupn1@example.org" : "othername:<unsupported>" ,
120
+ isOpenSsl3_4 ? "othername: UPN:subjectupn1@example.org" :
121
+ isOpenSsl3 ? "othername: UPN::subjectupn1@example.org" : "othername:<unsupported>" ,
120
122
// Choice[1]: Rfc822Name (EmailAddress)
121
123
"email:sanemail1@example.org" ,
122
124
// Choice[2]: DnsName
You can’t perform that action at this time.
0 commit comments