You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by tunix2fr <sn...@cergy.itin.fr> on 2012/04/30 12:24:46 UTC

ActiveMQ embedded broker + TLSv1 possible ?

Hi all, 

I would like to create an embedded ActiveMQ broker that listens on SSL
protocol using client authentication mechanism (TLS).

Here's my code that expects to do so : 

*//loading keystore from file    
KeyStore keystore = KeyStore.getInstance("pkcs12");

File ksfile = new File("/home/me/client1.pkcs12");
FileInputStream ksfis = new FileInputStream(ksfile);

keystore.load(ksfis, "password".toCharArray());

//loading truststore from file
KeyStore truststore = KeyStore.getInstance("jks");
truststore.load(new FileInputStream(new
File("/home/me/client1.truststore")), "password"
                .toCharArray());

KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory
        .getDefaultAlgorithm());
kmf.init(keystore, "password".toCharArray());

TrustManagerFactory tmf = TrustManagerFactory
        .getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(truststore);

//broker definition
String cfURI = "ssl://localhost:2032";
BrokerService brokerService = new BrokerService();
brokerService.addConnector(cfURI);

//configure ssl context for the broker
SslContext sslContext = new
SslContext(kmf.getKeyManagers(),tmf.getTrustManagers(), null);

//need client authentication
sslContext.getSSLContext().getDefaultSSLParameters().setNeedClientAuth(true);
sslContext.getSSLContext().getDefaultSSLParameters().setWantClientAuth(true);

brokerService.setSslContext(sslContext);
brokerService.start();*

When i execute the previous code in a main program, i get the following
error :

*GRAVE: Could not accept connection : javax.net.ssl.SSLException: No
available certificate or key corresponds to the SSL cipher suites which are
enabled.*

Does anyone have any ideas about this error  ? 

Any suggestion could be appreciated. 

Thanks.


--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-embedded-broker-TLSv1-possible-tp4597825.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.