// Try it as a File resource...
if(keyStoreStream == null) {
File keyStoreFile = new File(keyStore);
if(keyStoreFile.exists() && !keyStoreFile.isDirectory()) {
return new KeyMaterial(new FileInputStream(keyStoreFile), keyStorePassword.toCharArray());
}
} else {
return new KeyMaterial(keyStoreStream, keyStorePassword.toCharArray());
}
// Try it as a URI resource...
if(keyStoreStream == null) {
try {
URI fileURI = new URI(keyStore);
if(fileURI.isAbsolute()) {
return new KeyMaterial(fileURI.toURL().openStream(), keyStorePassword.toCharArray());
}
} catch (URISyntaxException e) {
throw new ConfigurationException("Failed to load keystore '" + keyStore + "'.");
}
}