InvalidAlgorithmParameterException: DH key size is not supported

Solution Unverified - Updated -

Issue

  • We see some outgoing connection attempt from our java application fails with an error like below:
Caused by: java.security.InvalidAlgorithmParameterException: DH key size must be multiple of 64, and can only range from 512 to 8192 (inclusive). The specific key size 256 is not supported
    at com.sun.crypto.provider.DHKeyPairGenerator.initialize(DHKeyPairGenerator.java:139) ~[sunjce_provider.jar:1.8.0_332]
    at java.security.KeyPairGenerator$Delegate.initialize(KeyPairGenerator.java:674) ~[na:1.8.0_332]
    at java.security.KeyPairGenerator.initialize(KeyPairGenerator.java:411) ~[na:1.8.0_332]

Environment

  • Oracle Java 1.8
  • OpenJDK 1.8

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content