use of org.apache.syncope.common.lib.types.SignatureAlgorithm in project syncope by apache.
the class SAML2ReaderWriter method init.
public void init() {
X509KeyInfoGeneratorFactory keyInfoGeneratorFactory = new X509KeyInfoGeneratorFactory();
keyInfoGeneratorFactory.setEmitEntityCertificate(true);
keyInfoGenerator = keyInfoGeneratorFactory.newInstance();
// Try to load a signature algorithm
if (loader.getSignatureAlgorithm() != null) {
SignatureAlgorithm loadedSignatureAlgorithm = SignatureAlgorithm.valueOf(loader.getSignatureAlgorithm());
if (loadedSignatureAlgorithm != null) {
sigAlgo = loadedSignatureAlgorithm.getAlgorithm();
jceSigAlgo = JCEMapper.translateURItoJCEID(sigAlgo);
}
if (jceSigAlgo == null) {
LOG.warn("Signature algorithm {} is not valid. Using default algorithm instead.", loader.getSignatureAlgorithm());
sigAlgo = null;
}
}
if (sigAlgo == null) {
sigAlgo = SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1;
String pubKeyAlgo = loader.getCredential().getPublicKey().getAlgorithm();
if (pubKeyAlgo.equalsIgnoreCase("DSA")) {
sigAlgo = SignatureConstants.ALGO_ID_SIGNATURE_DSA_SHA1;
} else if (pubKeyAlgo.equalsIgnoreCase("EC")) {
sigAlgo = SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA1;
}
jceSigAlgo = JCEMapper.translateURItoJCEID(sigAlgo);
}
callbackHandler = new SAMLSPCallbackHandler(loader.getKeyPass());
}
Aggregations