简体   繁体   中英

Tls 1.2 OR Tls 1.0 with .net framework 4.0

I have a .net 4.0 windows service that communicates between two different systems. One is service now, one is a messaging bus.

Service now is forcing tls 1.2 (as they should). We updated our code to use 1.1 or 1.2 by adding ServicePointManager.SecurityProtocol = (SecurityProtocolType)768 | (SecurityProtocolType)3072;

The problem, the message bus is old and uses 1.0.

Is there a way to support both? If I upgrade to .net 4.7 will it work for any and all protocols?

Thanks

If TLS1.2 is not supported by the server it will try TLS1.1 , if TLS1.1 is not supported by the server it will try TLS1.0 . This will allow you to use the best protocol and fall back if the server doesn't support it, as is your case.

ServicePointManager.SecurityProtocol =  
    SecurityProtocolType.Tls | 
    (SecurityProtocolType)768 | 
    (SecurityProtocolType)3072;

Is there a way to support both? If I upgrade to .net 4.7 will it work for any and all protocols?

Yes ( any and all as far as your question is concerned), I believe.Net 4.5 and up you can do this...

ServicePointManager.SecurityProtocol = 
            SecurityProtocolType.Tls | 
            SecurityProtocolType.Tls11 | 
            SecurityProtocolType.Tls12;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM