如何解决jsch客户端与sshd服务端建链异常

发布时间:2021-10-11 09:29:07 作者:柒染
来源:亿速云 阅读:131

这期内容当中小编将会给大家带来有关如何解决jsch客户端与sshd服务端建链异常,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

如下异常,提示加密算法不满足密钥尺寸。 

从外网找到原因如下,可能会是下面的。jdk两端版本不一致可能会报此类错误。但实际上我是用本地一样的jdk都是1.8-u191版本,仔细看一下,报错的线程栈打印的是DSA的加密算法,随后改了下服务端使用RSA并指定密钥长度为2048,之后就可以了。

The error message means, that the key likely has 1024 bits strength, because it had been generated with any JDK version before JDK 8u151 - while at least 2048 bits key-strength are being expected:

The security strength of SHA-1 digest algorithm is not sufficient for this key size.

The reason behind this is, that the default key-size had changed from 1024 to 2048 bits with JDK 8u151. This change can also be found in the JRE/JDK crypto roadmap at datecode 2017-10-17:

Upgraded the jarsigner and keytool ‑sigalg default to SHA256withDSA and the ‑keysize default to 2048 for DSA keys.

The "Reverting Instructions" would be (which do not really apply for signage with Android Studio):

To use a different algorithm and/or smaller key size use the ‑sigalg and ‑keysize options of keytool and jarsigner to override the current defaults. Before this change the default values were SHA1withDSA and 1024 bits.
[org.apache.sshd.server.session.ServerSession] : Exception caught
java.security.InvalidKeyException: The security strength of SHA-1 digest algorithm is not sufficient for this key size
	at sun.security.provider.DSA.checkKey(DSA.java:111)
	at sun.security.provider.DSA.engineInitSign(DSA.java:143)
	at java.security.Signature$Delegate.engineInitSign(Signature.java:1177)
	at java.security.Signature.initSign(Signature.java:530)
	at org.apache.sshd.common.signature.AbstractSignature.init(AbstractSignature.java:47)
	at org.apache.sshd.server.kex.AbstractDHGServer.next(AbstractDHGServer.java:93)
	at org.apache.sshd.server.session.ServerSession.handleMessage(ServerSession.java:177)
	at org.apache.sshd.common.session.AbstractSession.decode(AbstractSession.java:587)
	at org.apache.sshd.common.session.AbstractSession.messageReceived(AbstractSession.java:253)
	at org.apache.sshd.common.AbstractSessionIoHandler.messageReceived(AbstractSessionIoHandler.java:54)
	at org.apache.sshd.common.io.nio2.Nio2Session$2.completed(Nio2Session.java:231)
	at org.apache.sshd.common.io.nio2.Nio2Session$2.completed(Nio2Session.java:217)
	at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126)
	at sun.nio.ch.Invoker$2.run(Invoker.java:218)
	at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

上述就是小编为大家分享的如何解决jsch客户端与sshd服务端建链异常了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注亿速云行业资讯频道。

推荐阅读:
  1. 如何来解决编程异常链呢
  2. EndPoint学习之路_管理维护篇:验证客户端与服务端的通讯是否异常

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

jsch sshd

上一篇:dos中如何使用for命令扫描网段的端口

下一篇:如何建立一个XMLHttpRequest对象池

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》