I am working on a project and I have implemented something like this...
public static KeyStore getInstance(String storeType, Resource location, String password) throws IOException,
KeyStoreException,
CertificateException,
NoSuchAlgorithmException {
KeyStore keyStore = KeyStore.getInstance((storeType != null ? storeType : DEFAULT_STORE_TYPE));
try (FileInputStream fileInputStream = new FileInputStream(location.getFile())) {
keyStore.load(fileInputStream, password.toCharArray());
}
return keyStore;
}
I noticed that common-net has something similar in loadStore but it is private. Why is that? Is it something about the way the manager is constructed or something?