我正在尝试使用 j2ssh 将文件从我的应用程序发送到服务器。远程服务器正在运行 TECTIA。
从命令行(部署我的应用程序的 Solaris 机器)使用我们交换的密钥对,scp 可以正常工作。
在我的应用程序中,j2ssh 无法建立连接,抛出异常:
Caused by: com.sshtools.j2ssh.transport.TransportProtocolException: The connection did not complete
j2ssh 的调试日志显示如下:
com.sshtools.j2ssh.transport.TransportProtocolCommon.beginKeyExchange(Unknown Source) | Starting key exchange
com.sshtools.j2ssh.transport.TransportProtocolCommon.determineAlgorithm(Unknown Source) | Determine Algorithm
com.sshtools.j2ssh.transport.TransportProtocolCommon.determineAlgorithm(Unknown Source) | Client Algorithms: [diffie-hellman-group1-sha1]
com.sshtools.j2ssh.transport.TransportProtocolCommon.determineAlgorithm(Unknown Source) | Server Algorithms: [diffie-hellman-group14-sha1, diffie-hellman-group-exchange-sha1]
com.sshtools.j2ssh.transport.TransportProtocolCommon.sendMessage(Unknown Source) | Sending SSH_MSG_DISCONNECT
com.sshtools.j2ssh.transport.TransportProtocolCommon.run(Unknown Source) | The Transport Protocol has been stopped
从上面我可以看到我的应用程序和服务器之间的密钥交换没有匹配算法(调试实际上表明这个问题的根源是AlgorithmNotAgreedException
没有服务器和客户端算法匹配所以我知道这是根本原因)。
如何向 j2ssh 添加新算法以便找到匹配项?j2ssh 文档非常少。