File tree Expand file tree Collapse file tree
src/main/java/org/jruby/ext/openssl Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,6 +65,24 @@ public class SSL {
6565 public static final long OP_NETSCAPE_CA_DN_BUG = 0x20000000L ;
6666 public static final long OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG = 0x40000000L ;
6767
68+ static { configureJSSE (); }
69+
70+ private static void configureJSSE () {
71+ final String ephemeralDHKeySize = "jdk.tls.ephemeralDHKeySize" ;
72+ try {
73+ if ( System .getProperty (ephemeralDHKeySize ) == null ) {
74+ // The key size is the same as the authentication certificate,
75+ // but must be between 1024 bits and 2048 bits, inclusively.
76+ // However, the SunJCE provider only supports 2048-bit DH keys larger
77+ // than 1024 bits. Consequently, you may use the values 1024 or 2048 only.
78+ System .setProperty (ephemeralDHKeySize , "matched" ); // only affects Java 8
79+ }
80+ }
81+ catch (SecurityException ex ) {
82+ OpenSSL .debug ("setting " + ephemeralDHKeySize + " failed: " + ex );
83+ }
84+ }
85+
6886 public static void createSSL (final Ruby runtime , final RubyModule OpenSSL ) {
6987 final RubyModule SSL = OpenSSL .defineModuleUnder ("SSL" );
7088 final RubyClass OpenSSLError = OpenSSL .getClass ("OpenSSLError" );
You can’t perform that action at this time.
0 commit comments