sshj icon indicating copy to clipboard operation
sshj copied to clipboard

Unable to use SSHJ on Android P

Open shreyashpmc opened this issue 5 years ago • 4 comments

Recently we have changed our Application compiled version 27 to 28 (Android P).

After that while uploading file, we are facing below issue while using method (sshClient.connect(ip, port)).

net.schmizz.sshj.transport.TransportException: no such algorithm: ECDSA for provider BC.

Can you please let me know how i can solve this issue?

shreyashpmc avatar Oct 16 '19 06:10 shreyashpmc

I ran into this problem also. Android has removed ciphers from BC that are redundant with the default security provider: https://android-developers.googleblog.com/2018/03/cryptography-changes-in-android-p.html

I have a branch of sshj that works with Android P: https://github.com/acceleratedtech/sshj

I'm willing to create a PR but I need to add an interface to control whether sshj should use the "BC" security provider or just the default providers.

jameyhicks avatar Feb 28 '20 14:02 jameyhicks

@jameyhicks Just FYI if we add this library then it will work fine for newer versions as well. implementation 'com.madgag.spongycastle:prov:1.58.0.0'

shreyashpmc avatar Mar 02 '20 04:03 shreyashpmc

for the record, it's also possible to replace the android-shipped bouncycastle provider with the regular one, that'll also fix this issue:

    implementation "org.bouncycastle:bcprov-jdk15on:1.64"
Security.removeProvider("BC");
Security.insertProviderAt(org.bouncycastle.jce.provider.BouncyCastleProvider(), 0);

Valodim avatar Mar 07 '20 00:03 Valodim

Please note that Spongycastle "1.58" (dead project since several years) is a fork of Bouncy Castle. And there are CVEs not solved... It is needed to quickly move Spongycastle to Bouncy Castle.

Note: The last at this time is 1.65.

Neustradamus avatar Apr 13 '20 04:04 Neustradamus