}
private KeyStore initKeyStore(KeyStore keyStore, URL keyStoreUrl, String keyStoreType, char[] keyStorePassword) {
boolean keyStorePropertiesDefined = keyStoreUrl != null || keyStoreType != null || keyStorePassword != null;
if (keyStore != null && keyStorePropertiesDefined) {
throw new SoapClientException("Specify either a keyStore | trustStore instance or properties required to load one " +
"(url, type, password)");
}
if (keyStoreUrl != null) {
try {
InputStream in = keyStoreUrl.openStream();
KeyStore ks = KeyStore.getInstance(keyStoreType);
ks.load(in, keyStorePassword);
in.close();
return ks;
} catch (GeneralSecurityException e) {
throw new SoapClientException("KeyStore setup failed", e);
} catch (IOException e) {
throw new SoapClientException("KeyStore setup failed", e);
}
}
return null;
}