Lines Matching +full:four +full:- +full:byte
2 #------------------------------------------------------------------------------
3 # $File: pgp-binary-keys,v 1.2 2021/04/26 15:56:00 christos Exp $
4 # pgp-binary-keys: This file handles pgp binary keys.
9 # https://tools.ietf.org/html/rfc4880#section-4.3
13 # https://tools.ietf.org/html/rfc4880#section-11
18 # A PGP packet is described by a single byte: the so-called CTB. The
19 # high-bit is always set. If bit 6 is set, then it is a so-called
20 # new-style CTB; if bit 6 is clear, then it is a so-called old-style
21 # CTB. Old-style CTBs have only four bits of type information; bits
22 # 1-0 are used to describe the length. New-style CTBs have 6 bits of
33 # -------------
35 # https://tools.ietf.org/html/rfc4880#section-4.2.2
38 # ||\----/
44 # 0 0xC0 -- Reserved - a packet tag MUST NOT have this value
45 # 1 0xC1 -- Public-Key Encrypted Session Key Packet
46 # 2 0xC2 -- Signature Packet
47 # 3 0xC3 -- Symmetric-Key Encrypted Session Key Packet
48 # 4 0xC4 -- One-Pass Signature Packet
49 # 5 0xC5 -- Secret-Key Packet
50 # 6 0xC6 -- Public-Key Packet
51 # 7 0xC7 -- Secret-Subkey Packet
52 # 8 0xC8 -- Compressed Data Packet
53 # 9 0xC9 -- Symmetrically Encrypted Data Packet
54 # 10 0xCA -- Marker Packet
55 # 11 0xCB -- Literal Data Packet
56 # 12 0xCC -- Trust Packet
57 # 13 0xCD -- User ID Packet
58 # 14 0xCE -- Public-Subkey Packet
59 # 17 0xD1 -- User Attribute Packet
60 # 18 0xD2 -- Sym. Encrypted and Integrity Protected Data Packet
61 # 19 0xD3 -- Modification Detection Code Packet
62 # 60 to 63 -- Private or Experimental Values
67 # 0..191: one byte length (length[0])
68 # 192..223: two byte length ((length[0] - 192) * 256 + length[2] + 192
69 # 224..254: four byte length (big endian interpretation of length[1..5])
77 # -------------
79 # https://tools.ietf.org/html/rfc4880#section-4.2.1
84 # ||\--/\/
93 # 0 0x80 -- Reserved - a packet tag MUST NOT have this value
94 # 1 0x84 -- Public-Key Encrypted Session Key Packet
95 # 2 0x88 -- Signature Packet
96 # 3 0x8C -- Symmetric-Key Encrypted Session Key Packet
97 # 4 0x90 -- One-Pass Signature Packet
98 # 5 0x94 -- Secret-Key Packet
99 # 6 0x98 -- Public-Key Packet
100 # 7 0x9C -- Secret-Subkey Packet
101 # 8 0xA0 -- Compressed Data Packet
102 # 9 0xA4 -- Symmetrically Encrypted Data Packet
103 # 10 0xA8 -- Marker Packet
104 # 11 0xAC -- Literal Data Packet
105 # 12 0xB0 -- Trust Packet
106 # 13 0xB4 -- User ID Packet
107 # 14 0xB8 -- Public-Subkey Packet
112 # 0 1 byte length (following byte is the length)
113 # 1 2 byte length (following two bytes are the length)
114 # 2 4 byte length (following four bytes are the length)
121 # ------------
154 # https://lists.gnupg.org/pipermail/gnupg-announce/2014q4/000358.html
155 # https://www.ietf.org/id/draft-ietf-openpgp-rfc4880bis-09.html#name-key-material-packet
162 # New-Style Public Key
165 # New-Style Secret Key
168 # Old-Style Public Key
170 >&-1 use primary_key_length_old
171 # Old-Style Secret Key
173 >&-1 use primary_key_length_old
178 # There are 4 different new-style length encodings, but the partial
184 #>>&0 ubyte x (1 byte length encoding, %d bytes)
186 >>>&(&-1.B) use sig_or_component_1
188 >>&-1 ubyte <225
189 # offset = ((offset[0] - 192) << 8) + offset[1] + 192 (for the length header)
190 # raw - (192 * 256 - 192)
192 #>>>&0 ubeshort x (2 byte length encoding, %d bytes)
194 >>>>&(&-2.S-48960) use sig_or_component_1
196 #>>&0 belong x (5 byte length encoding, %d bytes)
198 >>>&(&-4.L) use sig_or_component_1
203 # There are 4 different old-style length encodings, but the
210 #>>&0 ubyte x (1 byte length encoding, %d bytes)
212 >>>&(&-1.B) use sig_or_component_1
214 #>>&0 ubeshort x (2 byte length encoding, %d bytes)
216 >>>&(&-2.S) use sig_or_component_1
218 #>>&0 ubelong x (4 byte length encoding, %d bytes)
220 >>>&(&-4.L) use sig_or_component_1
224 # https://tools.ietf.org/html/rfc4880#section-5.5.2
230 >>&-1 ubyte <8
231 >>>&-1 byte x Version %d
233 # (1990 - 1970) * 365.2524 * 24 * 60 * 60 = 631156147
235 >>>>&-5 ubyte >3
237 >>>>&-5 ubyte <4
282 >>&-1 use sig_or_component_1_length_old
285 >>&-1 use sig_or_component_1_length_old
288 >>&-1 use sig_or_component_1_length_old
291 >>&-1 use sig_or_component_1_length_old
296 #>>&0 ubyte x (1 byte new length encoding, %d bytes)
297 >>&(&-1.B) use cert_packet_3
299 >>&-1 ubyte <225
300 # offset = ((offset[0] - 192) << 8) + offset[1] + 192 + 1 (for the length header)
301 # raw - (192 * 256 - 192 - 1)
303 #>>>&-1 ubeshort x (2 byte new length encoding, %d bytes)
304 >>>&(&-1.S-48959) use cert_packet_3
306 #>>&0 belong x (5 byte new length encoding, %d bytes)
307 >>&(&-4.L) use cert_packet_3
315 #>>&0 ubyte x (1 byte old length encoding, %d bytes)
318 #>>&0 ubeshort x (2 byte old length encoding, %d bytes)
321 #>>&0 ubelong x (4 byte old length encoding, %d bytes)
344 >>&-1 use cert_packet_3_length_old
347 >>&-1 use cert_packet_3_length_old
350 >>&-1 use cert_packet_3_length_old
353 >>&-1 use cert_packet_3_length_old
358 #>>&0 ubyte x (1 byte new length encoding, %d bytes)
359 >>&(&-1.B) use pgp_binary_keys_end
361 >>&-1 ubyte <225
362 # offset = ((offset[0] - 192) << 8) + offset[1] + 192 + 1 (for the length header)
363 # raw - (192 * 256 - 192 - 1)
365 #>>>&-1 ubeshort x (2 byte new length encoding, %d bytes)
366 >>>&(&-1.S-48959) use pgp_binary_keys_end
368 #>>&0 belong x (5 byte new length encoding, %d bytes)
369 >>&(&-4.L) use pgp_binary_keys_end
374 #>>&0 ubyte x (1 byte old length encoding, %d bytes)
377 #>>&0 ubeshort x (2 byte old length encoding, %d bytes)
380 #>>&0 ubelong x (4 byte old length encoding, %d bytes)
386 >0 byte x \b; OpenPGP Certificate
387 !:mime application/pgp-keys