TLS 1. 2 The client and server cannot communicate, because they do not possess a common algorithm

1

I have an issue with TLS 1.2. It works if I enable tls1.0 in client machine, but it is not recommended.

Exception is - The client and server cannot communicate, because they do not possess a common algorithmSystem.ComponentModel.Win32Exception (0x80004005): The client and server cannot communicate, because they do not possess a common algorithm.

Target Framework of my app is .NET 4.6.2.

c#
.net
windows
tls1.2
asked on Stack Overflow Feb 18, 2019 by abc89 • edited Feb 18, 2019 by abc89

1 Answer

1

There are two possible scenario, in my case I used 2nd point.

  1. If you are facing this issue in production environment and you can easily deploy new code to the production then you can use of below solution.

    You can add below line of code before making api call,

    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; // .NET 4.5

  2. If you cannot deploy new code and you want to resolve with the same code which is present in the production, then this issue can be done by changing some configuration setting in config file. You can add either of one in your config file.

<runtime>
    <AppContextSwitchOverrides value="Switch.System.Net.DontEnableSchUseStrongCrypto=false"/>
  </runtime>

or

<runtime>
  <AppContextSwitchOverrides value="Switch.System.Net.DontEnableSystemDefaultTlsVersions=false"
</runtime>
answered on Stack Overflow Sep 15, 2020 by sagar borole

User contributions licensed under CC BY-SA 3.0