Skip to Content
Linux Security Cookbook
book

Linux Security Cookbook

by Daniel J. Barrett, Richard E. Silverman, Robert G. Byrnes
June 2003
Intermediate to advanced
336 pages
8h 54m
English
O'Reilly Media, Inc.
Content preview from Linux Security Cookbook

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 --export keyname [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).

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Practical Linux Security Cookbook - Second Edition

Practical Linux Security Cookbook - Second Edition

Tajinder Kalsi
Mastering Linux Command Line

Mastering Linux Command Line

Coding Gears | Train Your Brain

Publisher Resources

ISBN: 0596003919Errata Page