xref: /dflybsd-src/contrib/file/magic/Magdir/pgp (revision 7b80531f545c7d3c51c1660130c71d01f6bccbe0)
1327e51cbSPeter Avalos
2327e51cbSPeter Avalos#------------------------------------------------------------------------------
3*614728caSSascha Wildner# $File: pgp,v 1.25 2021/04/26 15:56:00 christos Exp $
4327e51cbSPeter Avalos# pgp:  file(1) magic for Pretty Good Privacy
5970935fdSSascha Wildner
6970935fdSSascha Wildner# Handling of binary PGP keys is in pgp-binary-keys.
76fca56fbSSascha Wildner# see https://lists.gnupg.org/pipermail/gnupg-devel/1999-September/016052.html
8327e51cbSPeter Avalos#
9327e51cbSPeter Avalos0	beshort		0xa600			PGP encrypted data
1079343712SPeter Avalos#!:mime	application/pgp-encrypted
1179343712SPeter Avalos#0	string		-----BEGIN\040PGP	text/PGP armored data
1279343712SPeter Avalos!:mime	text/PGP # encoding: armored data
1379343712SPeter Avalos#>15	string	PUBLIC\040KEY\040BLOCK-	public key block
1479343712SPeter Avalos#>15	string	MESSAGE-		message
1579343712SPeter Avalos#>15	string	SIGNED\040MESSAGE-	signed message
1679343712SPeter Avalos#>15	string	PGP\040SIGNATURE-	signature
1779343712SPeter Avalos
18c990e5baSDaniel Fojt# Update:	Joerg Jenderek
19c990e5baSDaniel Fojt# URL:		http://en.wikipedia.org/wiki/Pretty_Good_Privacy
20c990e5baSDaniel Fojt# Reference:	https://reposcope.com/mimetype/application/pgp-keys
21c990e5baSDaniel Fojt2	string	---BEGIN\040PGP\040PRIVATE\040KEY\040BLOCK-	PGP private key block
22c990e5baSDaniel Fojt#!:mime	text/PGP
23c990e5baSDaniel Fojt!:mime	application/pgp-keys
24c990e5baSDaniel Fojt!:ext	asc
25c30bd091SSascha Wildner2	string	---BEGIN\040PGP\040PUBLIC\040KEY\040BLOCK-	PGP public key block
2679343712SPeter Avalos!:mime	application/pgp-keys
27c990e5baSDaniel Fojt!:ext	asc
2882c5fa3eSPeter Avalos>10	search/100	\n\n
2982c5fa3eSPeter Avalos>>&0	use		pgp
30c30bd091SSascha Wildner0	string	-----BEGIN\040PGP\040MESSAGE-		PGP message
31c990e5baSDaniel Fojt# https://reposcope.com/mimetype/application/pgp-encrypted
32c990e5baSDaniel Fojt#!:mime	application/pgp
33c990e5baSDaniel Fojt!:mime	application/pgp-encrypted
34c990e5baSDaniel Fojt!:ext	asc
35c990e5baSDaniel Fojt#!:ext	asc/pgp/gpg
3682c5fa3eSPeter Avalos>10	search/100	\n\n
3782c5fa3eSPeter Avalos>>&0	use		pgp
38c990e5baSDaniel Fojt# Reference:	https://www.gnupg.org/gph/en/manual/x135.html
39c990e5baSDaniel Fojt0	string	-----BEGIN\040PGP\040SIGNED\040MESSAGE-	PGP signed message
40c990e5baSDaniel Fojt#!:mime	text/plain
41c990e5baSDaniel Fojt!:mime	text/PGP
42c990e5baSDaniel Fojt#!:mime	application/pgp
43c990e5baSDaniel Fojt!:ext	asc
44c30bd091SSascha Wildner0	string	-----BEGIN\040PGP\040SIGNATURE-		PGP signature
45c990e5baSDaniel Fojt# https://reposcope.com/mimetype/application/pgp-signature
4679343712SPeter Avalos!:mime	application/pgp-signature
47c990e5baSDaniel Fojt!:ext	asc
4882c5fa3eSPeter Avalos>10	search/100	\n\n
4982c5fa3eSPeter Avalos>>&0	use		pgp
5082c5fa3eSPeter Avalos
5182c5fa3eSPeter Avalos# Decode the type of the packet based on it's base64 encoding.
5282c5fa3eSPeter Avalos# Idea from Mark Martinec
5382c5fa3eSPeter Avalos# The specification is in RFC 4880, section 4.2 and 4.3:
546fca56fbSSascha Wildner# https://tools.ietf.org/html/rfc4880#section-4.2
5582c5fa3eSPeter Avalos
5682c5fa3eSPeter Avalos0	name		pgp
5782c5fa3eSPeter Avalos>0	byte		0x67		Reserved (old)
5882c5fa3eSPeter Avalos>0	byte		0x68		Public-Key Encrypted Session Key (old)
5982c5fa3eSPeter Avalos>0	byte		0x69		Signature (old)
6082c5fa3eSPeter Avalos>0	byte		0x6a		Symmetric-Key Encrypted Session Key (old)
6182c5fa3eSPeter Avalos>0	byte		0x6b		One-Pass Signature (old)
6282c5fa3eSPeter Avalos>0	byte		0x6c		Secret-Key (old)
6382c5fa3eSPeter Avalos>0	byte		0x6d		Public-Key (old)
6482c5fa3eSPeter Avalos>0	byte		0x6e		Secret-Subkey (old)
6582c5fa3eSPeter Avalos>0	byte		0x6f		Compressed Data (old)
6682c5fa3eSPeter Avalos>0	byte		0x70		Symmetrically Encrypted Data (old)
6782c5fa3eSPeter Avalos>0	byte		0x71		Marker (old)
6882c5fa3eSPeter Avalos>0	byte		0x72		Literal Data (old)
6982c5fa3eSPeter Avalos>0	byte		0x73		Trust (old)
7082c5fa3eSPeter Avalos>0	byte		0x74		User ID (old)
7182c5fa3eSPeter Avalos>0	byte		0x75		Public-Subkey (old)
7282c5fa3eSPeter Avalos>0	byte		0x76		Unused (old)
7382c5fa3eSPeter Avalos>0	byte		0x77
7482c5fa3eSPeter Avalos>>1	byte&0xc0	0x00		Reserved
7582c5fa3eSPeter Avalos>>1	byte&0xc0	0x40		Public-Key Encrypted Session Key
7682c5fa3eSPeter Avalos>>1	byte&0xc0	0x80		Signature
7782c5fa3eSPeter Avalos>>1	byte&0xc0	0xc0		Symmetric-Key Encrypted Session Key
7882c5fa3eSPeter Avalos>0	byte		0x78
7982c5fa3eSPeter Avalos>>1	byte&0xc0	0x00		One-Pass Signature
8082c5fa3eSPeter Avalos>>1	byte&0xc0	0x40		Secret-Key
8182c5fa3eSPeter Avalos>>1	byte&0xc0	0x80		Public-Key
8282c5fa3eSPeter Avalos>>1	byte&0xc0	0xc0		Secret-Subkey
8382c5fa3eSPeter Avalos>0	byte		0x79
8482c5fa3eSPeter Avalos>>1	byte&0xc0	0x00		Compressed Data
8582c5fa3eSPeter Avalos>>1	byte&0xc0	0x40		Symmetrically Encrypted Data
8682c5fa3eSPeter Avalos>>1	byte&0xc0	0x80		Marker
8782c5fa3eSPeter Avalos>>1	byte&0xc0	0xc0		Literal Data
8882c5fa3eSPeter Avalos>0	byte		0x7a
8982c5fa3eSPeter Avalos>>1	byte&0xc0	0x00		Trust
9082c5fa3eSPeter Avalos>>1	byte&0xc0	0x40		User ID
9182c5fa3eSPeter Avalos>>1	byte&0xc0	0x80		Public-Subkey
9282c5fa3eSPeter Avalos>>1	byte&0xc0	0xc0		Unused [z%x]
9382c5fa3eSPeter Avalos>0	byte		0x30
9482c5fa3eSPeter Avalos>>1	byte&0xc0	0x00		Unused [0%x]
9582c5fa3eSPeter Avalos>>1	byte&0xc0	0x40		User Attribute
9682c5fa3eSPeter Avalos>>1	byte&0xc0	0x80		Sym. Encrypted and Integrity Protected Data
9782c5fa3eSPeter Avalos>>1	byte&0xc0	0xc0		Modification Detection Code
9882c5fa3eSPeter Avalos
9982c5fa3eSPeter Avalos# magic signatures to detect PGP crypto material (from stef)
10082c5fa3eSPeter Avalos# detects and extracts metadata from:
10182c5fa3eSPeter Avalos#  - symmetric encrypted packet header
10282c5fa3eSPeter Avalos#  - RSA (e=65537) secret (sub-)keys
10382c5fa3eSPeter Avalos
10482c5fa3eSPeter Avalos# 1024b RSA encrypted data
10582c5fa3eSPeter Avalos
10682c5fa3eSPeter Avalos0	string	\x84\x8c\x03		PGP RSA encrypted session key -
107c990e5baSDaniel Fojt>3	belong	x			keyid: %08X
108c990e5baSDaniel Fojt>7	belong	x			%08X
10982c5fa3eSPeter Avalos>11	byte	0x01			RSA (Encrypt or Sign) 1024b
11082c5fa3eSPeter Avalos>11	byte	0x02			RSA Encrypt-Only 1024b
11182c5fa3eSPeter Avalos>12	string	\x04\x00
11282c5fa3eSPeter Avalos>12	string	\x03\xff
11382c5fa3eSPeter Avalos>12	string	\x03\xfe
11482c5fa3eSPeter Avalos>12	string	\x03\xfd
11582c5fa3eSPeter Avalos>12	string	\x03\xfc
11682c5fa3eSPeter Avalos>12	string	\x03\xfb
11782c5fa3eSPeter Avalos>12	string	\x03\xfa
11882c5fa3eSPeter Avalos>12	string	\x03\xf9
11982c5fa3eSPeter Avalos>142	byte	0xd2			.
12082c5fa3eSPeter Avalos
12182c5fa3eSPeter Avalos# 2048b RSA encrypted data
12282c5fa3eSPeter Avalos
12382c5fa3eSPeter Avalos0	string	\x85\x01\x0c\x03	PGP RSA encrypted session key -
124c990e5baSDaniel Fojt>4	belong	x			keyid: %08X
125c990e5baSDaniel Fojt>8	belong	x			%08X
12682c5fa3eSPeter Avalos>12	byte	0x01			RSA (Encrypt or Sign) 2048b
12782c5fa3eSPeter Avalos>12	byte	0x02			RSA Encrypt-Only 2048b
12882c5fa3eSPeter Avalos>13	string	\x08\x00
12982c5fa3eSPeter Avalos>13	string	\x07\xff
13082c5fa3eSPeter Avalos>13	string	\x07\xfe
13182c5fa3eSPeter Avalos>13	string	\x07\xfd
13282c5fa3eSPeter Avalos>13	string	\x07\xfc
13382c5fa3eSPeter Avalos>13	string	\x07\xfb
13482c5fa3eSPeter Avalos>13	string	\x07\xfa
13582c5fa3eSPeter Avalos>13	string	\x07\xf9
13682c5fa3eSPeter Avalos>271	byte	0xd2			.
13782c5fa3eSPeter Avalos
13882c5fa3eSPeter Avalos# 3072b RSA encrypted data
13982c5fa3eSPeter Avalos
14082c5fa3eSPeter Avalos0	string	\x85\x01\x8c\x03	PGP RSA encrypted session key -
141c990e5baSDaniel Fojt>4	belong	x			keyid: %08X
142c990e5baSDaniel Fojt>8	belong	x			%08X
14382c5fa3eSPeter Avalos>12	byte	0x01			RSA (Encrypt or Sign) 3072b
14482c5fa3eSPeter Avalos>12	byte	0x02			RSA Encrypt-Only 3072b
14582c5fa3eSPeter Avalos>13	string	\x0c\x00
14682c5fa3eSPeter Avalos>13	string	\x0b\xff
14782c5fa3eSPeter Avalos>13	string	\x0b\xfe
14882c5fa3eSPeter Avalos>13	string	\x0b\xfd
14982c5fa3eSPeter Avalos>13	string	\x0b\xfc
15082c5fa3eSPeter Avalos>13	string	\x0b\xfb
15182c5fa3eSPeter Avalos>13	string	\x0b\xfa
15282c5fa3eSPeter Avalos>13	string	\x0b\xf9
15382c5fa3eSPeter Avalos>399	byte	0xd2			.
15482c5fa3eSPeter Avalos
155c990e5baSDaniel Fojt# 4096b RSA encrypted data
15682c5fa3eSPeter Avalos
15782c5fa3eSPeter Avalos0	string	\x85\x02\x0c\x03	PGP RSA encrypted session key -
158c990e5baSDaniel Fojt>4	belong	x			keyid: %08X
159c990e5baSDaniel Fojt>8	belong	x			%08X
16082c5fa3eSPeter Avalos>12	byte	0x01			RSA (Encrypt or Sign) 4096b
16182c5fa3eSPeter Avalos>12	byte	0x02			RSA Encrypt-Only 4096b
16282c5fa3eSPeter Avalos>13	string	\x10\x00
16382c5fa3eSPeter Avalos>13	string	\x0f\xff
16482c5fa3eSPeter Avalos>13	string	\x0f\xfe
16582c5fa3eSPeter Avalos>13	string	\x0f\xfd
16682c5fa3eSPeter Avalos>13	string	\x0f\xfc
16782c5fa3eSPeter Avalos>13	string	\x0f\xfb
16882c5fa3eSPeter Avalos>13	string	\x0f\xfa
16982c5fa3eSPeter Avalos>13	string	\x0f\xf9
17082c5fa3eSPeter Avalos>527	byte	0xd2			.
17182c5fa3eSPeter Avalos
172c990e5baSDaniel Fojt# 8192b RSA encrypted data
17382c5fa3eSPeter Avalos
17482c5fa3eSPeter Avalos0	string	\x85\x04\x0c\x03	PGP RSA encrypted session key -
175c990e5baSDaniel Fojt>4	belong	x			keyid: %08X
176c990e5baSDaniel Fojt>8	belong	x			%08X
177c990e5baSDaniel Fojt>12	byte	0x01			RSA (Encrypt or Sign) 8192b
178c990e5baSDaniel Fojt>12	byte	0x02			RSA Encrypt-Only 8192b
17982c5fa3eSPeter Avalos>13	string	\x20\x00
18082c5fa3eSPeter Avalos>13	string	\x1f\xff
18182c5fa3eSPeter Avalos>13	string	\x1f\xfe
18282c5fa3eSPeter Avalos>13	string	\x1f\xfd
18382c5fa3eSPeter Avalos>13	string	\x1f\xfc
18482c5fa3eSPeter Avalos>13	string	\x1f\xfb
18582c5fa3eSPeter Avalos>13	string	\x1f\xfa
18682c5fa3eSPeter Avalos>13	string	\x1f\xf9
18782c5fa3eSPeter Avalos>1039	byte	0xd2			.
18882c5fa3eSPeter Avalos
189c990e5baSDaniel Fojt# 1024b Elgamal encrypted data
190c990e5baSDaniel Fojt
191c990e5baSDaniel Fojt0	string	\x85\x01\x0e\x03	PGP Elgamal encrypted session key -
192c990e5baSDaniel Fojt>4	belong	x			keyid: %08X
193c990e5baSDaniel Fojt>8	belong	x			%08X
194c990e5baSDaniel Fojt>12	byte	0x10			Elgamal Encrypt-Only 1024b.
195c990e5baSDaniel Fojt>13	string	\x04\x00
196c990e5baSDaniel Fojt>13	string	\x03\xff
197c990e5baSDaniel Fojt>13	string	\x03\xfe
198c990e5baSDaniel Fojt>13	string	\x03\xfd
199c990e5baSDaniel Fojt>13	string	\x03\xfc
200c990e5baSDaniel Fojt>13	string	\x03\xfb
201c990e5baSDaniel Fojt>13	string	\x03\xfa
202c990e5baSDaniel Fojt>13	string	\x03\xf9
203c990e5baSDaniel Fojt
204c990e5baSDaniel Fojt# 2048b Elgamal encrypted data
205c990e5baSDaniel Fojt
206c990e5baSDaniel Fojt0	string	\x85\x02\x0e\x03	PGP Elgamal encrypted session key -
207c990e5baSDaniel Fojt>4	belong	x			keyid: %08X
208c990e5baSDaniel Fojt>8	belong	x			%08X
209c990e5baSDaniel Fojt>12	byte	0x10			Elgamal Encrypt-Only 2048b.
210c990e5baSDaniel Fojt>13	string	\x08\x00
211c990e5baSDaniel Fojt>13	string	\x07\xff
212c990e5baSDaniel Fojt>13	string	\x07\xfe
213c990e5baSDaniel Fojt>13	string	\x07\xfd
214c990e5baSDaniel Fojt>13	string	\x07\xfc
215c990e5baSDaniel Fojt>13	string	\x07\xfb
216c990e5baSDaniel Fojt>13	string	\x07\xfa
217c990e5baSDaniel Fojt>13	string	\x07\xf9
218c990e5baSDaniel Fojt
219c990e5baSDaniel Fojt# 3072b Elgamal encrypted data
220c990e5baSDaniel Fojt
221c990e5baSDaniel Fojt0	string	\x85\x03\x0e\x03	PGP Elgamal encrypted session key -
222c990e5baSDaniel Fojt>4	belong	x			keyid: %08X
223c990e5baSDaniel Fojt>8	belong	x			%08X
224c990e5baSDaniel Fojt>12	byte	0x10			Elgamal Encrypt-Only 3072b.
225c990e5baSDaniel Fojt>13	string	\x0c\x00
226c990e5baSDaniel Fojt>13	string	\x0b\xff
227c990e5baSDaniel Fojt>13	string	\x0b\xfe
228c990e5baSDaniel Fojt>13	string	\x0b\xfd
229c990e5baSDaniel Fojt>13	string	\x0b\xfc
230c990e5baSDaniel Fojt>13	string	\x0b\xfb
231c990e5baSDaniel Fojt>13	string	\x0b\xfa
232c990e5baSDaniel Fojt>13	string	\x0b\xf9
233c990e5baSDaniel Fojt
23482c5fa3eSPeter Avalos# crypto algo mapper
23582c5fa3eSPeter Avalos
23682c5fa3eSPeter Avalos0	name	crypto
23782c5fa3eSPeter Avalos>0	byte	0x00			Plaintext or unencrypted data
23882c5fa3eSPeter Avalos>0	byte	0x01			IDEA
23982c5fa3eSPeter Avalos>0	byte	0x02			TripleDES
24082c5fa3eSPeter Avalos>0	byte	0x03			CAST5 (128 bit key)
24182c5fa3eSPeter Avalos>0	byte	0x04			Blowfish (128 bit key, 16 rounds)
24282c5fa3eSPeter Avalos>0	byte	0x07			AES with 128-bit key
24382c5fa3eSPeter Avalos>0	byte	0x08			AES with 192-bit key
24482c5fa3eSPeter Avalos>0	byte	0x09			AES with 256-bit key
24582c5fa3eSPeter Avalos>0	byte	0x0a			Twofish with 256-bit key
24682c5fa3eSPeter Avalos
24782c5fa3eSPeter Avalos# hash algo mapper
24882c5fa3eSPeter Avalos
24982c5fa3eSPeter Avalos0	name	hash
25082c5fa3eSPeter Avalos>0	byte	0x01			MD5
25182c5fa3eSPeter Avalos>0	byte	0x02			SHA-1
25282c5fa3eSPeter Avalos>0	byte	0x03			RIPE-MD/160
25382c5fa3eSPeter Avalos>0	byte	0x08			SHA256
25482c5fa3eSPeter Avalos>0	byte	0x09			SHA384
25582c5fa3eSPeter Avalos>0	byte	0x0a			SHA512
25682c5fa3eSPeter Avalos>0	byte	0x0b			SHA224
25782c5fa3eSPeter Avalos
258c30bd091SSascha Wildner# display public key algorithms as human readable text
259c30bd091SSascha Wildner0	name	key_algo
260c30bd091SSascha Wildner>0	byte	0x01			RSA (Encrypt or Sign)
261c30bd091SSascha Wildner# keep old look of version 5.28 without parentheses
262c30bd091SSascha Wildner>0	byte	0x02			RSA Encrypt-Only
263c30bd091SSascha Wildner>0	byte	0x03			RSA (Sign-Only)
264c30bd091SSascha Wildner>0	byte	16			ElGamal (Encrypt-Only)
265c30bd091SSascha Wildner>0	byte	17			DSA
266c30bd091SSascha Wildner>0	byte	18			Elliptic Curve
267c30bd091SSascha Wildner>0	byte	19			ECDSA
268c30bd091SSascha Wildner>0	byte	20			ElGamal (Encrypt or Sign)
269c30bd091SSascha Wildner>0	byte	21			Diffie-Hellman
270c30bd091SSascha Wildner>0	default	x
271c30bd091SSascha Wildner>>0	ubyte	<22			unknown (pub %d)
272c30bd091SSascha Wildner# this should never happen
273c30bd091SSascha Wildner>>0	ubyte	>21			invalid (%d)
274c30bd091SSascha Wildner
27582c5fa3eSPeter Avalos# pgp symmetric encrypted data
27682c5fa3eSPeter Avalos
27782c5fa3eSPeter Avalos0	byte	0x8c			PGP symmetric key encrypted data -
27882c5fa3eSPeter Avalos>1	byte	0x0d
27982c5fa3eSPeter Avalos>1	byte	0x0c
28082c5fa3eSPeter Avalos>2	byte	0x04
28182c5fa3eSPeter Avalos>3	use	crypto
28282c5fa3eSPeter Avalos>4	byte	0x01			salted -
28382c5fa3eSPeter Avalos>>5	use	hash
28482c5fa3eSPeter Avalos>>14	byte	0xd2			.
28582c5fa3eSPeter Avalos>>14	byte	0xc9			.
28682c5fa3eSPeter Avalos>4	byte	0x03			salted & iterated -
28782c5fa3eSPeter Avalos>>5	use	hash
28882c5fa3eSPeter Avalos>>15	byte	0xd2			.
28982c5fa3eSPeter Avalos>>15	byte	0xc9			.
29082c5fa3eSPeter Avalos
29182c5fa3eSPeter Avalos# encrypted keymaterial needs s2k & can be checksummed/hashed
29282c5fa3eSPeter Avalos
29382c5fa3eSPeter Avalos0	name	chkcrypto
29482c5fa3eSPeter Avalos>0	use	crypto
29582c5fa3eSPeter Avalos>1	byte	0x00			Simple S2K
29682c5fa3eSPeter Avalos>1	byte	0x01			Salted S2K
29782c5fa3eSPeter Avalos>1	byte	0x03			Salted&Iterated S2K
29882c5fa3eSPeter Avalos>2	use	hash
29982c5fa3eSPeter Avalos
30082c5fa3eSPeter Avalos# all PGP keys start with this prolog
30182c5fa3eSPeter Avalos# containing version, creation date, and purpose
30282c5fa3eSPeter Avalos
30382c5fa3eSPeter Avalos0	name	keyprolog
30482c5fa3eSPeter Avalos>0	byte	0x04
30582c5fa3eSPeter Avalos>1	beldate	x			created on %s -
30682c5fa3eSPeter Avalos>5	byte	0x01			RSA (Encrypt or Sign)
30782c5fa3eSPeter Avalos>5	byte	0x02			RSA Encrypt-Only
30882c5fa3eSPeter Avalos
30982c5fa3eSPeter Avalos# end of secret keys known signature
31082c5fa3eSPeter Avalos# contains e=65537 and the prolog to
31182c5fa3eSPeter Avalos# the encrypted parameters
31282c5fa3eSPeter Avalos
31382c5fa3eSPeter Avalos0	name	keyend
31482c5fa3eSPeter Avalos>0	string	\x00\x11\x01\x00\x01	e=65537
31582c5fa3eSPeter Avalos>5	use	crypto
31682c5fa3eSPeter Avalos>5	byte	0xff			checksummed
31782c5fa3eSPeter Avalos>>6	use	chkcrypto
31882c5fa3eSPeter Avalos>5	byte	0xfe			hashed
31982c5fa3eSPeter Avalos>>6	use	chkcrypto
32082c5fa3eSPeter Avalos
32182c5fa3eSPeter Avalos# PGP secret keys contain also the public parts
32282c5fa3eSPeter Avalos# these vary by bitsize of the key
32382c5fa3eSPeter Avalos
32482c5fa3eSPeter Avalos0	name	x1024
32582c5fa3eSPeter Avalos>0	use	keyprolog
32682c5fa3eSPeter Avalos>6	string	\x03\xfe
32782c5fa3eSPeter Avalos>6	string	\x03\xff
32882c5fa3eSPeter Avalos>6	string	\x04\x00
32982c5fa3eSPeter Avalos>136	use	keyend
33082c5fa3eSPeter Avalos
33182c5fa3eSPeter Avalos0	name	x2048
33282c5fa3eSPeter Avalos>0	use	keyprolog
33382c5fa3eSPeter Avalos>6	string	\x80\x00
33482c5fa3eSPeter Avalos>6	string	\x07\xfe
33582c5fa3eSPeter Avalos>6	string	\x07\xff
33682c5fa3eSPeter Avalos>264	use	keyend
33782c5fa3eSPeter Avalos
33882c5fa3eSPeter Avalos0	name	x3072
33982c5fa3eSPeter Avalos>0	use	keyprolog
34082c5fa3eSPeter Avalos>6	string	\x0b\xfe
34182c5fa3eSPeter Avalos>6	string	\x0b\xff
34282c5fa3eSPeter Avalos>6	string	\x0c\x00
34382c5fa3eSPeter Avalos>392	use	keyend
34482c5fa3eSPeter Avalos
34582c5fa3eSPeter Avalos0	name	x4096
34682c5fa3eSPeter Avalos>0	use	keyprolog
34782c5fa3eSPeter Avalos>6	string	\x10\x00
34882c5fa3eSPeter Avalos>6	string	\x0f\xfe
34982c5fa3eSPeter Avalos>6	string	\x0f\xff
35082c5fa3eSPeter Avalos>520	use	keyend
35182c5fa3eSPeter Avalos
35282c5fa3eSPeter Avalos# \x00|\x1f[\xfe\xff]).{1024})'
35382c5fa3eSPeter Avalos0	name	x8192
35482c5fa3eSPeter Avalos>0	use	keyprolog
35582c5fa3eSPeter Avalos>6	string	\x20\x00
35682c5fa3eSPeter Avalos>6	string	\x1f\xfe
35782c5fa3eSPeter Avalos>6	string	\x1f\xff
35882c5fa3eSPeter Avalos>1032	use	keyend
35982c5fa3eSPeter Avalos
36082c5fa3eSPeter Avalos# depending on the size of the pkt
36182c5fa3eSPeter Avalos# we branch into the proper key size
36282c5fa3eSPeter Avalos# signatures defined as x{keysize}
36382c5fa3eSPeter Avalos
364970935fdSSascha Wildner0	name	pgpkey
36582c5fa3eSPeter Avalos>0	string	\x01\xd8	1024b
36682c5fa3eSPeter Avalos>>2	use	x1024
36782c5fa3eSPeter Avalos>0	string	\x01\xeb	1024b
36882c5fa3eSPeter Avalos>>2	use	x1024
36982c5fa3eSPeter Avalos>0	string	\x01\xfb	1024b
37082c5fa3eSPeter Avalos>>2	use	x1024
37182c5fa3eSPeter Avalos>0	string	\x01\xfd	1024b
37282c5fa3eSPeter Avalos>>2	use	x1024
37382c5fa3eSPeter Avalos>0	string	\x01\xf3	1024b
37482c5fa3eSPeter Avalos>>2	use	x1024
37582c5fa3eSPeter Avalos>0	string	\x01\xee	1024b
37682c5fa3eSPeter Avalos>>2	use	x1024
37782c5fa3eSPeter Avalos>0	string	\x01\xfe	1024b
37882c5fa3eSPeter Avalos>>2	use	x1024
37982c5fa3eSPeter Avalos>0	string	\x01\xf4	1024b
38082c5fa3eSPeter Avalos>>2	use	x1024
38182c5fa3eSPeter Avalos>0	string	\x02\x0d	1024b
38282c5fa3eSPeter Avalos>>2	use	x1024
38382c5fa3eSPeter Avalos>0	string	\x02\x03	1024b
38482c5fa3eSPeter Avalos>>2	use	x1024
38582c5fa3eSPeter Avalos>0	string	\x02\x05	1024b
38682c5fa3eSPeter Avalos>>2	use	x1024
38782c5fa3eSPeter Avalos>0	string	\x02\x15	1024b
38882c5fa3eSPeter Avalos>>2	use	x1024
38982c5fa3eSPeter Avalos>0	string	\x02\x00	1024b
39082c5fa3eSPeter Avalos>>2	use	x1024
39182c5fa3eSPeter Avalos>0	string	\x02\x10	1024b
39282c5fa3eSPeter Avalos>>2	use	x1024
39382c5fa3eSPeter Avalos>0	string	\x02\x04	1024b
39482c5fa3eSPeter Avalos>>2	use	x1024
39582c5fa3eSPeter Avalos>0	string	\x02\x06	1024b
39682c5fa3eSPeter Avalos>>2	use	x1024
39782c5fa3eSPeter Avalos>0	string	\x02\x16	1024b
39882c5fa3eSPeter Avalos>>2	use	x1024
39982c5fa3eSPeter Avalos>0	string	\x03\x98	2048b
40082c5fa3eSPeter Avalos>>2	use	x2048
40182c5fa3eSPeter Avalos>0	string	\x03\xab	2048b
40282c5fa3eSPeter Avalos>>2	use	x2048
40382c5fa3eSPeter Avalos>0	string	\x03\xbb	2048b
40482c5fa3eSPeter Avalos>>2	use	x2048
40582c5fa3eSPeter Avalos>0	string	\x03\xbd	2048b
40682c5fa3eSPeter Avalos>>2	use	x2048
40782c5fa3eSPeter Avalos>0	string	\x03\xcd	2048b
40882c5fa3eSPeter Avalos>>2	use	x2048
40982c5fa3eSPeter Avalos>0	string	\x03\xb3	2048b
41082c5fa3eSPeter Avalos>>2	use	x2048
41182c5fa3eSPeter Avalos>0	string	\x03\xc3	2048b
41282c5fa3eSPeter Avalos>>2	use	x2048
41382c5fa3eSPeter Avalos>0	string	\x03\xc5	2048b
41482c5fa3eSPeter Avalos>>2	use	x2048
41582c5fa3eSPeter Avalos>0	string	\x03\xd5	2048b
41682c5fa3eSPeter Avalos>>2	use	x2048
41782c5fa3eSPeter Avalos>0	string	\x03\xae	2048b
41882c5fa3eSPeter Avalos>>2	use	x2048
41982c5fa3eSPeter Avalos>0	string	\x03\xbe	2048b
42082c5fa3eSPeter Avalos>>2	use	x2048
42182c5fa3eSPeter Avalos>0	string	\x03\xc0	2048b
42282c5fa3eSPeter Avalos>>2	use	x2048
42382c5fa3eSPeter Avalos>0	string	\x03\xd0	2048b
42482c5fa3eSPeter Avalos>>2	use	x2048
42582c5fa3eSPeter Avalos>0	string	\x03\xb4	2048b
42682c5fa3eSPeter Avalos>>2	use	x2048
42782c5fa3eSPeter Avalos>0	string	\x03\xc4	2048b
42882c5fa3eSPeter Avalos>>2	use	x2048
42982c5fa3eSPeter Avalos>0	string	\x03\xc6	2048b
43082c5fa3eSPeter Avalos>>2	use	x2048
43182c5fa3eSPeter Avalos>0	string	\x03\xd6	2048b
43282c5fa3eSPeter Avalos>>2	use	x2048
43382c5fa3eSPeter Avalos>0	string	\x05X		3072b
43482c5fa3eSPeter Avalos>>2	use	x3072
43582c5fa3eSPeter Avalos>0	string	\x05k		3072b
43682c5fa3eSPeter Avalos>>2	use	x3072
43782c5fa3eSPeter Avalos>0	string	\x05{		3072b
43882c5fa3eSPeter Avalos>>2	use	x3072
43982c5fa3eSPeter Avalos>0	string	\x05}		3072b
44082c5fa3eSPeter Avalos>>2	use	x3072
44182c5fa3eSPeter Avalos>0	string	\x05\x8d	3072b
44282c5fa3eSPeter Avalos>>2	use	x3072
44382c5fa3eSPeter Avalos>0	string	\x05s		3072b
44482c5fa3eSPeter Avalos>>2	use	x3072
44582c5fa3eSPeter Avalos>0	string	\x05\x83	3072b
44682c5fa3eSPeter Avalos>>2	use	x3072
44782c5fa3eSPeter Avalos>0	string	\x05\x85	3072b
44882c5fa3eSPeter Avalos>>2	use	x3072
44982c5fa3eSPeter Avalos>0	string	\x05\x95	3072b
45082c5fa3eSPeter Avalos>>2	use	x3072
45182c5fa3eSPeter Avalos>0	string	\x05n		3072b
45282c5fa3eSPeter Avalos>>2	use	x3072
45382c5fa3eSPeter Avalos>0	string	\x05\x7e	3072b
45482c5fa3eSPeter Avalos>>2	use	x3072
45582c5fa3eSPeter Avalos>0	string	\x05\x80	3072b
45682c5fa3eSPeter Avalos>>2	use	x3072
45782c5fa3eSPeter Avalos>0	string	\x05\x90	3072b
45882c5fa3eSPeter Avalos>>2	use	x3072
45982c5fa3eSPeter Avalos>0	string	\x05t		3072b
46082c5fa3eSPeter Avalos>>2	use	x3072
46182c5fa3eSPeter Avalos>0	string	\x05\x84	3072b
46282c5fa3eSPeter Avalos>>2	use	x3072
46382c5fa3eSPeter Avalos>0	string	\x05\x86	3072b
46482c5fa3eSPeter Avalos>>2	use	x3072
46582c5fa3eSPeter Avalos>0	string	\x05\x96	3072b
46682c5fa3eSPeter Avalos>>2	use	x3072
46782c5fa3eSPeter Avalos>0	string	\x07[		4096b
46882c5fa3eSPeter Avalos>>2	use	x4096
46982c5fa3eSPeter Avalos>0	string	\x07\x18	4096b
47082c5fa3eSPeter Avalos>>2	use	x4096
47182c5fa3eSPeter Avalos>0	string	\x07+		4096b
47282c5fa3eSPeter Avalos>>2	use	x4096
47382c5fa3eSPeter Avalos>0	string	\x07;		4096b
47482c5fa3eSPeter Avalos>>2	use	x4096
47582c5fa3eSPeter Avalos>0	string	\x07=		4096b
47682c5fa3eSPeter Avalos>>2	use	x4096
47782c5fa3eSPeter Avalos>0	string	\x07M		4096b
47882c5fa3eSPeter Avalos>>2	use	x4096
47982c5fa3eSPeter Avalos>0	string	\x073		4096b
48082c5fa3eSPeter Avalos>>2	use	x4096
48182c5fa3eSPeter Avalos>0	string	\x07C		4096b
48282c5fa3eSPeter Avalos>>2	use	x4096
48382c5fa3eSPeter Avalos>0	string	\x07E		4096b
48482c5fa3eSPeter Avalos>>2	use	x4096
48582c5fa3eSPeter Avalos>0	string	\x07U		4096b
48682c5fa3eSPeter Avalos>>2	use	x4096
48782c5fa3eSPeter Avalos>0	string	\x07.		4096b
48882c5fa3eSPeter Avalos>>2	use	x4096
48982c5fa3eSPeter Avalos>0	string	\x07>		4096b
49082c5fa3eSPeter Avalos>>2	use	x4096
49182c5fa3eSPeter Avalos>0	string	\x07@		4096b
49282c5fa3eSPeter Avalos>>2	use	x4096
49382c5fa3eSPeter Avalos>0	string	\x07P		4096b
49482c5fa3eSPeter Avalos>>2	use	x4096
49582c5fa3eSPeter Avalos>0	string	\x074		4096b
49682c5fa3eSPeter Avalos>>2	use	x4096
49782c5fa3eSPeter Avalos>0	string	\x07D		4096b
49882c5fa3eSPeter Avalos>>2	use	x4096
49982c5fa3eSPeter Avalos>0	string	\x07F		4096b
50082c5fa3eSPeter Avalos>>2	use	x4096
50182c5fa3eSPeter Avalos>0	string	\x07V		4096b
50282c5fa3eSPeter Avalos>>2	use	x4096
50382c5fa3eSPeter Avalos>0	string	\x0e[		8192b
50482c5fa3eSPeter Avalos>>2	use	x8192
50582c5fa3eSPeter Avalos>0	string	\x0e\x18	8192b
50682c5fa3eSPeter Avalos>>2	use	x8192
50782c5fa3eSPeter Avalos>0	string	\x0e+		8192b
50882c5fa3eSPeter Avalos>>2	use	x8192
50982c5fa3eSPeter Avalos>0	string	\x0e;		8192b
51082c5fa3eSPeter Avalos>>2	use	x8192
51182c5fa3eSPeter Avalos>0	string	\x0e=		8192b
51282c5fa3eSPeter Avalos>>2	use	x8192
51382c5fa3eSPeter Avalos>0	string	\x0eM		8192b
51482c5fa3eSPeter Avalos>>2	use	x8192
51582c5fa3eSPeter Avalos>0	string	\x0e3		8192b
51682c5fa3eSPeter Avalos>>2	use	x8192
51782c5fa3eSPeter Avalos>0	string	\x0eC		8192b
51882c5fa3eSPeter Avalos>>2	use	x8192
51982c5fa3eSPeter Avalos>0	string	\x0eE		8192b
52082c5fa3eSPeter Avalos>>2	use	x8192
52182c5fa3eSPeter Avalos>0	string	\x0eU		8192b
52282c5fa3eSPeter Avalos>>2	use	x8192
52382c5fa3eSPeter Avalos>0	string	\x0e.		8192b
52482c5fa3eSPeter Avalos>>2	use	x8192
52582c5fa3eSPeter Avalos>0	string	\x0e>		8192b
52682c5fa3eSPeter Avalos>>2	use	x8192
52782c5fa3eSPeter Avalos>0	string	\x0e@		8192b
52882c5fa3eSPeter Avalos>>2	use	x8192
52982c5fa3eSPeter Avalos>0	string	\x0eP		8192b
53082c5fa3eSPeter Avalos>>2	use	x8192
53182c5fa3eSPeter Avalos>0	string	\x0e4		8192b
53282c5fa3eSPeter Avalos>>2	use	x8192
53382c5fa3eSPeter Avalos>0	string	\x0eD		8192b
53482c5fa3eSPeter Avalos>>2	use	x8192
53582c5fa3eSPeter Avalos>0	string	\x0eF		8192b
53682c5fa3eSPeter Avalos>>2	use	x8192
53782c5fa3eSPeter Avalos>0	string	\x0eV		8192b
53882c5fa3eSPeter Avalos>>2	use	x8192
53982c5fa3eSPeter Avalos
54082c5fa3eSPeter Avalos# PGP RSA (e=65537) secret (sub-)key header
54182c5fa3eSPeter Avalos
54282c5fa3eSPeter Avalos0	byte	0x97			PGP Secret Sub-key -
54382c5fa3eSPeter Avalos>1	use	pgpkey
544c30bd091SSascha Wildner0	byte	0x9d
545c30bd091SSascha Wildner# Update: Joerg Jenderek
546c30bd091SSascha Wildner# secret subkey packet (tag 7) with same structure as secret key packet (tag 5)
547c30bd091SSascha Wildner# skip Fetus.Sys16 CALIBUS.MAIN OrbFix.Sys16.Ex by looking for positive len
548c30bd091SSascha Wildner>1	ubeshort	>0
549*614728caSSascha Wildner#>1	ubeshort	x		\b, body length %#x
550c30bd091SSascha Wildner# next packet type often 88h,89h~(tag 2)~Signature Packet
551*614728caSSascha Wildner#>>(1.S+3)	ubyte	x		\b, next packet type %#x
552c30bd091SSascha Wildner# skip Dragon.SHR DEMO.INIT by looking for positive version
553c30bd091SSascha Wildner>>3	ubyte		>0
554c30bd091SSascha Wildner# skip BUISSON.13 GUITAR1 by looking for low version number
555c30bd091SSascha Wildner>>>3	ubyte		<5		PGP Secret Sub-key
556c30bd091SSascha Wildner# sub-key are normally part of secret key. So it does not occur as standalone file
557c30bd091SSascha Wildner#!:ext	bin
558c30bd091SSascha Wildner# version 2,3~old 4~new . Comment following line for version 5.28 look
559c30bd091SSascha Wildner>>>>3	ubyte		x		(v%d)
560c30bd091SSascha Wildner>>>>3	ubyte		x		-
561c30bd091SSascha Wildner# old versions 2 or 3 but no real example found
562c30bd091SSascha Wildner>>>>3	ubyte		<4
563c30bd091SSascha Wildner# 2 byte for key bits in version 5.28 look
564c30bd091SSascha Wildner>>>>>11		ubeshort	x	%db
565c30bd091SSascha Wildner>>>>>4		beldate		x	created on %s -
566c30bd091SSascha Wildner# old versions use 2 additional bytes after time stamp
567*614728caSSascha Wildner#>>>>>8		ubeshort	x	%#x
568c30bd091SSascha Wildner# display key algorithm 1~RSA Encrypt|Sign - 21~Diffie-Hellman
569c30bd091SSascha Wildner>>>>>10	  	use		key_algo
570c30bd091SSascha Wildner>>>>>(11.S/8)	ubequad		x
571c30bd091SSascha Wildner# look after first key
572c30bd091SSascha Wildner>>>>>>&5	use		keyend
573c30bd091SSascha Wildner# new version
574c30bd091SSascha Wildner>>>>3	ubyte		>3
575c30bd091SSascha Wildner>>>>>9		ubeshort	x	%db
576c30bd091SSascha Wildner>>>>>4		beldate		x	created on %s -
577c30bd091SSascha Wildner# display key algorithm
578c30bd091SSascha Wildner>>>>>8		use		key_algo
579c30bd091SSascha Wildner>>>>>(9.S/8)	ubequad		x
580c30bd091SSascha Wildner# look after first key for something like s2k
581c30bd091SSascha Wildner>>>>>>&3	use		keyend
582