Skip to content

Commit 3aceaab

Browse files
committed
move javax.net.ssl.SSLContext initialization into its own method
1 parent 6253685 commit 3aceaab

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/main/java/org/jruby/ext/openssl/SSLContext.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -854,8 +854,7 @@ private class InternalContext {
854854

855855
// initialize SSL context :
856856

857-
final javax.net.ssl.SSLContext sslContext;
858-
sslContext = SecurityHelper.getSSLContext(protocol);
857+
final javax.net.ssl.SSLContext sslContext = SecurityHelper.getSSLContext(protocol);
859858

860859
if ( protocolForClient ) {
861860
final SSLSessionContext clientContext = sslContext.getClientSessionContext();
@@ -871,11 +870,17 @@ private class InternalContext {
871870
serverContext.setSessionCacheSize(sessionCacheSize);
872871
}
873872
}
873+
this.sslContext = initContext(sslContext);
874+
}
874875

876+
protected javax.net.ssl.SSLContext initContext(javax.net.ssl.SSLContext sslContext) throws KeyManagementException {
875877
final KeyManager[] keyManager = new KeyManager[] { new KeyManagerImpl(this) };
876878
final TrustManager[] trustManager = new TrustManager[] { new TrustManagerImpl(this) };
879+
// SSLContext on Sun JDK :
880+
// private final java.security.Provider provider; "SunJSSE"
881+
// private final javax.net.ssl.SSLContextSpi; sun.security.ssl.SSLContextImpl
877882
sslContext.init(keyManager, trustManager, null);
878-
this.sslContext = sslContext;
883+
return sslContext;
879884
}
880885

881886
final Store store;

0 commit comments

Comments
 (0)