0
Under review
"Unable to extract public key" when using an SSH key with a passphrase
When trying to use an ed25519 SSH key with a passphrase, I get the following error:
```
ERROR: Public key authentication failed: Unable to extract public key from private key fil
e: Wrong passphrase or invalid/unrecognized private key file format
```
I found https://feedback.textasticapp.com/communities/1/topics/2571-error-reading-ssh-private-key, but a key with the newer format but without a passphrase worked fine.
Any suggestions?
Customer support service by UserEcho
Did you enter the passphrase in the password field?
Yes, I did!
Aside, it would be good if the password wasn't specified if it was asked for interactively, matching the openssh CLI client.
Can you please send me an example private and public key file including a passphrase so I can try to reproduce the problem here?
You can send it to support@textasticapp.com
Or tell me how exactly you created the private key file.
I was able to figure out how to reproduce. I'm using 1Password for my SSH keys. If I export a key with a passphrase, and use that directly, I get the above error. However, if I reencrypt the same key by running `ssh-keygen -p -f id_textastic` using the same passphrase, it works! So there's something about the format of the private key from 1Password that's breaking things.
I created a brand new key for testing. Here it is as generated from 1Password, with passphrase `textastic`:
```
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAAFmFlczI1Ni1nY21Ab3BlbnNzaC5jb20AAAAGYmNyeXB0AA
AAGAAAABDoOBmnaYBuneUKVSO4pTuqAAAAIAAAAAEAAAAzAAAAC3NzaC1lZDI1NTE5AAAA
IBVwMVbyFoRVzprJHiAdBrO+iR23mMtXATk8J7e0Ylq5AAAAkK5LV0a3LPS4RDp57J3oar
yg35gQ7zlTFEj1wLAK7+IuCMwCu/wFBIryPiLijliOAf8ekVDHdNqmHxaJEtW5pGJknZUV
W4uC8i2KSx8KPB+6hzsP1zHpy1lVOsXIk4457sfwdz/2w9JwDtMbDtXkeRsZNbMMa8U+Mf
sLKWfQjOHhO0ptiwNFCWi1Kfsx5lZO6WHuSgzlKg2RtMNHvpJhOAs=
-----END OPENSSH PRIVATE KEY-----
```
Public key:
```
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBVwMVbyFoRVzprJHiAdBrO+iR23mMtXATk8J7e0Ylq5
```
And then the same private key above, but after passing it through ssh-keygen first:
```
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABBDzuiiHD
xR9g013d2VjMucAAAAEAAAAAEAAAAzAAAAC3NzaC1lZDI1NTE5AAAAIBVwMVbyFoRVzprJ
HiAdBrO+iR23mMtXATk8J7e0Ylq5AAAAkCPgAzIc3G+jRAiZrTNrbCHpuI7XYOlPm8HRQU
H44NT5deLHvbGZTt95BPtDAcb39FJvgo9tNFQ+OdTrnp+PXrYvLw4HXeQ0k9V1NsqzOIsD
Mqj8oXZ5lUIq3XNSGmrqvziB9zMRgp+tZK0x0YLM82ZoLlP0q+++UCqYHIEgEZ9AVJL/L1
2YS6ToWmFtmNOFVQ==
-----END OPENSSH PRIVATE KEY-----
```
Thanks a lot. It's great that you could figure it out. I'll try to find out what's going on with the key exported by 1Password.