I've been using GPG with authentication subkeys for a while now, and I recently ran into a rather unhelpful error message. I'm writing this question "Q&A-style" to help others who might run into the same problem.
I use a set of GPG keys for GitHub stuff — both for commit signing and for authentication via SSH. I decided to upgrade the authentication subkey to the newer ED25519 elliptic curve standard, so I added a new ed25519
subkey with authentication capability and revoked the old RSA authentication subkey. I gpg --export-ssh-key
ed the new subkey, then added it to both GitHub and a local ~/.ssh/id_gpg_gh.pub
file, which is set as my identity file for GitHub via my SSH config.
At this point, though, SSH threw a Load key ".ssh/id_gpg_gh.pub": invalid format
error when I tested my login ability. Connecting in verbose mode (ssh -T github.com -v
) revealed that SSH was correctly advertising my new key and GitHub was accepting it, but that acceptance was immediately followed by the error message. It seemed that SSH was refusing to actually use my new subkey due to formatting issues.