Error: 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
search cancel

Error: 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

book

Article ID: 403112

calendar_today

Updated On:

Products

VMware Tanzu Spring Runtime

Issue/Introduction

This issue happens on environments where customers are using Java apps that interact with db2 drivers. 

Cause

Error messages similar to the following are thrown:

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
  com.sun.crypto.provider.DHKeyPairGenerator.initialize(DHKeyPairGenerator.java:140)
  java.security.KeyPairGenerator$Delegate.initialize(KeyPairGenerator.java:674)
  java.security.KeyPairGenerator.initialize(KeyPairGenerator.java:411)
  com.ibm.db2.jcc.am.bq.a(bq.java:141)
  com.ibm.db2.jcc.t4.b.u(b.java:2889)
  com.ibm.db2.jcc.t4.b.b(b.java:823)
  com.ibm.db2.jcc.t4.b.a(b.java:781)
  com.ibm.db2.jcc.t4.b.a(b.java:424)
  com.ibm.db2.jcc.t4.b.a(b.java:397)
  com.ibm.db2.jcc.t4.b.<init>(b.java:335)
  com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(DB2SimpleDataSource.java:234)
  com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(DB2SimpleDataSource.java:200)
  com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:471)
  com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:112)
  org.apache.tomcat.jdbc.pool.PooledConnection.conne

This issue is caused by incompatibility of the db2 driver with the JDK version being used. There are JDK versions that do not support DH key size of 256 which interferes with the DB2 JDBC driver. 

Resolution

This issue falls out of the scope of Tanzu support. The customer will need to verify the versions of JDK and the DB2 driver they are using to find a supported combination of versions that allows DH key size of 256.