Skip to content

ED25519 keys with passphrase generated by Juice SSH cannot be decrypted to create SSH connection #2976

@TranceLove

Description

@TranceLove

To Reproduce
Steps to reproduce the behavior:

  1. Generate a key pair in Juice SSH, using ED25519 as key type, and enter a passphrase
  2. Export the key pair
  3. Copy the public key to target SSH server
  4. Create a new SSH connection in Amaze, using the private key exported in 2
  5. Enter passphrase in 1 when prompted
  6. Amaze complained incorrect passphrase even when correctly entered

Expected behavior
The key should decrypt, hence create the SSH connection without problem

Smartphone (please complete the following information):

  • Device: Pixel 2 emulator
  • OS: Android 11
  • Rooted: yes, but should not matter
  • Version: 3.6.5

Additional context
The key pair generated above can be used in Solid Explorer without problems.

And when the key went through PemToKeyPairTask, such exception was seen

java.lang.IllegalStateException: Cipher 'aes128-cbc' not currently implemented for openssh-key-v1 format
	at com.hierynomus.sshj.userauth.keyprovider.OpenSSHKeyV1KeyFile.createCipher(OpenSSHKeyV1KeyFile.java:145)
	at com.hierynomus.sshj.userauth.keyprovider.OpenSSHKeyV1KeyFile.decryptBuffer(OpenSSHKeyV1KeyFile.java:117)
	at com.hierynomus.sshj.userauth.keyprovider.OpenSSHKeyV1KeyFile.readDecodedKeyPair(OpenSSHKeyV1KeyFile.java:110)
	at com.hierynomus.sshj.userauth.keyprovider.OpenSSHKeyV1KeyFile.readKeyPair(OpenSSHKeyV1KeyFile.java:79)
	at net.schmizz.sshj.userauth.keyprovider.BaseFileKeyProvider.getPublic(BaseFileKeyProvider.java:81)
	at com.amaze.filemanager.asynchronous.asynctasks.ssh.PemToKeyPairTask$OpenSshV1PemToKeyPairConverter.throwingConvert(PemToKeyPairTask.kt:221)

which looks quite true.

https://github.com/hierynomus/sshj/blob/3256f5336d46afd9a2524b12e8e4a9480a604b22/src/main/java/com/hierynomus/sshj/userauth/keyprovider/OpenSSHKeyV1KeyFile.java#L191-L198

Not sure if we should override it and add the cipher back though (if this is really the culprit).

Metadata

Metadata

Assignees

Labels

Area-Ssh/Scp/SftpFrom-telegramIssue reported through telegram channelIssue-BugRelated unexpected behavior or something worth investigating.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions