use of com.sun.identity.saml.xmlsig.KeyProvider in project OpenAM by OpenRock.
the class SPSSOFederate method signAuthnRequest.
/**
* Sign an authentication request.
*
* @param certAlias the certificate alias
* @param authnRequest the authentication request to sign
* @throws SAML2Exception the signed authentication request
*/
public static void signAuthnRequest(final String certAlias, final AuthnRequest authnRequest) throws SAML2Exception {
KeyProvider kp = KeyUtil.getKeyProviderInstance();
if (kp == null) {
SAML2Utils.debug.error("SPSSOFederate:signAuthnRequest: " + "Unable to get a key provider instance.");
throw new SAML2Exception(SAML2Utils.bundle.getString("nullKeyProvider"));
}
authnRequest.sign(kp.getPrivateKey(certAlias), kp.getX509Certificate(certAlias));
}
use of com.sun.identity.saml.xmlsig.KeyProvider in project OpenAM by OpenRock.
the class SPSSOFederate method signQueryString.
/**
* Signs the query string.
*
* @param queryString the query string
* @param certAlias the certificate alias
* @return the signed query string
* @throws SAML2Exception
*/
public static String signQueryString(final String queryString, final String certAlias) throws SAML2Exception {
if (SAML2Utils.debug.messageEnabled()) {
SAML2Utils.debug.message("SPSSOFederate:queryString:" + queryString);
SAML2Utils.debug.message("SPSSOFederate: certAlias :" + certAlias);
}
KeyProvider kp = KeyUtil.getKeyProviderInstance();
PrivateKey privateKey = kp.getPrivateKey(certAlias);
return QuerySignatureUtil.sign(queryString, privateKey);
}
Aggregations