activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1378686 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOSSLTransport.java
Date Wed, 29 Aug 2012 19:11:23 GMT
Author: tabish
Date: Wed Aug 29 19:11:22 2012
New Revision: 1378686

URL: http://svn.apache.org/viewvc?rev=1378686&view=rev
Log:
additional change for: https://issues.apache.org/jira/browse/AMQ-3996

The sslEngine instance in the NIOSSLTransport needs to be updated when the handshake process
completes.


Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOSSLTransport.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOSSLTransport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOSSLTransport.java?rev=1378686&r1=1378685&r2=1378686&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOSSLTransport.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/nio/NIOSSLTransport.java
Wed Aug 29 19:11:22 2012
@@ -52,7 +52,6 @@ public class NIOSSLTransport extends NIO
     protected SSLEngine sslEngine;
     protected SSLSession sslSession;
 
-
     protected boolean handshakeInProgress = false;
     protected SSLEngineResult.Status status = null;
     protected SSLEngineResult.HandshakeStatus handshakeStatus = null;
@@ -79,7 +78,8 @@ public class NIOSSLTransport extends NIO
                 sslContext = SSLContext.getDefault();
             }
 
-            // initialize engine
+            // initialize engine, the initial sslSession we get will need to be
+            // updated once the ssl handshake process is completed.
             sslEngine = sslContext.createSSLEngine();
             sslEngine.setUseClientMode(false);
             if (enabledCipherSuites != null) {
@@ -101,11 +101,9 @@ public class NIOSSLTransport extends NIO
             sslEngine.beginHandshake();
             handshakeStatus = sslEngine.getHandshakeStatus();
             doHandshake();
-
         } catch (Exception e) {
             throw new IOException(e);
         }
-
     }
 
     protected void finishHandshake() throws Exception  {
@@ -113,6 +111,11 @@ public class NIOSSLTransport extends NIO
               handshakeInProgress = false;
               nextFrameSize = -1;
 
+              // Once handshake completes we need to ask for the now real sslSession
+              // otherwise the session would return 'SSL_NULL_WITH_NULL_NULL' for the
+              // cipher suite.
+              sslSession = sslEngine.getSession();
+
               // listen for events telling us when the socket is readable.
               selection = SelectorManager.getInstance().register(channel, new SelectorManager.Listener()
{
                   public void onSelect(SelectorSelection selection) {
@@ -164,7 +167,6 @@ public class NIOSSLTransport extends NIO
                 if (status == SSLEngineResult.Status.OK && handshakeStatus != SSLEngineResult.HandshakeStatus.NEED_UNWRAP)
{
                     processCommand(plain);
                 }
-
             }
         } catch (IOException e) {
             onException(e);
@@ -281,8 +283,7 @@ public class NIOSSLTransport extends NIO
     }
 
     /**
-     * Overriding in order to add the client's certificates to ConnectionInfo
-     * Commmands.
+     * Overriding in order to add the client's certificates to ConnectionInfo Commmands.
      *
      * @param command The Command coming in.
      */



Mime
View raw message