Search in sources :

Example 11 with JettyKeystoreConvertorBuilder

use of org.teknux.jettybootstrap.keystore.JettyKeystoreConvertorBuilder in project jetty-bootstrap by teknux-org.

the class JettyKeystoreConvertorBuilderTest method do02KeyAndKeystoreTest.

@Test
public void do02KeyAndKeystoreTest() throws JettyKeystoreException, InvalidKeyException, KeyStoreException, CertificateException, NoSuchAlgorithmException, NoSuchProviderException, SignatureException {
    InputStream keyInputStream = getClass().getResourceAsStream("/org/teknux/jettybootstrap/test/keystore/jks/test.key");
    InputStream crtInputStream = getClass().getResourceAsStream("/org/teknux/jettybootstrap/test/keystore/jks/test.jks");
    JettyKeystoreConvertorBuilder jettyKeystoreConvertorBuilder = new JettyKeystoreConvertorBuilder().setPrivateKeyFromPKCS8(keyInputStream).setCertificateFromKeystore(crtInputStream, "test");
    jettyKeystoreConvertorBuilder.checkValidity(true, true);
    KeyStore keystore = jettyKeystoreConvertorBuilder.build(KEYSTORE_ALIAS, KEYSTORE_PASSWORD);
    JettyKeystoreConvertorBuilder.checkValidity(keystore, KEYSTORE_ALIAS, true, true);
}
Also used : JettyKeystoreConvertorBuilder(org.teknux.jettybootstrap.keystore.JettyKeystoreConvertorBuilder) InputStream(java.io.InputStream) KeyStore(java.security.KeyStore) Test(org.junit.Test)

Aggregations

InputStream (java.io.InputStream)11 KeyStore (java.security.KeyStore)11 JettyKeystoreConvertorBuilder (org.teknux.jettybootstrap.keystore.JettyKeystoreConvertorBuilder)11 Test (org.junit.Test)10 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 ArrayList (java.util.ArrayList)1 Connector (org.eclipse.jetty.server.Connector)1 HttpConfiguration (org.eclipse.jetty.server.HttpConfiguration)1 HttpConnectionFactory (org.eclipse.jetty.server.HttpConnectionFactory)1 ServerConnector (org.eclipse.jetty.server.ServerConnector)1 SslContextFactory (org.eclipse.jetty.util.ssl.SslContextFactory)1 JettyConnector (org.teknux.jettybootstrap.configuration.JettyConnector)1