Callback[] cbs = new Callback[]{cb};
this.keystoreHandler.handle(cbs);
privKey = cb.getKey();
} catch (IOException ex) {
log.log(Level.SEVERE, LogStringsMessages.WSS_1538_ERROR_GETTING_PRIVATE_KEY(), ex);
throw new XWSSecurityRuntimeException(ex);
} catch (UnsupportedCallbackException ex) {
log.log(Level.SEVERE, LogStringsMessages.WSS_1538_ERROR_GETTING_PRIVATE_KEY(), ex);
throw new XWSSecurityRuntimeException(ex);
}
} else {
try {
privKey = (PrivateKey) keyStore.getKey(alias, this.keyPassword);
} catch (KeyStoreException ex) {
log.log(Level.SEVERE, LogStringsMessages.WSS_1538_ERROR_GETTING_PRIVATE_KEY(), ex);
throw new XWSSecurityRuntimeException(ex);
} catch (NoSuchAlgorithmException ex) {
log.log(Level.SEVERE, LogStringsMessages.WSS_1538_ERROR_GETTING_PRIVATE_KEY(), ex);
throw new XWSSecurityRuntimeException(ex);
} catch (UnrecoverableKeyException ex) {
log.log(Level.SEVERE, LogStringsMessages.WSS_1538_ERROR_GETTING_PRIVATE_KEY(), ex);
throw new XWSSecurityRuntimeException(ex);
}
}
if (privKey == null) {
log.log(Level.SEVERE, LogStringsMessages.WSS_1539_PRIVATE_KEY_NULL_ERROR());
throw new XWSSecurityRuntimeException("PrivateKey returned by PrivateKeyCallback was Null");
}
return privKey;
}