0
Answered

Error reading ssh private key

anders 1 month ago in iPad • updated by Robert Masen 3 weeks ago 2

I get an error when trying to use ssh to access a server. I get the following error:

ERROR: Public key authentication failed: Unable to extract public key from private key file: Wrong passphrase or invalid/un recognized


I copied the private and public key files from iCloud storage into a ssh sub folder in local files.

The private key isn’t password protected.


+1
Answered

Textastic currently only supports the PEM key file format. It looks like newer versions of ssh-keygen (for example on macOS 10.14 Mojave) don't use the PEM format by default anymore but instead use their own new format.

You can use the "-m PEM" parameter when generating the key to generate the private key file in a format recognized by Textastic, for example:

ssh-keygen -m PEM -t rsa -b 4096

I'll add support for the new format in a future update of Textastic.

The new keys that are not recognized by Textastic begin with:

-----BEGIN OPENSSH PRIVATE KEY-----


Private key files in the recognized PEM format begin with:

-----BEGIN RSA PRIVATE KEY-----

I'm sorry for the inconvenience.

I spent most of the last day or two chasing this issue. Is there any way you could bring more attention to this requirement of the ssh-key? Maybe including the command above in the documentation on the sftp section of the manual?

https://www.textasticapp.com/v7/manual/remote_servers/sftp_ftps_ftp.html#configure-an-sftp-ssh-connection