use of uk.gov.ida.common.shared.security.PublicKeyFactory in project verify-hub by alphagov.
the class MatchingServiceHealthCheckIntegrationTests method getKeyStore.
private IdaKeyStore getKeyStore() throws Base64DecodingException {
List<KeyPair> encryptionKeyPairs = new ArrayList<>();
PublicKeyFactory publicKeyFactory = new PublicKeyFactory(new X509CertificateFactory());
PrivateKeyFactory privateKeyFactory = new PrivateKeyFactory();
PublicKey encryptionPublicKey = publicKeyFactory.createPublicKey(HUB_TEST_PUBLIC_ENCRYPTION_CERT);
PrivateKey encryptionPrivateKey = privateKeyFactory.createPrivateKey(Base64.getDecoder().decode(HUB_TEST_PRIVATE_ENCRYPTION_KEY.getBytes()));
encryptionKeyPairs.add(new KeyPair(encryptionPublicKey, encryptionPrivateKey));
PublicKey publicSigningKey = publicKeyFactory.createPublicKey(HUB_TEST_PUBLIC_SIGNING_CERT);
PrivateKey privateSigningKey = privateKeyFactory.createPrivateKey(Base64.getDecoder().decode(HUB_TEST_PRIVATE_SIGNING_KEY.getBytes()));
KeyPair signingKeyPair = new KeyPair(publicSigningKey, privateSigningKey);
return new IdaKeyStore(signingKeyPair, encryptionKeyPairs);
}
use of uk.gov.ida.common.shared.security.PublicKeyFactory in project verify-hub by alphagov.
the class SamlMessageSenderApiResourceTest method getKeyStore.
private static IdaKeyStore getKeyStore() throws Base64DecodingException {
List<KeyPair> encryptionKeyPairs = new ArrayList<>();
PublicKeyFactory publicKeyFactory = new PublicKeyFactory(new X509CertificateFactory());
PrivateKeyFactory privateKeyFactory = new PrivateKeyFactory();
PublicKey encryptionPublicKey = publicKeyFactory.createPublicKey(HUB_TEST_PUBLIC_ENCRYPTION_CERT);
PrivateKey encryptionPrivateKey = privateKeyFactory.createPrivateKey(Base64.getDecoder().decode(HUB_TEST_PRIVATE_ENCRYPTION_KEY.getBytes()));
encryptionKeyPairs.add(new KeyPair(encryptionPublicKey, encryptionPrivateKey));
PublicKey publicSigningKey = publicKeyFactory.createPublicKey(HUB_TEST_PUBLIC_SIGNING_CERT);
PrivateKey privateSigningKey = privateKeyFactory.createPrivateKey(Base64.getDecoder().decode(HUB_TEST_PRIVATE_SIGNING_KEY.getBytes()));
KeyPair signingKeyPair = new KeyPair(publicSigningKey, privateSigningKey);
return new IdaKeyStore(signingKeyPair, encryptionKeyPairs);
}
Aggregations