@@ -867,7 +867,7 @@ private class InternalContext {
867
867
final List <X509AuxCertificate > clientCert ,
868
868
final List <X509AuxCertificate > extraChainCert ,
869
869
final int verifyMode ,
870
- final int timeout ) throws NoSuchAlgorithmException , KeyManagementException {
870
+ final int timeout ) throws NoSuchAlgorithmException {
871
871
872
872
if ( pKey != null && xCert != null ) {
873
873
this .privateKey = pKey .getPrivateKey ();
@@ -884,12 +884,26 @@ private class InternalContext {
884
884
this .clientCert = clientCert ;
885
885
this .extraChainCert = extraChainCert ;
886
886
this .verifyMode = verifyMode ;
887
- // this.timeout = timeout;
887
+ this .timeout = timeout ;
888
888
889
889
// initialize SSL context :
890
890
891
891
final javax .net .ssl .SSLContext sslContext = SecurityHelper .getSSLContext (protocol );
892
892
893
+ this .sslContext = sslContext ;
894
+ }
895
+
896
+ void initSSLContext (final ThreadContext context ) throws KeyManagementException {
897
+ final KeyManager [] keyManager = new KeyManager [] { new KeyManagerImpl (this ) };
898
+ final TrustManager [] trustManager = new TrustManager [] { new TrustManagerImpl (this ) };
899
+ // SSLContext (internals) on Sun JDK :
900
+ // private final java.security.Provider provider; "SunJSSE"
901
+ // private final javax.net.ssl.SSLContextSpi; sun.security.ssl.SSLContextImpl
902
+ sslContext .init (keyManager , trustManager , OpenSSL .getSecureRandomFrom (context ));
903
+ // if secureRandom == null JSSE will try :
904
+ // - new SecureRandom();
905
+ // - SecureRandom.getInstance("PKCS11", cryptoProvider);
906
+
893
907
if ( protocolForClient ) {
894
908
final SSLSessionContext clientContext = sslContext .getClientSessionContext ();
895
909
clientContext .setSessionTimeout (timeout );
@@ -898,25 +912,12 @@ private class InternalContext {
898
912
}
899
913
}
900
914
if ( protocolForServer ) {
901
- final SSLSessionContext serverContext = sslContext .getClientSessionContext ();
915
+ final SSLSessionContext serverContext = sslContext .getServerSessionContext ();
902
916
serverContext .setSessionTimeout (timeout );
903
917
if ( sessionCacheSize >= 0 ) {
904
918
serverContext .setSessionCacheSize (sessionCacheSize );
905
919
}
906
920
}
907
- this .sslContext = sslContext ;
908
- }
909
-
910
- protected void initSSLContext (final ThreadContext context ) throws KeyManagementException {
911
- final KeyManager [] keyManager = new KeyManager [] { new KeyManagerImpl (this ) };
912
- final TrustManager [] trustManager = new TrustManager [] { new TrustManagerImpl (this ) };
913
- // SSLContext (internals) on Sun JDK :
914
- // private final java.security.Provider provider; "SunJSSE"
915
- // private final javax.net.ssl.SSLContextSpi; sun.security.ssl.SSLContextImpl
916
- sslContext .init (keyManager , trustManager , OpenSSL .getSecureRandomFrom (context ));
917
- // if secureRandom == null JSSE will try :
918
- // - new SecureRandom();
919
- // - SecureRandom.getInstance("PKCS11", cryptoProvider);
920
921
}
921
922
922
923
final Store store ;
@@ -929,7 +930,7 @@ protected void initSSLContext(final ThreadContext context) throws KeyManagementE
929
930
final List <X509AuxCertificate > clientCert ; // assumed always != null
930
931
final List <X509AuxCertificate > extraChainCert ; // empty assumed == null
931
932
932
- // final int timeout;
933
+ private final int timeout ;
933
934
934
935
private final javax .net .ssl .SSLContext sslContext ;
935
936
0 commit comments