-
Notifications
You must be signed in to change notification settings - Fork 82
WIP: ALPN negotiation #238
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
Conversation
* SSLSocket now implements `#alpn_protocol` * SSLContext onw implements `#alpn_protocols` annd `#alpn_select_cb` They will be used to set the alpn parameters when using jsse BCSSLEngine, which supports ALPN negotiation.
@kares any feedback? Understand you might be busy, just wanted to deal with any feedback while I didn't lose the context yet :) |
Hey Tiago, sorry I wanted to get back to you but too much stuff going on. Basically I have 3 things here:
A blocker for the last might be that we still compile against Java 7 but there's a branch (next) where this is updated already - still trying to get CI in shape. |
hey @kares , thx for getting back.
It is, at least 1.69 release notes mentions "extended ALPN support recently added to Java 8". Which issues exactly? I could definitely make it a separate PR, if you think it's best.
I think it still does, i.e. if you don't opt in to JSSE provider, it'll just work as before, minus the ALPN support.
Can you point me to the docs? I didn't think that's possible when I checked, but can reassess my patch if it means supporting ALPN for all providers.
Perhaps there's a way to feature flag it by java version? Don't know exactly how to do it though. There's also the question of TLS 1.2 compatible cipher suites, which I have no idea how to patch. Does any of your ongoing changes perhaps deal with it? |
Hey, finally managed to look into ALPN and try your PR. I moved the work into a separate PR #247 let me know if you see anything missing or if you have any feedback/concens. I am okay with the BC update but would prefer to do it separately atm. |
@kares thx for the update! I just had a glance at the PR and it looks 👌 ready to go. One test is failing, but it seems unrelated? About the BC update, agree it can be done separately, I just thought it was necessary for Alpn initially. |
Thanks for the initial implementation Tiago, I am closing this WiP PR is favor of #247 |
This MR adds support for using the ALPN extension from bouncycastle (and when using
jsse.BCSSLEngine
). It:1.69
;ruby-openssl
;SSLSocket
andSSLContext
ALPN ruby APIs:OpenSSL::SSL::SSLSocket#alpn_protocol
OpenSSL::SSL::SSLContext#alpn_protocols (rw)
OpenSSL::SSL::SSLContext#alpn_select_cb
BCSSLEngine
client/server APIs.Pending
OpenSSL::SSL::SSLContext#initialize
(OpenSSL::SSL::SSLContext.new("Unsupported")
should raise exception instead)jsse
only?)how to reproduce
After building the jar for tests (via
rake test_prepare
):why it's not working yet
The test doesn't run yet. The error I get is:
I suspect this has to do with the advertised cipher suites in
jruby-openssl
(OpenSSL::SSL::SSLContext.new(:"TLSv1_2").ciphers.each { |c| p c}.sort
only returns "TLSv1/SSLv3" ciphers). I looked at the implementation inCipherStrings.java
, and a lot seems to be outdated in regards to mapping with openssl's "SSL_CIPHER", since the constants are matching v1.0.0 .As this definitely increases the scope of what I thought was necessary to implement ALPN negotiation, would greatly welcome some pointers on how to best overcome this, as I'm not so familiar with Java SSL APIs, and the cipher selection part of openssl in general.
cc @kares @headius
Closes #217