public PrivateKey getPrivateKey(String alias, char[] storePassword, char[] keyPassword) throws KeyNotFoundException, KeystoreException, KeystoreIsLocked {
ensureLoaded(storePassword);
try {
PrivateKey key = (PrivateKey) keystore.getKey(alias, keyPassword);
if (key == null) {
throw new KeyNotFoundException("Keystore '"+keystoreName+"' does not contain a private key with alias'"+alias+"'.");
}
return key;
} catch (KeyStoreException e) {
throw new KeystoreException("Unable to retrieve private key from keystore", e);
} catch (NoSuchAlgorithmException e) {