Check if file is a key file

Olaf Gellert og at pre-secure.de
Thu Feb 24 21:34:14 CET 2005


Kiefer, Sascha wrote:

> As i'm writing a program that automates the gnupg stuff and i want to achive
> the following:
> I have a file. Maybe it is a valid key file or it is not. But i want that
> gnupg finds
> it out for me. My idea was to use dry-run and import: if gnupg is possible
> to import
> something then I'm sure the file is a key file (or at least, it has an key
> in it).
> This works fine if the file contains just one key but if the file contains
> about 1000-5000
> Key,s things are getting slow. So is there a command that tests a file?

What else could the file be? If I just use the unix command
"file" on some files, I already get the following:

> file .gnupg/pubring.gpg
.gnupg/pubring.gpg: data
> file .gnupg/secring.gpg
.gnupg/secring.gpg: PGP key security ring
> file gellert.asc
gellert.asc: PGP armored data public key block

So it does not recognize a GPG public keyring, but it
does recognize secret keyrings and ASCII-armored keys.

Or do you need something that really checks if the
file contains a VALID key?

Cheers, Olaf

-- 
Dipl.Inform. Olaf Gellert                  PRESECURE (R)
Senior Researcher,                       Consulting GmbH
Phone: (+49) 0700 / PRESECURE           og at pre-secure.de

                        A daily view on Internet Attacks
                        https://www.ecsirt.net/sensornet




More information about the Gnupg-users mailing list