Default SecurityProtocol in .NET 4.5

前端 未结 17 1400
一生所求
一生所求 2020-11-22 03:24

What is the default security protocol for communicating with servers that support up to TLS 1.2? Will .NET by default, choose the highest security

17条回答
  •  青春惊慌失措
    2020-11-22 04:00

    The BEST solution to this problem appears to be to upgrade to at least .NET 4.6 or later, which will automatically choose strong protocols as well as strong ciphers.

    If you can't upgrade to .NET 4.6, the advice of setting

    System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

    And using the registry settings:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\v4.0.30319 – SchUseStrongCrypto = DWORD of 1 HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft.NETFramework\v4.0.30319 – SchUseStrongCrypto = DWORD of 1

    Results in using something other than TLS 1.0 and a strong cipher.

    In my testing, only the setting in the Wow6432Node made any difference, even though my test application was built for Any CPU.

提交回复
热议问题