Convert PGP/GPG private keys to SSH private keys
Find a file
Pablo Ovelleiro Corral 6dad98956c
add test key
2024-03-25 17:22:47 +01:00
gnupg add test key 2024-03-25 17:22:47 +01:00
age-public-key add test key 2024-03-25 17:22:47 +01:00
age-secret-key add test key 2024-03-25 17:22:47 +01:00
go.mod initial commit 2024-03-20 20:34:29 +01:00
go.sum initial commit 2024-03-20 20:34:29 +01:00
main.go add test key 2024-03-25 17:22:47 +01:00
README.md add test key 2024-03-25 17:22:47 +01:00
ssh-pubkey add test key 2024-03-25 17:22:47 +01:00
test-key.asc add test key 2024-03-25 17:22:47 +01:00
testfile.txt add test key 2024-03-25 17:22:47 +01:00
testfile.txt.age add test key 2024-03-25 17:22:47 +01:00

Example key provided in ./gnupg

 gpg --homedir ./gnupg_testkey/ -K
/home/pinpox/code/github.com/pinpox/gpg2age/./gnupg_testkey/pubring.kbx
-----------------------------------------------------------------------
sec   ed25519 2024-03-25 [C]
      9FE4D484B69DB9F5C7AA208E76188CF30717B54E
uid           [ultimate] test (test) <test@test.com>
ssb   ed25519 2024-03-25 [S]
ssb   cv25519 2024-03-25 [E]
ssb   ed25519 2024-03-25 [A]

Get age key and encrypt test file

 gpg --homedir ./gnupg --export-ssh-key 9FE4D484B69DB9F5C7AA208E76188CF30717B54E
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICYvKXGcG4a19tTT0Rycbn+D0r/YlKltLJ9dY2gR/Fjx openpgp:0x47C9F3FF
 gpg --homedir ./gnupg --export-ssh-key 9FE4D484B69DB9F5C7AA208E76188CF30717B54E | ssh-to-age                                                                                                                             impure ❄ ssh-to-age
age18s8m9hvlrwvltgys4lafyyqe356ntc7e06t4kd2nccqm5amsaa2s878mju # saved as age-public-key
 age --encrypt -R age-public-key testfile.txt > testfile.txt.age

Try to decrypt

 age --decrypt --identity age-secret-key --output decrypted testfile.txt.age                                                                                                                                          impure ❄ ssh-to-age age
age: error: no identity matched any of the recipients
age: report unexpected or unhelpful errors at https://filippo.io/age/report

FAIL :(