“no matching host key type found” - Apache MINA SFTP server

前端 未结 1 1585
遇见更好的自我
遇见更好的自我 2021-02-09 14:03

I’m hoping to set up a SFTP server in Java using Apache MINA.

It seems to start OK, but when I try to connect to it with an OpenSSH client, I get:

$ ssh          


        
相关标签:
1条回答
  • 2021-02-09 14:41

    This works for me:

    Change Maven pom.xml to remove "sshd-sftp", which is now part of "sshd-core":

    <dependency>
        <groupId>org.apache.sshd</groupId>
        <artifactId>sshd-core</artifactId>
        <version>1.0.0</version>
    </dependency>
    

    Add to "startSftpServer":

        AbstractGeneratorHostKeyProvider hostKeyProvider =
                new SimpleGeneratorHostKeyProvider(SERVER_KEY_FILE.toPath());
    
        hostKeyProvider.setAlgorithm("RSA");
        sshd.setKeyPairProvider(hostKeyProvider);
    

    ... there seems to be a lot of guesswork involved in using this library, which seems shady for a "security" lib.

    0 讨论(0)
提交回复
热议问题