1818import java .util .Set ;
1919import java .util .function .Function ;
2020import java .util .stream .Collectors ;
21+ import java .util .stream .Stream ;
2122
2223import javax .net .ssl .KeyManagerFactory ;
2324import javax .net .ssl .TrustManagerFactory ;
@@ -62,7 +63,7 @@ public abstract class SslConfigurationLoader {
6263
6364 static final List <String > DEFAULT_PROTOCOLS = List .of ("TLSv1.3" , "TLSv1.2" );
6465
65- private static final List <String > JDK12_CIPHERS = List .of (
66+ private static final List <String > JDK24_CIPHERS = List .of (
6667 // TLSv1.3 cipher has PFS, AEAD, hardware support
6768 "TLS_AES_256_GCM_SHA384" ,
6869 "TLS_AES_128_GCM_SHA256" ,
@@ -96,8 +97,13 @@ public abstract class SslConfigurationLoader {
9697
9798 // PFS, hardware support
9899 "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA" ,
99- "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA" ,
100+ "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"
101+ );
102+
100103
104+ private static final List <String > JDK12_CIPHERS = Stream .concat (
105+ JDK24_CIPHERS .stream (),
106+ List .of (
101107 // AEAD, hardware support
102108 "TLS_RSA_WITH_AES_256_GCM_SHA384" ,
103109 "TLS_RSA_WITH_AES_128_GCM_SHA256" ,
@@ -109,9 +115,9 @@ public abstract class SslConfigurationLoader {
109115 // hardware support
110116 "TLS_RSA_WITH_AES_256_CBC_SHA" ,
111117 "TLS_RSA_WITH_AES_128_CBC_SHA"
112- );
118+ ). stream ()). toList ( );
113119
114- static final List <String > DEFAULT_CIPHERS = JDK12_CIPHERS ;
120+ static final List <String > DEFAULT_CIPHERS = Runtime . version (). feature () >= 24 ? JDK24_CIPHERS : JDK12_CIPHERS ;
115121 private static final char [] EMPTY_PASSWORD = new char [0 ];
116122 public static final List <X509Field > GLOBAL_DEFAULT_RESTRICTED_TRUST_FIELDS = List .of (X509Field .SAN_OTHERNAME_COMMONNAME );
117123
0 commit comments