KeyStore ks = KeyStore.getInstance("JCEKS");
ks.load(keystoreStream, keystorePassword);
return ks;
}
<BUG>private Key loadKey(KeyStore ks, String keyAlias, char[] keyPassword) throws KeyStoreException, UnrecoverableKeyException, NoSuchAlgorithmException {
if (!ks.containsAlias(keyAlias)) {</BUG>
throw new RuntimeException("Secret key " + keyAlias + " not found in keystore");
}
<BUG>Key key = ks.getKey(keyAlias, keyPassword);

return key;</BUG>
}

KeyStore ks = KeyStore.getInstance("JCEKS");
ks.load(keystoreStream, keystorePassword);
return ks;
}
private Key loadKey(KeyStore ks, String keyAlias, char[] keyPassword) throws KeyStoreException,
UnrecoverableKeyException, NoSuchAlgorithmException {
if (!ks.containsAlias(keyAlias)) {
throw new RuntimeException("Secret key " + keyAlias + " not found in keystore");
}
return ks.getKey(keyAlias, keyPassword);
}
