Error: Could Not Generate DH Keypair During SSL Handshake
When establishing an SSL connection with certain IRC servers, developers may encounter an exception titled "Could not generate DH keypair." This error stems from a discrepancy in preferred encryption methods.
The issue lies in the prime size used for Diffie-Hellman (DH) key exchange. Java has a maximum-acceptable size of 1024 bits, while some servers may require a larger size. This problem was reported as JDK-6521495.
Currently, a workaround exists using BouncyCastle's JCE implementation.
Update
The error was subsequently logged as JDK-7044060 and has been resolved. However, it's important to note that the limit was only increased to 2048 bits. It is still subject to the limitation of 2048 bits, and larger sizes will require JDK-8072452 to be fixed in Java 9.
The above is the detailed content of Why Does My Java SSL Connection Fail with 'Could Not Generate DH Keypair'?. For more information, please follow other related articles on the PHP Chinese website!