public static KeyStore createKeyStore(String clientCertData, String clientCertFile, String clientKeyData, String clientKeyFile, String clientKeyAlgo, String clientKeyPassphrase, String keyStoreFile, String keyStorePassphrase) throws IOException, CertificateException, NoSuchAlgorithmException, InvalidKeySpecException, KeyStoreException { try (InputStream certInputStream = getInputStreamFromDataOrFile(clientCertData, clientCertFile); InputStream keyInputStream = getInputStreamFromDataOrFile(clientKeyData, clientKeyFile)) { return createKeyStore(certInputStream, keyInputStream, clientKeyAlgo, clientKeyPassphrase.toCharArray(), keyStoreFile, getKeyStorePassphrase(keyStorePassphrase)); } }
private InputStream getMultipleCertsInputSteam() throws IOException { return CertUtils.getInputStreamFromDataOrFile(null, "src/test/resources/ssl/multiple-certs.pem"); }
public static KeyStore createTrustStore(String caCertData, String caCertFile, String trustStoreFile, String trustStorePassphrase) throws IOException, CertificateException, KeyStoreException, NoSuchAlgorithmException { try (InputStream pemInputStream = getInputStreamFromDataOrFile(caCertData, caCertFile)) { return createTrustStore(pemInputStream, trustStoreFile, getTrustStorePassphrase(trustStorePassphrase)); } }
private void verifyFabric8InStore(KeyStore trustStore) throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException { Certificate certificate = trustStore.getCertificate("fabric8-in-store"); assertNotNull(certificate); InputStream certificateFile = CertUtils.getInputStreamFromDataOrFile(null, "src/test/resources/ssl/fabric8.crt"); KeyStore storeWithCert = CertUtils.createTrustStore(certificateFile, null, "".toCharArray()); String certificateAlias = storeWithCert.getCertificateAlias(certificate); assertNotNull(certificateAlias); }
public static KeyStore createKeyStore(String clientCertData, String clientCertFile, String clientKeyData, String clientKeyFile, String clientKeyAlgo, char[] clientKeyPassphrase) throws IOException, CertificateException, NoSuchAlgorithmException, InvalidKeySpecException, KeyStoreException { try (InputStream certInputStream = getInputStreamFromDataOrFile(clientCertData, clientCertFile); InputStream keyInputStream = getInputStreamFromDataOrFile(clientKeyData, clientKeyFile)) { return createKeyStore(certInputStream, keyInputStream, clientKeyAlgo, clientKeyPassphrase); } }
public static KeyStore createTrustStore(String caCertData, String caCertFile) throws IOException, CertificateException, KeyStoreException, NoSuchAlgorithmException { try (InputStream pemInputStream = getInputStreamFromDataOrFile(caCertData, caCertFile)) { return createTrustStore(pemInputStream); } }