Made SecureRandom configurable.
protected Provider tlsProvider;
protected KeyManager[] keyManagers;
protected X509TrustManager[] trustManagers;
+ protected SecureRandom secureRandom = new SecureRandom();
public SSLSocketFactoryCreatorBuilder(X509TrustManager trustManager)
{
@@ -47,6 +48,12 @@ public SSLSocketFactoryCreatorBuilder withTLSVersion(String tlsVersion)
return this;
}
+ public SSLSocketFactoryCreatorBuilder withSecureRandom(SecureRandom secureRandom)
+ {
+ this.secureRandom = secureRandom;
+ return this;
+ }
+
/**
* Configure this builder to use the provider with the passed in name.
*
@@ -128,7 +135,7 @@ public SSLSocketFactory createFactory()
ctx = SSLContext.getInstance(tlsVersion);
}
- ctx.init(keyManagers, trustManagers, new SecureRandom());
+ ctx.init(keyManagers, trustManagers, secureRandom);
return ctx.getSocketFactory();
}
