use of com.adaptris.security.keystore.KeystoreFactory in project interlok by adaptris.
the class HttpsProduceConnection method initialiseClient.
/**
* @see HttpClientConnection#initialiseClient(java.lang.String)
*/
@Override
public HttpClientTransport initialiseClient(String url) throws HttpException {
HttpsClient client = new HttpsClient(url);
try {
if (keystore != null) {
KeystoreFactory ksf = KeystoreFactory.getDefault();
KeystoreLocation ksl = null;
if (keystorePassword != null) {
ksl = ksf.create(keystore, Password.decode(keystorePassword).toCharArray());
} else {
ksl = ksf.create(keystore);
}
char[] pkpw = PasswordOverride.discoverPrivateKeyPassword(ksl, getPrivateKeyPasswordProvider());
if (pkpw != null) {
client.registerPrivateKeyPassword(pkpw);
}
client.registerKeystore(ksf.create(ksl));
}
} catch (AdaptrisSecurityException e) {
throw new HttpException(e);
}
client.setAlwaysTrust(alwaysTrust);
return client;
}
use of com.adaptris.security.keystore.KeystoreFactory in project interlok by adaptris.
the class VersionedHttpsProduceConnection method initialiseClient.
/**
* @see HttpClientConnection#initialiseClient(java.lang.String)
*/
@Override
public HttpClientTransport initialiseClient(String url) throws HttpException {
HttpsClient client = new HttpsClient(new URLString(url), protocolVersion);
try {
if (getKeystore() != null) {
KeystoreFactory ksf = KeystoreFactory.getDefault();
KeystoreLocation ksl = null;
if (getKeystorePassword() != null) {
ksl = ksf.create(getKeystore(), Password.decode(getKeystorePassword()).toCharArray());
} else {
ksl = ksf.create(getKeystore());
}
char[] pkpw = PasswordOverride.discoverPrivateKeyPassword(ksl, getPrivateKeyPasswordProvider());
if (pkpw != null) {
client.registerPrivateKeyPassword(pkpw);
}
client.registerKeystore(ksf.create(ksl));
}
} catch (AdaptrisSecurityException e) {
throw new HttpException(e);
}
client.setAlwaysTrust(getAlwaysTrust());
return client;
}
Aggregations