40
40
import javax .net .ssl .X509ExtendedTrustManager ;
41
41
import java .io .File ;
42
42
import java .security .PrivateKey ;
43
+ import java .security .SecureRandom ;
43
44
import java .security .UnrecoverableKeyException ;
44
45
import java .security .cert .CertificateException ;
45
46
import java .security .cert .X509Certificate ;
@@ -207,7 +208,7 @@ public JdkSslServerContext(
207
208
long sessionCacheSize , long sessionTimeout , String keyStore ) throws SSLException {
208
209
super (newSSLContext (provider , null , null ,
209
210
toX509CertificatesInternal (certChainFile ), toPrivateKeyInternal (keyFile , keyPassword ),
210
- keyPassword , null , sessionCacheSize , sessionTimeout , keyStore ), false ,
211
+ keyPassword , null , sessionCacheSize , sessionTimeout , null , keyStore ), false ,
211
212
ciphers , cipherFilter , apn , ClientAuth .NONE , null , false );
212
213
}
213
214
@@ -247,7 +248,7 @@ public JdkSslServerContext(File trustCertCollectionFile, TrustManagerFactory tru
247
248
long sessionCacheSize , long sessionTimeout ) throws SSLException {
248
249
super (newSSLContext (null , toX509CertificatesInternal (trustCertCollectionFile ), trustManagerFactory ,
249
250
toX509CertificatesInternal (keyCertChainFile ), toPrivateKeyInternal (keyFile , keyPassword ),
250
- keyPassword , keyManagerFactory , sessionCacheSize , sessionTimeout , null ), false ,
251
+ keyPassword , keyManagerFactory , sessionCacheSize , sessionTimeout , null , null ), false ,
251
252
ciphers , cipherFilter , apn , ClientAuth .NONE , null , false );
252
253
}
253
254
@@ -288,7 +289,8 @@ public JdkSslServerContext(File trustCertCollectionFile, TrustManagerFactory tru
288
289
long sessionCacheSize , long sessionTimeout ) throws SSLException {
289
290
super (newSSLContext (null , toX509CertificatesInternal (trustCertCollectionFile ), trustManagerFactory ,
290
291
toX509CertificatesInternal (keyCertChainFile ), toPrivateKeyInternal (keyFile , keyPassword ),
291
- keyPassword , keyManagerFactory , sessionCacheSize , sessionTimeout , KeyStore .getDefaultType ()), false ,
292
+ keyPassword , keyManagerFactory , sessionCacheSize , sessionTimeout ,
293
+ null , KeyStore .getDefaultType ()), false ,
292
294
ciphers , cipherFilter , apn , ClientAuth .NONE , null , false );
293
295
}
294
296
@@ -298,16 +300,17 @@ public JdkSslServerContext(File trustCertCollectionFile, TrustManagerFactory tru
298
300
KeyManagerFactory keyManagerFactory , Iterable <String > ciphers , CipherSuiteFilter cipherFilter ,
299
301
ApplicationProtocolConfig apn , long sessionCacheSize , long sessionTimeout ,
300
302
ClientAuth clientAuth , String [] protocols , boolean startTls ,
301
- String keyStore ) throws SSLException {
303
+ SecureRandom secureRandom , String keyStore ) throws SSLException {
302
304
super (newSSLContext (provider , trustCertCollection , trustManagerFactory , keyCertChain , key ,
303
- keyPassword , keyManagerFactory , sessionCacheSize , sessionTimeout , keyStore ), false ,
305
+ keyPassword , keyManagerFactory , sessionCacheSize , sessionTimeout , secureRandom , keyStore ), false ,
304
306
ciphers , cipherFilter , toNegotiator (apn , true ), clientAuth , protocols , startTls );
305
307
}
306
308
307
309
private static SSLContext newSSLContext (Provider sslContextProvider , X509Certificate [] trustCertCollection ,
308
- TrustManagerFactory trustManagerFactory , X509Certificate [] keyCertChain ,
309
- PrivateKey key , String keyPassword , KeyManagerFactory keyManagerFactory ,
310
- long sessionCacheSize , long sessionTimeout , String keyStore )
310
+ TrustManagerFactory trustManagerFactory , X509Certificate [] keyCertChain ,
311
+ PrivateKey key , String keyPassword , KeyManagerFactory keyManagerFactory ,
312
+ long sessionCacheSize , long sessionTimeout ,
313
+ SecureRandom secureRandom , String keyStore )
311
314
throws SSLException {
312
315
if (key == null && keyManagerFactory == null ) {
313
316
throw new NullPointerException ("key, keyManagerFactory" );
@@ -333,7 +336,7 @@ private static SSLContext newSSLContext(Provider sslContextProvider, X509Certifi
333
336
: SSLContext .getInstance (PROTOCOL , sslContextProvider );
334
337
ctx .init (keyManagerFactory .getKeyManagers (),
335
338
wrapTrustManagerIfNeeded (trustManagerFactory .getTrustManagers ()),
336
- null );
339
+ secureRandom );
337
340
338
341
SSLSessionContext sessCtx = ctx .getServerSessionContext ();
339
342
if (sessionCacheSize > 0 ) {
0 commit comments