1

我正在尝试使用 spongycastle 1.51 在 android 上使用 mina sshd 0.12.0。

我已按照可用的说明进行操作,使用注册 Spongycastle

static {
  Security.insertProviderAt( new org.spongycastle.jce.provider.BouncyCastleProvider(), 1);
}

Spongycastle 已被验证为干净地注册并请求算法“EC”:

java.security.KeyPairGenerator.getInstance("EC");

工作正常。

当我最终尝试建立与服务器的 ssh 连接时,它失败并显示以下堆栈跟踪:

java.security.NoSuchAlgorithmException: KeyPairGenerator EC implementation not found
    at org.apache.harmony.security.fortress.Engine.notFound(Engine.java:113)
    at org.apache.harmony.security.fortress.Engine.getInstance(Engine.java:135)
    at java.security.KeyPairGenerator.getInstance(KeyPairGenerator.java:153)
    at java.security.KeyPairGenerator.getInstance(KeyPairGenerator.java:125)
    at org.apache.sshd.common.util.SecurityUtils.getKeyPairGenerator(SecurityUtils.java:157)
    at org.apache.sshd.common.kex.ECDH.<init>(ECDH.java:51)
    at org.apache.sshd.server.kex.ECDHP256.getDH(ECDHP256.java:48)
    at org.apache.sshd.server.kex.AbstractDHGServer.init(AbstractDHGServer.java:68)
    at org.apache.sshd.common.session.AbstractSession.doHandleMessage(AbstractSession.java:359)
    at org.apache.sshd.common.session.AbstractSession.handleMessage(AbstractSession.java:295)
    at org.apache.sshd.common.session.AbstractSession.decode(AbstractSession.java:731)
    at org.apache.sshd.common.session.AbstractSession.messageReceived(AbstractSession.java:277)
    at org.apache.sshd.common.AbstractSessionIoHandler.messageReceived(AbstractSessionIoHandler.java:54)
    at org.apache.sshd.common.io.mina.MinaService.messageReceived(MinaService.java:107)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:854)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:943)
    at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:109)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:535)
    at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:714)
    at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:668)
    at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:657)
    at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:67)
    at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1121)
    at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
    at java.lang.Thread.run(Thread.java:1019)

我在这里不知所措。插入的提供程序是否以某种方式线程本地?

我很感谢任何提示。

4

0 回答 0