Поделиться через


Use TLS 1.2 on a Windows Store App developed with Xamarin

So, lets imagine that you are using Xamarin do develop some Apps that will targeting Android, iOS and Windows 8.1 devices, now lets imagine also that due to security concerns you will need to use TLS 1.2 for all these three platforms.

If you do a quick research on the Web you will find that iOS does this out-of-box, in Android you could rely on the ModernHTTPClient to achieve this, but for Windows 8.1 seems that there is no way to implement this type of security requirement.
But if you think about it, the solution is there for grabs, we just need to think a little about what we already have in .NET.

In fact the solution here would be much obvious than you will think, if you take a look at the "Windows.Web.Http" namespace you can see that in fact "Windows.Web.Http" wraps WinInet which uses TLS 1.2 unless the system is specifically configured otherwise.
And that is it, your solution right there for you, all you need to do is just make a HTTPClient call to a TLS1.2 site using the Windows.Web.Http.

You can learn more about this class in the below article:
/en-us/uwp/api/windows.web.http.httpclient

Hope that helps