20
20
import io .netty .handler .ssl .util .InsecureTrustManagerFactory ;
21
21
import org .asynchttpclient .AsyncHttpClientConfig ;
22
22
23
- import javax .net .ssl .SSLContext ;
24
23
import javax .net .ssl .SSLEngine ;
25
24
import javax .net .ssl .SSLException ;
26
25
import java .util .Arrays ;
27
- import java .util .List ;
28
26
29
27
import static org .asynchttpclient .util .MiscUtils .isNonEmpty ;
30
28
31
29
public class DefaultSslEngineFactory extends SslEngineFactoryBase {
32
30
33
- // TODO replace with a custom CipherSuiteFilter once https://github.com/netty/netty/issues/7673 is fixed
34
- private static final List <String > JDK_SUPPORTED_CIPHER_SUITES ;
35
-
36
- static {
37
- SSLContext context ;
38
- try {
39
- context = SSLContext .getInstance ("TLS" );
40
- context .init (null , null , null );
41
- } catch (Exception e ) {
42
- throw new Error ("Failed to initialize the default SSL context" , e );
43
- }
44
-
45
- SSLEngine engine = context .createSSLEngine ();
46
-
47
- JDK_SUPPORTED_CIPHER_SUITES = Arrays .asList (engine .getSupportedCipherSuites ());
48
- }
49
-
50
31
private volatile SslContext sslContext ;
51
32
52
33
private SslContext buildSslContext (AsyncHttpClientConfig config ) throws SSLException {
@@ -65,8 +46,8 @@ private SslContext buildSslContext(AsyncHttpClientConfig config) throws SSLExcep
65
46
66
47
if (isNonEmpty (config .getEnabledCipherSuites ())) {
67
48
sslContextBuilder .ciphers (Arrays .asList (config .getEnabledCipherSuites ()));
68
- } else if (!config .isFilterInsecureCipherSuites () && ! config . isUseOpenSsl () ) {
69
- sslContextBuilder .ciphers (JDK_SUPPORTED_CIPHER_SUITES );
49
+ } else if (!config .isFilterInsecureCipherSuites ()) {
50
+ sslContextBuilder .ciphers (null , IdentityCipherSuiteFilterWorkaround . INSTANCE );
70
51
}
71
52
72
53
if (config .isUseInsecureTrustManager ()) {
0 commit comments