Search in sources :

Example 1 with KeyAndCertificateFactory

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() });
}
Also used : KeyAndCertificateFactory(org.mockserver.socket.tls.KeyAndCertificateFactory) KeyStoreFactory(org.mockserver.socket.tls.KeyStoreFactory) MockServerLogger(org.mockserver.logging.MockServerLogger)

Example 2 with KeyAndCertificateFactory

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() });
}
Also used : KeyAndCertificateFactory(org.mockserver.socket.tls.KeyAndCertificateFactory) KeyStoreFactory(org.mockserver.socket.tls.KeyStoreFactory) MockServerLogger(org.mockserver.logging.MockServerLogger)

Aggregations

MockServerLogger (org.mockserver.logging.MockServerLogger)2 KeyAndCertificateFactory (org.mockserver.socket.tls.KeyAndCertificateFactory)2 KeyStoreFactory (org.mockserver.socket.tls.KeyStoreFactory)2