Backup and import a keypair
We often need to move our keypair to an other system. This guide will show the solution for this problem.
- Exporting the keys
Importing the keys
- List the local keys and select which one we need.
- Export the public key to a file. Change the key_id as necessary. In this case public.key is the name of the file.
gpg -ao public.key --export key_id
After this, export the private key.
gpg -ao private.key --export-secret-keys key_id
- Copy the keys to the other system, and run
gpg --import public.key
gpg --import private.key
Warning! The private key is qualified as sensitive data. Handle with care!