0

After adding the below registry key to enable TLS1.3 on Windows Server 2022

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client]
"DisabledByDefault"=dword:00000000
"Enabled"=dword:00000001

The .NET Client application throws the below exception

System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception.
 ---> System.ComponentModel.Win32Exception (0x80090308): The token supplied to the function is invalid
   --- End of inner exception stack trace ---
   at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](TIOAdapter adapter, Boolean receiveFirst, Byte[] reAuthenticationData, Boolean isApm)
   at System.Net.Security.SslStream.AuthenticateAsClient(SslClientAuthenticationOptions sslClientAuthenticationOptions)
   at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)

Is there anything i am missing? In the .NET Client application i had set the protocol version to TLS13.

Thanks in advance.

subbaraoc
  • 1,123
  • 1
  • 8
  • 27

1 Answers1

0

Try the below before you call the server if server is also on windows 2022+

Otherwise it will not work if server is not 2022+

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls13
Allanckw
  • 641
  • 1
  • 6
  • 17