提交 88712127 编写于 作者: S serge-rider

#934 MongoDB - Atlas connectivity settings


Former-commit-id: 8786a8fa
上级 cd95c56f
......@@ -43,8 +43,12 @@ public class SSLHandlerTrustStoreImpl extends SSLHandlerImpl {
public static final String PROP_SSL_SELF_SIGNED_CERT = "ssl.self-signed-cert";
public static final String PROP_SSL_KEYSTORE = "ssl.keystore";
public static final String PROP_SSL_METHOD = "ssl.method";
public static final String PROP_SSL_FORCE_TLS12 = "ssl.forceTls12";
public static final String CERT_TYPE = "ssl";
public static final String TLS_PROTOCOL_VAR_NAME = "jdk.tls.client.protocols";
public static final String TLS_1_2_VERSION = "TLSv1.2";
/**
* Creates certificates and adds them into trust store
*/
......@@ -115,7 +119,10 @@ public class SSLHandlerTrustStoreImpl extends SSLHandlerImpl {
trustManagers = trustManagerFactory.getTrustManagers();
}
SSLContext sslContext = SSLContext.getInstance("SSL");
final boolean forceTLS12 = sslConfig.getBooleanProperty(PROP_SSL_FORCE_TLS12);
SSLContext sslContext = forceTLS12 ? SSLContext.getInstance(TLS_1_2_VERSION) : SSLContext.getInstance("SSL");
sslContext.init(keyManagers, trustManagers, new SecureRandom());
return sslContext;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册