TIL Verify your SSH key passphrase
I was working through The New Stack's guide to signing
git commits with SSH keys and I needed to make sure that the passphrase I was using was the right one. I wanted an elegant way to check this and I found:
man page, we see that
ssh-keygen -y does this:
-y This option will read a private OpenSSH format file and print an OpenSSH public key to stdout.
If you supply an incorrect passphrase, you'll see something like this:
# ssh-keygen -f til-brie-dev -y Enter passphrase: Load key "til-brie-dev": incorrect passphrase supplied to decrypt private key
If things go well, you'll see the corresponding public key printed, probably in a a string that starts
ssh-rsa and contains the signature blob with an optional comment. 🎉
If there's no passphrase set, you won't be prompted.
ℹ️ About this TIL snippet: Created 2022-12-30T21:41:06-05:00 · View the source