@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); }
@Test public void do03KeystoreAndCrtTest() throws JettyKeystoreException, InvalidKeyException, KeyStoreException, CertificateException, NoSuchAlgorithmException, NoSuchProviderException, SignatureException { InputStream keyInputStream = getClass().getResourceAsStream("/org/teknux/jettybootstrap/test/keystore/jks/test.jks"); InputStream crtInputStream = getClass().getResourceAsStream("/org/teknux/jettybootstrap/test/keystore/jks/test.crt"); JettyKeystoreConvertorBuilder jettyKeystoreConvertorBuilder = new JettyKeystoreConvertorBuilder() .setPrivateKeyFromKeystore(keyInputStream, "test") .setCertificateFromPKCS8(crtInputStream); jettyKeystoreConvertorBuilder.checkValidity(true, true); KeyStore keystore = jettyKeystoreConvertorBuilder.build(KEYSTORE_ALIAS, KEYSTORE_PASSWORD); JettyKeystoreConvertorBuilder.checkValidity(keystore, KEYSTORE_ALIAS, true, true); }