use of org.mockserver.socket.tls.KeyAndCertificateFactory in project mockserver by mock-server.
the class ClientAuthenticationAdditionalCertificateChainMockingIntegrationTest method getSslContext.
private SSLContext getSslContext() {
KeyAndCertificateFactory keyAndCertificateFactory = KeyAndCertificateFactoryFactory.createKeyAndCertificateFactory(configuration(), new MockServerLogger());
assertThat(keyAndCertificateFactory, notNullValue());
keyAndCertificateFactory.buildAndSavePrivateKeyAndX509Certificate();
return new KeyStoreFactory(configuration(), new MockServerLogger()).sslContext(privateKeyFromPEMFile("org/mockserver/netty/integration/tls/leaf-key-pkcs8.pem"), x509FromPEMFile("org/mockserver/netty/integration/tls/leaf-cert.pem"), x509FromPEMFile("org/mockserver/netty/integration/tls/ca.pem"), new X509Certificate[] { x509FromPEMFile("org/mockserver/netty/integration/tls/ca.pem"), keyAndCertificateFactory.certificateAuthorityX509Certificate() });
}
use of org.mockserver.socket.tls.KeyAndCertificateFactory in project mockserver by mock-server.
the class ClientAuthenticationAdditionalCertificateChainMockingIntegrationTest method getSslContext.
private SSLContext getSslContext() {
KeyAndCertificateFactory keyAndCertificateFactory = KeyAndCertificateFactoryFactory.createKeyAndCertificateFactory(configuration(), new MockServerLogger());
assertThat(keyAndCertificateFactory, notNullValue());
keyAndCertificateFactory.buildAndSavePrivateKeyAndX509Certificate();
return new KeyStoreFactory(configuration(), new MockServerLogger()).sslContext(privateKeyFromPEMFile("org/mockserver/netty/integration/tls/leaf-key-pkcs8.pem"), x509FromPEMFile("org/mockserver/netty/integration/tls/leaf-cert.pem"), x509FromPEMFile("org/mockserver/netty/integration/tls/ca.pem"), new X509Certificate[] { x509FromPEMFile("org/mockserver/netty/integration/tls/ca.pem"), keyAndCertificateFactory.certificateAuthorityX509Certificate() });
}
Aggregations