Java: InvalidAlgorithmParameterException Prime size must be multiple of 64

前端 未结 9 1977
北海茫月
北海茫月 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:46

    My solution to this problem was putting in the first line of my main method the following:

    public static void main(String[] args) {
        Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
        ...
    }
    

    If you are using Spring you can add instead:

    @Configuration
    public class AppConfig {
        @PostConstruct
        public void init(){
            Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
        }
    }
    

提交回复
热议问题