Search in sources :

Example 1 with EncrypterFactory

use of uk.gov.ida.saml.security.EncrypterFactory in project verify-hub by alphagov.

the class AuthnRequestFromRelyingPartyUnmarshallerTest method setUp.

@BeforeAll
public static void setUp() {
    final BasicCredential basicCredential = createBasicCredential();
    encrypter = new EncrypterFactory().createEncrypter(basicCredential);
    unmarshaller = new AuthnRequestFromRelyingPartyUnmarshaller(new DecrypterFactory().createDecrypter(List.of(basicCredential)));
}
Also used : DecrypterFactory(uk.gov.ida.saml.security.DecrypterFactory) EncrypterFactory(uk.gov.ida.saml.security.EncrypterFactory) BasicCredential(org.opensaml.security.credential.BasicCredential) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 2 with EncrypterFactory

use of uk.gov.ida.saml.security.EncrypterFactory in project verify-hub by alphagov.

the class MsaTransformersFactory method getResponseToElementTransformer.

public ResponseToElementTransformer getResponseToElementTransformer(EncryptionKeyStore encryptionKeyStore, IdaKeyStore keyStore, EntityToEncryptForLocator entityToEncryptForLocator, SignatureAlgorithm signatureAlgorithm, DigestAlgorithm digestAlgorithm) {
    SignatureFactory signatureFactory = new SignatureFactory(new IdaKeyStoreCredentialRetriever(keyStore), signatureAlgorithm, digestAlgorithm);
    SamlResponseAssertionEncrypter assertionEncrypter = new SamlResponseAssertionEncrypter(new KeyStoreBackedEncryptionCredentialResolver(encryptionKeyStore), new EncrypterFactory(), entityToEncryptForLocator);
    return new ResponseToElementTransformer(new XmlObjectToElementTransformer<>(), new SamlSignatureSigner<>(), assertionEncrypter, new ResponseAssertionSigner(signatureFactory), new ResponseSignatureCreator(signatureFactory));
}
Also used : KeyStoreBackedEncryptionCredentialResolver(uk.gov.ida.saml.security.KeyStoreBackedEncryptionCredentialResolver) IdaKeyStoreCredentialRetriever(uk.gov.ida.saml.security.IdaKeyStoreCredentialRetriever) ResponseAssertionSigner(uk.gov.ida.saml.core.transformers.outbound.decorators.ResponseAssertionSigner) EncrypterFactory(uk.gov.ida.saml.security.EncrypterFactory) SignatureFactory(uk.gov.ida.saml.security.SignatureFactory) ResponseToElementTransformer(uk.gov.ida.saml.msa.test.transformers.ResponseToElementTransformer) ResponseSignatureCreator(uk.gov.ida.saml.core.transformers.outbound.decorators.ResponseSignatureCreator) SamlResponseAssertionEncrypter(uk.gov.ida.saml.core.transformers.outbound.decorators.SamlResponseAssertionEncrypter)

Example 3 with EncrypterFactory

use of uk.gov.ida.saml.security.EncrypterFactory in project verify-hub by alphagov.

the class CryptoModule method configure.

