class 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();

}