@@ -199,7 +199,7 @@ public void set_ecdh_curve(CodeContext context, [NotNone] Bytes curve) {
199199 public void load_cert_chain ( CodeContext context , string certfile , string keyfile = null , object password = null ) {
200200 if ( keyfile is not null ) throw new NotImplementedException ( nameof ( keyfile ) ) ;
201201 if ( password is not null ) throw new NotImplementedException ( nameof ( password ) ) ;
202- #if NET5_0_OR_GREATER
202+ #if NET
203203 _cert = X509Certificate2 . CreateFromPemFile ( certfile , keyfile ) ;
204204#else
205205 _cert = ReadCertificate ( context , certfile , readKey : true ) ;
@@ -224,7 +224,7 @@ public void load_verify_locations(CodeContext context, object cafile = null, str
224224 } else {
225225 throw PythonOps . TypeError ( "cafile should be a valid filesystem path" ) ;
226226 }
227- #if NET5_0_OR_GREATER
227+ #if NET
228228 _cert_store . ImportFromPemFile ( _cafile ) ;
229229#else
230230 _cert_store . Add ( ReadCertificate ( context , _cafile ) ) ;
@@ -239,7 +239,7 @@ public void load_verify_locations(CodeContext context, object cafile = null, str
239239 if ( cadata is string s ) {
240240 if ( ! StringOps . TryEncodeAscii ( s , out Bytes ascii ) )
241241 throw PythonOps . ValueError ( "cadata should be an ASCII string or a bytes-like object" ) ;
242- #if NET5_0_OR_GREATER
242+ #if NET
243243 _cert_store . ImportFromPem ( s ) ;
244244#else
245245 string line ;
@@ -254,7 +254,7 @@ public void load_verify_locations(CodeContext context, object cafile = null, str
254254 using IPythonBuffer buf = cabuf . GetBuffer ( ) ;
255255 var contents = buf . AsReadOnlySpan ( ) ;
256256 while ( contents . Length > 0 ) {
257- #if NET5_0_OR_GREATER
257+ #if NET
258258 var cert = new X509Certificate2 ( contents ) ;
259259#else
260260 var cert = new X509Certificate2 ( contents . ToArray ( ) ) ;
@@ -949,7 +949,7 @@ private static PythonTuple IssuerFieldToPython(CodeContext context, string p) {
949949 }
950950
951951 private static X509Certificate2 ReadCertificate ( CodeContext context , string filename , bool readKey = false ) {
952- #if NET5_0_OR_GREATER
952+ #if NET
953953 if ( readKey ) {
954954 return X509Certificate2 . CreateFromPemFile ( filename ) ;
955955 }
0 commit comments