use of org.opensaml.xml.security.keyinfo.KeyInfoCredentialResolver in project product-is by wso2.
the class SAML2SSOTestBase method getDecryptedAssertion.
private Assertion getDecryptedAssertion(EncryptedAssertion encryptedAssertion, X509Credential x509Credential) throws Exception {
KeyInfoCredentialResolver keyResolver = new StaticKeyInfoCredentialResolver(x509Credential);
EncryptedKey key = encryptedAssertion.getEncryptedData().getKeyInfo().getEncryptedKeys().get(0);
Decrypter decrypter = new Decrypter(null, keyResolver, null);
SecretKey dkey = (SecretKey) decrypter.decryptKey(key, encryptedAssertion.getEncryptedData().getEncryptionMethod().getAlgorithm());
Credential shared = SecurityHelper.getSimpleCredential(dkey);
decrypter = new Decrypter(new StaticKeyInfoCredentialResolver(shared), null, null);
decrypter.setRootInNewDocument(true);
return decrypter.decrypt(encryptedAssertion);
}
use of org.opensaml.xml.security.keyinfo.KeyInfoCredentialResolver in project MaxKey by dromara.
the class SignatureSecurityPolicyRule method loadTrustEngine.
public void loadTrustEngine() {
KeyInfoCredentialResolver keyInfoCredResolver = Configuration.getGlobalSecurityConfiguration().getDefaultKeyInfoCredentialResolver();
trustEngine = new ExplicitKeySignatureTrustEngine(credentialResolver, keyInfoCredResolver);
}
use of org.opensaml.xml.security.keyinfo.KeyInfoCredentialResolver in project MaxKey by dromara.
the class SignatureSecurityPolicyRule method afterPropertiesSet.
@Override
public void afterPropertiesSet() throws Exception {
KeyInfoCredentialResolver keyInfoCredResolver = Configuration.getGlobalSecurityConfiguration().getDefaultKeyInfoCredentialResolver();
trustEngine = new ExplicitKeySignatureTrustEngine(credentialResolver, keyInfoCredResolver);
}
use of org.opensaml.xml.security.keyinfo.KeyInfoCredentialResolver in project entcore by opendigitaleducation.
the class SamlValidator method loadSignatureTrustEngine.
private void loadSignatureTrustEngine(String filePath) throws MetadataProviderException {
logger.info(filePath);
FilesystemMetadataProvider metadataProvider = new FilesystemMetadataProvider(new File(filePath));
metadataProvider.setParserPool(new BasicParserPool());
metadataProvider.initialize();
MetadataCredentialResolver metadataCredResolver = new MetadataCredentialResolver(metadataProvider);
KeyInfoCredentialResolver keyInfoCredResolver = Configuration.getGlobalSecurityConfiguration().getDefaultKeyInfoCredentialResolver();
EntityDescriptor entityDescriptor = (EntityDescriptor) metadataProvider.getMetadata();
String entityID = entityDescriptor.getEntityID();
entityDescriptorMap.put(entityID, entityDescriptor);
signatureTrustEngineMap.put(entityID, new ExplicitKeySignatureTrustEngine(metadataCredResolver, keyInfoCredResolver));
}
Aggregations