-
-
Notifications
You must be signed in to change notification settings - Fork 179
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
Getting protocol for session #1
Conversation
@@ -1309,6 +1309,15 @@ TCN_IMPLEMENT_CALL(jstring, SSL, getCipherForSSL)(TCN_STDARGS, | |||
return AJP_TO_JSTRING(SSL_get_cipher(J2P(ssl, SSL*))); | |||
} | |||
|
|||
// Read which protocol was negotiated for the given SSL *. | |||
TCN_IMPLEMENT_CALL(jstring, SSL, getProtocolForSSL)(TCN_STDARGS, |
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.
Please call it getVersion as we usually use the same method names for java and c.
@fondemen can you please adjust the commit message to match our template: |
TLSv1.2 or SSLv3) Motivation: It is possible to check what is the chosen cipher for an SSL session, which is properly reported in netty using the OpenSSL implementation for SSLSession. However, protocol is reported as unknown. If using the JDK implementation, it is correctly reported such as as SSLv3. Knowing the session protocol can help in managing security properly, e.g. for accepting SSLv3 or TLSv1 in some parts of an application for compatibility, and allowing only TLSv1.1 or TLSv1.2 for more secured parts, such as user authentication. Modifications: Just adding a new native operation to SSL to quary protocol of an existing session thanks to its id. Result: It will be possible to implement getProtocol for the OpenSslEngine.getSession().getProtocol() so that it has same behavior as JDK implementation.
Corrections made to match your expectations. |
@@ -1309,6 +1309,15 @@ TCN_IMPLEMENT_CALL(jstring, SSL, getCipherForSSL)(TCN_STDARGS, | |||
return AJP_TO_JSTRING(SSL_get_cipher(J2P(ssl, SSL*))); | |||
} | |||
|
|||
// Read which protocol was negotiated for the given SSL *. | |||
TCN_IMPLEMENT_CALL(jstring, SSL, getVersionForSSL)(TCN_STDARGS, |
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.
Call it getVersion(...)
@fondemen also please squash commits into 1 |
TLSv1.2 or SSLv3) Motivation: It is possible to check what is the chosen cipher for an SSL session, which is properly reported in netty using the OpenSSL implementation for SSLSession. However, protocol is reported as unknown. If using the JDK implementation, it is correctly reported such as as SSLv3. Knowing the session protocol can help in managing security properly, e.g. for accepting SSLv3 or TLSv1 in some parts of an application for compatibility, and allowing only TLSv1.1 or TLSv1.2 for more secured parts, such as user authentication. Modifications: Just adding a new native operation to SSL to quary protocol of an existing session thanks to its id. Result: It will be possible to implement getProtocol for the OpenSslEngine.getSession().getProtocol() so that it has same behavior as JDK implementation.
This simple pach would make possible to know what protocol is in use for a session.
If pulled, onc could later change OpenSslEngine.getSession() with:
SSLSession session = this.session;
if (session == null) {
this.session = session = new SSLSession() {
...
public String getProtocol() {
SSL.getProtocolForSSL(ssl);
}
instead of the current code