Search in sources :

Example 6 with JettyKeystoreConvertorBuilder

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

the class JettyKeystoreConvertorBuilderTest method do08P12Test.

@Test
public void do08P12Test() throws JettyKeystoreException, InvalidKeyException, KeyStoreException, CertificateException, NoSuchAlgorithmException, NoSuchProviderException, SignatureException {
    InputStream inputStream = getClass().getResourceAsStream("/org/teknux/jettybootstrap/test/keystore/pkcs12/test.p12");
    JettyKeystoreConvertorBuilder jettyKeystoreConvertorBuilder = new JettyKeystoreConvertorBuilder().setPKCS12(inputStream, "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)

Example 7 with JettyKeystoreConvertorBuilder

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

the class JettyKeystoreConvertorBuilderTest method do09KeyAndP12Test.

@Test
public void do09KeyAndP12Test() throws JettyKeystoreException, InvalidKeyException, KeyStoreException, CertificateException, NoSuchAlgorithmException, NoSuchProviderException, SignatureException {
    InputStream keyInputStream = getClass().getResourceAsStream("/org/teknux/jettybootstrap/test/keystore/pkcs12/test.key");
    InputStream crtInputStream = getClass().getResourceAsStream("/org/teknux/jettybootstrap/test/keystore/pkcs12/test.p12");
    JettyKeystoreConvertorBuilder jettyKeystoreConvertorBuilder = new JettyKeystoreConvertorBuilder().setPrivateKeyFromPKCS8(keyInputStream).setCertificateFromPKCS12(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)

Example 8 with JettyKeystoreConvertorBuilder

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

the class JettyKeystoreConvertorBuilderTest method do05KeyAndCrtTest.

@Test
public void do05KeyAndCrtTest() throws JettyKeystoreException, InvalidKeyException, KeyStoreException, CertificateException, NoSuchAlgorithmException, NoSuchProviderException, SignatureException {
    InputStream keyInputStream = getClass().getResourceAsStream("/org/teknux/jettybootstrap/test/keystore/pkcs8/test.key");
    InputStream crtInputStream = getClass().getResourceAsStream("/org/teknux/jettybootstrap/test/keystore/pkcs8/test.crt");
    JettyKeystoreConvertorBuilder jettyKeystoreConvertorBuilder = new JettyKeystoreConvertorBuilder().setPrivateKeyFromPKCS8(keyInputStream).setCertificateFromPKCS8(crtInputStream);
    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)

Example 9 with JettyKeystoreConvertorBuilder

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

the class JettyKeystoreConvertorBuilderTest method do04PemTest.

@Test
public void do04PemTest() throws JettyKeystoreException, InvalidKeyException, KeyStoreException, CertificateException, NoSuchAlgorithmException, NoSuchProviderException, SignatureException {
    InputStream inputStream = getClass().getResourceAsStream("/org/teknux/jettybootstrap/test/keystore/pkcs8/test.pem");
    JettyKeystoreConvertorBuilder jettyKeystoreConvertorBuilder = new JettyKeystoreConvertorBuilder().setPKCS8(inputStream);
    jettyKeystoreConvertorBuilder.checkValidity(true, true);
    KeyStore keystore = jettyKeystoreConvertorBuilder.build(KEYSTORE_ALIAS, "test");
    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)

Example 10 with JettyKeystoreConvertorBuilder

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

the class JettyKeystoreConvertorBuilderTest method do07PemAndCrtTest.

@Test
public void do07PemAndCrtTest() throws JettyKeystoreException, InvalidKeyException, KeyStoreException, CertificateException, NoSuchAlgorithmException, NoSuchProviderException, SignatureException {
    InputStream keyInputStream = getClass().getResourceAsStream("/org/teknux/jettybootstrap/test/keystore/pkcs8/test.pem");
    InputStream crtInputStream = getClass().getResourceAsStream("/org/teknux/jettybootstrap/test/keystore/pkcs8/test.crt");
    JettyKeystoreConvertorBuilder jettyKeystoreConvertorBuilder = new JettyKeystoreConvertorBuilder().setPrivateKeyFromPKCS8(keyInputStream).setCertificateFromPKCS8(crtInputStream);
    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