sshj icon indicating copy to clipboard operation
sshj copied to clipboard

SSHJ usage on Android app in Kotlin

Open StanRichie opened this issue 2 years ago • 2 comments

Hi, I am developing Android app, written in Kotlin, and I get the 'net.schmizz.sshj.common.SSHException: no such algorithm: X25519 for provider BC' error while trying to connect to an SSH server on remote local host. I discovered this article from 2018 -> https://android-developers.googleblog.com/2018/03/cryptography-changes-in-android-p.html I am targeting API 34. I was testing this library in Android 14, and Android 10 (API 29). Can you confirm, that SSHJ is not usable in Android apps as of right now?

StanRichie avatar Oct 18 '23 11:10 StanRichie

@StanRichie This issue sounds similar to the problems reported in issue #895.

In that case, the runtime version of Bouncy Castle was not new enough, resulting in the failures described. As you noted in the referenced blog, Android has made some changes in their cryptographic security provider configuration. This might be related, but as a starting point, I recommend checking the dependency tree to confirm that the compiled binary includes a recent version of Bouncy Castle. There are some different configuration classes in SSHJ to control security provider registration, so that may be a next step for evaluation.

exceptionfactory avatar Oct 18 '23 12:10 exceptionfactory

Hi, I ran into the same issue and found a method that fixed it by removing and reinserting the BouncyCastle provider: setupBouncyCastle()

jjh9397 avatar Mar 29 '24 22:03 jjh9397