https://issues.apache.org/jira/browse/AMQ-5495 - apply suggested changes to allow keyStoreKeyPassword to be specified in ActiveMQSslConnectionFactory

This commit is contained in:
gtully 2014-12-22 15:26:40 +00:00
parent 02d974c409
commit 815e0ec5bf
1 changed files with 18 additions and 1 deletions

View File

@ -66,6 +66,7 @@ public class ActiveMQSslConnectionFactory extends ActiveMQConnectionFactory {
protected String trustStorePassword;
protected String keyStore;
protected String keyStorePassword;
protected String keyStoreKeyPassword;
public ActiveMQSslConnectionFactory() {
super();
@ -148,7 +149,7 @@ public class ActiveMQSslConnectionFactory extends ActiveMQConnectionFactory {
if (sslCert != null && sslCert.length > 0) {
ByteArrayInputStream bin = new ByteArrayInputStream(sslCert);
ks.load(bin, keyStorePassword.toCharArray());
kmf.init(ks, keyStorePassword.toCharArray());
kmf.init(ks, keyStoreKeyPassword !=null ? keyStoreKeyPassword.toCharArray() : keyStorePassword.toCharArray());
keystoreManagers = kmf.getKeyManagers();
}
}
@ -268,4 +269,20 @@ public class ActiveMQSslConnectionFactory extends ActiveMQConnectionFactory {
this.keyStorePassword = keyStorePassword;
}
public String getKeyStoreKeyPassword() {
return keyStoreKeyPassword;
}
/**
* The password to match the key from the keyStore.
*
* @param keyStoreKeyPassword
* The password for the private key stored in the
* keyStore if different from keyStorePassword.
*/
public void setKeyStoreKeyPassword(String keyStoreKeyPassword) {
this.keyStoreKeyPassword = keyStoreKeyPassword;
}
}