How do I fix SSL connection error could not generate DH Keypair?
To resolve, follow the steps below:
- Download Bouncy Castle jars: bcprov-jdk15on-152. jar. bcprov-ext-jdk15on-152. jar.
- Copy these jars to JAVA_HOME/jre/lib/ext.
- Add the following line into JAVA_HOME/jre/lib/security/java.security file, security.provider.1=org.bouncycastle.jce.provider.BouncyCastleProvider.
Could not generate DH keypair Java?
The key to this error message is: “Could not generate DH keypair”. This error normally occurs when the Java on the Automation Engine is updated to a newer release or if Java on the Agent is upgraded to a newer release. Later versions of Java restrict DH keys less than 1024 bits.
Why is Java-getting could not generate DH keypair exception?
VCenter server has JRE 1.6.0.31. I am aware of bug related to same issue in Java 1.6 and 1.7. This exception is caused by java.security.InvalidAlgorithmParameterException: Prime size must be multiple of 64, and can only range from 512 to 1024 (inclusive). I can change the SSL certificate from the https server.
Why did I get a Java RuntimeException error?
I was trying to access a SAP endpoint in my apex code when I got this error: java.lang.RuntimeException: Could not generate DH keypair. Any idea of how this could be resolved?
Why does SSL handshake give’could not generate DH keypair’?
It’s that last startHandshake that throws the exception. And yes there is some magic going on with the ‘trustAllCerts’; that code forces the SSL system not to validate certs.
What’s the maximum size of a DH key in Java?
Note, however, that the limit was only raised to 2048 bit. For sizes > 2048 bit, there is JDK-8072452 – Remove the maximum prime size of DH Keys; the fix appears to be for 9. The “Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files” answer did not work for me but The BouncyCastle’s JCE provider suggestion did.