use of org.apache.wss4j.common.saml.bean.KeyInfoBean in project cxf by apache.
the class SamlCallbackHandler method createKeyInfo.
protected KeyInfoBean createKeyInfo() throws Exception {
Crypto crypto = CryptoFactory.getInstance(cryptoPropertiesFile);
CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
cryptoType.setAlias(cryptoAlias);
X509Certificate[] certs = crypto.getX509Certificates(cryptoType);
KeyInfoBean keyInfo = new KeyInfoBean();
keyInfo.setCertIdentifer(keyInfoIdentifier);
if (keyInfoIdentifier == CERT_IDENTIFIER.X509_CERT) {
keyInfo.setCertificate(certs[0]);
} else if (keyInfoIdentifier == CERT_IDENTIFIER.KEY_VALUE) {
keyInfo.setPublicKey(certs[0].getPublicKey());
}
return keyInfo;
}
use of org.apache.wss4j.common.saml.bean.KeyInfoBean in project jbossws-cxf by jbossws.
the class SamlCallbackHandler method createKeyInfo.
protected KeyInfoBean createKeyInfo() throws Exception {
InputStream is = Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties").openStream();
Properties props = new Properties();
try {
props.load(is);
} finally {
is.close();
}
Crypto crypto = CryptoFactory.getInstance(props);
CryptoType cryptoType = new CryptoType(CryptoType.TYPE.ALIAS);
cryptoType.setAlias("alice");
X509Certificate[] certs = crypto.getX509Certificates(cryptoType);
KeyInfoBean keyInfo = new KeyInfoBean();
keyInfo.setCertificate(certs[0]);
keyInfo.setCertIdentifer(CERT_IDENTIFIER.X509_CERT);
return keyInfo;
}
Aggregations