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

Getting protocol for session #1

Closed
wants to merge 3 commits into from
Closed

Getting protocol for session #1

wants to merge 3 commits into from

Conversation

fondemen
Copy link
Contributor

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

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

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.

@normanmaurer
Copy link
Member

@fondemen can you please adjust the commit message to match our template:
http://netty.io/wiki/writing-a-commit-message.html

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.
@fondemen
Copy link
Contributor Author

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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call it getVersion(...)

@normanmaurer
Copy link
Member

@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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants