1 1.1 agc 2 1.1 agc 3 1.1 agc 4 1.1 agc 5 1.1 agc 6 1.1 agc 7 1.1 agc Network Working Group D. Atkins 8 1.1 agc Request for Comments: 1991 MIT 9 1.1 agc Category: Informational W. Stallings 10 1.1 agc Comp-Comm Consulting 11 1.1 agc P. Zimmermann 12 1.1 agc Boulder Software Engineering 13 1.1 agc August 1996 14 1.1 agc 15 1.1 agc 16 1.1 agc PGP Message Exchange Formats 17 1.1 agc 18 1.1 agc Status of This Memo 19 1.1 agc 20 1.1 agc This memo provides information for the Internet community. This memo 21 1.1 agc does not specify an Internet standard of any kind. Distribution of 22 1.1 agc this memo is unlimited. 23 1.1 agc 24 1.1 agc Table of Contents 25 1.1 agc 26 1.1 agc 1. Introduction............................................2 27 1.1 agc 2. PGP Services............................................2 28 1.1 agc 2.1 Digital signature.......................................3 29 1.1 agc 2.2 Confidentiality.........................................3 30 1.1 agc 2.3 Compression.............................................4 31 1.1 agc 2.4 Radix-64 conversion.....................................4 32 1.1 agc 2.4.1 ASCII Armor Formats.....................................5 33 1.1 agc 3. Data Element Formats....................................6 34 1.1 agc 3.1 Byte strings............................................6 35 1.1 agc 3.2 Whole number fields.....................................7 36 1.1 agc 3.3 Multiprecision fields...................................7 37 1.1 agc 3.4 String fields...........................................8 38 1.1 agc 3.5 Time fields.............................................8 39 1.1 agc 4. Common Fields...........................................8 40 1.1 agc 4.1 Packet structure fields.................................8 41 1.1 agc 4.2 Number ID fields.......................................10 42 1.1 agc 4.3 Version fields.........................................10 43 1.1 agc 5. Packets................................................10 44 1.1 agc 5.1 Overview...............................................10 45 1.1 agc 5.2 General Packet Structure...............................11 46 1.1 agc 5.2.1 Message component......................................11 47 1.1 agc 5.2.2 Signature component....................................11 48 1.1 agc 5.2.3 Session key component..................................11 49 1.1 agc 6. PGP Packet Types.......................................12 50 1.1 agc 6.1 Literal data packets...................................12 51 1.1 agc 6.2 Signature packets......................................13 52 1.1 agc 6.2.1 Message-digest-related fields..........................14 53 1.1 agc 6.2.2 Public-key-related fields..............................15 54 1.1 agc 6.2.3 RSA signatures.........................................16 55 1.1 agc 56 1.1 agc 57 1.1 agc 58 1.1 agc Atkins, et. al. Informational [Page 1] 59 1.1 agc 61 1.1 agc RFC 1991 PGP Message Exchange Formats August 1996 62 1.1 agc 63 1.1 agc 64 1.1 agc 6.2.4 Miscellaneous fields...................................16 65 1.1 agc 6.3 Compressed data packets................................17 66 1.1 agc 6.4 Conventional-key-encrypted data packets................17 67 1.1 agc 6.4.1 Conventional-encryption type byte......................18 68 1.1 agc 6.5 Public-key-encrypted packets...........................18 69 1.1 agc 6.5.1 RSA-encrypted data encryption key (DEK)................19 70 1.1 agc 6.6 Public-key Packets.....................................19 71 1.1 agc 6.7 User ID packets........................................20 72 1.1 agc 7. Transferable Public Keys...............................20 73 1.1 agc 8. Acknowledgments........................................20 74 1.1 agc 9. Security Considerations................................21 75 1.1 agc 10. Authors' Addresses.....................................21 76 1.1 agc 77 1.1 agc 1. Introduction 78 1.1 agc 79 1.1 agc PGP (Pretty Good Privacy) uses a combination of public-key and 80 1.1 agc conventional encryption to provide security services for electronic 81 1.1 agc mail messages and data files. These services include confidentiality 82 1.1 agc and digital signature. PGP is widely used throughout the global 83 1.1 agc computer community. This document describes the format of "PGP 84 1.1 agc files", i.e., messages that have been encrypted and/or signed with 85 1.1 agc PGP. 86 1.1 agc 87 1.1 agc PGP was created by Philip Zimmermann and first released, in Version 88 1.1 agc 1.0, in 1991. Subsequent versions have been designed and implemented 89 1.1 agc by an all-volunteer collaborative effort under the design guidance of 90 1.1 agc Philip Zimmermann. PGP and Pretty Good Privacy are trademarks of 91 1.1 agc Philip Zimmermann. 92 1.1 agc 93 1.1 agc This document describes versions 2.x of PGP. Specifically, versions 94 1.1 agc 2.6 and 2.7 conform to this specification. Version 2.3 conforms to 95 1.1 agc this specification with minor differences. 96 1.1 agc 97 1.1 agc A new release of PGP, known as PGP 3.0, is anticipated in 1995. To 98 1.1 agc the maximum extent possible, this version will be upwardly compatible 99 1.1 agc with version 2.x. At a minimum, PGP 3.0 will be able to read messages 100 1.1 agc and signatures produced by version 2.x. 101 1.1 agc 102 1.1 agc 2. PGP Services 103 1.1 agc 104 1.1 agc PGP provides four services related to the format of messages and data 105 1.1 agc files: digital signature, confidentiality, compression, and radix-64 106 1.1 agc conversion. 107 1.1 agc 108 1.1 agc 109 1.1 agc 110 1.1 agc 111 1.1 agc 112 1.1 agc 113 1.1 agc 114 1.1 agc 115 1.1 agc Atkins, et. al. Informational [Page 2] 116 1.1 agc 118 1.1 agc RFC 1991 PGP Message Exchange Formats August 1996 119 1.1 agc 120 1.1 agc 121 1.1 agc 2.1 Digital signature 122 1.1 agc 123 1.1 agc The digital signature service involves the use of a hash code, or 124 1.1 agc message digest, algorithm, and a public-key encryption algorithm. The 125 1.1 agc sequence is as follows: 126 1.1 agc 127 1.1 agc -the sender creates a message 128 1.1 agc -the sending PGP generates a hash code of the message 129 1.1 agc -the sending PGP encrypts the hash code using the sender's private 130 1.1 agc key 131 1.1 agc -the encrypted hash code is prepended to the message 132 1.1 agc -the receiving PGP decrypts the hash code using the sender's public 133 1.1 agc key 134 1.1 agc -the receiving PGP generates a new hash code for the received 135 1.1 agc message and compares it to the decrypted hash code. If the two 136 1.1 agc match, the message is accepted as authentic 137 1.1 agc 138 1.1 agc Although signatures normally are found attached to the message or 139 1.1 agc file that they sign, this is not always the case: detached signatures 140 1.1 agc are supported. A detached signature may be stored and transmitted 141 1.1 agc separately from the message it signs. This is useful in several 142 1.1 agc contexts. A user may wish to maintain a separate signature log of all 143 1.1 agc messages sent or received. A detached signature of an executable 144 1.1 agc program can detect subsequent virus infection. Finally, detached 145 1.1 agc signatures can be used when more than one party must sign a document, 146 1.1 agc such as a legal contract. Each person's signature is independent and 147 1.1 agc therefore is applied only to the document. Otherwise, signatures 148 1.1 agc would have to be nested, with the second signer signing both the 149 1.1 agc document and the first signature, and so on. 150 1.1 agc 151 1.1 agc 2.2 Confidentiality 152 1.1 agc 153 1.1 agc PGP provides confidentiality by encrypting messages to be transmitted 154 1.1 agc or data files to be stored locally using conventional encryption. In 155 1.1 agc PGP, each conventional key is used only once. That is, a new key is 156 1.1 agc generated as a random 128-bit number for each message. Since it is to 157 1.1 agc be used only once, the session key is bound to the message and 158 1.1 agc transmitted with it. To protect the key, it is encrypted with the 159 1.1 agc receiver's public key. The sequence is as follows: 160 1.1 agc 161 1.1 agc -the sender creates a message 162 1.1 agc -the sending PGP generates a random number to be used as a session 163 1.1 agc key for this message only 164 1.1 agc -the sending PGP encrypts the message using the session key 165 1.1 agc -the session key is encrypted using the recipient's public key and 166 1.1 agc prepended to the encrypted message 167 1.1 agc -the receiving PGP decrypts the session key using the recipient's 168 1.1 agc private key 169 1.1 agc 170 1.1 agc 171 1.1 agc 172 1.1 agc Atkins, et. al. Informational [Page 3] 173 1.1 agc 175 1.1 agc RFC 1991 PGP Message Exchange Formats August 1996 176 1.1 agc 177 1.1 agc 178 1.1 agc -the receiving PGP decrypts the message using the session key 179 1.1 agc 180 1.1 agc Both digital signature and confidentiality services may be applied to 181 1.1 agc the same message. First, a signature is generated for the message and 182 1.1 agc prepended to the message. Then, the message plus signature is 183 1.1 agc encrypted using a conventional session key. Finally, the session key 184 1.1 agc is encrypted using public-key encryption and prepended to the 185 1.1 agc encrypted block. 186 1.1 agc 187 1.1 agc 2.3 Compression 188 1.1 agc 189 1.1 agc As a default, PGP compresses the message after applying the signature 190 1.1 agc but before encryption. 191 1.1 agc 192 1.1 agc 2.4 Radix-64 conversion 193 1.1 agc 194 1.1 agc When PGP is used, usually part of the block to be transmitted is 195 1.1 agc encrypted. If only the signature service is used, then the message 196 1.1 agc digest is encrypted (with the sender's private key). If the 197 1.1 agc confidentiality service is used, the message plus signature (if 198 1.1 agc present) are encrypted (with a one-time conventional key). Thus, part 199 1.1 agc or all of the resulting block consists of a stream of arbitrary 8-bit 200 1.1 agc bytes. However, many electronic mail systems only permit the use of 201 1.1 agc blocks consisting of ASCII text. To accommodate this restriction, PGP 202 1.1 agc provides the service of converting the raw 8-bit binary stream to a 203 1.1 agc stream of printable ASCII characters, called ASCII Armor. 204 1.1 agc 205 1.1 agc The scheme used for this purpose is radix-64 conversion. Each group 206 1.1 agc of three bytes of binary data is mapped into 4 ASCII characters. This 207 1.1 agc format also appends a CRC to detect transmission errors. This 208 1.1 agc radix-64 conversion, also called Ascii Armor, is a wrapper around the 209 1.1 agc binary PGP messages, and is used to protect the binary messages 210 1.1 agc during transmission over non-binary channels, such as Internet Email. 211 1.1 agc 212 1.1 agc The following table defines the mapping. The characters used are the 213 1.1 agc upper- and lower-case letters, the digits 0 through 9, and the 214 1.1 agc characters + and /. The carriage-return and linefeed characters 215 1.1 agc aren't used in the conversion, nor is the tab or any other character 216 1.1 agc that might be altered by the mail system. The result is a text file 217 1.1 agc that is "immune" to the modifications inflicted by mail systems. 218 1.1 agc 219 1.1 agc 220 1.1 agc 221 1.1 agc 222 1.1 agc 223 1.1 agc 224 1.1 agc 225 1.1 agc 226 1.1 agc 227 1.1 agc 228 1.1 agc 229 1.1 agc Atkins, et. al. Informational [Page 4] 230 1.1 agc 232 1.1 agc RFC 1991 PGP Message Exchange Formats August 1996 233 1.1 agc 234 1.1 agc 235 1.1 agc 6-bit character 6-bit character 6-bit character 6-bit character 236 1.1 agc value encoding value encoding value encoding value encoding 237 1.1 agc 0 A 16 Q 32 g 48 w 238 1.1 agc 1 B 17 R 33 h 49 x 239 1.1 agc 2 C 18 S 34 i 50 y 240 1.1 agc 3 D 19 T 35 j 51 z 241 1.1 agc 4 E 20 U 36 k 52 0 242 1.1 agc 5 F 21 V 37 l 53 1 243 1.1 agc 6 G 22 W 38 m 54 2 244 1.1 agc 7 H 23 X 39 n 55 3 245 1.1 agc 8 I 24 Y 40 o 56 4 246 1.1 agc 9 J 25 Z 41 p 57 5 247 1.1 agc 1 K 26 a 42 q 58 6 248 1.1 agc 11 L 27 b 43 r 59 7 249 1.1 agc 12 M 28 c 44 s 60 8 250 1.1 agc 13 N 29 d 45 t 61 9 251 1.1 agc 14 O 30 e 46 u 62 + 252 1.1 agc 15 P 31 f 47 v 63 / 253 1.1 agc (pad) = 254 1.1 agc 255 1.1 agc It is possible to use PGP to convert any arbitrary file to ASCII 256 1.1 agc Armor. When this is done, PGP tries to compress the data before it 257 1.1 agc is converted to Radix-64. 258 1.1 agc 259 1.1 agc 2.4.1 ASCII Armor Formats 260 1.1 agc 261 1.1 agc When PGP encodes data into ASCII Armor, it puts specific headers 262 1.1 agc around the data, so PGP can reconstruct the data at a future time. 263 1.1 agc PGP tries to inform the user what kind of data is encoded in the 264 1.1 agc ASCII armor through the use of the headers. 265 1.1 agc 266 1.1 agc ASCII Armor is created by concatenating the following data: 267 1.1 agc 268 1.1 agc - An Armor Headerline, appropriate for the type of data 269 1.1 agc - Armor Headers 270 1.1 agc - A blank line 271 1.1 agc - The ASCII-Armored data 272 1.1 agc - An Armor Checksum 273 1.1 agc - The Armor Tail (which depends on the Armor Headerline). 274 1.1 agc 275 1.1 agc An Armor Headerline is composed by taking the appropriate headerline 276 1.1 agc text surrounded by five (5) dashes (-) on either side of the 277 1.1 agc headerline text. The headerline text is chosen based upon the type 278 1.1 agc of data that is being encoded in Armor, and how it is being encoded. 279 1.1 agc Headerline texts include the following strings: 280 1.1 agc 281 1.1 agc BEGIN PGP MESSAGE -- used for signed, encrypted, or compressed files 282 1.1 agc BEGIN PGP PUBLIC KEY BLOCK -- used for transferring public keys 283 1.1 agc 284 1.1 agc 285 1.1 agc 286 1.1 agc Atkins, et. al. Informational [Page 5] 287 1.1 agc 289 1.1 agc RFC 1991 PGP Message Exchange Formats August 1996 290 1.1 agc 291 1.1 agc 292 1.1 agc BEGIN PGP MESSAGE, PART X/Y -- used for multi-part messages, where 293 1.1 agc the armor is split amongst Y files, 294 1.1 agc and this is the Xth file out of Y. 295 1.1 agc 296 1.1 agc The Armor Headers are pairs of strings that can give the user or the 297 1.1 agc receiving PGP program some information about how to decode or use the 298 1.1 agc message. The Armor Headers are a part of the armor, not a part of 299 1.1 agc the message, and hence should not be used to convey any important 300 1.1 agc information, since they can be changed in transport. 301 1.1 agc 302 1.1 agc The format of an Armor Header is that of a key-value pair, the 303 1.1 agc encoding of RFC-822 headers. PGP should consider improperly 304 1.1 agc formatted Armor Headers to be corruption of the ASCII Armor. Unknown 305 1.1 agc Keys should be reported to the user, but so long as the RFC-822 306 1.1 agc formatting is correct, PGP should continue to process the message. 307 1.1 agc Currently defined Armor Header Keys include "Version" and "Comment", 308 1.1 agc which define the PGP Version used to encode the message and a user- 309 1.1 agc defined comment. 310 1.1 agc 311 1.1 agc The Armor Checksum is a 24-bit CRC converted to four bytes of radix- 312 1.1 agc 64 encoding, prepending an equal-sign (=) to the four-byte code. The 313 1.1 agc CRC is computed by using the generator 0x864CFB and an initialization 314 1.1 agc of 0xB704CE. The accumulation is done on the data before it is 315 1.1 agc converted to radix-64, rather than on the converted data. For more 316 1.1 agc information on CRC functions, the reader is asked to look at chapter 317 1.1 agc 19 of the book "C Programmer's Guide to Serial Communications," by 318 1.1 agc Joe Campbell. 319 1.1 agc 320 1.1 agc The Armor Tail is composed in the same manner as the Armor 321 1.1 agc Headerline, except the string "BEGIN" is replaced by the string 322 1.1 agc "END". 323 1.1 agc 324 1.1 agc 3. Data Element Formats 325 1.1 agc 326 1.1 agc 3.1 Byte strings 327 1.1 agc 328 1.1 agc The objects considered in this document are all "byte strings." A 329 1.1 agc byte string is a finite sequence of bytes. The concatenation of byte 330 1.1 agc string X of length M with byte string Y of length N is a byte string 331 1.1 agc Z of length M + N; the first M bytes of Z are the bytes of X in the 332 1.1 agc same order, and the remaining N bytes of Z are the bytes of Y in the 333 1.1 agc same order. 334 1.1 agc 335 1.1 agc Literal byte strings are written from left to right, with pairs of 336 1.1 agc hex nibbles separated by spaces, enclosed by angle brackets: for 337 1.1 agc instance, <05 ff 07> is a byte string of length 3 whose bytes have 338 1.1 agc numeric values 5, 255, and 7 in that order. All numbers in this 339 1.1 agc document outside angle brackets are written in decimal. 340 1.1 agc 341 1.1 agc 342 1.1 agc 343 1.1 agc Atkins, et. al. Informational [Page 6] 344 1.1 agc 346 1.1 agc RFC 1991 PGP Message Exchange Formats August 1996 347 1.1 agc 348 1.1 agc 349 1.1 agc The byte string of length 0 is called "empty" and written <>. 350 1.1 agc 351 1.1 agc 3.2 Whole number fields 352 1.1 agc 353 1.1 agc Purpose. A whole number field can represent any nonnegative integer, 354 1.1 agc in a format where the field length is known in advance. 355 1.1 agc 356 1.1 agc Definition. A whole number field is any byte string. It is stored 357 1.1 agc in radix-256 MSB-first format. This means that a whole number field 358 1.1 agc of length N with bytes b_0 b_1 ... b_{N-2} b_{N-1} in that order has 359 1.1 agc value 360 1.1 agc 361 1.1 agc b_0 * 256^{N-1} + b_1 * 256^{N-2} + ... + b_{N-2} * 256 + b_{N-1}. 362 1.1 agc 363 1.1 agc Examples. The byte string <00 0D 64 11 00 00> is a valid whole 364 1.1 agc number field with value 57513410560. The byte string <FF> is a valid 365 1.1 agc whole number field with value 255. The byte string <00 00> is a 366 1.1 agc valid whole number field with value 0. The empty byte string <> is a 367 1.1 agc valid whole number field with value 0. 368 1.1 agc 369 1.1 agc 3.3 Multiprecision fields 370 1.1 agc 371 1.1 agc Purpose. A multiprecision field can represent any nonnegative 372 1.1 agc integer which is not too large. The field length need not be known 373 1.1 agc in advance. Multiprecision fields are designed to waste very little 374 1.1 agc space: a small integer uses a short field. 375 1.1 agc 376 1.1 agc Definition. A multiprecision field is the concatenation of two 377 1.1 agc fields: 378 1.1 agc 379 1.1 agc (a) a whole number field of length 2, with value B; 380 1.1 agc (b) a whole number field, with value V. 381 1.1 agc 382 1.1 agc Field (b) is of length [(B+7)/8], i.e., the greatest integer which is 383 1.1 agc no larger than (B+7)/8. The value of the multiprecision field is 384 1.1 agc defined to be V. V must be between 2^{B-1} and 2^B - 1 inclusive. 385 1.1 agc In other words B must be exactly the number of significant bits in V. 386 1.1 agc 387 1.1 agc Some implementations may limit the possible range of B. The 388 1.1 agc implementor must document which values of B are allowed by an 389 1.1 agc implementation. 390 1.1 agc 391 1.1 agc Examples. The byte string <00 00> is a valid multiprecision integer 392 1.1 agc with value 0. The byte string <00 03 05> is a valid multiprecision 393 1.1 agc field with value 5. The byte strings <00 03 85> and <00 00 00> are 394 1.1 agc not valid multiprecision fields. The former is invalild because <85> 395 1.1 agc has 8 significant bits, not 3; the latter is invalid because the 396 1.1 agc second field has too many bytes of data given the value of the first 397 1.1 agc 398 1.1 agc 399 1.1 agc 400 1.1 agc Atkins, et. al. Informational [Page 7] 401 1.1 agc 403 1.1 agc RFC 1991 PGP Message Exchange Formats August 1996 404 1.1 agc 405 1.1 agc 406 1.1 agc field. The byte string <00 09 01 ff> is a valid multiprecision field 407 1.1 agc with value 511. The byte string <01 00 80 00 00 00 00 00 00 00 00 00 408 1.1 agc 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07> is 409 1.1 agc a valid multiprecision field with value 2^255 + 7. 410 1.1 agc 411 1.1 agc 3.4 String fields 412 1.1 agc 413 1.1 agc Purpose. A string field represents any sequence of bytes of length 414 1.1 agc between 0 and 255 inclusive. The length need not be known in 415 1.1 agc advance. By convention, the content of a string field is normally 416 1.1 agc interpreted as ASCII codes when it is displayed. 417 1.1 agc 418 1.1 agc Definition. A string field is the concatenation of the following: 419 1.1 agc 420 1.1 agc (a) a whole number field of length 1, with value L; 421 1.1 agc (b) a byte string of length L. 422 1.1 agc 423 1.1 agc The content of the string field is defined to be field (b). 424 1.1 agc 425 1.1 agc Examples: <05 48 45 4c 4c 4f> is a valid string field which would 426 1.1 agc normally be displayed as the string HELLO. <00> is a valid string 427 1.1 agc field which would normally be displayed as the empty string. <01 00> 428 1.1 agc is a valid string field. 429 1.1 agc 430 1.1 agc 3.5 Time fields 431 1.1 agc 432 1.1 agc Purpose. A time field represents the number of seconds elapsed since 433 1.1 agc 1970 Jan 1 00:00:00 GMT. It is compatible with the usual 434 1.1 agc representation of times under UNIX. 435 1.1 agc 436 1.1 agc Definition. A time field is a whole number field of length 4, with 437 1.1 agc value V. The time represented by the time field is the one-second 438 1.1 agc interval beginning V seconds after 1970 Jan 1 00:00:00 GMT. 439 1.1 agc 440 1.1 agc 4. Common Fields 441 1.1 agc 442 1.1 agc This section defines fields found in more than one packet format. 443 1.1 agc 444 1.1 agc 4.1 Packet structure fields 445 1.1 agc 446 1.1 agc Purpose. The packet structure field distinguishes between different 447 1.1 agc types of packets, and indicates the length of packets. 448 1.1 agc 449 1.1 agc Definition. A packet structure field is a byte string of length 1, 450 1.1 agc 2, 3, or 5. Its first byte is the cipher type byte (CTB), with bits 451 1.1 agc labeled 76543210, 7 the most significant bit and 0 the least 452 1.1 agc significant bit. As indicated below the length of the packet 453 1.1 agc structure field is determined by the CTB. 454 1.1 agc 455 1.1 agc 456 1.1 agc 457 1.1 agc Atkins, et. al. Informational [Page 8] 458 1.1 agc 460 1.1 agc RFC 1991 PGP Message Exchange Formats August 1996 461 1.1 agc 462 1.1 agc 463 1.1 agc CTB bits 76 have values listed in the following table: 464 1.1 agc 465 1.1 agc 10 - normal CTB 466 1.1 agc 11 - reserved for future experimental work 467 1.1 agc all others - reserved 468 1.1 agc 469 1.1 agc CTB bits 5432, the "packet type bits", have values listed in the 470 1.1 agc following table: 471 1.1 agc 472 1.1 agc 0001 - public-key-encrypted packet 473 1.1 agc 0010 - signature packet 474 1.1 agc 0101 - secret-key certificate packet 475 1.1 agc 0110 - public-key certificate packet 476 1.1 agc 1000 - compressed data packet 477 1.1 agc 1001 - conventional-key-encrypted packet 478 1.1 agc 1011 - literal data packet 479 1.1 agc 1100 - keyring trust packet 480 1.1 agc 1101 - user id packet 481 1.1 agc 1110 - comment packet (*) 482 1.1 agc all others - reserved 483 1.1 agc 484 1.1 agc CTB bits 10, the "packet-length length bits", have values listed in 485 1.1 agc the following table: 486 1.1 agc 487 1.1 agc 00 - 1-byte packet-length field 488 1.1 agc 01 - 2-byte packet-length field 489 1.1 agc 10 - 4-byte packet-length field 490 1.1 agc 11 - no packet length supplied, unknown packet length 491 1.1 agc 492 1.1 agc As indicated in this table, depending on the packet-length length 493 1.1 agc bits, the remaining 1, 2, 4, or 0 bytes of the packet structure field 494 1.1 agc are a "packet-length field". The packet-length field is a whole 495 1.1 agc number field. The value of the packet-length field is defined to be 496 1.1 agc the value of the whole number field. 497 1.1 agc 498 1.1 agc A value of 11 is currently used in one place: on compressed data. 499 1.1 agc That is, a compressed data block currently looks like <A3 01 . . .>, 500 1.1 agc where <A3>, binary 10 1000 11, is an indefinite-length packet. The 501 1.1 agc proper interpretation is "until the end of the enclosing structure", 502 1.1 agc although it should never appear outermost (where the enclosing 503 1.1 agc structure is a file). 504 1.1 agc 505 1.1 agc Options marked with an asterisk (*) are not implemented yet; PGP 506 1.1 agc 2.6.2 will never output this packet type. 507 1.1 agc 508 1.1 agc 509 1.1 agc 510 1.1 agc 511 1.1 agc 512 1.1 agc 513 1.1 agc 514 1.1 agc Atkins, et. al. Informational [Page 9] 515 1.1 agc 517 1.1 agc RFC 1991 PGP Message Exchange Formats August 1996 518 1.1 agc 519 1.1 agc 520 1.1 agc 4.2 Number ID fields 521 1.1 agc 522 1.1 agc Purpose. The ID of a whole number is its 64 least significant bits. 523 1.1 agc The ID is a convenient way to distinguish between large numbers such 524 1.1 agc as keys, without having to transmit the number itself. Thus, a number 525 1.1 agc that may be hundreds or thousands of decimal digits in length can be 526 1.1 agc identified with a 64-bit identifier. Two keys may have the same ID by 527 1.1 agc chance or by malice; although the probability that two large keys 528 1.1 agc chosen at random would have the same ID is extremely small. 529 1.1 agc 530 1.1 agc Definition. A number ID field is a whole number field of length 8. 531 1.1 agc The value of the number ID field is defined to be the value of the 532 1.1 agc whole number field. 533 1.1 agc 534 1.1 agc 4.3 Version fields 535 1.1 agc 536 1.1 agc Many packet types include a version number as the first byte of the 537 1.1 agc body. The format and meaning of the body depend on the version 538 1.1 agc number. More versions of packets, with new version numbers, may be 539 1.1 agc defined in the future. An implementation need not support every 540 1.1 agc version of each packet type. However, the implementor must document 541 1.1 agc which versions of each packet type are supported by the 542 1.1 agc implementation. 543 1.1 agc 544 1.1 agc A version number of 2 or 3 is currently allowed for each packet 545 1.1 agc format. New versions will probably be numbered sequentially up from 546 1.1 agc 3. For backwards compatibility, implementations will usually be 547 1.1 agc expected to support version N of a packet whenever they support 548 1.1 agc version N+1. Version 255 may be used for experimental purposes. 549 1.1 agc 550 1.1 agc 5. Packets 551 1.1 agc 552 1.1 agc 5.1 Overview 553 1.1 agc 554 1.1 agc A packet is a digital envelope with data inside. A PGP file, by 555 1.1 agc definition, is the concatenation of one or more packets. In addition, 556 1.1 agc one or more of the packets in a file may be subject to a 557 1.1 agc transformation using encryption, compression, or radix-64 conversion. 558 1.1 agc 559 1.1 agc A packet is the concatenation of the following: 560 1.1 agc 561 1.1 agc (a) a packet structure field; 562 1.1 agc (b) a byte string of some length N. 563 1.1 agc 564 1.1 agc Byte string (b) is called the "body" of the packet. The value of the 565 1.1 agc packet-length field inside the packet structure field (a) must equal 566 1.1 agc N, the length of the body. 567 1.1 agc 568 1.1 agc 569 1.1 agc 570 1.1 agc 571 1.1 agc Atkins, et. al. Informational [Page 10] 572 1.1 agc 574 1.1 agc RFC 1991 PGP Message Exchange Formats August 1996 575 1.1 agc 576 1.1 agc 577 1.1 agc Other characteristics of the packet are determined by the type of the 578 1.1 agc packet. See the definitions of particular packet types for further 579 1.1 agc details. The CTB packet-type bits inside the packet structure always 580 1.1 agc indicate the packet type. 581 1.1 agc 582 1.1 agc Note that packets may be nested: one digital envelope may be placed 583 1.1 agc inside another. For example, a conventional-key-encrypted packet 584 1.1 agc contains a disguised packet, which in turn might be a compressed data 585 1.1 agc packet. 586 1.1 agc 587 1.1 agc 5.2 General packet structure 588 1.1 agc 589 1.1 agc A pgp file consists of three components: a message component, a 590 1.1 agc signature (optional), and a session key component (optional). 591 1.1 agc 592 1.1 agc 5.2.1 Message component 593 1.1 agc 594 1.1 agc The message component includes the actual data to be stored or 595 1.1 agc transmitted as well as a header that includes control information 596 1.1 agc generated by PGP. The message component consists of a single literal 597 1.1 agc data packet. 598 1.1 agc 599 1.1 agc 5.2.2 Signature component 600 1.1 agc 601 1.1 agc The signature component is the signature of the message component, 602 1.1 agc formed using a hash code of the message component and the public key 603 1.1 agc of the sending PGP entity. The signature component consists of a 604 1.1 agc single signature packet. 605 1.1 agc 606 1.1 agc If the default option of compression is chosen, then the block 607 1.1 agc consisting of the literal data packet and the signature packet is 608 1.1 agc compressed to form a compressed data packet. 609 1.1 agc 610 1.1 agc 5.2.3 Session key component 611 1.1 agc 612 1.1 agc The session key component includes the encrypted session key and the 613 1.1 agc identifier of the recipients public key used by the sender to encrypt 614 1.1 agc the session key. The session key component consists of a single 615 1.1 agc public-key-encrypted packet for each recipient of the message. 616 1.1 agc 617 1.1 agc If compression has been used, then conventional encryption is applied 618 1.1 agc to the compressed data packet formed from the compression of the 619 1.1 agc signature packet and the literal data packet. Otherwise, conventional 620 1.1 agc encryption is applied to the block consisting of the signature packet 621 1.1 agc and the literal data packet. In either case, the cyphertext is 622 1.1 agc referred to as a conventional-key-encrypted data packet. 623 1.1 agc 624 1.1 agc 625 1.1 agc 626 1.1 agc 627 1.1 agc 628 1.1 agc Atkins, et. al. Informational [Page 11] 629 1.1 agc 631 1.1 agc RFC 1991 PGP Message Exchange Formats August 1996 632 1.1 agc 633 1.1 agc 634 1.1 agc 6. PGP Packet Types 635 1.1 agc 636 1.1 agc PGP includes the following types of packets: 637 1.1 agc 638 1.1 agc -literal data packet 639 1.1 agc -signature packet 640 1.1 agc -compressed data packet 641 1.1 agc -conventional-key-encrypted data packet 642 1.1 agc -public-key-encrypted packet 643 1.1 agc -public-key packet 644 1.1 agc -User ID packet 645 1.1 agc 646 1.1 agc 6.1 Literal data packets 647 1.1 agc 648 1.1 agc Purpose. A literal data packet is the lowest level of contents of a 649 1.1 agc digital envelope. The data inside a literal data packet is not 650 1.1 agc subject to any further interpretation by PGP. 651 1.1 agc 652 1.1 agc Definition. A literal data packet is the concatenation of the 653 1.1 agc following fields: 654 1.1 agc 655 1.1 agc (a) a packet structure field; 656 1.1 agc (b) a byte, giving a mode; 657 1.1 agc (c) a string field, giving a filename; 658 1.1 agc (d) a time field; 659 1.1 agc (e) a byte string of literal data. 660 1.1 agc 661 1.1 agc 662 1.1 agc Fields (b), (c), and (d) suggest how the data should be written to a 663 1.1 agc file. Byte (b) is either ASCII b <62>, for binary, or ASCII t <74>, 664 1.1 agc for text. Byte (b) may also take on the value ASCII 1, indicating a 665 1.1 agc machine-local conversion. It is not defined how PGP will convert this 666 1.1 agc across platforms. 667 1.1 agc 668 1.1 agc Field (c) suggests a filename. Field (d) should be the time at which 669 1.1 agc the file was last modified, or the time at which the data packet was 670 1.1 agc created, or 0. 671 1.1 agc 672 1.1 agc Note that only field (e) of a literal data packet is fed to a 673 1.1 agc message-digest function for the formation of a signature. The 674 1.1 agc exclusion of the other fields ensures that detached signatures are 675 1.1 agc exactly the same as attached signatures prefixed to the message. 676 1.1 agc Detached signatures are calculated on a separate file that has none 677 1.1 agc of the literal data packet header fields. 678 1.1 agc 679 1.1 agc 680 1.1 agc 681 1.1 agc 682 1.1 agc 683 1.1 agc 684 1.1 agc 685 1.1 agc Atkins, et. al. Informational [Page 12] 686 1.1 agc 688 1.1 agc RFC 1991 PGP Message Exchange Formats August 1996 689 1.1 agc 690 1.1 agc 691 1.1 agc 6.2 Signature packet 692 1.1 agc 693 1.1 agc Purpose. Signatures are attached to data, in such a way that only 694 1.1 agc one entity, called the "writer," can create the signature. The 695 1.1 agc writer must first create a "public key" K and distribute it. The 696 1.1 agc writer keeps certain private data related to K. Only someone 697 1.1 agc cooperating with the writer can sign data using K, enveloping the 698 1.1 agc data in a signature packet (also known as a private-key-encrypted 699 1.1 agc packet). Anyone can look through the glass in the envelope and 700 1.1 agc verify that the signature was attached to the data using K. If the 701 1.1 agc data is altered in any way then the verification will fail. 702 1.1 agc 703 1.1 agc Signatures have different meanings. For example, a signature might 704 1.1 agc mean "I wrote this document," or "I received this document." A 705 1.1 agc signature packet includes a "classification" which expresses its 706 1.1 agc meaning. 707 1.1 agc 708 1.1 agc Definition. A signature packet, version 2 or 3, is the concatenation 709 1.1 agc of the following fields: 710 1.1 agc 711 1.1 agc (a) packet structure field (2, 3, or 5 bytes); 712 1.1 agc (b) version number = 2 or 3 (1 byte); 713 1.1 agc (c) length of following material included in MD calculation 714 1.1 agc (1 byte, always the value 5); 715 1.1 agc (d1) signature classification (1 byte); 716 1.1 agc (d2) signature time stamp (4 bytes); 717 1.1 agc (e) key ID for key used for singing (8 bytes); 718 1.1 agc (f) public-key-cryptosystem (PKC) type (1 byte); 719 1.1 agc (g) message digest algorithm type (1 byte); 720 1.1 agc (h) first two bytes of the MD output, used as a checksum 721 1.1 agc (2 bytes); 722 1.1 agc (i) a byte string of encrypted data holding the RSA-signed digest. 723 1.1 agc 724 1.1 agc The message digest is taken of the bytes of the file, followed by the 725 1.1 agc bytes of field (d). It was originally intended that the length (c) 726 1.1 agc could vary, but now it seems that it will alwaye remain a constant 727 1.1 agc value of 5, and that is the only value that will be accepted. Thus, 728 1.1 agc only the fields (d1) and (d2) will be hashed into the signature along 729 1.1 agc with the main message. 730 1.1 agc 731 1.1 agc 732 1.1 agc 733 1.1 agc 734 1.1 agc 735 1.1 agc 736 1.1 agc 737 1.1 agc 738 1.1 agc 739 1.1 agc 740 1.1 agc 741 1.1 agc 742 1.1 agc Atkins, et. al. Informational [Page 13] 743 1.1 agc 745 1.1 agc RFC 1991 PGP Message Exchange Formats August 1996 746 1.1 agc 747 1.1 agc 748 1.1 agc 6.2.1 Message-digest-related fields 749 1.1 agc 750 1.1 agc The message digest algorithm is specified by the message digest (MD) 751 1.1 agc number of field (g). The following MD numbers are currently defined: 752 1.1 agc 753 1.1 agc 1 - MD5 (output length 16) 754 1.1 agc 255 - experimental 755 1.1 agc 756 1.1 agc More MD numbers may be defined in the future. An implementation need 757 1.1 agc not support every MD number. The implementor must document the MD 758 1.1 agc numbers understood by an implementation. 759 1.1 agc 760 1.1 agc A message digest algorithm reads a byte string of any length, and 761 1.1 agc writes a byte string of some fixed length, as indicated in the table 762 1.1 agc above. 763 1.1 agc 764 1.1 agc The input to the message digest algorithm is the concatenation of 765 1.1 agc some "primary input" and some "appended input." 766 1.1 agc 767 1.1 agc The appended input is specified by field (c), which gives a number of 768 1.1 agc bytes to be taken from the following fields: (d1), (d2), and so on. 769 1.1 agc The current implementation uses the value 5 for this number, for 770 1.1 agc fields (d1) and (d2). Any field not included in the appended input 771 1.1 agc is not "signed" by field (i). 772 1.1 agc 773 1.1 agc The primary input is determined by the signature classification byte 774 1.1 agc (d1). Byte (d1) is one of the following hex numbers, with these 775 1.1 agc meanings: 776 1.1 agc 777 1.1 agc <00> - document signature, binary image ("I wrote this document") 778 1.1 agc <01> - document signature, canonical text ("I wrote this document") 779 1.1 agc <10> - public key packet and user ID packet, generic certification 780 1.1 agc ("I think this key was created by this user, but I won't say 781 1.1 agc how sure I am") 782 1.1 agc <11> - public key packet and user ID packet, persona certification 783 1.1 agc ("This key was created by someone who has told me that he is 784 1.1 agc this user") (#) 785 1.1 agc <12> - public key packet and user ID packet, casual certification 786 1.1 agc ("This key was created by someone who I believe, after casual 787 1.1 agc verification, to be this user") (#) 788 1.1 agc <13> - public key packet and user ID packet, positive certification 789 1.1 agc ("This key was created by someone who I believe, after 790 1.1 agc heavy-duty identification such as picture ID, to be this 791 1.1 agc user") (#) 792 1.1 agc <20> - public key packet, key compromise ("This is my key, and I 793 1.1 agc have revoked it") 794 1.1 agc 795 1.1 agc 796 1.1 agc 797 1.1 agc 798 1.1 agc 799 1.1 agc Atkins, et. al. Informational [Page 14] 800 1.1 agc 802 1.1 agc RFC 1991 PGP Message Exchange Formats August 1996 803 1.1 agc 804 1.1 agc 805 1.1 agc <30> - public key packet and user ID packet, revocation ("I retract 806 1.1 agc all my previous statements that this key is related to this 807 1.1 agc user") (*) 808 1.1 agc <40> - time stamping ("I saw this document") (*) 809 1.1 agc 810 1.1 agc More classification numbers may be defined in the future to handle 811 1.1 agc other meanings of signatures, but only the above numbers may be used 812 1.1 agc with version 2 or version 3 of a signature packet. It should be 813 1.1 agc noted that PGP 2.6.2 has not implemented the packets marked with an 814 1.1 agc asterisk (*), and the packets marked with a hash (#) are not output 815 1.1 agc by PGP 2.6.2. 816 1.1 agc 817 1.1 agc Signature packets are used in two different contexts. One (signature 818 1.1 agc type <00> or <01>) is of text (either the contents of a literal 819 1.1 agc packet or a separate file), while types <10> through <1F> appear only 820 1.1 agc in key files, after the keys and user IDs that they sign. Type <20> 821 1.1 agc appears in key files, after the keys that it signs, and type <30> 822 1.1 agc also appears after a key/userid combination. Type <40> is intended to 823 1.1 agc be a signature of a signature, as a notary seal on a signed document. 824 1.1 agc 825 1.1 agc The output of the message digest algorithm is a message digest, or 826 1.1 agc hash code. Field i contains the cyphertext produced by encrypting the 827 1.1 agc message digest with the signer's private key. Field h contains the 828 1.1 agc first two bytes of the unencrypted message digest. This enables the 829 1.1 agc recipient to determine if the correct public key was used to decrypt 830 1.1 agc the message digest for authentication, by comparing this plaintext 831 1.1 agc copy of the first two byes with the first two bytes of the decrypted 832 1.1 agc digest. These two bytes also serve as a 16-bit frame check sequence 833 1.1 agc for the message. 834 1.1 agc 835 1.1 agc 6.2.2 Public-key-related fields 836 1.1 agc 837 1.1 agc The message digest is signed by encrypting it using the writer's 838 1.1 agc private key. Field (e) is the ID of the corresponding public key. 839 1.1 agc 840 1.1 agc The public-key-encryption algorithm is specified by the public-key 841 1.1 agc cryptosystem (PKC) number of field (f). The following PKC numbers are 842 1.1 agc currently defined: 843 1.1 agc 844 1.1 agc 1 - RSA 845 1.1 agc 255 - experimental 846 1.1 agc 847 1.1 agc More PKC numbers may be defined in the future. An implementation 848 1.1 agc need not support every PKC number. The implementor must document the 849 1.1 agc PKC numbers understood by an implementation. 850 1.1 agc 851 1.1 agc 852 1.1 agc 853 1.1 agc 854 1.1 agc 855 1.1 agc 856 1.1 agc Atkins, et. al. Informational [Page 15] 857 1.1 agc 859 1.1 agc RFC 1991 PGP Message Exchange Formats August 1996 860 1.1 agc 861 1.1 agc 862 1.1 agc A PKC number identifies both a public-key encryption method and a 863 1.1 agc signature method. Both of these methods are fully defined as part of 864 1.1 agc the definition of the PKC number. Some cryptosystems are usable only 865 1.1 agc for encryption, or only for signatures; if any such PKC numbers are 866 1.1 agc defined in the future, they will be marked appropriately. 867 1.1 agc 868 1.1 agc 6.2.3 RSA signatures 869 1.1 agc 870 1.1 agc An RSA-signed byte string is a multiprecision field that is formed by 871 1.1 agc taking the message digest and filling in an ASN structure, and then 872 1.1 agc encrypting the whole byte string in the RSA key of the signer. 873 1.1 agc 874 1.1 agc PGP versions 2.3 and later encode the MD into a PKCS-format signature 875 1.1 agc string, which has the following format: 876 1.1 agc 877 1.1 agc MSB . . . LSB 878 1.1 agc 0 1 <FF>(n bytes) 0 ASN(18 bytes) MD(16 bytes) 879 1.1 agc 880 1.1 agc See RFC1423 for an explanation of the meaning of the ASN string. It 881 1.1 agc is the following 18 byte long hex value: 882 1.1 agc 883 1.1 agc <30 20 30 0C 06 08 2A 86 48 86 F7 0D 02 05 05 00 04 10> 884 1.1 agc 885 1.1 agc Enough bytes of <FF> padding are added to make the length of this 886 1.1 agc whole string equal to the number of bytes in the modulus. 887 1.1 agc 888 1.1 agc 6.2.4 Miscellaneous fields 889 1.1 agc 890 1.1 agc The timestamp field (d2) is analogous to the date box next to a 891 1.1 agc signature box on a form. It represents a time which is typically 892 1.1 agc close to the moment that the signature packet was created. However, 893 1.1 agc this is not a requirement. Users may choose to date their signatures 894 1.1 agc as they wish, just as they do now in handwritten signatures. 895 1.1 agc 896 1.1 agc If an application requires the creation of trusted timestamps on 897 1.1 agc signatures, a detached signature certificate with an untrusted 898 1.1 agc timestamp may be submitted to a trusted timestamp notary service to 899 1.1 agc sign the signature packet with another signature packet, creating a 900 1.1 agc signature of a signature. The notary's signature's timestamp could 901 1.1 agc be used as the trusted "legal" time of the original signature. 902 1.1 agc 903 1.1 agc 904 1.1 agc 905 1.1 agc 906 1.1 agc 907 1.1 agc 908 1.1 agc 909 1.1 agc 910 1.1 agc 911 1.1 agc 912 1.1 agc 913 1.1 agc Atkins, et. al. Informational [Page 16] 914 1.1 agc 916 1.1 agc RFC 1991 PGP Message Exchange Formats August 1996 917 1.1 agc 918 1.1 agc 919 1.1 agc 6.3 Compressed data packets 920 1.1 agc 921 1.1 agc Purpose. A compressed data packet is an envelope which safely 922 1.1 agc squeezes its contents into a small space. 923 1.1 agc 924 1.1 agc Definition. A compressed data packet is the concatenation of the 925 1.1 agc following fields: 926 1.1 agc 927 1.1 agc (a) a packet structure field; 928 1.1 agc (b) a byte, giving a compression type; 929 1.1 agc (c) a byte string of compressed data. 930 1.1 agc 931 1.1 agc Byte string (c) is a packet which may be decompressed using the 932 1.1 agc algorithm identified in byte (b). Typically, the data that are 933 1.1 agc compressed consist of a literal data packet or a signature packet 934 1.1 agc concatenated to a literal data packet. 935 1.1 agc 936 1.1 agc A compression type selects a compression algorithm for use in 937 1.1 agc compressed data packets. The following compression numbers are 938 1.1 agc currently defined. 939 1.1 agc 940 1.1 agc 1 - ZIP 941 1.1 agc 255 - experimental 942 1.1 agc 943 1.1 agc More compression numbers may be defined in the future. An 944 1.1 agc implementation need not support every MD number. The implementor 945 1.1 agc must document the compression numbers understood by an 946 1.1 agc implementation. 947 1.1 agc 948 1.1 agc 6.4 Conventional-key-encrypted data packets 949 1.1 agc 950 1.1 agc Purpose. A conventional-key-encrypted data packet is formed by 951 1.1 agc encrypting a block of data with a conventional encryption algorithm 952 1.1 agc using a one-time session key. Typically, the block to be encrypted is 953 1.1 agc a compressed data packet. 954 1.1 agc 955 1.1 agc Definition. A conventional-key-encrypted data packet is the 956 1.1 agc concatenation of the following fields: 957 1.1 agc 958 1.1 agc (a) a packet structure field; 959 1.1 agc (b) a byte string of encrypted data. 960 1.1 agc 961 1.1 agc The plaintext or compressed plaintext that is encrypted to form field 962 1.1 agc (b) is first prepended with 64 bits of random data plus 16 "key 963 1.1 agc check" bits. The random prefix serves to start off the cipher 964 1.1 agc feedback chaining process with 64 bits of random material; this 965 1.1 agc serves the same function as an initialization vector (IV) for a 966 1.1 agc cipher-block-chaining encryption scheme. The key check prefix is 967 1.1 agc 968 1.1 agc 969 1.1 agc 970 1.1 agc Atkins, et. al. Informational [Page 17] 971 1.1 agc 973 1.1 agc RFC 1991 PGP Message Exchange Formats August 1996 974 1.1 agc 975 1.1 agc 976 1.1 agc equal to the last 16 bits of the random prefix. During decryption, a 977 1.1 agc comparison is made to see if the 7th and 8th byte of the decrypted 978 1.1 agc material match the 9th and 10th bytes. If so, then the conventional 979 1.1 agc session key used for decryption is assumed to be correct. 980 1.1 agc 981 1.1 agc 6.4.1 Conventional-encryption type byte 982 1.1 agc 983 1.1 agc Purpose. The conventional-encryption type byte is used to determine 984 1.1 agc what conventional encryption algorithm is in use. The algorithm type 985 1.1 agc byte will also define how long the conventional encryption key is, 986 1.1 agc based upon the algorithm in use. 987 1.1 agc 988 1.1 agc Definition. A conventional-encryption type byte is a single byte 989 1.1 agc which defines the algorithm in use. It is possible that the 990 1.1 agc algorithm in use may require further definition, such as key-length. 991 1.1 agc It is up to the implementor to document the supported key-length in 992 1.1 agc such a situation. 993 1.1 agc 994 1.1 agc 1 - IDEA (16-byte key) 995 1.1 agc 255 - experimental 996 1.1 agc 997 1.1 agc 6.5 Public-key-encrypted packets 998 1.1 agc 999 1.1 agc Purpose. The public-key-encrypted packet is the format for the 1000 1.1 agc session key component of a message. The purpose of this packet is to 1001 1.1 agc convey the one-time session key used to encrypt the message to the 1002 1.1 agc recipient in a secure manner. This is done by encrypting the session 1003 1.1 agc key with the recipient's public key, so that only the recipient can 1004 1.1 agc recover the session key. 1005 1.1 agc 1006 1.1 agc Definition. A public-key-encrypted packet, version 2 or 3, is the 1007 1.1 agc concatenation of the following fields: 1008 1.1 agc 1009 1.1 agc (a) a packet structure field; 1010 1.1 agc (b) a byte, giving the version number, 2 or 3; 1011 1.1 agc (c) a number ID field, giving the ID of a key; 1012 1.1 agc (d) a byte, giving a PKC number; 1013 1.1 agc (e) a byte string of encrypted data (DEK). 1014 1.1 agc 1015 1.1 agc Byte string (e) represents the value of the session key, encrypted 1016 1.1 agc using the reader's public key K, under the cryptosystem identified in 1017 1.1 agc byte (d). 1018 1.1 agc 1019 1.1 agc The value of field (c) is the ID of K. 1020 1.1 agc 1021 1.1 agc Note that the packet does not actually identify K: two keys may have 1022 1.1 agc the same ID, by chance or by malice. Normally it will be obvious 1023 1.1 agc from the context which key K was used to create the packet. But 1024 1.1 agc 1025 1.1 agc 1026 1.1 agc 1027 1.1 agc Atkins, et. al. Informational [Page 18] 1028 1.1 agc 1030 1.1 agc RFC 1991 PGP Message Exchange Formats August 1996 1031 1.1 agc 1032 1.1 agc 1033 1.1 agc sometimes it is not obvious. In this case field (c) is useful. If, 1034 1.1 agc for example, a reader has created several keys, and receives a 1035 1.1 agc message, then he should attempt to decrypt the message only with the 1036 1.1 agc key whose ID matches the value of field (c). If he has accidentally 1037 1.1 agc generated two keys with the same ID, then he must attempt to decrypt 1038 1.1 agc the message with both keys, but this case is highly unlikely to occur 1039 1.1 agc by chance. 1040 1.1 agc 1041 1.1 agc 6.5.1 RSA-encrypted data encryption key (DEK) 1042 1.1 agc 1043 1.1 agc The Data Encryption Key (DEK) is a multiprecision field which stores 1044 1.1 agc an RSA encrypted byte string. The byte string is a PKCS encoding of 1045 1.1 agc the secret key used the encrypt the message, with random padding for 1046 1.1 agc each Public-Key encrypted packet. 1047 1.1 agc 1048 1.1 agc PGP version 2.3 and later encode the DEK into an MPI using the 1049 1.1 agc following format: 1050 1.1 agc 1051 1.1 agc MSB . . . LSB 1052 1.1 agc 0 2 RND(n bytes) 0 ALG(1 byte) DEK(k bytes) CSUM(2 bytes) 1053 1.1 agc 1054 1.1 agc ALG refers to the algorithm byte for the secret key algorithm used to 1055 1.1 agc encrypt the data packet. The DEK is the actual Data Encryption Key, 1056 1.1 agc and its size is dependent upon the encryption algorithm defined by 1057 1.1 agc ALG. For the IDEA encryption algorithm, type byte 1, the DEK is 16 1058 1.1 agc bytes long. CSUM is a 16-bit checksum of the DEK, used to determine 1059 1.1 agc that the correct Private key was used to decrypt this packet. The 1060 1.1 agc checksum is computed by the 16-bit sum of the bytes in the DEK. RND 1061 1.1 agc is random padding to expand the byte to fill the size of the RSA 1062 1.1 agc Public Key that is used to encrypt the whole byte. 1063 1.1 agc 1064 1.1 agc 6.6 Public Key Packet 1065 1.1 agc 1066 1.1 agc Purpose. A public key packet defines an RSA public key. 1067 1.1 agc 1068 1.1 agc Definition. A public key packet is the concatenation of the 1069 1.1 agc following fields: 1070 1.1 agc 1071 1.1 agc (a) packet structure field (2 or 3 bytes); 1072 1.1 agc (b) version number = 2 or 3 (1 byte);; 1073 1.1 agc (c) time stamp of key creation (4 bytes); 1074 1.1 agc (d) validity period in days (0 means forever) (2 bytes); 1075 1.1 agc (e) public-key-cryptosystem (PKC) type (1 byte); 1076 1.1 agc (f) MPI of RSA public modulus n; 1077 1.1 agc (g) MPI of RSA public encryption exponent e. 1078 1.1 agc 1079 1.1 agc The validity period is always set to 0. 1080 1.1 agc 1081 1.1 agc 1082 1.1 agc 1083 1.1 agc 1084 1.1 agc Atkins, et. al. Informational [Page 19] 1085 1.1 agc 1087 1.1 agc RFC 1991 PGP Message Exchange Formats August 1996 1088 1.1 agc 1089 1.1 agc 1090 1.1 agc 6.7 User ID Packet 1091 1.1 agc 1092 1.1 agc Purpose. A user ID packet identifies a user and is associated with a 1093 1.1 agc public or private key. 1094 1.1 agc 1095 1.1 agc Definition. A user ID packet is the concatenation of the following 1096 1.1 agc fields: 1097 1.1 agc 1098 1.1 agc (a) packet structure field (2 bytes); 1099 1.1 agc (b) User ID string. 1100 1.1 agc 1101 1.1 agc The User ID string may be any string of printable ASCII characters. 1102 1.1 agc However, since the purpose of this packet is to uniquely identify an 1103 1.1 agc individual, the usual practice is for the User ID string to consist 1104 1.1 agc of the user's name followed by an e-mail address for that user, the 1105 1.1 agc latter enclosed in angle brackets. 1106 1.1 agc 1107 1.1 agc 7. Transferable Public Keys 1108 1.1 agc 1109 1.1 agc Public keys may transferred between PGP users. The essential elements 1110 1.1 agc of a transferable public key are 1111 1.1 agc 1112 1.1 agc (a) One public key packet; 1113 1.1 agc (b) One or more user ID packets; 1114 1.1 agc (c) Zero or more signature packets 1115 1.1 agc 1116 1.1 agc The public key packet occurs first. Each of the following user ID 1117 1.1 agc packets provides the identity of the owner of this public key. If 1118 1.1 agc there are multiple user ID packets, this corresponds to multiple 1119 1.1 agc means of identifying the same unique individual user; for example, a 1120 1.1 agc user may enjoy the use of more than one e-mail address, and construct 1121 1.1 agc a user ID packet for each one. Immediately following each user ID 1122 1.1 agc packet, there are zero or more signature packets. Each signature 1123 1.1 agc packet is calculated on the immediately preceding user ID packet and 1124 1.1 agc the initial public key packet. The signature serves to certify the 1125 1.1 agc corresponding public key and user ID. In effect, the signer is 1126 1.1 agc testifying to his or her belief that this public key belongs to the 1127 1.1 agc user identified by this user ID. 1128 1.1 agc 1129 1.1 agc 8. Acknowledgments 1130 1.1 agc 1131 1.1 agc Philip Zimmermann is the creator of PGP 1.0, which is the precursor 1132 1.1 agc of PGP 2.x. Major parts of later versions of PGP have been 1133 1.1 agc implemented by an international collaborative effort involving a 1134 1.1 agc large number of contributors, under the design guidance of Philip 1135 1.1 agc Zimmermann. 1136 1.1 agc 1137 1.1 agc 1138 1.1 agc 1139 1.1 agc 1140 1.1 agc 1141 1.1 agc Atkins, et. al. Informational [Page 20] 1142 1.1 agc 1144 1.1 agc RFC 1991 PGP Message Exchange Formats August 1996 1145 1.1 agc 1146 1.1 agc 1147 1.1 agc 9. Security Considerations 1148 1.1 agc 1149 1.1 agc Security issues are discussed throughout this memo. 1150 1.1 agc 1151 1.1 agc 10. Authors' Addresses 1152 1.1 agc 1153 1.1 agc Derek Atkins 1154 1.1 agc 12 Rindge Ave. #1R 1155 1.1 agc Cambridge, MA 1156 1.1 agc 1157 1.1 agc Phone: +1 617 868-4469 1158 1.1 agc EMail: warlord (a] MIT.EDU 1159 1.1 agc 1160 1.1 agc 1161 1.1 agc William Stallings 1162 1.1 agc Comp-Comm Consulting 1163 1.1 agc P. O. Box 2405 1164 1.1 agc Brewster, MA 02631 1165 1.1 agc 1166 1.1 agc EMail: stallings (a] ACM.org 1167 1.1 agc 1168 1.1 agc 1169 1.1 agc Philip Zimmermann 1170 1.1 agc Boulder Software Engineering 1171 1.1 agc 3021 Eleventh Street 1172 1.1 agc Boulder, Colorado 80304 USA 1173 1.1 agc 1174 1.1 agc Phone: +1-303-541-0140 1175 1.1 agc EMail: prz (a] acm.org 1176 1.1 agc 1177 1.1 agc 1178 1.1 agc 1179 1.1 agc 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 Atkins, et. al. Informational [Page 21] 1199 1201