Getting information from an armored gpg public key file
Solution 1:
I don't know that gpg has an option for this, but here's a more flexible workaround for extracting information from the key file:
mkdir temp-gnupg-dir
export GNUPGHOME=temp-gnupg-dir
gpg --import pubkey.gpg
gpg --list-keys
rm -r temp-gnupg-dir
Instead of the GNUPGHOME
environment variable, you can pass --homedir=temp-gnupg-dir
to every gpg invocation.
Solution 2:
To print the fingerprint of an on-disk armored key without importing it, just use --with-fingerprint
:
> gpg --with-fingerprint jm3.asc
pub 1024R/9112BC51 1996-02-05 john manoogian <jm3@*>
Key fingerprint = C9 DC 27 29 0E 1A DB 50 21 C8 64 08 15 29 41 86
uid john manoogian <jm3@foo...
uid john manoogian <jm3@bar...
uid john manoogian <jm3@baz...
uid john manoogian <jm3@qux...
Voilà!
Solution 3:
You can checkout Kazu Yamamoto's PGP packet visualizer which displays the packet format of OpenPGP (RFC 4880) and PGP version 2 (RFC 1991).
To fetch and compile:
git clone http://github.com/kazu-yamamoto/pgpdump
cd pgpdump
./configure --prefix=/usr/local/ && make && sudo make install
Using it is even simpler:
pgpdump pubkey.gpg
There is also a cgi-bin interface available on this site: http://www.pgpdump.net/cgi-bin/pgpdump