Import/Export PGP key pair

From Wiki
Jump to navigation Jump to search


$ gpg --list-keys
pub 1024D/ABCDFE01 2008-04-13
uid firstname lastname (description) <>
sub 2048g/DEFABC01 2008-04-13

Export key ABCDFE01:

$ gpg --output gpgkey_pub.gpg --armor --export ABCDFE01
$ gpg --output gpgkey_sec.gpg --armor --export-secret-key ABCDFE01

Optionally, use scp to copy those files to a remote host:

$ scp gpgkey_pub.gpg gpgkey_sec.gpg user@remotehost:~/


On the "import host":

$ gpg --import ~/gpgkey_pub.gpg
$ gpg --import ~/gpgkey_sec.gpg
Don't forget to remove the exposed keys: $ rm ~/gpgkey_*