GPG file format

Janusz A. Urbanowicz alex at bofh.net.pl
Fri Oct 22 00:54:14 CEST 2004


On Thu, Oct 21, 2004 at 07:06:46PM +0000, Markus Bauer wrote:
> Sorry that I post here now but I've already posted to the users list but
> could not get any information.

> But I'd like to know if there's somewhere a file specification. Do gpg
> files have a signature or a magic-string so that I may find a gpg file?

I guess you haven'teven managed to use google not to mention reading GnuPG's
FM.

OpenPGP format absolute definition is in RFCs 1991 and 2440.

This is relevant section from GNU file(1) magic database:

#------------------------------------------------------------------------------
# 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 text
>15     string          PUBLIC\040KEY\040BLOCK- public key block
>15     string          MESSAGE-                message
>15     string          SIGNED\040MESSAGE-      signed message
>15     string          PGP\040SIGNATURE-       signature

 
> And is the whole 130MB file encrypted at once or is it encrypted in
> "blocks"

Sometimes. Sometimes not. The application is free to do it either way when
creating the file.

> so that I may have the chance to recover at least a few blocks?

It is simple. Restore it from the backup, you do have backups, don't you? 
That's the simpliest method.

OpenPGP format is quite compact and there is not much redundancy in it. No
visible headers
 
> If a gpg file is divided into blocks: Does each block have a "header" so
> that I may identify a GPG block?

If there are multiple packets in the mesage, yes.

Read the RFCs.

Alex
-- 
0x46399138



More information about the Gnupg-devel mailing list