xref: /freebsd/contrib/file/magic/Magdir/pgp (revision ae316d1d1cffd71ab7751f94e10118777a88e027)
1b6cee71dSXin LI
2b6cee71dSXin LI#------------------------------------------------------------------------------
3*ae316d1dSXin LI# $File: pgp,v 1.26 2024/09/01 15:51:51 christos Exp $
4b6cee71dSXin LI# pgp:  file(1) magic for Pretty Good Privacy
543a5ec4eSXin LI
643a5ec4eSXin LI# Handling of binary PGP keys is in pgp-binary-keys.
748c779cdSXin LI# see https://lists.gnupg.org/pipermail/gnupg-devel/1999-September/016052.html
8b6cee71dSXin LI#
9b6cee71dSXin LI0	beshort		0xa600			PGP encrypted data
10b6cee71dSXin LI#!:mime	application/pgp-encrypted
11b6cee71dSXin LI#0	string		-----BEGIN\040PGP	text/PGP armored data
12b6cee71dSXin LI!:mime	text/PGP # encoding: armored data
13b6cee71dSXin LI#>15	string	PUBLIC\040KEY\040BLOCK-	public key block
14b6cee71dSXin LI#>15	string	MESSAGE-		message
15b6cee71dSXin LI#>15	string	SIGNED\040MESSAGE-	signed message
16b6cee71dSXin LI#>15	string	PGP\040SIGNATURE-	signature
17b6cee71dSXin LI
182726a701SXin LI# Update:	Joerg Jenderek
192726a701SXin LI# URL:		http://en.wikipedia.org/wiki/Pretty_Good_Privacy
202726a701SXin LI# Reference:	https://reposcope.com/mimetype/application/pgp-keys
212726a701SXin LI2	string	---BEGIN\040PGP\040PRIVATE\040KEY\040BLOCK-	PGP private key block
222726a701SXin LI#!:mime	text/PGP
232726a701SXin LI!:mime	application/pgp-keys
242726a701SXin LI!:ext	asc
2540427ccaSGordon Tetlow2	string	---BEGIN\040PGP\040PUBLIC\040KEY\040BLOCK-	PGP public key block
26b6cee71dSXin LI!:mime	application/pgp-keys
272726a701SXin LI!:ext	asc
28c2931133SXin LI>10	search/100	\n\n
29c2931133SXin LI>>&0	use		pgp
3040427ccaSGordon Tetlow0	string	-----BEGIN\040PGP\040MESSAGE-		PGP message
312726a701SXin LI# https://reposcope.com/mimetype/application/pgp-encrypted
322726a701SXin LI#!:mime	application/pgp
332726a701SXin LI!:mime	application/pgp-encrypted
342726a701SXin LI!:ext	asc
352726a701SXin LI#!:ext	asc/pgp/gpg
36c2931133SXin LI>10	search/100	\n\n
37c2931133SXin LI>>&0	use		pgp
382726a701SXin LI# Reference:	https://www.gnupg.org/gph/en/manual/x135.html
392726a701SXin LI0	string	-----BEGIN\040PGP\040SIGNED\040MESSAGE-	PGP signed message
402726a701SXin LI#!:mime	text/plain
412726a701SXin LI!:mime	text/PGP
422726a701SXin LI#!:mime	application/pgp
432726a701SXin LI!:ext	asc
4440427ccaSGordon Tetlow0	string	-----BEGIN\040PGP\040SIGNATURE-		PGP signature
452726a701SXin LI# https://reposcope.com/mimetype/application/pgp-signature
46b6cee71dSXin LI!:mime	application/pgp-signature
472726a701SXin LI!:ext	asc
48c2931133SXin LI>10	search/100	\n\n
49c2931133SXin LI>>&0	use		pgp
50c2931133SXin LI
51c2931133SXin LI# Decode the type of the packet based on it's base64 encoding.
52c2931133SXin LI# Idea from Mark Martinec
53c2931133SXin LI# The specification is in RFC 4880, section 4.2 and 4.3:
5448c779cdSXin LI# https://tools.ietf.org/html/rfc4880#section-4.2
55c2931133SXin LI
56c2931133SXin LI0	name		pgp
57c2931133SXin LI>0	byte		0x67		Reserved (old)
58c2931133SXin LI>0	byte		0x68		Public-Key Encrypted Session Key (old)
59c2931133SXin LI>0	byte		0x69		Signature (old)
60c2931133SXin LI>0	byte		0x6a		Symmetric-Key Encrypted Session Key (old)
61c2931133SXin LI>0	byte		0x6b		One-Pass Signature (old)
62c2931133SXin LI>0	byte		0x6c		Secret-Key (old)
63c2931133SXin LI>0	byte		0x6d		Public-Key (old)
64c2931133SXin LI>0	byte		0x6e		Secret-Subkey (old)
65c2931133SXin LI>0	byte		0x6f		Compressed Data (old)
66c2931133SXin LI>0	byte		0x70		Symmetrically Encrypted Data (old)
67c2931133SXin LI>0	byte		0x71		Marker (old)
68c2931133SXin LI>0	byte		0x72		Literal Data (old)
69c2931133SXin LI>0	byte		0x73		Trust (old)
70c2931133SXin LI>0	byte		0x74		User ID (old)
71c2931133SXin LI>0	byte		0x75		Public-Subkey (old)
72c2931133SXin LI>0	byte		0x76		Unused (old)
73c2931133SXin LI>0	byte		0x77
74c2931133SXin LI>>1	byte&0xc0	0x00		Reserved
75c2931133SXin LI>>1	byte&0xc0	0x40		Public-Key Encrypted Session Key
76c2931133SXin LI>>1	byte&0xc0	0x80		Signature
77c2931133SXin LI>>1	byte&0xc0	0xc0		Symmetric-Key Encrypted Session Key
78c2931133SXin LI>0	byte		0x78
79c2931133SXin LI>>1	byte&0xc0	0x00		One-Pass Signature
80c2931133SXin LI>>1	byte&0xc0	0x40		Secret-Key
81c2931133SXin LI>>1	byte&0xc0	0x80		Public-Key
82c2931133SXin LI>>1	byte&0xc0	0xc0		Secret-Subkey
83c2931133SXin LI>0	byte		0x79
84c2931133SXin LI>>1	byte&0xc0	0x00		Compressed Data
85c2931133SXin LI>>1	byte&0xc0	0x40		Symmetrically Encrypted Data
86c2931133SXin LI>>1	byte&0xc0	0x80		Marker
87c2931133SXin LI>>1	byte&0xc0	0xc0		Literal Data
88c2931133SXin LI>0	byte		0x7a
89c2931133SXin LI>>1	byte&0xc0	0x00		Trust
90c2931133SXin LI>>1	byte&0xc0	0x40		User ID
91c2931133SXin LI>>1	byte&0xc0	0x80		Public-Subkey
92c2931133SXin LI>>1	byte&0xc0	0xc0		Unused [z%x]
93c2931133SXin LI>0	byte		0x30
94c2931133SXin LI>>1	byte&0xc0	0x00		Unused [0%x]
95c2931133SXin LI>>1	byte&0xc0	0x40		User Attribute
96c2931133SXin LI>>1	byte&0xc0	0x80		Sym. Encrypted and Integrity Protected Data
97c2931133SXin LI>>1	byte&0xc0	0xc0		Modification Detection Code
98c2931133SXin LI
99c2931133SXin LI# magic signatures to detect PGP crypto material (from stef)
100c2931133SXin LI# detects and extracts metadata from:
101c2931133SXin LI#  - symmetric encrypted packet header
102c2931133SXin LI#  - RSA (e=65537) secret (sub-)keys
103c2931133SXin LI
104c2931133SXin LI# 1024b RSA encrypted data
105c2931133SXin LI
106c2931133SXin LI0	string	\x84\x8c\x03		PGP RSA encrypted session key -
1072726a701SXin LI>3	belong	x			keyid: %08X
1082726a701SXin LI>7	belong	x			%08X
109c2931133SXin LI>11	byte	0x01			RSA (Encrypt or Sign) 1024b
110c2931133SXin LI>11	byte	0x02			RSA Encrypt-Only 1024b
111*ae316d1dSXin LI#>12	string	\x04\x00
112*ae316d1dSXin LI#>12	string	\x03\xff
113*ae316d1dSXin LI#>12	string	\x03\xfe
114*ae316d1dSXin LI#>12	string	\x03\xfd
115*ae316d1dSXin LI#>12	string	\x03\xfc
116*ae316d1dSXin LI#>12	string	\x03\xfb
117*ae316d1dSXin LI#>12	string	\x03\xfa
118*ae316d1dSXin LI#>12	string	\x03\xf9
119*ae316d1dSXin LI#>142	byte	0xd2			.
120c2931133SXin LI
121c2931133SXin LI# 2048b RSA encrypted data
122c2931133SXin LI
123c2931133SXin LI0	string	\x85\x01\x0c\x03	PGP RSA encrypted session key -
1242726a701SXin LI>4	belong	x			keyid: %08X
1252726a701SXin LI>8	belong	x			%08X
126c2931133SXin LI>12	byte	0x01			RSA (Encrypt or Sign) 2048b
127c2931133SXin LI>12	byte	0x02			RSA Encrypt-Only 2048b
128*ae316d1dSXin LI#>13	string	\x08\x00
129*ae316d1dSXin LI#>13	string	\x07\xff
130*ae316d1dSXin LI#>13	string	\x07\xfe
131*ae316d1dSXin LI#>13	string	\x07\xfd
132*ae316d1dSXin LI#>13	string	\x07\xfc
133*ae316d1dSXin LI#>13	string	\x07\xfb
134*ae316d1dSXin LI#>13	string	\x07\xfa
135*ae316d1dSXin LI#>13	string	\x07\xf9
136*ae316d1dSXin LI#>271	byte	0xd2			.
137c2931133SXin LI
138c2931133SXin LI# 3072b RSA encrypted data
139c2931133SXin LI
140c2931133SXin LI0	string	\x85\x01\x8c\x03	PGP RSA encrypted session key -
1412726a701SXin LI>4	belong	x			keyid: %08X
1422726a701SXin LI>8	belong	x			%08X
143c2931133SXin LI>12	byte	0x01			RSA (Encrypt or Sign) 3072b
144c2931133SXin LI>12	byte	0x02			RSA Encrypt-Only 3072b
145*ae316d1dSXin LI#>13	string	\x0c\x00
146*ae316d1dSXin LI#>13	string	\x0b\xff
147*ae316d1dSXin LI#>13	string	\x0b\xfe
148*ae316d1dSXin LI#>13	string	\x0b\xfd
149*ae316d1dSXin LI#>13	string	\x0b\xfc
150*ae316d1dSXin LI#>13	string	\x0b\xfb
151*ae316d1dSXin LI#>13	string	\x0b\xfa
152*ae316d1dSXin LI#>13	string	\x0b\xf9
153*ae316d1dSXin LI#>399	byte	0xd2			.
154c2931133SXin LI
1552726a701SXin LI# 4096b RSA encrypted data
156c2931133SXin LI
157c2931133SXin LI0	string	\x85\x02\x0c\x03	PGP RSA encrypted session key -
1582726a701SXin LI>4	belong	x			keyid: %08X
1592726a701SXin LI>8	belong	x			%08X
160c2931133SXin LI>12	byte	0x01			RSA (Encrypt or Sign) 4096b
161c2931133SXin LI>12	byte	0x02			RSA Encrypt-Only 4096b
162*ae316d1dSXin LI#>13	string	\x10\x00
163*ae316d1dSXin LI#>13	string	\x0f\xff
164*ae316d1dSXin LI#>13	string	\x0f\xfe
165*ae316d1dSXin LI#>13	string	\x0f\xfd
166*ae316d1dSXin LI#>13	string	\x0f\xfc
167*ae316d1dSXin LI#>13	string	\x0f\xfb
168*ae316d1dSXin LI#>13	string	\x0f\xfa
169*ae316d1dSXin LI#>13	string	\x0f\xf9
170*ae316d1dSXin LI#>527	byte	0xd2			.
171c2931133SXin LI
1722726a701SXin LI# 8192b RSA encrypted data
173c2931133SXin LI
174c2931133SXin LI0	string	\x85\x04\x0c\x03	PGP RSA encrypted session key -
1752726a701SXin LI>4	belong	x			keyid: %08X
1762726a701SXin LI>8	belong	x			%08X
1772726a701SXin LI>12	byte	0x01			RSA (Encrypt or Sign) 8192b
1782726a701SXin LI>12	byte	0x02			RSA Encrypt-Only 8192b
179*ae316d1dSXin LI#>13	string	\x20\x00
180*ae316d1dSXin LI#>13	string	\x1f\xff
181*ae316d1dSXin LI#>13	string	\x1f\xfe
182*ae316d1dSXin LI#>13	string	\x1f\xfd
183*ae316d1dSXin LI#>13	string	\x1f\xfc
184*ae316d1dSXin LI#>13	string	\x1f\xfb
185*ae316d1dSXin LI#>13	string	\x1f\xfa
186*ae316d1dSXin LI#>13	string	\x1f\xf9
187*ae316d1dSXin LI#>1039	byte	0xd2			.
188c2931133SXin LI
1892726a701SXin LI# 1024b Elgamal encrypted data
1902726a701SXin LI
1912726a701SXin LI0	string	\x85\x01\x0e\x03	PGP Elgamal encrypted session key -
1922726a701SXin LI>4	belong	x			keyid: %08X
1932726a701SXin LI>8	belong	x			%08X
1942726a701SXin LI>12	byte	0x10			Elgamal Encrypt-Only 1024b.
195*ae316d1dSXin LI#>13	string	\x04\x00
196*ae316d1dSXin LI#>13	string	\x03\xff
197*ae316d1dSXin LI#>13	string	\x03\xfe
198*ae316d1dSXin LI#>13	string	\x03\xfd
199*ae316d1dSXin LI#>13	string	\x03\xfc
200*ae316d1dSXin LI#>13	string	\x03\xfb
201*ae316d1dSXin LI#>13	string	\x03\xfa
202*ae316d1dSXin LI#>13	string	\x03\xf9
2032726a701SXin LI
2042726a701SXin LI# 2048b Elgamal encrypted data
2052726a701SXin LI
2062726a701SXin LI0	string	\x85\x02\x0e\x03	PGP Elgamal encrypted session key -
2072726a701SXin LI>4	belong	x			keyid: %08X
2082726a701SXin LI>8	belong	x			%08X
2092726a701SXin LI>12	byte	0x10			Elgamal Encrypt-Only 2048b.
210*ae316d1dSXin LI#>13	string	\x08\x00
211*ae316d1dSXin LI#>13	string	\x07\xff
212*ae316d1dSXin LI#>13	string	\x07\xfe
213*ae316d1dSXin LI#>13	string	\x07\xfd
214*ae316d1dSXin LI#>13	string	\x07\xfc
215*ae316d1dSXin LI#>13	string	\x07\xfb
216*ae316d1dSXin LI#>13	string	\x07\xfa
217*ae316d1dSXin LI#>13	string	\x07\xf9
2182726a701SXin LI
2192726a701SXin LI# 3072b Elgamal encrypted data
2202726a701SXin LI
2212726a701SXin LI0	string	\x85\x03\x0e\x03	PGP Elgamal encrypted session key -
2222726a701SXin LI>4	belong	x			keyid: %08X
2232726a701SXin LI>8	belong	x			%08X
2242726a701SXin LI>12	byte	0x10			Elgamal Encrypt-Only 3072b.
225*ae316d1dSXin LI#>13	string	\x0c\x00
226*ae316d1dSXin LI#>13	string	\x0b\xff
227*ae316d1dSXin LI#>13	string	\x0b\xfe
228*ae316d1dSXin LI#>13	string	\x0b\xfd
229*ae316d1dSXin LI#>13	string	\x0b\xfc
230*ae316d1dSXin LI#>13	string	\x0b\xfb
231*ae316d1dSXin LI#>13	string	\x0b\xfa
232*ae316d1dSXin LI#>13	string	\x0b\xf9
2332726a701SXin LI
234c2931133SXin LI# crypto algo mapper
235c2931133SXin LI
236c2931133SXin LI0	name	crypto
237c2931133SXin LI>0	byte	0x00			Plaintext or unencrypted data
238c2931133SXin LI>0	byte	0x01			IDEA
239c2931133SXin LI>0	byte	0x02			TripleDES
240c2931133SXin LI>0	byte	0x03			CAST5 (128 bit key)
241c2931133SXin LI>0	byte	0x04			Blowfish (128 bit key, 16 rounds)
242c2931133SXin LI>0	byte	0x07			AES with 128-bit key
243c2931133SXin LI>0	byte	0x08			AES with 192-bit key
244c2931133SXin LI>0	byte	0x09			AES with 256-bit key
245c2931133SXin LI>0	byte	0x0a			Twofish with 256-bit key
246c2931133SXin LI
247c2931133SXin LI# hash algo mapper
248c2931133SXin LI
249c2931133SXin LI0	name	hash
250c2931133SXin LI>0	byte	0x01			MD5
251c2931133SXin LI>0	byte	0x02			SHA-1
252c2931133SXin LI>0	byte	0x03			RIPE-MD/160
253c2931133SXin LI>0	byte	0x08			SHA256
254c2931133SXin LI>0	byte	0x09			SHA384
255c2931133SXin LI>0	byte	0x0a			SHA512
256c2931133SXin LI>0	byte	0x0b			SHA224
257c2931133SXin LI
258a5d223e6SXin LI# display public key algorithms as human readable text
259a5d223e6SXin LI0	name	key_algo
260a5d223e6SXin LI>0	byte	0x01			RSA (Encrypt or Sign)
261a5d223e6SXin LI# keep old look of version 5.28 without parentheses
262a5d223e6SXin LI>0	byte	0x02			RSA Encrypt-Only
263a5d223e6SXin LI>0	byte	0x03			RSA (Sign-Only)
264a5d223e6SXin LI>0	byte	16			ElGamal (Encrypt-Only)
265a5d223e6SXin LI>0	byte	17			DSA
266a5d223e6SXin LI>0	byte	18			Elliptic Curve
267a5d223e6SXin LI>0	byte	19			ECDSA
268a5d223e6SXin LI>0	byte	20			ElGamal (Encrypt or Sign)
269a5d223e6SXin LI>0	byte	21			Diffie-Hellman
270a5d223e6SXin LI>0	default	x
271a5d223e6SXin LI>>0	ubyte	<22			unknown (pub %d)
272a5d223e6SXin LI# this should never happen
273a5d223e6SXin LI>>0	ubyte	>21			invalid (%d)
274a5d223e6SXin LI
275c2931133SXin LI# pgp symmetric encrypted data
276c2931133SXin LI
277c2931133SXin LI0	byte	0x8c			PGP symmetric key encrypted data -
278c2931133SXin LI>1	byte	0x0d
279c2931133SXin LI>1	byte	0x0c
280c2931133SXin LI>2	byte	0x04
281c2931133SXin LI>3	use	crypto
282c2931133SXin LI>4	byte	0x01			salted -
283c2931133SXin LI>>5	use	hash
284c2931133SXin LI>>14	byte	0xd2			.
285c2931133SXin LI>>14	byte	0xc9			.
286c2931133SXin LI>4	byte	0x03			salted & iterated -
287c2931133SXin LI>>5	use	hash
288c2931133SXin LI>>15	byte	0xd2			.
289c2931133SXin LI>>15	byte	0xc9			.
290c2931133SXin LI
291c2931133SXin LI# encrypted keymaterial needs s2k & can be checksummed/hashed
292c2931133SXin LI
293c2931133SXin LI0	name	chkcrypto
294c2931133SXin LI>0	use	crypto
295c2931133SXin LI>1	byte	0x00			Simple S2K
296c2931133SXin LI>1	byte	0x01			Salted S2K
297c2931133SXin LI>1	byte	0x03			Salted&Iterated S2K
298c2931133SXin LI>2	use	hash
299c2931133SXin LI
300c2931133SXin LI# all PGP keys start with this prolog
301c2931133SXin LI# containing version, creation date, and purpose
302c2931133SXin LI
303c2931133SXin LI0	name	keyprolog
304c2931133SXin LI>0	byte	0x04
305c2931133SXin LI>1	beldate	x			created on %s -
306c2931133SXin LI>5	byte	0x01			RSA (Encrypt or Sign)
307c2931133SXin LI>5	byte	0x02			RSA Encrypt-Only
308c2931133SXin LI
309c2931133SXin LI# end of secret keys known signature
310c2931133SXin LI# contains e=65537 and the prolog to
311c2931133SXin LI# the encrypted parameters
312c2931133SXin LI
313c2931133SXin LI0	name	keyend
314c2931133SXin LI>0	string	\x00\x11\x01\x00\x01	e=65537
315c2931133SXin LI>5	use	crypto
316c2931133SXin LI>5	byte	0xff			checksummed
317c2931133SXin LI>>6	use	chkcrypto
318c2931133SXin LI>5	byte	0xfe			hashed
319c2931133SXin LI>>6	use	chkcrypto
320c2931133SXin LI
321c2931133SXin LI# PGP secret keys contain also the public parts
322c2931133SXin LI# these vary by bitsize of the key
323c2931133SXin LI
324c2931133SXin LI0	name	x1024
325c2931133SXin LI>0	use	keyprolog
326c2931133SXin LI>6	string	\x03\xfe
327c2931133SXin LI>6	string	\x03\xff
328c2931133SXin LI>6	string	\x04\x00
329c2931133SXin LI>136	use	keyend
330c2931133SXin LI
331c2931133SXin LI0	name	x2048
332c2931133SXin LI>0	use	keyprolog
333c2931133SXin LI>6	string	\x80\x00
334c2931133SXin LI>6	string	\x07\xfe
335c2931133SXin LI>6	string	\x07\xff
336c2931133SXin LI>264	use	keyend
337c2931133SXin LI
338c2931133SXin LI0	name	x3072
339c2931133SXin LI>0	use	keyprolog
340c2931133SXin LI>6	string	\x0b\xfe
341c2931133SXin LI>6	string	\x0b\xff
342c2931133SXin LI>6	string	\x0c\x00
343c2931133SXin LI>392	use	keyend
344c2931133SXin LI
345c2931133SXin LI0	name	x4096
346c2931133SXin LI>0	use	keyprolog
347c2931133SXin LI>6	string	\x10\x00
348c2931133SXin LI>6	string	\x0f\xfe
349c2931133SXin LI>6	string	\x0f\xff
350c2931133SXin LI>520	use	keyend
351c2931133SXin LI
352c2931133SXin LI# \x00|\x1f[\xfe\xff]).{1024})'
353c2931133SXin LI0	name	x8192
354c2931133SXin LI>0	use	keyprolog
355c2931133SXin LI>6	string	\x20\x00
356c2931133SXin LI>6	string	\x1f\xfe
357c2931133SXin LI>6	string	\x1f\xff
358c2931133SXin LI>1032	use	keyend
359c2931133SXin LI
360c2931133SXin LI# depending on the size of the pkt
361c2931133SXin LI# we branch into the proper key size
362c2931133SXin LI# signatures defined as x{keysize}
363c2931133SXin LI
36443a5ec4eSXin LI0	name	pgpkey
365c2931133SXin LI>0	string	\x01\xd8	1024b
366c2931133SXin LI>>2	use	x1024
367c2931133SXin LI>0	string	\x01\xeb	1024b
368c2931133SXin LI>>2	use	x1024
369c2931133SXin LI>0	string	\x01\xfb	1024b
370c2931133SXin LI>>2	use	x1024
371c2931133SXin LI>0	string	\x01\xfd	1024b
372c2931133SXin LI>>2	use	x1024
373c2931133SXin LI>0	string	\x01\xf3	1024b
374c2931133SXin LI>>2	use	x1024
375c2931133SXin LI>0	string	\x01\xee	1024b
376c2931133SXin LI>>2	use	x1024
377c2931133SXin LI>0	string	\x01\xfe	1024b
378c2931133SXin LI>>2	use	x1024
379c2931133SXin LI>0	string	\x01\xf4	1024b
380c2931133SXin LI>>2	use	x1024
381c2931133SXin LI>0	string	\x02\x0d	1024b
382c2931133SXin LI>>2	use	x1024
383c2931133SXin LI>0	string	\x02\x03	1024b
384c2931133SXin LI>>2	use	x1024
385c2931133SXin LI>0	string	\x02\x05	1024b
386c2931133SXin LI>>2	use	x1024
387c2931133SXin LI>0	string	\x02\x15	1024b
388c2931133SXin LI>>2	use	x1024
389c2931133SXin LI>0	string	\x02\x00	1024b
390c2931133SXin LI>>2	use	x1024
391c2931133SXin LI>0	string	\x02\x10	1024b
392c2931133SXin LI>>2	use	x1024
393c2931133SXin LI>0	string	\x02\x04	1024b
394c2931133SXin LI>>2	use	x1024
395c2931133SXin LI>0	string	\x02\x06	1024b
396c2931133SXin LI>>2	use	x1024
397c2931133SXin LI>0	string	\x02\x16	1024b
398c2931133SXin LI>>2	use	x1024
399c2931133SXin LI>0	string	\x03\x98	2048b
400c2931133SXin LI>>2	use	x2048
401c2931133SXin LI>0	string	\x03\xab	2048b
402c2931133SXin LI>>2	use	x2048
403c2931133SXin LI>0	string	\x03\xbb	2048b
404c2931133SXin LI>>2	use	x2048
405c2931133SXin LI>0	string	\x03\xbd	2048b
406c2931133SXin LI>>2	use	x2048
407c2931133SXin LI>0	string	\x03\xcd	2048b
408c2931133SXin LI>>2	use	x2048
409c2931133SXin LI>0	string	\x03\xb3	2048b
410c2931133SXin LI>>2	use	x2048
411c2931133SXin LI>0	string	\x03\xc3	2048b
412c2931133SXin LI>>2	use	x2048
413c2931133SXin LI>0	string	\x03\xc5	2048b
414c2931133SXin LI>>2	use	x2048
415c2931133SXin LI>0	string	\x03\xd5	2048b
416c2931133SXin LI>>2	use	x2048
417c2931133SXin LI>0	string	\x03\xae	2048b
418c2931133SXin LI>>2	use	x2048
419c2931133SXin LI>0	string	\x03\xbe	2048b
420c2931133SXin LI>>2	use	x2048
421c2931133SXin LI>0	string	\x03\xc0	2048b
422c2931133SXin LI>>2	use	x2048
423c2931133SXin LI>0	string	\x03\xd0	2048b
424c2931133SXin LI>>2	use	x2048
425c2931133SXin LI>0	string	\x03\xb4	2048b
426c2931133SXin LI>>2	use	x2048
427c2931133SXin LI>0	string	\x03\xc4	2048b
428c2931133SXin LI>>2	use	x2048
429c2931133SXin LI>0	string	\x03\xc6	2048b
430c2931133SXin LI>>2	use	x2048
431c2931133SXin LI>0	string	\x03\xd6	2048b
432c2931133SXin LI>>2	use	x2048
433c2931133SXin LI>0	string	\x05X		3072b
434c2931133SXin LI>>2	use	x3072
435c2931133SXin LI>0	string	\x05k		3072b
436c2931133SXin LI>>2	use	x3072
437c2931133SXin LI>0	string	\x05{		3072b
438c2931133SXin LI>>2	use	x3072
439c2931133SXin LI>0	string	\x05}		3072b
440c2931133SXin LI>>2	use	x3072
441c2931133SXin LI>0	string	\x05\x8d	3072b
442c2931133SXin LI>>2	use	x3072
443c2931133SXin LI>0	string	\x05s		3072b
444c2931133SXin LI>>2	use	x3072
445c2931133SXin LI>0	string	\x05\x83	3072b
446c2931133SXin LI>>2	use	x3072
447c2931133SXin LI>0	string	\x05\x85	3072b
448c2931133SXin LI>>2	use	x3072
449c2931133SXin LI>0	string	\x05\x95	3072b
450c2931133SXin LI>>2	use	x3072
451c2931133SXin LI>0	string	\x05n		3072b
452c2931133SXin LI>>2	use	x3072
453c2931133SXin LI>0	string	\x05\x7e	3072b
454c2931133SXin LI>>2	use	x3072
455c2931133SXin LI>0	string	\x05\x80	3072b
456c2931133SXin LI>>2	use	x3072
457c2931133SXin LI>0	string	\x05\x90	3072b
458c2931133SXin LI>>2	use	x3072
459c2931133SXin LI>0	string	\x05t		3072b
460c2931133SXin LI>>2	use	x3072
461c2931133SXin LI>0	string	\x05\x84	3072b
462c2931133SXin LI>>2	use	x3072
463c2931133SXin LI>0	string	\x05\x86	3072b
464c2931133SXin LI>>2	use	x3072
465c2931133SXin LI>0	string	\x05\x96	3072b
466c2931133SXin LI>>2	use	x3072
467c2931133SXin LI>0	string	\x07[		4096b
468c2931133SXin LI>>2	use	x4096
469c2931133SXin LI>0	string	\x07\x18	4096b
470c2931133SXin LI>>2	use	x4096
471c2931133SXin LI>0	string	\x07+		4096b
472c2931133SXin LI>>2	use	x4096
473c2931133SXin LI>0	string	\x07;		4096b
474c2931133SXin LI>>2	use	x4096
475c2931133SXin LI>0	string	\x07=		4096b
476c2931133SXin LI>>2	use	x4096
477c2931133SXin LI>0	string	\x07M		4096b
478c2931133SXin LI>>2	use	x4096
479c2931133SXin LI>0	string	\x073		4096b
480c2931133SXin LI>>2	use	x4096
481c2931133SXin LI>0	string	\x07C		4096b
482c2931133SXin LI>>2	use	x4096
483c2931133SXin LI>0	string	\x07E		4096b
484c2931133SXin LI>>2	use	x4096
485c2931133SXin LI>0	string	\x07U		4096b
486c2931133SXin LI>>2	use	x4096
487c2931133SXin LI>0	string	\x07.		4096b
488c2931133SXin LI>>2	use	x4096
489c2931133SXin LI>0	string	\x07>		4096b
490c2931133SXin LI>>2	use	x4096
491c2931133SXin LI>0	string	\x07@		4096b
492c2931133SXin LI>>2	use	x4096
493c2931133SXin LI>0	string	\x07P		4096b
494c2931133SXin LI>>2	use	x4096
495c2931133SXin LI>0	string	\x074		4096b
496c2931133SXin LI>>2	use	x4096
497c2931133SXin LI>0	string	\x07D		4096b
498c2931133SXin LI>>2	use	x4096
499c2931133SXin LI>0	string	\x07F		4096b
500c2931133SXin LI>>2	use	x4096
501c2931133SXin LI>0	string	\x07V		4096b
502c2931133SXin LI>>2	use	x4096
503c2931133SXin LI>0	string	\x0e[		8192b
504c2931133SXin LI>>2	use	x8192
505c2931133SXin LI>0	string	\x0e\x18	8192b
506c2931133SXin LI>>2	use	x8192
507c2931133SXin LI>0	string	\x0e+		8192b
508c2931133SXin LI>>2	use	x8192
509c2931133SXin LI>0	string	\x0e;		8192b
510c2931133SXin LI>>2	use	x8192
511c2931133SXin LI>0	string	\x0e=		8192b
512c2931133SXin LI>>2	use	x8192
513c2931133SXin LI>0	string	\x0eM		8192b
514c2931133SXin LI>>2	use	x8192
515c2931133SXin LI>0	string	\x0e3		8192b
516c2931133SXin LI>>2	use	x8192
517c2931133SXin LI>0	string	\x0eC		8192b
518c2931133SXin LI>>2	use	x8192
519c2931133SXin LI>0	string	\x0eE		8192b
520c2931133SXin LI>>2	use	x8192
521c2931133SXin LI>0	string	\x0eU		8192b
522c2931133SXin LI>>2	use	x8192
523c2931133SXin LI>0	string	\x0e.		8192b
524c2931133SXin LI>>2	use	x8192
525c2931133SXin LI>0	string	\x0e>		8192b
526c2931133SXin LI>>2	use	x8192
527c2931133SXin LI>0	string	\x0e@		8192b
528c2931133SXin LI>>2	use	x8192
529c2931133SXin LI>0	string	\x0eP		8192b
530c2931133SXin LI>>2	use	x8192
531c2931133SXin LI>0	string	\x0e4		8192b
532c2931133SXin LI>>2	use	x8192
533c2931133SXin LI>0	string	\x0eD		8192b
534c2931133SXin LI>>2	use	x8192
535c2931133SXin LI>0	string	\x0eF		8192b
536c2931133SXin LI>>2	use	x8192
537c2931133SXin LI>0	string	\x0eV		8192b
538c2931133SXin LI>>2	use	x8192
539c2931133SXin LI
540c2931133SXin LI# PGP RSA (e=65537) secret (sub-)key header
541c2931133SXin LI
542c2931133SXin LI0	byte	0x97			PGP Secret Sub-key -
543c2931133SXin LI>1	use	pgpkey
544a5d223e6SXin LI0	byte	0x9d
545a5d223e6SXin LI# Update: Joerg Jenderek
546a5d223e6SXin LI# secret subkey packet (tag 7) with same structure as secret key packet (tag 5)
547a5d223e6SXin LI# skip Fetus.Sys16 CALIBUS.MAIN OrbFix.Sys16.Ex by looking for positive len
548a5d223e6SXin LI>1	ubeshort	>0
54943a5ec4eSXin LI#>1	ubeshort	x		\b, body length %#x
550a5d223e6SXin LI# next packet type often 88h,89h~(tag 2)~Signature Packet
55143a5ec4eSXin LI#>>(1.S+3)	ubyte	x		\b, next packet type %#x
552a5d223e6SXin LI# skip Dragon.SHR DEMO.INIT by looking for positive version
553a5d223e6SXin LI>>3	ubyte		>0
554a5d223e6SXin LI# skip BUISSON.13 GUITAR1 by looking for low version number
555a5d223e6SXin LI>>>3	ubyte		<5		PGP Secret Sub-key
556a5d223e6SXin LI# sub-key are normally part of secret key. So it does not occur as standalone file
557a5d223e6SXin LI#!:ext	bin
558a5d223e6SXin LI# version 2,3~old 4~new . Comment following line for version 5.28 look
559a5d223e6SXin LI>>>>3	ubyte		x		(v%d)
560a5d223e6SXin LI>>>>3	ubyte		x		-
561a5d223e6SXin LI# old versions 2 or 3 but no real example found
562a5d223e6SXin LI>>>>3	ubyte		<4
563a5d223e6SXin LI# 2 byte for key bits in version 5.28 look
564a5d223e6SXin LI>>>>>11		ubeshort	x	%db
565a5d223e6SXin LI>>>>>4		beldate		x	created on %s -
566a5d223e6SXin LI# old versions use 2 additional bytes after time stamp
56743a5ec4eSXin LI#>>>>>8		ubeshort	x	%#x
568a5d223e6SXin LI# display key algorithm 1~RSA Encrypt|Sign - 21~Diffie-Hellman
569a5d223e6SXin LI>>>>>10	  	use		key_algo
570a5d223e6SXin LI>>>>>(11.S/8)	ubequad		x
571a5d223e6SXin LI# look after first key
572a5d223e6SXin LI>>>>>>&5	use		keyend
573a5d223e6SXin LI# new version
574a5d223e6SXin LI>>>>3	ubyte		>3
575a5d223e6SXin LI>>>>>9		ubeshort	x	%db
576a5d223e6SXin LI>>>>>4		beldate		x	created on %s -
577a5d223e6SXin LI# display key algorithm
578a5d223e6SXin LI>>>>>8		use		key_algo
579a5d223e6SXin LI>>>>>(9.S/8)	ubequad		x
580a5d223e6SXin LI# look after first key for something like s2k
581a5d223e6SXin LI>>>>>>&3	use		keyend
582