7.16. Printing Public Keys
Problem
You want to display your default public key in ASCII to share with other users.
Solution
Display in ASCII on standard output:
$ gpg -a --exportkeyname
[keyname
...]
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.
See Also
gpg(1).
Get Linux Security Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.