@@ -2377,6 +2377,7 @@ private static SslProtocols GetProtocolType(int type) {
23772377 SslProtocols result = SslProtocols . None ;
23782378
23792379 switch ( type & ~ PythonSsl . OP_NO_ALL ) {
2380+ #pragma warning disable CA5397 // Do not use deprecated SslProtocols values
23802381#pragma warning disable CS0618 // Type or member is obsolete
23812382 case PythonSsl . PROTOCOL_SSLv2 :
23822383 result = SslProtocols . Ssl2 ;
@@ -2394,20 +2395,23 @@ private static SslProtocols GetProtocolType(int type) {
23942395 case PythonSsl . PROTOCOL_TLSv1_1 :
23952396 result = SslProtocols . Tls11 ;
23962397 break ;
2398+ #pragma warning restore CA5397 // Do not use deprecated SslProtocols values
23972399 case PythonSsl . PROTOCOL_TLSv1_2 :
23982400 result = SslProtocols . Tls12 ;
23992401 break ;
24002402 default :
24012403 throw new InvalidOperationException ( "bad ssl protocol type: " + type ) ;
24022404 }
24032405 // Filter out requested protocol exclusions:
2406+ #pragma warning disable CA5397 // Do not use deprecated SslProtocols values
24042407#pragma warning disable CS0618 // Type or member is obsolete
24052408 result &= ( type & PythonSsl . OP_NO_SSLv3 ) != 0 ? ~ SslProtocols . Ssl3 : ~ SslProtocols . None ;
24062409 result &= ( type & PythonSsl . OP_NO_SSLv2 ) != 0 ? ~ SslProtocols . Ssl2 : ~ SslProtocols . None ;
24072410#pragma warning restore CS0618 // Type or member is obsolete
24082411 result &= ( type & PythonSsl . OP_NO_TLSv1 ) != 0 ? ~ SslProtocols . Tls : ~ SslProtocols . None ;
24092412 result &= ( type & PythonSsl . OP_NO_TLSv1_1 ) != 0 ? ~ SslProtocols . Tls11 : ~ SslProtocols . None ;
24102413 result &= ( type & PythonSsl . OP_NO_TLSv1_2 ) != 0 ? ~ SslProtocols . Tls12 : ~ SslProtocols . None ;
2414+ #pragma warning restore CA5397 // Do not use deprecated SslProtocols values
24112415 return result ;
24122416 }
24132417
@@ -2424,11 +2428,13 @@ public PythonTuple cipher() {
24242428
24252429 private string ProtocolToPython ( ) {
24262430 switch ( _sslStream . SslProtocol ) {
2431+ #pragma warning disable CA5397 // Do not use deprecated SslProtocols values
24272432#pragma warning disable CS0618 // Type or member is obsolete
24282433 case SslProtocols . Ssl2 : return "SSLv2" ;
24292434 case SslProtocols . Ssl3 : return "TLSv1/SSLv3" ;
24302435#pragma warning restore CS0618 // Type or member is obsolete
24312436 case SslProtocols . Tls : return "TLSv1" ;
2437+ #pragma warning restore CA5397 // Do not use deprecated SslProtocols values
24322438 default : return _sslStream . SslProtocol . ToString ( ) ;
24332439 }
24342440 }
0 commit comments