Bug 48994 - Mono TLS 1.2 not working on Android - Cannot load image with HTTPS with default client
Summary: Mono TLS 1.2 not working on Android - Cannot load image with HTTPS with defau...
Status: RESOLVED UPSTREAM
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.3
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-12-05 02:55 UTC by Emanuele Sabetta
Modified: 2016-12-13 20:08 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Sample project demonstrating the Mono TLS 1.2 client failure when loading an image from a HTTPS address (52.26 KB, application/zip)
2016-12-05 02:55 UTC, Emanuele Sabetta
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED UPSTREAM

Description Emanuele Sabetta 2016-12-05 02:55:37 UTC
Created attachment 18766 [details]
Sample project demonstrating the Mono TLS 1.2 client failure when loading an image from a HTTPS address

Mono now has TLS 1.2 support: http://tirania.org/blog/archive/2016/Sep-30.html

According to this post on stackoverflow the Mono TLS 1.2 client should work on Xamarin:

http://stackoverflow.com/questions/40735964/how-can-i-enable-ntlm-and-tls-1-2-with-xamarin-on-android

Yet in my Xamarin.Forms (Android version) I cannot connect to HTTPS web sites to download an image:

https://randomuser.me/api/portraits/men/85.jpg

This is the error I get:

Image Loading: Error getting stream for https://randomuser.me/api/portraits/men/85.jpg?random=0b8505c128554c9f982cfa4fdc169f5e: System.Net.WebException: Error: SecureChannelFailure (The authentication or decryption has failed.) ---> System.IO.IOException: The authentication or decryption has failed. ---> System.IO.IOException: The authentication or decryption has failed. ---> Mono.Security.Protocol.Tls.TlsException: The authentication or decryption has failed.
  at Mono.Security.Protocol.Tls.RecordProtocol.EndReceiveRecord (System.IAsyncResult asyncResult) [0x0003a] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs:430 
  at Mono.Security.Protocol.Tls.SslClientStream.SafeEndReceiveRecord (System.IAsyncResult ar, System.Boolean ignoreEmpty) [0x00000] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs:256 
  at Mono.Security.Protocol.Tls.SslClientStream.NegotiateAsyncWorker (System.IAsyncResult result) [0x00071] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs:418 
   --- End of inner exception stack trace ---

I've attached a small sample project that reproduces the issue.
Comment 1 Jon Douglas [MSFT] 2016-12-12 17:34:05 UTC
Here is a relevant forum response to try with regards to this bug:

https://forums.xamarin.com/discussion/comment/239726/#Comment_239726

Although you should be able to work around it, we will still want to investigate the TLS support for these Ciphers.
Comment 2 Jon Douglas [MSFT] 2016-12-13 19:51:01 UTC
This is resolved as of the current Alpha channel with TLS fixes to Mono's implementation. Thus I would confirm this as "Resolved Upstream".
Comment 3 Jon Douglas [MSFT] 2016-12-13 20:08:59 UTC
*Edit:

Fixes in the sense that a new SSL/TLS implementation is used by default over Mono's implementation. On Android it's BoringSSL and on iOS it's AppleTLS.