My WPF app connects to an Azure Web API. The endpoints will be configured to deny access to any non secured (HTTP) or weakly secured (HTTPS with TLS 1.0 or older) requests. But I also want my App to never even try sending non secured or weakly secured requests.
Microsoft recommends here and there to target the Framework 4.7 and to leave ServicePointManager.SecurityProtocol
to its default value so that the OS determines what protocol to use.
The second article I mentioned also indicates Windows 7 will rely on TLS 1.0, just a few lines after having highly recommended not to rely upon TLS 1.0. So I understand I can trust the OS to get the best layer of security it has available, but cannot trust the OS for not sending a request if the best option is still a bad option.
My App relies on System.Net.Http.HttpClient
. I would like to make sure that the calls I make through this client are:
- Always secured. That is, always use HTTPS, never use HTTP.
- Always secured to a sufficient level. That is, rely at least on TLS 1.1; but never TLS 1.0 or SSL.
How can I achieve this?
- For point 1, I have read I should simply specify "https://" when creating the URI object; is this always true?
- For point 2, I could do a bitwise combination of all the
SecurityProtocolType
enum, excluding.ssl3
and.Tls
, but that would also exclude any future technologies (TLS1.4?). Is this answer still true now that the.SystemDefault
field has been added to the enum?