Skip to content

Commit 610fe58

Browse files
committed
Use SSLContext.getDefault() in default SSLOptions.
The way we built the SSLContext before, it would ignore keystore system properties (javax.net.ssl.keyStore and javax.net.ssl.keyStorePassword). We provide the default implementation for people who have a simple configuration that should require no code, so it makes sense that it would honor those properties.
1 parent efbf9bf commit 610fe58

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

driver-core/src/main/java/com/datastax/driver/core/SSLOptions.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
*/
2525
public class SSLOptions {
2626

27-
private static final String SSL_PROTOCOL = "TLS";
28-
2927
/**
3028
* The default SSL cipher suites.
3129
*/
@@ -63,12 +61,8 @@ public SSLOptions(SSLContext context, String[] cipherSuites) {
6361

6462
private static SSLContext makeDefaultContext() throws IllegalStateException {
6563
try {
66-
SSLContext ctx = SSLContext.getInstance(SSL_PROTOCOL);
67-
ctx.init(null, null, null); // use defaults
68-
return ctx;
64+
return SSLContext.getDefault();
6965
} catch (NoSuchAlgorithmException e) {
70-
throw new RuntimeException("This JVM doesn't support TLS, this shouldn't happen");
71-
} catch (KeyManagementException e) {
7266
throw new IllegalStateException("Cannot initialize SSL Context", e);
7367
}
7468
}

0 commit comments

Comments
 (0)