@Override
protected void configure() {
    bind(EncryptionKeyStore.class).to(HubEncryptionKeyStore.class).asEagerSingleton();
    bind(SigningKeyStore.class).annotatedWith(Names.named("authnRequestKeyStore")).to(AuthnRequestKeyStore.class).asEagerSingleton();
    bind(SigningKeyStore.class).annotatedWith(Names.named("samlResponseFromMatchingServiceKeyStore")).to(SamlResponseFromMatchingServiceKeyStore.class).asEagerSingleton();
    bind(X509CertificateFactory.class).toInstance(new X509CertificateFactory());
    bind(CertificateChainValidator.class);
    bind(PKIXParametersProvider.class).toInstance(new PKIXParametersProvider());
    bind(CertificatesConfigProxy.class);
    bind(TrustStoreForCertificateProvider.class);
    bind(KeyStoreCache.class);
    bind(KeyStoreLoader.class).toInstance(new KeyStoreLoader());
    bind(AssertionBlobEncrypter.class);
    bind(EncrypterFactory.class).toInstance(new EncrypterFactory());
    bind(SignatureAlgorithm.class).toInstance(new SignatureRSASHA1());
    bind(DigestAlgorithm.class).toInstance(new DigestSHA256());
}
Also used : X509CertificateFactory(uk.gov.ida.common.shared.security.X509CertificateFactory) DigestSHA256(org.opensaml.xmlsec.algorithm.descriptors.DigestSHA256) AuthnRequestKeyStore(uk.gov.ida.hub.samlengine.security.AuthnRequestKeyStore) SignatureRSASHA1(org.opensaml.xmlsec.algorithm.descriptors.SignatureRSASHA1) KeyStoreLoader(uk.gov.ida.truststore.KeyStoreLoader) EncrypterFactory(uk.gov.ida.saml.security.EncrypterFactory) SignatureAlgorithm(org.opensaml.xmlsec.algorithm.SignatureAlgorithm) SigningKeyStore(uk.gov.ida.saml.security.SigningKeyStore) PKIXParametersProvider(uk.gov.ida.common.shared.security.verification.PKIXParametersProvider) SamlResponseFromMatchingServiceKeyStore(uk.gov.ida.hub.samlengine.security.SamlResponseFromMatchingServiceKeyStore) HubEncryptionKeyStore(uk.gov.ida.hub.samlengine.security.HubEncryptionKeyStore) DigestAlgorithm(org.opensaml.xmlsec.algorithm.DigestAlgorithm)

Aggregations

EncrypterFactory (uk.gov.ida.saml.security.EncrypterFactory)3 BeforeAll (org.junit.jupiter.api.BeforeAll)1 BasicCredential (org.opensaml.security.credential.BasicCredential)1 DigestAlgorithm (org.opensaml.xmlsec.algorithm.DigestAlgorithm)1 SignatureAlgorithm (org.opensaml.xmlsec.algorithm.SignatureAlgorithm)1 DigestSHA256 (org.opensaml.xmlsec.algorithm.descriptors.DigestSHA256)1 SignatureRSASHA1 (org.opensaml.xmlsec.algorithm.descriptors.SignatureRSASHA1)1 X509CertificateFactory (uk.gov.ida.common.shared.security.X509CertificateFactory)1 PKIXParametersProvider (uk.gov.ida.common.shared.security.verification.PKIXParametersProvider)1 AuthnRequestKeyStore (uk.gov.ida.hub.samlengine.security.AuthnRequestKeyStore)1 HubEncryptionKeyStore (uk.gov.ida.hub.samlengine.security.HubEncryptionKeyStore)1 SamlResponseFromMatchingServiceKeyStore (uk.gov.ida.hub.samlengine.security.SamlResponseFromMatchingServiceKeyStore)1 ResponseAssertionSigner (uk.gov.ida.saml.core.transformers.outbound.decorators.ResponseAssertionSigner)1 ResponseSignatureCreator (uk.gov.ida.saml.core.transformers.outbound.decorators.ResponseSignatureCreator)1 SamlResponseAssertionEncrypter (uk.gov.ida.saml.core.transformers.outbound.decorators.SamlResponseAssertionEncrypter)1 ResponseToElementTransformer (uk.gov.ida.saml.msa.test.transformers.ResponseToElementTransformer)1 DecrypterFactory (uk.gov.ida.saml.security.DecrypterFactory)1 IdaKeyStoreCredentialRetriever (uk.gov.ida.saml.security.IdaKeyStoreCredentialRetriever)1 KeyStoreBackedEncryptionCredentialResolver (uk.gov.ida.saml.security.KeyStoreBackedEncryptionCredentialResolver)1 SignatureFactory (uk.gov.ida.saml.security.SignatureFactory)1