callbackHandler.handle(callbacks);
} catch (Exception e) {
log.log(Level.SEVERE, LogStringsMessages.WSS_0216_CALLBACKHANDLER_HANDLE_EXCEPTION("SignatureKeyCallback.AliasPrivKeyCertRequest"),
new Object[]{"SignatureKeyCallback.AliasPrivKeyCertRequest"});
log.log(Level.SEVERE, LogStringsMessages.WSS_0217_CALLBACKHANDLER_HANDLE_EXCEPTION_LOG(), e);
throw new XWSSecurityException(e);
}
cert = certRequest.getX509Certificate();
} else {
EncryptionKeyCallback.X509CertificateRequest certRequest =
new EncryptionKeyCallback.AliasX509CertificateRequest(alias);
EncryptionKeyCallback encKeyCallback = new EncryptionKeyCallback(certRequest);
//incase of EncryptionKeyCallback.AliasX509Request we need all runtime, properties
//so we can pass them to CertSelector(s) if any...
//if (!isDefaultHandler) {
ProcessingContext.copy(encKeyCallback.getRuntimeProperties(), context);
//} else {
// encKeyCallback.getRuntimeProperties().
// put(MessageConstants.AUTH_SUBJECT, context.get(MessageConstants.AUTH_SUBJECT));
//}
Callback[] callbacks = new Callback[]{encKeyCallback};
try {
callbackHandler.handle(callbacks);
} catch (Exception e) {
log.log(Level.SEVERE, LogStringsMessages.WSS_0216_CALLBACKHANDLER_HANDLE_EXCEPTION("EncryptionKeyCallback.AliasX509CertificateRequest"),
new Object[]{"EncryptionKeyCallback.AliasX509CertificateRequest"});
log.log(Level.SEVERE, LogStringsMessages.WSS_0217_CALLBACKHANDLER_HANDLE_EXCEPTION_LOG(), e);
throw new XWSSecurityException(e);
}
cert = certRequest.getX509Certificate();
}
if (cert == null) {
String val = forSigning ? "Signature" : "Key Encryption";
log.log(Level.SEVERE, LogStringsMessages.WSS_0221_CANNOT_LOCATE_CERT(val), new Object[]{val});
throw new XWSSecurityException(
"Unable to locate certificate for the alias '" + alias + "'");
}
return cert;
}