How to support TLS 1.2 for Windows 8.1 and UWP platforms

ChrisOnXamChrisOnXam CAUniversity ✭✭
edited March 2017 in Xamarin University

The current official Xamarin website only supports iOS and Android:
https://developer.xamarin.com/guides/cross-platform/transport-layer-security/

The same goes for ModernHttpClient PCL (iOS/Android only)

So is there anyway we can support TLS 1.2 for Windows 8.1 and UWP platforms? If Yes, please share and provided tutorial with source code

I am using Profile 111 for my PCL

Many thanks!

Answers

  • rene_ruppertrene_ruppert DEXamarin Team, University, XamUProfessors Xamurai

    Xamarin is meant to cover iOS, Android and Mac. As long as you are working on a Windows based platform, you're working with Microsoft .Net. This means, there is no need for any additional tooling and no Xamarin/Mono involved here. As of .Net 4.6 (or was it 4.5 - I don't remember 100% sure) you'll get TLS 1.2 support.

  • ChrisOnXamChrisOnXam CAUniversity ✭✭

    Hi Rene,
    Thank you for your answer. But I don't agree that Xamarin is only for iOS/Android/Mac. Since Microsoft bought Xamarin and even before that, Xamarin has moved toward to covering Windows Phone, Windows 8.1 and UWP platforms. So far, my app is running on iOS/Android/Windows 8.1/UWP platforms without problem until my client was asking for TLS 1.2 support for Windows platforms.

  • MichaelWatsonMichaelWatson USXamarin Team Xamurai
    edited March 2017

    Xamarin.Forms is an abstraction layer on top of Xamarin.iOS, Xamarin.Android and Windows platforms. The base technology that is Xamarin is really Xamarin.iOS and Xamarin.Android (well mono makes it all work, but the libraries of iOS and Android give you access to make the native app); this is what Rene is referring to.

    Also if you are running into TLS issues with HttpClient, you are now really talking about the .Net framework on that specific platform, not Xamarin. For your problem, you can make sure TLS is implemented by providing your own handler on the Windows platforms. There is a great SO post that explains this: http://stackoverflow.com/questions/22251689/make-https-call-using-httpclient.

    It sounds like you are using a PCL that is targeting .Net framework 4.5 because .Net 4.6+ gives TLS 1.2 by default.. Try upgrading your PCL profile to support .Net 4.6, or create a separate PCL that supports .Net 4.6+ and have all your HttpClient code live in that PCL. That should fix your problem.

  • ChrisOnXamChrisOnXam CAUniversity ✭✭

    Hi Michael,
    I have tried that. In VS 2015 whenever I change my target to .NET 4.6, it automatically set it back to 4.5. See the screenshot because they target the same set of APIs.

Sign In or Register to comment.