actualAlias = this.peerEntityAlias;
}
}
}
PrivateKeyCallback pkCallback = null;
if (forSigning) {
try {
Subject subject = getSubject(context);
if (subject != null) {
Set set = subject.getPrivateCredentials(X500PrivateCredential.class);
if (set != null) {
Iterator it = set.iterator();
while (it.hasNext()) {
X500PrivateCredential cred = (X500PrivateCredential)it.next();
if (cred.getAlias().equals(actualAlias))
return cred.getCertificate();
}
}
}
PrivateKeyCallback.Request request = new PrivateKeyCallback.AliasRequest(actualAlias);
pkCallback = new PrivateKeyCallback(request);
Callback[] callbacks = null;
if (this.useXWSSCallbacks) {
RuntimeProperties props = new RuntimeProperties(context);
callbacks = new Callback[]{props, pkCallback};
} else {
callbacks = new Callback[]{pkCallback};
}
_handler.handle(callbacks);
} catch (Exception e) {
log.log(Level.SEVERE,LogStringsMessages.WSS_0221_CANNOT_LOCATE_CERT(alias), new Object[] {alias});
throw new XWSSecurityException(e);
}
Certificate[] chain = pkCallback.getChain();
if (chain != null){
cert = (X509Certificate)chain[0];
} else {
if (log.isLoggable(Level.FINE)){
log.log(Level.SEVERE,LogStringsMessages.WSS_0296_NULL_CHAIN_CERT());