public SignatureKeyCallback.AliasPrivKeyCertRequest getAliasPrivKeyCertRequest(String certIdentifier) throws XWSSecurityException { SignatureKeyCallback.AliasPrivKeyCertRequest request = new SignatureKeyCallback.AliasPrivKeyCertRequest(certIdentifier); SignatureKeyCallback sigCallback = new SignatureKeyCallback(request); Callback[] callback = new Callback[]{sigCallback}; try { callbackHandler.handle(callback); } catch (Exception e) { log.log(Level.SEVERE, "WSS0216.callbackhandler.handle.exception", new Object[]{"SignatureKeyCallback.AliasPrivKeyCertRequest"}); log.log(Level.SEVERE, "WSS0217.callbackhandler.handle.exception.log", e); throw new XWSSecurityException(e); } return request; }
public SignatureKeyCallback.PrivKeyCertRequest getDefaultPrivKeyCertRequest(Map context) throws XWSSecurityException { SignatureKeyCallback.PrivKeyCertRequest privKeyRequest = new SignatureKeyCallback.DefaultPrivKeyCertRequest(); SignatureKeyCallback sigKeyCallback = new SignatureKeyCallback(privKeyRequest); //we want all runtime props to be available to certSelectors if (context != null /*&& !isDefaultHandler*/) { ProcessingContext.copy(sigKeyCallback.getRuntimeProperties(), context); } Callback[] callbacks = new Callback[]{sigKeyCallback}; try { callbackHandler.handle(callbacks); } catch (Exception e) { log.log(Level.SEVERE, "WSS0216.callbackhandler.handle.exception", new Object[]{"SignatureKeyCallback.DefaultPrivKeyCertRequest"}); log.log(Level.SEVERE, "WSS0217.callbackhandler.handle.exception.log", e); throw new XWSSecurityException(e); } return privKeyRequest; }
public PrivateKey getDefaultPrivateKey(Map context) throws XWSSecurityException { PrivateKey defaultPrivKey = null; SignatureKeyCallback.PrivKeyCertRequest privKeyRequest = new SignatureKeyCallback.DefaultPrivKeyCertRequest(); SignatureKeyCallback sigKeyCallback = new SignatureKeyCallback(privKeyRequest); //we want to give all runtime props to CertSelector(s) if (context != null /*&& !isDefaultHandler*/) { ProcessingContext.copy(sigKeyCallback.getRuntimeProperties(), context); } Callback[] callbacks = new Callback[]{sigKeyCallback}; try { callbackHandler.handle(callbacks); } catch (Exception e) { log.log(Level.SEVERE, "WSS0216.callbackhandler.handle.exception", new Object[]{"SignatureKeyCallback.DefaultPrivKeyCertRequest"}); log.log(Level.SEVERE, "WSS0217.callbackhandler.handle.exception.log", e); throw new XWSSecurityException(e); } defaultPrivKey = privKeyRequest.getPrivateKey(); if (defaultPrivKey == null) { log.log(Level.SEVERE, "WSS0219.cannot.locate.default.privkey"); throw new XWSSecurityException( "Unable to locate a default certificate"); } return defaultPrivKey; }
public X509Certificate getDefaultCertificate(Map context) throws XWSSecurityException { X509Certificate defaultCert = null; SignatureKeyCallback.PrivKeyCertRequest privKeyRequest = new SignatureKeyCallback.DefaultPrivKeyCertRequest(); SignatureKeyCallback sigKeyCallback = new SignatureKeyCallback(privKeyRequest); //we want to give all runtime properties to be used by CertSelectors if (context != null /*&& !isDefaultHandler*/) { ProcessingContext.copy(sigKeyCallback.getRuntimeProperties(), context); } Callback[] callbacks = new Callback[]{sigKeyCallback}; try { callbackHandler.handle(callbacks); } catch (Exception e) { log.log(Level.SEVERE, "WSS0216.callbackhandler.handle.exception", new Object[]{"SignatureKeyCallback.DefaultPrivKeyCertRequest"}); log.log(Level.SEVERE, "WSS0217.callbackhandler.handle.exception.log", e); throw new XWSSecurityException(e); } defaultCert = privKeyRequest.getX509Certificate(); if (defaultCert == null) { log.log(Level.SEVERE, "WSS0218.cannot.locate.default.cert"); throw new XWSSecurityException( "Unable to locate a default certificate"); } return defaultCert; }
SignatureKeyCallback sigKeyCallback = new SignatureKeyCallback(privKeyRequest);
SignatureKeyCallback.PublicKeyBasedPrivKeyCertRequest req = new SignatureKeyCallback.PublicKeyBasedPrivKeyCertRequest(publicKey); SignatureKeyCallback skc = new SignatureKeyCallback(req);
SignatureKeyCallback.PrivKeyCertRequest certRequest = new SignatureKeyCallback.AliasPrivKeyCertRequest(alias); SignatureKeyCallback sigKeyCallback = new SignatureKeyCallback(certRequest);