Exporting gpg private key

Problem

Needed to back my gpg keys.

Solution

First export a revocation certificate. This is useful if you want to notify people to stop using your key for any reason:


$ gpg --output test.gpg.revocation-certificate --gen-revoke email@test.org

Now you can export your secret key pair

 


$ gpg --export-secret-keys --armor email@test.org > test.gpg.sec

References

Creating the perfect GPG keypair

Creating the perfect GPG keypair