Recipe 7.16 Printing Public Keys

7.16.1 Problem

You want to display your default public key in ASCII to share with other users.

7.16.2 Solution

Display in ASCII on standard output:

$ gpg -a --export keyname [keyname...]

7.16.3 Discussion

Try finding this combination in gpg's massive manpage. Whew!

Now you can distribute your public key to others [Recipe 7.9], and they can check its fingerprint and add it to their keyrings. [Recipe 7.10] An ASCII public key looks like:

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

mQGiBDqTFZ8RBACuT1xDXPK0RUFBgcGKx7gk85v4r3tt98qWq+kCyWA1XuRqROyq
aj4OufqiabWm2QYjYrLSBx+BrAE5t84Fi4AR23M1dNOy2gUm2R6IvjwneL4erppk
...more...
2WEACgkQ5U0ZSgD1tx9A3XYbBLbpbNBV0w25TnqiUy/vOWZcxJEAoMz4ertAFAAO
=j962
-----END PGP PUBLIC KEY BLOCK-----

To write the results to a file, add the option ?output pubkeyfile. You can also create binary output by omitting the -a option.

7.16.4 See Also

gpg(1).



    Chapter 9. Testing and Monitoring