pgp 15 KB

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