DH key size must be multiple of 64, and can only range from 512 to 2048 (inclusive)

坚强是说给别人听的谎言 提交于 2019-12-01 20:53:07

问题


I have a set-up in which I am executing a build from Jenkins on a Solaris Server connecting via sshexec task in ANT.

On trigerring the build, it is throwing below error:

com.jcraft.jsch.JSchException: Session.connect: java.security.InvalidAlgorithmParameterException: DH key size must be multiple of 64, and can only range from 512 to 2048 (inclusive). The specific key size 2047 is not supported.

After some google search, I came to know that it might be fixed by updating to Java 8. I did that, however, still no success.

Can anyone please let me know how to fix it?


回答1:


Our fix:

Security.insertProviderAt(new BouncyCastleProvider(), 1)

we were using Jsch 0.1.54 directly to connect to an SFT server and saw:

java.security.InvalidAlgorithmParameterException: DH key size must be multiple of 64, and can only range from 512 to 4096 (inclusive). The specific key size 2047 is not supported

possibly related

  • JDK-8164963: InvalidAlgorithmParameterException prime size issue after JDK upgrade with JSCH libraries.
  • DHGEX failing with 2048-bit key under Java 8, but succeeding with 1024-bit key


来源:https://stackoverflow.com/questions/40381968/dh-key-size-must-be-multiple-of-64-and-can-only-range-from-512-to-2048-inclusi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!