Skip to content

techtrendings.com

Let's explore

Menu
Menu

TLS 1.2 support with C# windows

Posted on November 14, 2022November 14, 2022 by Avidlearner

Recently I ran into an issue where my client failed to connect to our windows software after they upgraded to TLS 1.2. Reason being our application was supporting tls version < 1.2 because of .Net 4.5 . Since TLS standards keep developing and improving. At the moment TLS 1.2 is a latest encryption standard powering SSL and TLS 1.3 is under work. In general, anything that is using TLS standard below TLS 1.2 is considered to be non secure.

The solution for my problem was to upgrade my application to the latest .NET framework: 4.6.1 as in this framework version TLS 1.2 is a default cryptographic standard.

Let’s see how different versions of .Net has kind of support for TLS:

  1. .NET 4.6 and above. : TLS 1.2 is supported by default,You don’t need to do any additional work to support it.
  2. .NET 4.5. TLS 1.2 is supported, but it’s not a default protocol. You need to add code in your application to use it. The following code will make TLS 1.2 default, make sure to execute it before making a connection in your application:
    • ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
  3. .NET 4.0. TLS 1.2 is not supported, but if you have .NET 4.5 (or above) installed on the system then you still can go for TLS 1.2 even if your application framework doesn’t support it. To do this we have to use below line of code:
     ServicePointManager.SecurityProtocol =(SecurityProtocolType)3072;

For .Net 4.5 , setting securityprotocol as Tls12 does solve the issue. But if you still got any issue then try adding the below line too as I was able to connect but while fetching data facing some issue but below code line worked for me.

ws.SslConfiguration.EnabledSslProtocols = SslProtocolsExtensions.Tls12;

ws refers to a Websocketsharp.websocket instance.

Hope it helps.

Related

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Implement Trie Data Structure in C++- LeetCode
  • How TLS Works
  • C++ – Factory Design Pattern – Creation Design Pattern
  • C++ – Strategy Design Pattern – Behavioral Design Pattern
  • LFU Cache Implementation – LeetCode

Recent Comments

  • automatically like friends photos on instagram on Program to find unpaired element in an Array in C++|Leetcode |techtrendings
  • Twicsy on Program to find unpaired element in an Array in C++|Leetcode |techtrendings

Archives

  • January 2023
  • November 2022
  • August 2022
  • June 2022
  • May 2022
  • March 2022
  • February 2022
  • January 2022

Categories

  • Algorithm
  • Algorithm
  • C++
  • Design Patterns
  • Multithreading
  • OS Concepts
  • Programming
  • Uncategorized

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Join Our Mailing List for the Latest News and Updates.

© 2023 techtrendings.com | Powered by Superbs Personal Blog theme