I have an SSH ed25519 key which I would like to import to GPG as an Authentication Subkey. There doesn't appear to be any documentation available on how to do this.
Asked
Active
Viewed 1,606 times
1 Answers
3
The first step is impossible.
But you can import an SSH ed25519 private key to GPG.
Assume that you have already setup gpg-agent.
- Setup
SSH_AUTH_SOCKandGPG_TTYenvironment variables byexport SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)andexport GPG_TTY=$(tty). - Add your SSH private key to GPG by
ssh-add ed25519-filename.
Note that if you are asked for a new password, it is recommended that you use the same as your GPG master password. - Identify the keygrip of the private key that you added by step 2.
- Check the keygrips of your existing GPG private keys by
gpg -K --with-keygrip. - Check private key files by
ls -l $(gpgconf --list-dirs homedir)/private-keys-v1.d. - The filename of step 3.2. that is not in the keygrips of step 3-1 is the keygrip that you added by step 2.
- Check the keygrips of your existing GPG private keys by
- Setup the key added by
ssh-addto a subkey.- Start GPG by
gpg --expert --edit-key "Your-existing-GPG-Key-ID". - Enter
addkeycommand. - Select "Existing key". (Maybe "13")
- Enter the keygrip identified by step 3.
- Set the capability as you wish and Finish.
- Then, answer the questions appropriately.
Note that you should answerYtoReally create?andSave changes?etc.
- Start GPG by
- Verify that the import was successful by
gpg -K --with-keygrip.
You should be able to see the keygrip that you just added.
Lucas
- 125
- 7
Mitsuru Kariya
- 131
- 2
-
2Thanks for the help. I ended up writing a quick script using to openpgp.js to extract/modify the gpg sigchain ([link](https://github.com/tcyrus/swiss-army-spoon)), but this solution is a lot better. – tcyrus Oct 22 '21 at 21:04