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

Set ServicePointManager.SecurityProtocol #795

Closed
hackily opened this issue Jan 5, 2017 · 7 comments
Closed

Set ServicePointManager.SecurityProtocol #795

hackily opened this issue Jan 5, 2017 · 7 comments
Assignees
Labels
Milestone

Comments

@hackily
Copy link
Contributor

hackily commented Jan 5, 2017

Is there a way to set the SecurityProtocol to SecurityProtocolType.Tls12 (or anything other than TLS?)

It looks like by default, it is set to SecurityProtocolType.Tls on Line 80:

https://github.com/couchbase/couchbase-lite-net/blob/7e82825a7082960884991ac6b7bd3dec7930acf2/src/Couchbase.Lite.Shared/Replication/CouchbaseLiteHttpClientFactory.cs

I'm getting this error:

Exception in HttpWebRequest#45592480:: - The request was aborted: Could not create SSL/TLS secure channel..

Sorry if there's a super obvious way to do this.

I've already attempted to set ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 after I create a new Manager.

@borrrden
Copy link
Member

borrrden commented Jan 6, 2017

Actually even if you set it, the library is going to change it back. This is one of the drawbacks of having a globally configurable variable for stuff like this -_-. I want to change it to 1.2 but I can't because SecurityProtocolType.Tls12 does not exist in .NET 3.5, and until very recently Mono only supported TLS 1.0. Have you confirmed that switching to SecurityProtocolType.Tls12 will solve the problem you are facing?

@hackily
Copy link
Contributor Author

hackily commented Jan 6, 2017

Yeah, when I create and send an HTTPWebRequest manually with TLS 1.0 or 1.1 or SSL3, the request will be aborted.
Only when I switch to TLS1.2 will it work. The IT guys take security seriously, so that's good. Unfortunately, just not for me in this situation :D

I did notice that when I switch to TLS1.2, the initial request will work, but subsequent calls will all fail.

Any ideas for a workaround?

@borrrden
Copy link
Member

borrrden commented Jan 6, 2017

No (sorry), but what I can do is change the library to only change it if it is set to SSL3 which will achieve the same thing for my purposes but leave it open to change by the user.

@borrrden borrrden added the bug label Jan 6, 2017
@borrrden borrrden added this to the 1.4.0 milestone Jan 6, 2017
@borrrden borrrden self-assigned this Jan 6, 2017
@hackily
Copy link
Contributor Author

hackily commented Jan 6, 2017

That'd be beautiful. Thanks!

@borrrden
Copy link
Member

borrrden commented Jan 6, 2017

Since the setting is marked as [Flags] I unset the Ssl3 flag and set the Tls flag (if you keep setting it to Tls12, this should end up as Tls | Tls12)

@sisirak
Copy link

sisirak commented Aug 24, 2019

Hi borrrden, I need to know how to work around the same issue in 1.3.0 release?

@borrrden
Copy link
Member

The only thing you can do is make a build with the above changes in it. 1.x is well past its end of life at this point (and 1.3 may have even reached the end of paid support) and no more work is being done on it.

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

No branches or pull requests

3 participants