Skip to content
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

Merged
merged 1 commit into from Sep 17, 2018

Conversation

grendello
Copy link
Member

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

@jonpryor
Copy link
Member

Thanks to code provided by https://github.com/gameleon-dev

Where/how was that code provided?

@@ -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" />

Copy link
Member

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 ();
Copy link
Member

@jonpryor jonpryor Sep 14, 2018

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.

@grendello
Copy link
Member Author

Thanks to code provided by https://github.com/gameleon-dev

Where/how was that code provided?

See the commit message:

Thanks to code provided by
https://github.com/gameleon-dev in the **issue linked to above** we now support it
too.

@grendello
Copy link
Member Author

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
@grendello
Copy link
Member Author

build

1 similar comment
@grendello
Copy link
Member Author

build

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants