@@ -87,7 +87,6 @@ public final class X509Util {
8787 public static final String TLS_CIPHER_SUITES = CONFIG_PREFIX + "ciphersuites" ;
8888 public static final String TLS_CERT_RELOAD = CONFIG_PREFIX + "certReload" ;
8989 public static final String TLS_USE_OPENSSL = CONFIG_PREFIX + "useOpenSsl" ;
90- public static final String DEFAULT_PROTOCOL = "TLSv1.2" ;
9190
9291 //
9392 // Server-side specific configs
@@ -206,7 +205,10 @@ public static SslContext createSslContextForClient(Configuration config)
206205 }
207206
208207 sslContextBuilder .enableOcsp (sslOcspEnabled );
209- sslContextBuilder .protocols (getEnabledProtocols (config ));
208+ String [] enabledProtocols = getEnabledProtocols (config );
209+ if (enabledProtocols != null ) {
210+ sslContextBuilder .protocols (enabledProtocols );
211+ }
210212 String [] cipherSuites = getCipherSuites (config );
211213 if (cipherSuites != null ) {
212214 sslContextBuilder .ciphers (Arrays .asList (cipherSuites ));
@@ -276,7 +278,10 @@ public static SslContext createSslContextForServer(Configuration config)
276278 }
277279
278280 sslContextBuilder .enableOcsp (sslOcspEnabled );
279- sslContextBuilder .protocols (getEnabledProtocols (config ));
281+ String [] enabledProtocols = getEnabledProtocols (config );
282+ if (enabledProtocols != null ) {
283+ sslContextBuilder .protocols (enabledProtocols );
284+ }
280285 String [] cipherSuites = getCipherSuites (config );
281286 if (cipherSuites != null ) {
282287 sslContextBuilder .ciphers (Arrays .asList (cipherSuites ));
@@ -391,9 +396,13 @@ static X509TrustManager createTrustManager(String trustStoreLocation, char[] tru
391396 private static String [] getEnabledProtocols (Configuration config ) {
392397 String enabledProtocolsInput = config .get (TLS_ENABLED_PROTOCOLS );
393398 if (enabledProtocolsInput == null ) {
394- return new String [] { config .get (TLS_CONFIG_PROTOCOL , DEFAULT_PROTOCOL ) };
399+ enabledProtocolsInput = config .get (TLS_CONFIG_PROTOCOL );
400+ }
401+ if (enabledProtocolsInput != null ) {
402+ return enabledProtocolsInput .split ("," );
403+ } else {
404+ return null ;
395405 }
396- return enabledProtocolsInput .split ("," );
397406 }
398407
399408 private static String [] getCipherSuites (Configuration config ) {
0 commit comments