Finding the key-id of an armoured key

Chris Hastie lists@oak-wood.co.uk
Fri Jan 10 19:28:02 2003


I need to be able to establish various details about a key (public or 
secret) that is held as armoured text, preferably without having to 
import it into a keyring first.

Many can be parsed from the output of "gpg --list-packets /path/to/file" 
but I can see no reliable way of getting the key id or its digest 
algorithm from this. The digest algorithm can probably be established 
from a self-signature if I know what the key id is so that I can match 
it.

The best I can come up with for the key id is to import the key into a 
temporary keyring and then use --fingerprint, along with options to 
restrict it to the temporary key ring, and parse the output from there. 
This has a lot of problems for me though, and I'd prefer something 
cleaner. It also doesn't work for secret keys, AFAICT.

Any suggestions as to how I can get this information. I'm sure it should 
be simple, but I just can't see it.
-- 
Chris Hastie