问题
I want to support all security protocols from ssl3 to tls 1.2 . But while searching on net I either found code as
`ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11;`
or as
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
But, I want to support all the protocols. So, is it wrong to write as
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
I didn't give me any compilation errors when I wrote the above code.So, will this cause any problem?
回答1:
Yes it will work. You can find a web site which only supports TLS 1.2 and try different combinations of this value, when you omit SecurityProtocolType.Tls12 from your value, your .NET app won't be able to connect to that site.
来源:https://stackoverflow.com/questions/38843806/can-we-add-four-protocols-to-servicepointmanager-securityprotocol