@Test public void create() throws GeneralSecurityException, IOException { assertThat(cut.create(certificates, rsaPrivateKey), is(notNullValue())); }
public SSLContext create(String x509Certificates, String rsaPrivateKey) throws GeneralSecurityException, IOException { assertHasText(x509Certificates, "x509Certificate is required"); assertHasText(rsaPrivateKey, "rsaPrivateKey is required"); SSLContext sslContext = createDefaultSSLContext(); PrivateKey privateKey = getPrivateKeyFromString(rsaPrivateKey); Certificate[] certificateChain = getCertificatesFromString(x509Certificates); KeyStore keystore = initializeKeyStore(privateKey, certificateChain); KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509"); keyManagerFactory.init(keystore, noPassword); sslContext.init(keyManagerFactory.getKeyManagers(), null, null); return sslContext; }
SSLContextFactory { public SSLContext create(String x509Certificates, String rsaPrivateKey) throws GeneralSecurityException, IOException { assertHasText(x509Certificates, "x509Certificate is required"); assertHasText(rsaPrivateKey, "rsaPrivateKey is required"); SSLContext sslContext = createDefaultSSLContext(); PrivateKey privateKey = getPrivateKeyFromString(rsaPrivateKey); Certificate[] certificateChain = getCertificatesFromString(x509Certificates); KeyStore keystore = initializeKeyStore(privateKey, certificateChain); KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509"); keyManagerFactory.init(keystore, noPassword); sslContext.init(keyManagerFactory.getKeyManagers(), null, null); return sslContext; } }
SSLContextFactory { public SSLContext create(String x509Certificates, String rsaPrivateKey) throws GeneralSecurityException, IOException { assertHasText(x509Certificates, "x509Certificate is required"); assertHasText(rsaPrivateKey, "rsaPrivateKey is required"); SSLContext sslContext = createDefaultSSLContext(); PrivateKey privateKey = getPrivateKeyFromString(rsaPrivateKey); Certificate[] certificateChain = getCertificatesFromString(x509Certificates); KeyStore keystore = initializeKeyStore(privateKey, certificateChain); KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509"); keyManagerFactory.init(keystore, noPassword); sslContext.init(keyManagerFactory.getKeyManagers(), null, null); return sslContext; } private  SSLContextFactory(); }
SSLContextFactory { public SSLContext create(String x509Certificates, String rsaPrivateKey) throws GeneralSecurityException, IOException { assertHasText(x509Certificates, "x509Certificate is required"); assertHasText(rsaPrivateKey, "rsaPrivateKey is required"); SSLContext sslContext = createDefaultSSLContext(); PrivateKey privateKey = getPrivateKeyFromString(rsaPrivateKey); Certificate[] certificateChain = getCertificatesFromString(x509Certificates); KeyStore keystore = initializeKeyStore(privateKey, certificateChain); KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509"); keyManagerFactory.init(keystore, noPassword); sslContext.init(keyManagerFactory.getKeyManagers(), null, null); return sslContext; } private  SSLContextFactory(); static SSLContextFactory getInstance(); SSLContext create(String x509Certificates, String rsaPrivateKey); }
SSLContextFactory { public SSLContext create(String x509Certificates, String rsaPrivateKey) throws GeneralSecurityException, IOException { assertHasText(x509Certificates, "x509Certificate is required"); assertHasText(rsaPrivateKey, "rsaPrivateKey is required"); SSLContext sslContext = createDefaultSSLContext(); PrivateKey privateKey = getPrivateKeyFromString(rsaPrivateKey); Certificate[] certificateChain = getCertificatesFromString(x509Certificates); KeyStore keystore = initializeKeyStore(privateKey, certificateChain); KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509"); keyManagerFactory.init(keystore, noPassword); sslContext.init(keyManagerFactory.getKeyManagers(), null, null); return sslContext; } private  SSLContextFactory(); static SSLContextFactory getInstance(); SSLContext create(String x509Certificates, String rsaPrivateKey);  }