Werner Koch wk at
Mon Sep 27 09:25:08 CEST 1999

Cees van de Griend <cees-list at> writes:

> Has anynody ever made a magic number file (see: man 4 magic) for GnuPG or
> PGP?

Debian has entries for the old PGP formats:
# pgp:  file(1) magic for Pretty Good Privacy

0       beshort         0x9900                  PGP key public ring
0       beshort         0x9501                  PGP key security ring
0       beshort         0x9500                  PGP key security ring
0       beshort         0xa600                  PGP encrypted data
0       string          -----BEGIN\040PGP       PGP armored data
>15     string          PUBLIC\040KEY\040BLOCK- public key block
>15     string          MESSAGE-                message
>15     string          SIGNED\040MESSAGE-      signed message
>15     string          PGP\040SIGNATURE-       signature

The problem with OpenPGP is that there are different ways of encoding
the packet type and the length of the packet.  One way to detect
OpenPGP files would be to put the optional marker packet in front of
every PGP message and extend this marker packet to describe the type
of data in this file (keyring,encrypted data).  The marker packet as
it is today would only help to detect that it is a OpenPGP file.

Werner Koch at            keyid 621CC013

More information about the Gnupg-devel mailing list