PrivateKeyCallback.Request request = new PrivateKeyCallback.IssuerSerialNumRequest(
new X500Principal(issuerName),
serialNumber);
PrivateKeyCallback pkCallback = new PrivateKeyCallback(request);
TrustStoreCallback tsCallback = new TrustStoreCallback();
CertStoreCallback csCallback = new CertStoreCallback();
Callback[] callbacks = null;
if (this.useXWSSCallbacks) {
RuntimeProperties props = new RuntimeProperties(context);
callbacks = new Callback[]{props, pkCallback, tsCallback, csCallback};
} else {
callbacks = new Callback[]{pkCallback, tsCallback, csCallback};
}
try {
_handler.handle(callbacks);
} catch (Exception e) {
log.log(Level.SEVERE, LogStringsMessages.WSS_0216_CALLBACKHANDLER_HANDLE_EXCEPTION("PrivateKeyCallback.IssuerSerialNumRequest"),
new Object[] { "PrivateKeyCallback.IssuerSerialNumRequest"});
throw new XWSSecurityException(e);
}
Certificate[] chain = pkCallback.getChain();
if (chain != null) {
if (chain.length == 1) {
return (X509Certificate)chain[0];
}
for (int i=0; i < chain.length; i++) {
X509Certificate x509Cert = (X509Certificate)chain[i];
if (
matchesIssuerSerialAndName(
serialNumber,
issuerName,
x509Cert)) return x509Cert;
}
} else {
if ( log.isLoggable(Level.FINE)){
log.log(Level.FINE, LogStringsMessages.WSS_0296_NULL_CHAIN_CERT());
}
}
// if not found, look in CertStore followed by TrustStore
CertStore certStore = csCallback.getCertStore();
if (certStore != null) {
CertSelector selector = null;
/*if (this.certSelectorClass != null) {
HashMap props = new HashMap();
props.putAll(context);