in core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/keystore/impl/FileKeystoreInstance.java [228:268]
private boolean loadKeystoreData() {
if (keystoreFile == null) {
throw new IllegalArgumentException("keystorePath not set");
}
if (keystoreReadDate >= keystoreFile.lastModified()) {
return true;
}
if (!keystoreFile.exists() || !keystoreFile.canRead()) {
throw new IllegalArgumentException("Invalid keystore file (" + path + " = " + keystoreFile.getAbsolutePath() + ")");
}
try {
keystoreReadDate = System.currentTimeMillis();
privateKeys.clear();
trustCerts.clear();
if (keystore == null) {
keystore = KeyStore.getInstance(JKS);
}
InputStream in = new BufferedInputStream(new FileInputStream(keystoreFile));
keystore.load(in, keystorePassword == null ? new char[0] : keystorePassword.toCharArray());
in.close();
Enumeration aliases = keystore.aliases();
while (aliases.hasMoreElements()) {
String alias = (String) aliases.nextElement();
if (keystore.isKeyEntry(alias)) {
privateKeys.add(alias);
} else if (keystore.isCertificateEntry(alias)) {
trustCerts.add(alias);
}
}
return true;
} catch (KeyStoreException e) {
LOGGER.error("Unable to open keystore with provided password", e);
} catch (IOException e) {
LOGGER.error("Unable to open keystore with provided password", e);
} catch (NoSuchAlgorithmException e) {
LOGGER.error("Unable to open keystore with provided password", e);
} catch (CertificateException e) {
LOGGER.error("Unable to open keystore with provided password", e);
}
return false;
}