Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / System.ServiceModel / System / ServiceModel / Security / TlsnegoTokenAuthenticator.cs
index 6fe4644020f7b858b5814479f3a92b4f3861da48..688b509f644c0701f5259e94cbdfe534e61594fd 100644 (file)
@@ -170,8 +170,17 @@ namespace System.ServiceModel.Security
 
         protected override SspiNegotiationTokenAuthenticatorState CreateSspiState(byte[] incomingBlob, string incomingValueTypeUri)
         {
-            TlsSspiNegotiation tlsNegotiation = new TlsSspiNegotiation(SchProtocols.TlsServer | SchProtocols.Ssl3Server,
+            TlsSspiNegotiation tlsNegotiation = null;
+            if (LocalAppContextSwitches.DisableUsingServicePointManagerSecurityProtocols)
+            {
+                tlsNegotiation = new TlsSspiNegotiation(SchProtocols.TlsServer | SchProtocols.Ssl3Server,
                 this.serverToken.Certificate, this.ClientTokenAuthenticator != null);
+            }
+            else
+            {
+                var protocol = (SchProtocols)System.Net.ServicePointManager.SecurityProtocol & SchProtocols.ServerMask;
+                tlsNegotiation = new TlsSspiNegotiation(protocol, this.serverToken.Certificate, this.ClientTokenAuthenticator != null);
+            }
             // Echo only for TrustFeb2005 and ValueType mismatch
             if (this.StandardsManager.MessageSecurityVersion.TrustVersion == TrustVersion.WSTrustFeb2005 && 
                 this.NegotiationValueType.Value != incomingValueTypeUri)