New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enabled TLS 1.1 and 1.2 support on platforms >= 16 and <= 20 #2185
Conversation
Where/how was that code provided? |
src/Mono.Android/Mono.Android.csproj
Outdated
@@ -335,6 +335,8 @@ | |||
<Compile Include="Xamarin.Android.Net\AuthModuleBasic.cs" /> | |||
<Compile Include="Xamarin.Android.Net\AuthModuleDigest.cs" /> | |||
<Compile Include="Xamarin.Android.Net\IAndroidAuthenticationModule.cs" /> | |||
<Compile Include="Xamarin.Android.Net\OldAndroidSSLSocketFactory.cs" /> | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the empty line?
|
||
protected override void Dispose (bool disposing) | ||
{ | ||
factory.Dispose (); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not do this.
The problem is "reference sharing": every AndroidClientHandler
instance (on API-16..20 devices) will have an OldAndroidSSLSocketFactory
instance -- so let's call it N
instances of AndroidClientHandler
& OldAndroidSSLSocketFactory
-- each of which will refer to the same SSLSocketFactory
value returned by SSLSocketFactory.Default
.
This results in "unintentional spooky action at a distance", a'la:
var a = new AndroidClientHandler (...);
var b = new AndroidClientHandler (...);
a.Dispose(); /* ...or otherwise cause `a.httpsConnection.SSLSocketFactory.Dispose()` to be invoked */
/* use `b` */
Once a.httpsConnection.SSLSocketFactory
has been disposed, b.httpsConnection.SSLSocketFactory
can no longer be used either, because even though the httpsConnection.SSLSocketFactory
instances differ, OldAndroidSSLSocketFactory.factory
for all instances refers to the same instance, and when that instance was disposed from a
, b
can no longer use it.
See the commit message:
|
f5d855d
to
4c3dca1
Compare
build |
Context: xamarin#1615 It turns out that the older platforms do support TLS 1.1 and 1.2 protocols but that they don't enable it by default. Thanks to code provided by https://github.com/gameleon-dev in the issue linked to above we now support it too. Updated the TLS 1.2 tests to enable them on platforms >= 16
4c3dca1
to
d4c72b8
Compare
build |
1 similar comment
build |
Context: #1615
It turns out that the older platforms do support TLS 1.1 and 1.2 protocols but
that they don't enable it by default. Thanks to code provided by
https://github.com/gameleon-dev in the issue linked to above we now support it
too.
Updated the TLS 1.2 tests to enable them on platforms >= 16