Java: InvalidAlgorithmParameterException Prime size must be multiple of 64

前端 未结 9 1984
北海茫月
北海茫月 2020-12-10 16:01

I implemented a Java program that will connect and execute a command in a remote server using JSCH. The problem is that whenever I tried to connect to the server, I got the

9条回答
  •  盖世英雄少女心
    2020-12-10 16:44

    I was getting this error

    ERROR: Message form the remote server : Session.connect: java.security.InvalidAlgorithmParameterException: Prime size must be multiple of 64, and can only range from 512 to 1024 (inclusive)

    I was able to solve it by setting the client version as in this line

    session.setClientVersion("SSH-2.0-OpenSSH_2.5.3");
    

    The default value that was causing the error is

    session.setClientVersion("SSH-2.0-JSCH-0.1.54");
    

提交回复
热议问题