You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by rmkreddy <rm...@gmail.com> on 2016/12/19 00:41:28 UTC

How to retrieve the SSL protocol and cipher suites usedin ActiveMQCOnnection

Hello,

I would like to retrieve the SSL/TLS protocol used and the cipher suite used
when a secure AciveMQConnection is established. I do not find any
appropriate api to find the same. Here is the sample code which I am using
to connect to ActiveMQ.

            ActiveMQSslConnectionFactory sslConnectionFactory = new
ActiveMQSslConnectionFactory("ssl://ActiveqMQIP:61617");
            sslConnectionFactory.setKeyStore(new
File("C:\\users\\user\\desktop\\client.ks").toURI().toString());
            sslConnectionFactory.setTrustStore(new
File("C:\\users\\user\\desktop\\client.ts").toURI().toString());
            sslConnectionFactory.setKeyStorePassword("test");
            sslConnectionFactory.setTrustStorePassword("test");
            connection = sslConnectionFactory.createConnection();
            

I am able to connect to activemq successfully, create sessions/topics/queues
and do all the needed operations. But I do not find any way to retrieve the
protocol used(TLS or TLSv1.1 or TLSv1.2) and the ciphersuite used. Is there
any way/api to find the same?

Regards,
Mahesh





--
View this message in context: http://activemq.2283324.n4.nabble.com/How-to-retrieve-the-SSL-protocol-and-cipher-suites-usedin-ActiveMQCOnnection-tp4720573.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: How to retrieve the SSL protocol and cipher suites usedin ActiveMQCOnnection

Posted by Christopher Shannon <ch...@gmail.com>.
Unfortunately it is a bit convoluted to do this right now as you need
to get access to the SSLSocket that is part of the connection which
isn't exposed through the API so you need to use reflection to get
access to the Socket.  But the following is an example that should
work:

        ActiveMQConnection connection = (ActiveMQConnection)
activeMQSslConnectionFactory.createConnection();
        TcpTransport tcpTransport =
connection.getTransport().narrow(TcpTransport.class);
        Field socketField = TcpTransport.class.getDeclaredField("socket");
        socketField.setAccessible(true);

        Socket socket = (Socket) socketField.get(tcpTransport);
        if (socket instanceof SSLSocket) {
            SSLSocket sslSocket = (SSLSocket)socket;
            System.out.println("SSL/TLS Protocol: " +
sslSocket.getSession().getProtocol());
            System.out.println("Cipher Suite: " +
sslSocket.getSession().getCipherSuite());
        }

On Sun, Dec 18, 2016 at 7:41 PM, rmkreddy <rm...@gmail.com> wrote:
> Hello,
>
> I would like to retrieve the SSL/TLS protocol used and the cipher suite used
> when a secure AciveMQConnection is established. I do not find any
> appropriate api to find the same. Here is the sample code which I am using
> to connect to ActiveMQ.
>
>             ActiveMQSslConnectionFactory sslConnectionFactory = new
> ActiveMQSslConnectionFactory("ssl://ActiveqMQIP:61617");
>             sslConnectionFactory.setKeyStore(new
> File("C:\\users\\user\\desktop\\client.ks").toURI().toString());
>             sslConnectionFactory.setTrustStore(new
> File("C:\\users\\user\\desktop\\client.ts").toURI().toString());
>             sslConnectionFactory.setKeyStorePassword("test");
>             sslConnectionFactory.setTrustStorePassword("test");
>             connection = sslConnectionFactory.createConnection();
>
>
> I am able to connect to activemq successfully, create sessions/topics/queues
> and do all the needed operations. But I do not find any way to retrieve the
> protocol used(TLS or TLSv1.1 or TLSv1.2) and the ciphersuite used. Is there
> any way/api to find the same?
>
> Regards,
> Mahesh
>
>
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/How-to-retrieve-the-SSL-protocol-and-cipher-suites-usedin-ActiveMQCOnnection-tp4720573.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.