idnits 2.17.1 draft-ietf-smime-rfc3369bis-04.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** Looks like you're using RFC 2026 boilerplate. This must be updated to follow RFC 3978/3979, as updated by RFC 4748. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- ** Missing expiration date. The document expiration date should appear on the first and last page. ** The document seems to lack a 1id_guidelines paragraph about Internet-Drafts being working documents. ** The document seems to lack a 1id_guidelines paragraph about the list of current Internet-Drafts. ** The document seems to lack a 1id_guidelines paragraph about the list of Shadow Directories. == No 'Intended status' indicated for this document; assuming Proposed Standard Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) ** There are 4 instances of too long lines in the document, the longest one being 1 character in excess of 72. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the RFC 3978 Section 5.4 Copyright Line does not match the current year == The document seems to lack the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. (The document does seem to have the reference to RFC 2119 which the ID-Checklist requires). -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (May 2004) is 7258 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: '0' on line 2347 -- Looks like a reference, but probably isn't: '1' on line 2349 -- Looks like a reference, but probably isn't: '2' on line 2209 -- Looks like a reference, but probably isn't: '3' on line 2210 -- Looks like a reference, but probably isn't: '4' on line 2086 ** Obsolete normative reference: RFC 3281 (ref. 'ACPROFILE') (Obsoleted by RFC 5755) ** Obsolete normative reference: RFC 3280 (ref. 'PROFILE') (Obsoleted by RFC 5280) -- Obsolete informational reference (is this intentional?): RFC 2630 (ref. 'CMS1') (Obsoleted by RFC 3369, RFC 3370) -- Obsolete informational reference (is this intentional?): RFC 3369 (ref. 'CMS2') (Obsoleted by RFC 3852) -- Obsolete informational reference (is this intentional?): RFC 2633 (ref. 'MSG') (Obsoleted by RFC 3851) -- Obsolete informational reference (is this intentional?): RFC 2560 (ref. 'OCSP') (Obsoleted by RFC 6960) -- Obsolete informational reference (is this intentional?): RFC 3211 (ref. 'PWRI') (Obsoleted by RFC 3369, RFC 3370) -- Obsolete informational reference (is this intentional?): RFC 1750 (ref. 'RANDOM') (Obsoleted by RFC 4086) Summary: 9 errors (**), 0 flaws (~~), 3 warnings (==), 14 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 S/MIME Working Group R. Housley 3 Internet-Draft Vigil Security 4 When Approved, Obsoletes: 3369 May 2004 6 Cryptographic Message Syntax (CMS) 8 10 Status of this Memo 12 This document is an Internet-Draft and is in full conformance with 13 all provisions of Section 10 of RFC2026. Internet-Drafts are working 14 documents of the Internet Engineering Task Force (IETF), its areas, 15 and its working groups. Note that other groups may also distribute 16 working documents as Internet-Drafts. 18 Internet-Drafts are draft documents valid for a maximum of six months 19 and may be updated, replaced, or obsoleted by other documents at any 20 time. It is inappropriate to use Internet-Drafts as reference 21 material or to cite them other than as "work in progress." 23 To view the entire list of current Internet-Drafts, please check the 24 "1id-abstracts.txt" listing contained in the Internet-Drafts Shadow 25 Directories on ftp.is.co.za (Africa), ftp.nordu.net (Northern 26 Europe), ftp.nis.garr.it (Southern Europe), munnari.oz.au (Pacific 27 Rim), ftp.ietf.org (US East Coast), or ftp.isi.edu (US West Coast). 29 Copyright Notice 31 Copyright (C) The Internet Society (2004). All Rights Reserved. 33 Abstract 35 This document describes the Cryptographic Message Syntax (CMS). This 36 syntax is used to digitally sign, digest, authenticate, or encrypt 37 arbitrary message content. 39 Table of Contents 41 1 Introduction ............................................. ?? 42 1.1 Evolution of the CMS ..................................... ?? 43 1.1.1 Changes Since PKCS #7 Version 1.5 ........................ ?? 44 1.1.2 Changes Since RFC 2630 ................................... ?? 45 1.1.3 Changes Since RFC 3369 ................................... ?? 46 1.2 Terminology .............................................. ?? 47 1.3 Version Numbers .......................................... ?? 48 2 General Overview ......................................... ?? 49 3 General Syntax ........................................... ?? 50 4 Data Content Type ........................................ ?? 51 5 Signed-data Content Type ................................. ?? 52 5.1 SignedData Type .......................................... ?? 53 5.2 EncapsulatedContentInfo Type ............................. ?? 54 5.2.1 Compatibility with PKCS #7 ............................... ?? 55 5.3 SignerInfo Type .......................................... ?? 56 5.4 Message Digest Calculation Process ....................... ?? 57 5.5 Signature Generation Process ............................. ?? 58 5.6 Signature Verification Process ........................... ?? 59 6 Enveloped-data Content Type .............................. ?? 60 6.1 EnvelopedData Type ....................................... ?? 61 6.2 RecipientInfo Type ....................................... ?? 62 6.2.1 KeyTransRecipientInfo Type ............................... ?? 63 6.2.2 KeyAgreeRecipientInfo Type ............................... ?? 64 6.2.3 KEKRecipientInfo Type .................................... ?? 65 6.2.4 PasswordRecipientInfo Type ............................... ?? 66 6.2.5 OtherRecipientInfo Type .................................. ?? 67 6.3 Content-encryption Process ............................... ?? 68 6.4 Key-encryption Process ................................... ?? 69 7 Digested-data Content Type ............................... ?? 70 8 Encrypted-data Content Type .............................. ?? 71 9 Authenticated-data Content Type .......................... ?? 72 9.1 AuthenticatedData Type ................................... ?? 73 9.2 MAC Generation ........................................... ?? 74 9.3 MAC Verification ......................................... ?? 75 10 Useful Types ............................................. ?? 76 10.1 Algorithm Identifier Types ............................... ?? 77 10.1.1 DigestAlgorithmIdentifier ................................ ?? 78 10.1.2 SignatureAlgorithmIdentifier ............................. ?? 79 10.1.3 KeyEncryptionAlgorithmIdentifier ......................... ?? 80 10.1.4 ContentEncryptionAlgorithmIdentifier ..................... ?? 81 10.1.5 MessageAuthenticationCodeAlgorithm ....................... ?? 82 10.1.6 KeyDerivationAlgorithmIdentifier ......................... ?? 83 10.2 Other Useful Types ....................................... ?? 84 10.2.1 RevocationInfoChoices .................................... ?? 85 10.2.2 CertificateChoices ....................................... ?? 86 10.2.3 CertificateSet ........................................... ?? 87 10.2.4 IssuerAndSerialNumber .................................... ?? 88 10.2.5 CMSVersion ............................................... ?? 89 10.2.6 UserKeyingMaterial ....................................... ?? 90 10.2.7 OtherKeyAttribute ........................................ ?? 91 11 Useful Attributes ........................................ ?? 92 11.1 Content Type ............................................. ?? 93 11.2 Message Digest ........................................... ?? 94 11.3 Signing Time ............................................. ?? 95 11.4 Countersignature ......................................... ?? 96 12 ASN.1 Modules ............................................ ?? 97 12.1 CMS ASN.1 Module ......................................... ?? 98 12.2 Version 1 Attribute Certificate ASN.1 Module ............. ?? 99 13 Normative References ..................................... ?? 100 14 Informative References ................................... ?? 101 15 Security Considerations .................................. ?? 102 16 Acknowledgments .......................................... ?? 103 17 Author Address ........................................... ?? 104 18 Full Copyright Statement ................................. ?? 106 1. Introduction 108 This document describes the Cryptographic Message Syntax (CMS). This 109 syntax is used to digitally sign, digest, authenticate, or encrypt 110 arbitrary message content. 112 The CMS describes an encapsulation syntax for data protection. It 113 supports digital signatures and encryption. The syntax allows 114 multiple encapsulations; one encapsulation envelope can be nested 115 inside another. Likewise, one party can digitally sign some 116 previously encapsulated data. It also allows arbitrary attributes, 117 such as signing time, to be signed along with the message content, 118 and provides for other attributes such as countersignatures to be 119 associated with a signature. 121 The CMS can support a variety of architectures for certificate-based 122 key management, such as the one defined by the PKIX working group 123 [PROFILE]. 125 The CMS values are generated using ASN.1 [X.208-88], using BER- 126 encoding [X.209-88]. Values are typically represented as octet 127 strings. While many systems are capable of transmitting arbitrary 128 octet strings reliably, it is well known that many electronic mail 129 systems are not. This document does not address mechanisms for 130 encoding octet strings for reliable transmission in such 131 environments. 133 1.1 Evolution of the CMS 135 The CMS is derived from PKCS #7 version 1.5, which is documented in 136 RFC 2315 [PKCS#7]. PKCS #7 version 1.5 was developed outside of the 137 IETF; it was originally published as an RSA Laboratories Technical 138 Note in November 1993. Since that time, the IETF has taken 139 responsibility for the development and maintenance of the CMS. 140 Today, several important IETF standards-track protocols make use of 141 the CMS. 143 This section describes that changes that the IETF has made to the CMS 144 in each of the published versions. 146 1.1.1 Changes Since PKCS #7 Version 1.5 148 RFC 2630 [CMS1] was the first version of the CMS on the IETF 149 standards track. Wherever possible, backward compatibility with PKCS 150 #7 version 1.5 is preserved; however, changes were made to 151 accommodate version 1 attribute certificate transfer and to support 152 algorithm independent key management. PKCS #7 version 1.5 included 153 support only for key transport. RFC 2630 adds support for key 154 agreement and previously distributed symmetric key-encryption key 155 techniques. 157 1.1.2 Changes Since RFC 2630 159 RFC 3369 [CMS2] obsoletes RFC 2630 [CMS1] and RFC 3211 [PWRI]. 160 Password-based key management is included in the CMS specification, 161 and an extension mechanism to support new key management schemes 162 without further changes to the CMS is specified. Backward 163 compatibility with RFC 2630 and RFC 3211 is preserved; however, 164 version 2 attribute certificate transfer is added, and the use of 165 version 1 attribute certificates is deprecated. 167 S/MIME v2 signatures [OLDMSG], which are based on PKCS#7 version 1.5, 168 are compatible with S/MIME v3 signatures [MSG], which are based on 169 RFC 2630. However, there are some subtle compatibility issues with 170 signatures based on PKCS #7 version 1.5. These issues are discussed 171 in section 5.2.1. These issues remain with the current version of 172 the CMS. 174 Specific cryptographic algorithms are not discussed in this document, 175 but they were discussed in RFC 2630. The discussion of specific 176 cryptographic algorithms has been moved to a separate document 177 [CMSALG]. Separation of the protocol and algorithm specifications 178 allows the IETF to update each document independently. This 179 specification does not require the implementation of any particular 180 algorithms. Rather, protocols that rely on the CMS are expected to 181 choose appropriate algorithms for their environment. The algorithms 182 may be selected from [CMSALG] or elsewhere. 184 1.1.3 Changes Since RFC 3369 186 This document obsoletes RFC 3369 [CMS2]. As discussed in the 187 previous section, RFC 3369 introduced an extension mechanism to 188 support new key management schemes without further changes to the 189 CMS. This document introduces a similar extension mechanism to 190 support additional certificate formats and revocation status 191 information formats without further changes to the CMS. These 192 extensions are primarily documented in section 10.2.1 and section 193 10.2.2. Backward compatibility with earlier versions of the CMS is 194 preserved. 196 The use of version numbers is described in section 1.3. 198 Since the publication of RFC 3369, a few errata have been noted. 199 These errata are posted on the RFC Editor web site. These errors 200 have been corrected in this document. 202 The text in section 11.4 that describes the counter signature 203 unsigned attribute is clarified. Hopefully the revised text is 204 clearer about the portion of the SignerInfo signature that is covered 205 by a countersignature. 207 1.2 Terminology 209 In this document, the key words MUST, MUST NOT, REQUIRED, SHOULD, 210 SHOULD NOT, RECOMMENDED, MAY, and OPTIONAL are to be interpreted as 211 described in [STDWORDS]. 213 1.3 Version Numbers 215 Each of the major data structures includes a version number as the 216 first item in the data structure. The version numbers are intended 217 to avoid ASN.1 decode errors. Some implementations do not check the 218 version number prior to attempting a decode, and if a decode error 219 occurs, then the version number is checked as part of the error 220 handling routine. This is a reasonable approach; it places error 221 processing outside of the fast path. This approach is also forgiving 222 when an incorrect version number is used by the sender. 224 Most of the initial version numbers were assigned in PKCS #7 version 225 1.5. Others were assigned when the structure was initially created. 226 Whenever a structure is updated, a higher version number is assigned. 227 However, to ensure maximum interoperability the higher version number 228 is only used when the new syntax feature is employed. That is, the 229 lowest version number that supports the generated syntax is used. 231 2 General Overview 233 The CMS is general enough to support many different content types. 234 This document defines one protection content, ContentInfo. 235 ContentInfo encapsulates a single identified content type, and the 236 identified type may provide further encapsulation. This document 237 defines six content types: data, signed-data, enveloped-data, 238 digested-data, encrypted-data, and authenticated-data. Additional 239 content types can be defined outside this document. 241 An implementation that conforms to this specification MUST implement 242 the protection content, ContentInfo, and MUST implement the data, 243 signed-data, and enveloped-data content types. The other content 244 types MAY be implemented. 246 As a general design philosophy, each content type permits single pass 247 processing using indefinite-length Basic Encoding Rules (BER) 248 encoding. Single-pass operation is especially helpful if content is 249 large, stored on tapes, or is "piped" from another process. Single- 250 pass operation has one significant drawback: it is difficult to 251 perform encode operations using the Distinguished Encoding Rules 252 (DER) [X.509-88] encoding in a single pass since the lengths of the 253 various components may not be known in advance. However, signed 254 attributes within the signed-data content type and authenticated 255 attributes within the authenticated-data content type need to be 256 transmitted in DER form to ensure that recipients can verify a 257 content that contains one or more unrecognized attributes. Signed 258 attributes and authenticated attributes are the only data types used 259 in the CMS that require DER encoding. 261 3 General Syntax 263 The following object identifier identifies the content information 264 type: 266 id-ct-contentInfo OBJECT IDENTIFIER ::= { iso(1) member-body(2) 267 us(840) rsadsi(113549) pkcs(1) pkcs9(9) smime(16) ct(1) 6 } 269 The CMS associates a content type identifier with a content. The 270 syntax MUST have ASN.1 type ContentInfo: 272 ContentInfo ::= SEQUENCE { 273 contentType ContentType, 274 content [0] EXPLICIT ANY DEFINED BY contentType } 276 ContentType ::= OBJECT IDENTIFIER 278 The fields of ContentInfo have the following meanings: 280 contentType indicates the type of the associated content. It is 281 an object identifier; it is a unique string of integers assigned 282 by an authority that defines the content type. 284 content is the associated content. The type of content can be 285 determined uniquely by contentType. Content types for data, 286 signed-data, enveloped-data, digested-data, encrypted-data, and 287 authenticated-data are defined in this document. If additional 288 content types are defined in other documents, the ASN.1 type 289 defined SHOULD NOT be a CHOICE type. 291 4 Data Content Type 293 The following object identifier identifies the data content type: 295 id-data OBJECT IDENTIFIER ::= { iso(1) member-body(2) 296 us(840) rsadsi(113549) pkcs(1) pkcs7(7) 1 } 298 The data content type is intended to refer to arbitrary octet 299 strings, such as ASCII text files; the interpretation is left to the 300 application. Such strings need not have any internal structure 301 (although they could have their own ASN.1 definition or other 302 structure). 304 S/MIME uses id-data to identify MIME encoded content. The use of 305 this content identifier is specified in RFC 2311 for S/MIME v2 306 [OLDMSG] and RFC 2633 for S/MIME v3 [MSG]. 308 The data content type is generally encapsulated in the signed-data, 309 enveloped-data, digested-data, encrypted-data, or authenticated-data 310 content type. 312 5. Signed-data Content Type 314 The signed-data content type consists of a content of any type and 315 zero or more signature values. Any number of signers in parallel can 316 sign any type of content. 318 The typical application of the signed-data content type represents 319 one signer's digital signature on content of the data content type. 320 Another typical application disseminates certificates and certificate 321 revocation lists (CRLs). 323 The process by which signed-data is constructed involves the 324 following steps: 326 1. For each signer, a message digest, or hash value, is computed 327 on the content with a signer-specific message-digest algorithm. 328 If the signer is signing any information other than the content, 329 the message digest of the content and the other information are 330 digested with the signer's message digest algorithm (see Section 331 5.4), and the result becomes the "message digest." 333 2. For each signer, the message digest is digitally signed using 334 the signer's private key. 336 3. For each signer, the signature value and other signer-specific 337 information are collected into a SignerInfo value, as defined in 338 Section 5.3. Certificates and CRLs for each signer, and those not 339 corresponding to any signer, are collected in this step. 341 4. The message digest algorithms for all the signers and the 342 SignerInfo values for all the signers are collected together with 343 the content into a SignedData value, as defined in Section 5.1. 345 A recipient independently computes the message digest. This message 346 digest and the signer's public key are used to verify the signature 347 value. The signer's public key is referenced either by an issuer 348 distinguished name along with an issuer-specific serial number or by 349 a subject key identifier that uniquely identifies the certificate 350 containing the public key. The signer's certificate can be included 351 in the SignedData certificates field. 353 This section is divided into six parts. The first part describes the 354 top-level type SignedData, the second part describes 355 EncapsulatedContentInfo, the third part describes the per-signer 356 information type SignerInfo, and the fourth, fifth, and sixth parts 357 describe the message digest calculation, signature generation, and 358 signature verification processes, respectively. 360 5.1 SignedData Type 362 The following object identifier identifies the signed-data content 363 type: 365 id-signedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) 366 us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 } 368 The signed-data content type shall have ASN.1 type SignedData: 370 SignedData ::= SEQUENCE { 371 version CMSVersion, 372 digestAlgorithms DigestAlgorithmIdentifiers, 373 encapContentInfo EncapsulatedContentInfo, 374 certificates [0] IMPLICIT CertificateSet OPTIONAL, 375 crls [1] IMPLICIT RevocationInfoChoices OPTIONAL, 376 signerInfos SignerInfos } 378 DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier 380 SignerInfos ::= SET OF SignerInfo 382 The fields of type SignedData have the following meanings: 384 version is the syntax version number. The appropriate value 385 depends on certificates, eContentType, and SignerInfo. The 386 version MUST be assigned as follows: 388 IF ((certificates is present) AND 389 (any certificates with a type of other are present)) OR 390 ((crls is present) AND 391 (any crls with a type of other are present)) 392 THEN version MUST be 5 393 ELSE 394 IF (certificates is present) AND 395 (any version 2 attribute certificates are present) 396 THEN version MUST be 4 397 ELSE 398 IF ((certificates is present) AND 399 (any version 1 attribute certificates are present)) OR 400 (any SignerInfo structures are version 3) OR 401 (encapContentInfo eContentType is other than id-data) 402 THEN version MUST be 3 403 ELSE version MUST be 1 405 digestAlgorithms is a collection of message digest algorithm 406 identifiers. There MAY be any number of elements in the 407 collection, including zero. Each element identifies the message 408 digest algorithm, along with any associated parameters, used by 409 one or more signer. The collection is intended to list the 410 message digest algorithms employed by all of the signers, in any 411 order, to facilitate one-pass signature verification. 412 Implementations MAY fail to validate signatures that use a digest 413 algorithm that is not included in this set. The message digesting 414 process is described in Section 5.4. 416 encapContentInfo is the signed content, consisting of a content 417 type identifier and the content itself. Details of the 418 EncapsulatedContentInfo type are discussed in section 5.2. 420 certificates is a collection of certificates. It is intended that 421 the set of certificates be sufficient to contain certification 422 paths from a recognized "root" or "top-level certification 423 authority" to all of the signers in the signerInfos field. There 424 may be more certificates than necessary, and there may be 425 certificates sufficient to contain certification paths from two or 426 more independent top-level certification authorities. There may 427 also be fewer certificates than necessary, if it is expected that 428 recipients have an alternate means of obtaining necessary 429 certificates (e.g., from a previous set of certificates). The 430 signer's certificate MAY be included. The use of version 1 431 attribute certificates is strongly discouraged. 433 crls is a collection of revocation status information. It is 434 intended that the collection contain information sufficient to 435 determine whether the certificates in the certificates field are 436 valid, but such correspondence is not necessary. Certificate 437 revocation lists (CRLs) are the primary source of revocation 438 status information. There MAY be more CRLs than necessary, and 439 there MAY also be fewer CRLs than necessary. 441 signerInfos is a collection of per-signer information. There MAY 442 be any number of elements in the collection, including zero. The 443 details of the SignerInfo type are discussed in section 5.3. 444 Since each signer can employ a digital signature technique and 445 future specifications could update the syntax, all implementations 446 MUST gracefully handle unimplemented versions of SignerInfo. 447 Further, since all implementations will not support every possible 448 signature algorithm, all implementations MUST gracefully handle 449 unimplemented signature algorithms when they are encountered. 451 5.2 EncapsulatedContentInfo Type 453 The content is represented in the type EncapsulatedContentInfo: 455 EncapsulatedContentInfo ::= SEQUENCE { 456 eContentType ContentType, 457 eContent [0] EXPLICIT OCTET STRING OPTIONAL } 459 ContentType ::= OBJECT IDENTIFIER 461 The fields of type EncapsulatedContentInfo have the following 462 meanings: 464 eContentType is an object identifier. The object identifier 465 uniquely specifies the content type. 467 eContent is the content itself, carried as an octet string. The 468 eContent need not be DER encoded. 470 The optional omission of the eContent within the 471 EncapsulatedContentInfo field makes it possible to construct 472 "external signatures." In the case of external signatures, the 473 content being signed is absent from the EncapsulatedContentInfo value 474 included in the signed-data content type. If the eContent value 475 within EncapsulatedContentInfo is absent, then the signatureValue is 476 calculated and the eContentType is assigned as though the eContent 477 value was present. 479 In the degenerate case where there are no signers, the 480 EncapsulatedContentInfo value being "signed" is irrelevant. In this 481 case, the content type within the EncapsulatedContentInfo value being 482 "signed" MUST be id-data (as defined in section 4), and the content 483 field of the EncapsulatedContentInfo value MUST be omitted. 485 5.2.1 Compatibility with PKCS #7 487 This section contains a word of warning to implementers that wish to 488 support both the CMS and PKCS #7 [PKCS#7] SignedData content types. 490 Both the CMS and PKCS #7 identify the type of the encapsulated 491 content with an object identifier, but the ASN.1 type of the content 492 itself is variable in PKCS #7 SignedData content type. 494 PKCS #7 defines content as: 496 content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL 498 The CMS defines eContent as: 500 eContent [0] EXPLICIT OCTET STRING OPTIONAL 502 The CMS definition is much easier to use in most applications, and it 503 is compatible with both S/MIME v2 and S/MIME v3. S/MIME signed 504 messages using the CMS and PKCS #7 are compatible because identical 505 signed message formats are specified in RFC 2311 for S/MIME v2 506 [OLDMSG] and RFC 2633 for S/MIME v3 [MSG]. S/MIME v2 encapsulates 507 the MIME content in a Data type (that is, an OCTET STRING) carried in 508 the SignedData contentInfo content ANY field, and S/MIME v3 carries 509 the MIME content in the SignedData encapContentInfo eContent OCTET 510 STRING. Therefore, in both S/MIME v2 and S/MIME v3, the MIME content 511 is placed in an OCTET STRING and the message digest is computed over 512 the identical portions of the content. That is, the message digest 513 is computed over the octets comprising the value of the OCTET STRING, 514 neither the tag nor length octets are included. 516 There are incompatibilities between the CMS and PKCS #7 SignedData 517 types when the encapsulated content is not formatted using the Data 518 type. For example, when an RFC 2634 [ESS] signed receipt is 519 encapsulated in the CMS SignedData type, then the Receipt SEQUENCE is 520 encoded in the SignedData encapContentInfo eContent OCTET STRING and 521 the message digest is computed using the entire Receipt SEQUENCE 522 encoding (including tag, length and value octets). However, if an 523 RFC 2634 signed receipt is encapsulated in the PKCS #7 SignedData 524 type, then the Receipt SEQUENCE is DER encoded [X.509-88] in the 525 SignedData contentInfo content ANY field (a SEQUENCE, not an OCTET 526 STRING). Therefore, the message digest is computed using only the 527 value octets of the Receipt SEQUENCE encoding. 529 The following strategy can be used to achieve backward compatibility 530 with PKCS #7 when processing SignedData content types. If the 531 implementation is unable to ASN.1 decode the SignedData type using 532 the CMS SignedData encapContentInfo eContent OCTET STRING syntax, 533 then the implementation MAY attempt to decode the SignedData type 534 using the PKCS #7 SignedData contentInfo content ANY syntax and 535 compute the message digest accordingly. 537 The following strategy can be used to achieve backward compatibility 538 with PKCS #7 when creating a SignedData content type in which the 539 encapsulated content is not formatted using the Data type. 540 Implementations MAY examine the value of the eContentType, and then 541 adjust the expected DER encoding of eContent based on the object 542 identifier value. For example, to support Microsoft Authenticode 543 [MSAC], the following information MAY be included: 545 eContentType Object Identifier is set to { 1 3 6 1 4 1 311 2 1 4 } 547 eContent contains DER encoded Authenticode signing information 549 5.3 SignerInfo Type 551 Per-signer information is represented in the type SignerInfo: 553 SignerInfo ::= SEQUENCE { 554 version CMSVersion, 555 sid SignerIdentifier, 556 digestAlgorithm DigestAlgorithmIdentifier, 557 signedAttrs [0] IMPLICIT SignedAttributes OPTIONAL, 558 signatureAlgorithm SignatureAlgorithmIdentifier, 559 signature SignatureValue, 560 unsignedAttrs [1] IMPLICIT UnsignedAttributes OPTIONAL } 562 SignerIdentifier ::= CHOICE { 563 issuerAndSerialNumber IssuerAndSerialNumber, 564 subjectKeyIdentifier [0] SubjectKeyIdentifier } 566 SignedAttributes ::= SET SIZE (1..MAX) OF Attribute 568 UnsignedAttributes ::= SET SIZE (1..MAX) OF Attribute 570 Attribute ::= SEQUENCE { 571 attrType OBJECT IDENTIFIER, 572 attrValues SET OF AttributeValue } 574 AttributeValue ::= ANY 576 SignatureValue ::= OCTET STRING 578 The fields of type SignerInfo have the following meanings: 580 version is the syntax version number. If the SignerIdentifier is 581 the CHOICE issuerAndSerialNumber, then the version MUST be 1. If 582 the SignerIdentifier is subjectKeyIdentifier, then the version 583 MUST be 3. 585 sid specifies the signer's certificate (and thereby the signer's 586 public key). The signer's public key is needed by the recipient 587 to verify the signature. SignerIdentifier provides two 588 alternatives for specifying the signer's public key. The 589 issuerAndSerialNumber alternative identifies the signer's 590 certificate by the issuer's distinguished name and the certificate 591 serial number; the subjectKeyIdentifier identifies the signer's 592 certificate by a key identifier. When an X.509 certificate is 593 reference, the key identifier matches the X.509 594 subjectKeyIdentifier extension value. When other certificate 595 formats are referenced, the documents that specify the certificate 596 format and their use with the CMS must include details on matching 597 the key identifier to the appropriate certificate field. 598 Implementations MUST support the reception of the 599 issuerAndSerialNumber and subjectKeyIdentifier forms of 600 SignerIdentifier. When generating a SignerIdentifier, 601 implementations MAY support one of the forms (either 602 issuerAndSerialNumber or subjectKeyIdentifier) and always use it, 603 or implementations MAY arbitrarily mix the two forms. However, 604 subjectKeyIdentifier MUST be used to refer to a public key 605 contained in a non-X.509 certificate. 607 digestAlgorithm identifies the message digest algorithm, and any 608 associated parameters, used by the signer. The message digest is 609 computed on either the content being signed or the content 610 together with the signed attributes using the process described in 611 section 5.4. The message digest algorithm SHOULD be among those 612 listed in the digestAlgorithms field of the associated SignerData. 613 Implementations MAY fail to validate signatures that use a digest 614 algorithm that is not included in the SignedData digestAlgorithms 615 set. 617 signedAttrs is a collection of attributes that are signed. The 618 field is optional, but it MUST be present if the content type of 619 the EncapsulatedContentInfo value being signed is not id-data. 620 SignedAttributes MUST be DER encoded, even if the rest of the 621 structure is BER encoded. Useful attribute types, such as signing 622 time, are defined in Section 11. If the field is present, it MUST 623 contain, at a minimum, the following two attributes: 625 A content-type attribute having as its value the content type 626 of the EncapsulatedContentInfo value being signed. Section 627 11.1 defines the content-type attribute. However, the content- 628 type attribute MUST NOT be used as part of a countersignature 629 unsigned attribute as defined in section 11.4. 631 A message-digest attribute, having as its value the message 632 digest of the content. Section 11.2 defines the message-digest 633 attribute. 635 signatureAlgorithm identifies the signature algorithm, and any 636 associated parameters, used by the signer to generate the digital 637 signature. 639 signature is the result of digital signature generation, using the 640 message digest and the signer's private key. The details of the 641 signature depend on the signature algorithm employed. 643 unsignedAttrs is a collection of attributes that are not signed. 644 The field is optional. Useful attribute types, such as 645 countersignatures, are defined in Section 11. 647 The fields of type SignedAttribute and UnsignedAttribute have the 648 following meanings: 650 attrType indicates the type of attribute. It is an object 651 identifier. 653 attrValues is a set of values that comprise the attribute. The 654 type of each value in the set can be determined uniquely by 655 attrType. The attrType can impose restrictions on the number of 656 items in the set. 658 5.4 Message Digest Calculation Process 660 The message digest calculation process computes a message digest on 661 either the content being signed or the content together with the 662 signed attributes. In either case, the initial input to the message 663 digest calculation process is the "value" of the encapsulated content 664 being signed. Specifically, the initial input is the 665 encapContentInfo eContent OCTET STRING to which the signing process 666 is applied. Only the octets comprising the value of the eContent 667 OCTET STRING are input to the message digest algorithm, not the tag 668 or the length octets. 670 The result of the message digest calculation process depends on 671 whether the signedAttrs field is present. When the field is absent, 672 the result is just the message digest of the content as described 673 above. When the field is present, however, the result is the message 674 digest of the complete DER encoding of the SignedAttrs value 675 contained in the signedAttrs field. Since the SignedAttrs value, 676 when present, must contain the content-type and the message-digest 677 attributes, those values are indirectly included in the result. The 678 content-type attribute MUST NOT be included in a countersignature 679 unsigned attribute as defined in section 11.4. A separate encoding 680 of the signedAttrs field is performed for message digest calculation. 681 The IMPLICIT [0] tag in the signedAttrs is not used for the DER 682 encoding, rather an EXPLICIT SET OF tag is used. That is, the DER 683 encoding of the EXPLICIT SET OF tag, rather than of the IMPLICIT [0] 684 tag, MUST be included in the message digest calculation along with 685 the length and content octets of the SignedAttributes value. 687 When the signedAttrs field is absent, only the octets comprising the 688 value of the SignedData encapContentInfo eContent OCTET STRING (e.g., 689 the contents of a file) are input to the message digest calculation. 690 This has the advantage that the length of the content being signed 691 need not be known in advance of the signature generation process. 693 Although the encapContentInfo eContent OCTET STRING tag and length 694 octets are not included in the message digest calculation, they are 695 protected by other means. The length octets are protected by the 696 nature of the message digest algorithm since it is computationally 697 infeasible to find any two distinct message contents of any length 698 that have the same message digest. 700 5.5 Signature Generation Process 702 The input to the signature generation process includes the result of 703 the message digest calculation process and the signer's private key. 704 The details of the signature generation depend on the signature 705 algorithm employed. The object identifier, along with any 706 parameters, that specifies the signature algorithm employed by the 707 signer is carried in the signatureAlgorithm field. The signature 708 value generated by the signer MUST be encoded as an OCTET STRING and 709 carried in the signature field. 711 5.6 Signature Verification Process 713 The input to the signature verification process includes the result 714 of the message digest calculation process and the signer's public 715 key. The recipient MAY obtain the correct public key for the signer 716 by any means, but the preferred method is from a certificate obtained 717 from the SignedData certificates field. The selection and validation 718 of the signer's public key MAY be based on certification path 719 validation (see [PROFILE]) as well as other external context, but is 720 beyond the scope of this document. The details of the signature 721 verification depend on the signature algorithm employed. 723 The recipient MUST NOT rely on any message digest values computed by 724 the originator. If the SignedData signerInfo includes 725 signedAttributes, then the content message digest MUST be calculated 726 as described in section 5.4. For the signature to be valid, the 727 message digest value calculated by the recipient MUST be the same as 728 the value of the messageDigest attribute included in the 729 signedAttributes of the SignedData signerInfo. 731 If the SignedData signerInfo includes signedAttributes, then the 732 content-type attribute value MUST match the SignedData 733 encapContentInfo eContentType value. 735 6. Enveloped-data Content Type 737 The enveloped-data content type consists of an encrypted content of 738 any type and encrypted content-encryption keys for one or more 739 recipients. The combination of the encrypted content and one 740 encrypted content-encryption key for a recipient is a "digital 741 envelope" for that recipient. Any type of content can be enveloped 742 for an arbitrary number of recipients using any of the supported key 743 management techniques for each recipient. 745 The typical application of the enveloped-data content type will 746 represent one or more recipients' digital envelopes on content of the 747 data or signed-data content types. 749 Enveloped-data is constructed by the following steps: 751 1. A content-encryption key for a particular content-encryption 752 algorithm is generated at random. 754 2. The content-encryption key is encrypted for each recipient. 755 The details of this encryption depend on the key management 756 algorithm used, but four general techniques are supported: 758 key transport: the content-encryption key is encrypted in the 759 recipient's public key; 761 key agreement: the recipient's public key and the sender's 762 private key are used to generate a pairwise symmetric key, then 763 the content-encryption key is encrypted in the pairwise 764 symmetric key; 766 symmetric key-encryption keys: the content-encryption key is 767 encrypted in a previously distributed symmetric key-encryption 768 key; and 770 passwords: the content-encryption key is encrypted in a key- 771 encryption key that is derived from a password or other shared 772 secret value. 774 3. For each recipient, the encrypted content-encryption key and 775 other recipient-specific information are collected into a 776 RecipientInfo value, defined in Section 6.2. 778 4. The content is encrypted with the content-encryption key. 779 Content encryption may require that the content be padded to a 780 multiple of some block size; see Section 6.3. 782 5. The RecipientInfo values for all the recipients are collected 783 together with the encrypted content to form an EnvelopedData value 784 as defined in Section 6.1. 786 A recipient opens the digital envelope by decrypting one of the 787 encrypted content-encryption keys and then decrypting the encrypted 788 content with the recovered content-encryption key. 790 This section is divided into four parts. The first part describes 791 the top-level type EnvelopedData, the second part describes the per- 792 recipient information type RecipientInfo, and the third and fourth 793 parts describe the content-encryption and key-encryption processes. 795 6.1 EnvelopedData Type 797 The following object identifier identifies the enveloped-data content 798 type: 800 id-envelopedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) 801 us(840) rsadsi(113549) pkcs(1) pkcs7(7) 3 } 803 The enveloped-data content type shall have ASN.1 type EnvelopedData: 805 EnvelopedData ::= SEQUENCE { 806 version CMSVersion, 807 originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL, 808 recipientInfos RecipientInfos, 809 encryptedContentInfo EncryptedContentInfo, 810 unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL } 812 OriginatorInfo ::= SEQUENCE { 813 certs [0] IMPLICIT CertificateSet OPTIONAL, 814 crls [1] IMPLICIT RevocationInfoChoices OPTIONAL } 816 RecipientInfos ::= SET SIZE (1..MAX) OF RecipientInfo 818 EncryptedContentInfo ::= SEQUENCE { 819 contentType ContentType, 820 contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier, 821 encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL } 823 EncryptedContent ::= OCTET STRING 825 UnprotectedAttributes ::= SET SIZE (1..MAX) OF Attribute 827 The fields of type EnvelopedData have the following meanings: 829 version is the syntax version number. The appropriate value 830 depends on originatorInfo, RecipientInfo, and unprotectedAttrs. 831 The version MUST be assigned as follows: 833 IF (originatorInfo is present) AND 834 ((any certificates with a type of other are present) OR 835 (any crls with a type of other are present)) 836 THEN version is 4 837 ELSE 838 IF ((originatorInfo is present) AND 839 (any version 2 attribute certificates are present)) OR 840 (any RecipientInfo structures include pwri) OR 841 (any RecipientInfo structures include ori) 842 THEN version is 3 843 ELSE 844 IF (originatorInfo is absent) OR 845 (unprotectedAttrs is absent) OR 846 (all RecipientInfo structures are version 0) 847 THEN version is 0 848 ELSE version is 2 850 originatorInfo optionally provides information about the 851 originator. It is present only if required by the key management 852 algorithm. It may contain certificates and CRLs: 854 certs is a collection of certificates. certs may contain 855 originator certificates associated with several different key 856 management algorithms. certs may also contain attribute 857 certificates associated with the originator. The certificates 858 contained in certs are intended to be sufficient for all 859 recipients to build certification paths from a recognized 860 "root" or "top-level certification authority." However, certs 861 may contain more certificates than necessary, and there may be 862 certificates sufficient to make certification paths from two or 863 more independent top-level certification authorities. 864 Alternatively, certs may contain fewer certificates than 865 necessary, if it is expected that recipients have an alternate 866 means of obtaining necessary certificates (e.g., from a 867 previous set of certificates). 869 crls is a collection of CRLs. It is intended that the set 870 contain information sufficient to determine whether or not the 871 certificates in the certs field are valid, but such 872 correspondence is not necessary. There MAY be more CRLs than 873 necessary, and there MAY also be fewer CRLs than necessary. 875 recipientInfos is a collection of per-recipient information. 876 There MUST be at least one element in the collection. 878 encryptedContentInfo is the encrypted content information. 880 unprotectedAttrs is a collection of attributes that are not 881 encrypted. The field is optional. Useful attribute types are 882 defined in Section 11. 884 The fields of type EncryptedContentInfo have the following meanings: 886 contentType indicates the type of content. 888 contentEncryptionAlgorithm identifies the content-encryption 889 algorithm, and any associated parameters, used to encrypt the 890 content. The content-encryption process is described in Section 891 6.3. The same content-encryption algorithm and content-encryption 892 key are used for all recipients. 894 encryptedContent is the result of encrypting the content. The 895 field is optional, and if the field is not present, its intended 896 value must be supplied by other means. 898 The recipientInfos field comes before the encryptedContentInfo field 899 so that an EnvelopedData value may be processed in a single pass. 901 6.2 RecipientInfo Type 903 Per-recipient information is represented in the type RecipientInfo. 904 RecipientInfo has a different format for each of the supported key 905 management techniques. Any of the key management techniques can be 906 used for each recipient of the same encrypted content. In all cases, 907 the encrypted content-encryption key is transferred to one or more 908 recipients. 910 Since all implementations will not support every possible key 911 management algorithm, all implementations MUST gracefully handle 912 unimplemented algorithms when they are encountered. For example, if 913 a recipient receives a content-encryption key encrypted in their RSA 914 public key using RSA-OAEP and the implementation only supports RSA 915 PKCS #1 v1.5, then a graceful failure must be implemented. 917 Implementations MUST support key transport, key agreement, and 918 previously distributed symmetric key-encryption keys, as represented 919 by ktri, kari, and kekri, respectively. Implementations MAY support 920 the password-based key management as represented by pwri. 921 Implementations MAY support any other key management technique as 922 represented by ori. Since each recipient can employ a different key 923 management technique and future specifications could define 924 additional key management techniques, all implementations MUST 925 gracefully handle unimplemented alternatives within the RecipientInfo 926 CHOICE, all implementations MUST gracefully handle unimplemented 927 versions of otherwise supported alternatives within the RecipientInfo 928 CHOICE, and all implementations MUST gracefully handle unimplemented 929 or unknown ori alternatives. 931 RecipientInfo ::= CHOICE { 932 ktri KeyTransRecipientInfo, 933 kari [1] KeyAgreeRecipientInfo, 934 kekri [2] KEKRecipientInfo, 935 pwri [3] PasswordRecipientinfo, 936 ori [4] OtherRecipientInfo } 938 EncryptedKey ::= OCTET STRING 940 6.2.1 KeyTransRecipientInfo Type 942 Per-recipient information using key transport is represented in the 943 type KeyTransRecipientInfo. Each instance of KeyTransRecipientInfo 944 transfers the content-encryption key to one recipient. 946 KeyTransRecipientInfo ::= SEQUENCE { 947 version CMSVersion, -- always set to 0 or 2 948 rid RecipientIdentifier, 949 keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier, 950 encryptedKey EncryptedKey } 952 RecipientIdentifier ::= CHOICE { 953 issuerAndSerialNumber IssuerAndSerialNumber, 954 subjectKeyIdentifier [0] SubjectKeyIdentifier } 956 The fields of type KeyTransRecipientInfo have the following meanings: 958 version is the syntax version number. If the RecipientIdentifier 959 is the CHOICE issuerAndSerialNumber, then the version MUST be 0. 960 If the RecipientIdentifier is subjectKeyIdentifier, then the 961 version MUST be 2. 963 rid specifies the recipient's certificate or key that was used by 964 the sender to protect the content-encryption key. The content- 965 encryption key is encrypted with the recipient's public key. The 966 RecipientIdentifier provides two alternatives for specifying the 967 recipient's certificate, and thereby the recipient's public key. 968 The recipient's certificate must contain a key transport public 969 key. Therefore, a recipient X.509 version 3 certificate that 970 contains a key usage extension MUST assert the keyEncipherment 971 bit. The issuerAndSerialNumber alternative identifies the 972 recipient's certificate by the issuer's distinguished name and the 973 certificate serial number; the subjectKeyIdentifier identifies the 974 recipient's certificate by a key identifier. When an X.509 975 certificate is referenced, the key identifier matches the X.509 976 subjectKeyIdentifier extension value. When other certificate 977 formats are referenced, the documents that specify the certificate 978 format and their use with the CMS must include details on matching 979 the key identifier to the appropriate certificate field. For 980 recipient processing, implementations MUST support both of these 981 alternatives for specifying the recipient's certificate. For 982 sender processing, implementations MUST support at least one of 983 these alternatives. 985 keyEncryptionAlgorithm identifies the key-encryption algorithm, 986 and any associated parameters, used to encrypt the content- 987 encryption key for the recipient. The key-encryption process is 988 described in Section 6.4. 990 encryptedKey is the result of encrypting the content-encryption 991 key for the recipient. 993 6.2.2 KeyAgreeRecipientInfo Type 995 Recipient information using key agreement is represented in the type 996 KeyAgreeRecipientInfo. Each instance of KeyAgreeRecipientInfo will 997 transfer the content-encryption key to one or more recipients that 998 use the same key agreement algorithm and domain parameters for that 999 algorithm. 1001 KeyAgreeRecipientInfo ::= SEQUENCE { 1002 version CMSVersion, -- always set to 3 1003 originator [0] EXPLICIT OriginatorIdentifierOrKey, 1004 ukm [1] EXPLICIT UserKeyingMaterial OPTIONAL, 1005 keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier, 1006 recipientEncryptedKeys RecipientEncryptedKeys } 1008 OriginatorIdentifierOrKey ::= CHOICE { 1009 issuerAndSerialNumber IssuerAndSerialNumber, 1010 subjectKeyIdentifier [0] SubjectKeyIdentifier, 1011 originatorKey [1] OriginatorPublicKey } 1013 OriginatorPublicKey ::= SEQUENCE { 1014 algorithm AlgorithmIdentifier, 1015 publicKey BIT STRING } 1017 RecipientEncryptedKeys ::= SEQUENCE OF RecipientEncryptedKey 1019 RecipientEncryptedKey ::= SEQUENCE { 1020 rid KeyAgreeRecipientIdentifier, 1021 encryptedKey EncryptedKey } 1023 KeyAgreeRecipientIdentifier ::= CHOICE { 1024 issuerAndSerialNumber IssuerAndSerialNumber, 1025 rKeyId [0] IMPLICIT RecipientKeyIdentifier } 1027 RecipientKeyIdentifier ::= SEQUENCE { 1028 subjectKeyIdentifier SubjectKeyIdentifier, 1029 date GeneralizedTime OPTIONAL, 1030 other OtherKeyAttribute OPTIONAL } 1032 SubjectKeyIdentifier ::= OCTET STRING 1034 The fields of type KeyAgreeRecipientInfo have the following meanings: 1036 version is the syntax version number. It MUST always be 3. 1038 originator is a CHOICE with three alternatives specifying the 1039 sender's key agreement public key. The sender uses the 1040 corresponding private key and the recipient's public key to 1041 generate a pairwise key. The content-encryption key is encrypted 1042 in the pairwise key. The issuerAndSerialNumber alternative 1043 identifies the sender's certificate, and thereby the sender's 1044 public key, by the issuer's distinguished name and the certificate 1045 serial number. The subjectKeyIdentifier alternative identifies 1046 the sender's certificate, and thereby the sender's public key, by 1047 a key identifier. When an X.509 certificate is referenced, the 1048 key identifier matches the X.509 subjectKeyIdentifier extension 1049 value. When other certificate formats are referenced, the 1050 documents that specify the certificate format and their use with 1051 the CMS must must include details on matching the key identifier 1052 to the appropriate certificate field. The originatorKey 1053 alternative includes the algorithm identifier and sender's key 1054 agreement public key. This alternative permits originator 1055 anonymity since the public key is not certified. Implementations 1056 MUST support all three alternatives for specifying the sender's 1057 public key. 1059 ukm is optional. With some key agreement algorithms, the sender 1060 provides a User Keying Material (UKM) to ensure that a different 1061 key is generated each time the same two parties generate a 1062 pairwise key. Implementations MUST accept a KeyAgreeRecipientInfo 1063 SEQUENCE that includes a ukm field. Implementations that do not 1064 support key agreement algorithms that make use of UKMs MUST 1065 gracefully handle the presence of UKMs. 1067 keyEncryptionAlgorithm identifies the key-encryption algorithm, 1068 and any associated parameters, used to encrypt the content- 1069 encryption key with the key-encryption key. The key-encryption 1070 process is described in Section 6.4. 1072 recipientEncryptedKeys includes a recipient identifier and 1073 encrypted key for one or more recipients. The 1074 KeyAgreeRecipientIdentifier is a CHOICE with two alternatives 1075 specifying the recipient's certificate, and thereby the 1076 recipient's public key, that was used by the sender to generate a 1077 pairwise key-encryption key. The recipient's certificate must 1078 contain a key agreement public key. Therefore, a recipient X.509 1079 version 3 certificate that contains a key usage extension MUST 1080 assert the keyAgreement bit. The content-encryption key is 1081 encrypted in the pairwise key-encryption key. The 1082 issuerAndSerialNumber alternative identifies the recipient's 1083 certificate by the issuer's distinguished name and the certificate 1084 serial number; the RecipientKeyIdentifier is described below. The 1085 encryptedKey is the result of encrypting the content-encryption 1086 key in the pairwise key-encryption key generated using the key 1087 agreement algorithm. Implementations MUST support both 1088 alternatives for specifying the recipient's certificate. 1090 The fields of type RecipientKeyIdentifier have the following 1091 meanings: 1093 subjectKeyIdentifier identifies the recipient's certificate by a 1094 key identifier. When an X.509 certificate is referenced, the key 1095 identifier matches the X.509 subjectKeyIdentifier extension value. 1096 When other certificate formats are referenced, the documents that 1097 specify the certificate format and their use with the CMS must 1098 include details on matching the key identifier to the appropriate 1099 certificate field. 1101 date is optional. When present, the date specifies which of the 1102 recipient's previously distributed UKMs was used by the sender. 1104 other is optional. When present, this field contains additional 1105 information used by the recipient to locate the public keying 1106 material used by the sender. 1108 6.2.3 KEKRecipientInfo Type 1110 Recipient information using previously distributed symmetric keys is 1111 represented in the type KEKRecipientInfo. Each instance of 1112 KEKRecipientInfo will transfer the content-encryption key to one or 1113 more recipients who have the previously distributed key-encryption 1114 key. 1116 KEKRecipientInfo ::= SEQUENCE { 1117 version CMSVersion, -- always set to 4 1118 kekid KEKIdentifier, 1119 keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier, 1120 encryptedKey EncryptedKey } 1122 KEKIdentifier ::= SEQUENCE { 1123 keyIdentifier OCTET STRING, 1124 date GeneralizedTime OPTIONAL, 1125 other OtherKeyAttribute OPTIONAL } 1127 The fields of type KEKRecipientInfo have the following meanings: 1129 version is the syntax version number. It MUST always be 4. 1131 kekid specifies a symmetric key-encryption key that was previously 1132 distributed to the sender and one or more recipients. 1134 keyEncryptionAlgorithm identifies the key-encryption algorithm, 1135 and any associated parameters, used to encrypt the content- 1136 encryption key with the key-encryption key. The key-encryption 1137 process is described in Section 6.4. 1139 encryptedKey is the result of encrypting the content-encryption 1140 key in the key-encryption key. 1142 The fields of type KEKIdentifier have the following meanings: 1144 keyIdentifier identifies the key-encryption key that was 1145 previously distributed to the sender and one or more recipients. 1147 date is optional. When present, the date specifies a single key- 1148 encryption key from a set that was previously distributed. 1150 other is optional. When present, this field contains additional 1151 information used by the recipient to determine the key-encryption 1152 key used by the sender. 1154 6.2.4 PasswordRecipientInfo Type 1156 Recipient information using a password or shared secret value is 1157 represented in the type PasswordRecipientInfo. Each instance of 1158 PasswordRecipientInfo will transfer the content-encryption key to one 1159 or more recipients who possess the password or shared secret value. 1161 The PasswordRecipientInfo Type is specified in RFC 3211 [PWRI]. The 1162 PasswordRecipientInfo structure is repeated here for completeness. 1164 PasswordRecipientInfo ::= SEQUENCE { 1165 version CMSVersion, -- Always set to 0 1166 keyDerivationAlgorithm [0] KeyDerivationAlgorithmIdentifier 1167 OPTIONAL, 1168 keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier, 1169 encryptedKey EncryptedKey } 1171 The fields of type PasswordRecipientInfo have the following meanings: 1173 version is the syntax version number. It MUST always be 0. 1175 keyDerivationAlgorithm identifies the key-derivation algorithm, 1176 and any associated parameters, used to derive the key-encryption 1177 key from the password or shared secret value. If this field is 1178 absent, the key-encryption key is supplied from an external 1179 source, for example a hardware crypto token such as a smart card. 1181 keyEncryptionAlgorithm identifies the encryption algorithm, and 1182 any associated parameters, used to encrypt the content-encryption 1183 key with the key-encryption key. 1185 encryptedKey is the result of encrypting the content-encryption 1186 key with the key-encryption key. 1188 6.2.5 OtherRecipientInfo Type 1190 Recipient information for additional key management techniques are 1191 represented in the type OtherRecipientInfo. The OtherRecipientInfo 1192 type allows key management techniques beyond key transport, key 1193 agreement, previously distributed symmetric key-encryption keys, and 1194 password-based key management to be specified in future documents. 1195 An object identifier uniquely identifies such key management 1196 techniques. 1198 OtherRecipientInfo ::= SEQUENCE { 1199 oriType OBJECT IDENTIFIER, 1200 oriValue ANY DEFINED BY oriType } 1202 The fields of type OtherRecipientInfo have the following meanings: 1204 oriType identifies the key management technique. 1206 oriValue contains the protocol data elements needed by a recipient 1207 using the identified key management technique. 1209 6.3 Content-encryption Process 1211 The content-encryption key for the desired content-encryption 1212 algorithm is randomly generated. The data to be protected is padded 1213 as described below, then the padded data is encrypted using the 1214 content-encryption key. The encryption operation maps an arbitrary 1215 string of octets (the data) to another string of octets (the 1216 ciphertext) under control of a content-encryption key. The encrypted 1217 data is included in the EnvelopedData encryptedContentInfo 1218 encryptedContent OCTET STRING. 1220 Some content-encryption algorithms assume the input length is a 1221 multiple of k octets, where k is greater than one. For such 1222 algorithms, the input shall be padded at the trailing end with 1223 k-(lth mod k) octets all having value k-(lth mod k), where lth is 1224 the length of the input. In other words, the input is padded at 1225 the trailing end with one of the following strings: 1227 01 -- if lth mod k = k-1 1228 02 02 -- if lth mod k = k-2 1229 . 1230 . 1231 . 1232 k k ... k k -- if lth mod k = 0 1234 The padding can be removed unambiguously since all input is padded, 1235 including input values that are already a multiple of the block size, 1236 and no padding string is a suffix of another. This padding method is 1237 well defined if and only if k is less than 256. 1239 6.4 Key-encryption Process 1241 The input to the key-encryption process -- the value supplied to the 1242 recipient's key-encryption algorithm -- is just the "value" of the 1243 content-encryption key. 1245 Any of the aforementioned key management techniques can be used for 1246 each recipient of the same encrypted content. 1248 7. Digested-data Content Type 1250 The digested-data content type consists of content of any type and a 1251 message digest of the content. 1253 Typically, the digested-data content type is used to provide content 1254 integrity, and the result generally becomes an input to the 1255 enveloped-data content type. 1257 The following steps construct digested-data: 1259 1. A message digest is computed on the content with a message- 1260 digest algorithm. 1262 2. The message-digest algorithm and the message digest are 1263 collected together with the content into a DigestedData value. 1265 A recipient verifies the message digest by comparing the message 1266 digest to an independently computed message digest. 1268 The following object identifier identifies the digested-data content 1269 type: 1271 id-digestedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) 1272 us(840) rsadsi(113549) pkcs(1) pkcs7(7) 5 } 1274 The digested-data content type shall have ASN.1 type DigestedData: 1276 DigestedData ::= SEQUENCE { 1277 version CMSVersion, 1278 digestAlgorithm DigestAlgorithmIdentifier, 1279 encapContentInfo EncapsulatedContentInfo, 1280 digest Digest } 1282 Digest ::= OCTET STRING 1284 The fields of type DigestedData have the following meanings: 1286 version is the syntax version number. If the encapsulated content 1287 type is id-data, then the value of version MUST be 0; however, if 1288 the encapsulated content type is other than id-data, then the 1289 value of version MUST be 2. 1291 digestAlgorithm identifies the message digest algorithm, and any 1292 associated parameters, under which the content is digested. The 1293 message-digesting process is the same as in Section 5.4 in the 1294 case when there are no signed attributes. 1296 encapContentInfo is the content that is digested, as defined in 1297 section 5.2. 1299 digest is the result of the message-digesting process. 1301 The ordering of the digestAlgorithm field, the encapContentInfo 1302 field, and the digest field makes it possible to process a 1303 DigestedData value in a single pass. 1305 8. Encrypted-data Content Type 1307 The encrypted-data content type consists of encrypted content of any 1308 type. Unlike the enveloped-data content type, the encrypted-data 1309 content type has neither recipients nor encrypted content-encryption 1310 keys. Keys MUST be managed by other means. 1312 The typical application of the encrypted-data content type will be to 1313 encrypt the content of the data content type for local storage, 1314 perhaps where the encryption key is derived from a password. 1316 The following object identifier identifies the encrypted-data content 1317 type: 1319 id-encryptedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) 1320 us(840) rsadsi(113549) pkcs(1) pkcs7(7) 6 } 1322 The encrypted-data content type shall have ASN.1 type EncryptedData: 1324 EncryptedData ::= SEQUENCE { 1325 version CMSVersion, 1326 encryptedContentInfo EncryptedContentInfo, 1327 unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL } 1329 The fields of type EncryptedData have the following meanings: 1331 version is the syntax version number. If unprotectedAttrs is 1332 present, then version MUST be 2. If unprotectedAttrs is absent, 1333 then version MUST be 0. 1335 encryptedContentInfo is the encrypted content information, as 1336 defined in Section 6.1. 1338 unprotectedAttrs is a collection of attributes that are not 1339 encrypted. The field is optional. Useful attribute types are 1340 defined in Section 11. 1342 9. Authenticated-data Content Type 1344 The authenticated-data content type consists of content of any type, 1345 a message authentication code (MAC), and encrypted authentication 1346 keys for one or more recipients. The combination of the MAC and one 1347 encrypted authentication key for a recipient is necessary for that 1348 recipient to verify the integrity of the content. Any type of 1349 content can be integrity protected for an arbitrary number of 1350 recipients. 1352 The process by which authenticated-data is constructed involves the 1353 following steps: 1355 1. A message-authentication key for a particular message- 1356 authentication algorithm is generated at random. 1358 2. The message-authentication key is encrypted for each 1359 recipient. The details of this encryption depend on the key 1360 management algorithm used. 1362 3. For each recipient, the encrypted message-authentication key 1363 and other recipient-specific information are collected into a 1364 RecipientInfo value, defined in Section 6.2. 1366 4. Using the message-authentication key, the originator computes 1367 a MAC value on the content. If the originator is authenticating 1368 any information in addition to the content (see Section 9.2), a 1369 message digest is calculated on the content, the message digest of 1370 the content and the other information are authenticated using the 1371 message-authentication key, and the result becomes the "MAC 1372 value." 1374 9.1 AuthenticatedData Type 1376 The following object identifier identifies the authenticated-data 1377 content type: 1379 id-ct-authData OBJECT IDENTIFIER ::= { iso(1) member-body(2) 1380 us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) 1381 ct(1) 2 } 1383 The authenticated-data content type shall have ASN.1 type 1384 AuthenticatedData: 1386 AuthenticatedData ::= SEQUENCE { 1387 version CMSVersion, 1388 originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL, 1389 recipientInfos RecipientInfos, 1390 macAlgorithm MessageAuthenticationCodeAlgorithm, 1391 digestAlgorithm [1] DigestAlgorithmIdentifier OPTIONAL, 1392 encapContentInfo EncapsulatedContentInfo, 1393 authAttrs [2] IMPLICIT AuthAttributes OPTIONAL, 1394 mac MessageAuthenticationCode, 1395 unauthAttrs [3] IMPLICIT UnauthAttributes OPTIONAL } 1397 AuthAttributes ::= SET SIZE (1..MAX) OF Attribute 1399 UnauthAttributes ::= SET SIZE (1..MAX) OF Attribute 1401 MessageAuthenticationCode ::= OCTET STRING 1403 The fields of type AuthenticatedData have the following meanings: 1405 version is the syntax version number. The version MUST be 1406 assigned as follows: 1408 IF (originatorInfo is present) AND 1409 ((any certificates with a type of other are present) OR 1410 (any crls with a type of other are present)) 1411 THEN version is 3 1412 ELSE 1413 IF ((originatorInfo is present) AND 1414 (any version 2 attribute certificates are present)) 1415 THEN version is 1 1416 ELSE version is 0 1418 originatorInfo optionally provides information about the 1419 originator. It is present only if required by the key management 1420 algorithm. It MAY contain certificates, attribute certificates, 1421 and CRLs, as defined in Section 6.1. 1423 recipientInfos is a collection of per-recipient information, as 1424 defined in Section 6.1. There MUST be at least one element in the 1425 collection. 1427 macAlgorithm is a message authentication code (MAC) algorithm 1428 identifier. It identifies the MAC algorithm, along with any 1429 associated parameters, used by the originator. Placement of the 1430 macAlgorithm field facilitates one-pass processing by the 1431 recipient. 1433 digestAlgorithm identifies the message digest algorithm, and any 1434 associated parameters, used to compute a message digest on the 1435 encapsulated content if authenticated attributes are present. The 1436 message digesting process is described in Section 9.2. Placement 1437 of the digestAlgorithm field facilitates one-pass processing by 1438 the recipient. If the digestAlgorithm field is present, then the 1439 authAttrs field MUST also be present. 1441 encapContentInfo is the content that is authenticated, as defined 1442 in section 5.2. 1444 authAttrs is a collection of authenticated attributes. The 1445 authAttrs structure is optional, but it MUST be present if the 1446 content type of the EncapsulatedContentInfo value being 1447 authenticated is not id-data. If the authAttrs field is present, 1448 then the digestAlgorithm field MUST also be present. The 1449 AuthAttributes structure MUST be DER encoded, even if the rest of 1450 the structure is BER encoded. Useful attribute types are defined 1451 in Section 11. If the authAttrs field is present, it MUST 1452 contain, at a minimum, the following two attributes: 1454 A content-type attribute having as its value the content type 1455 of the EncapsulatedContentInfo value being authenticated. 1456 Section 11.1 defines the content-type attribute. 1458 A message-digest attribute, having as its value the message 1459 digest of the content. Section 11.2 defines the message-digest 1460 attribute. 1462 mac is the message authentication code. 1464 unauthAttrs is a collection of attributes that are not 1465 authenticated. The field is optional. To date, no attributes 1466 have been defined for use as unauthenticated attributes, but other 1467 useful attribute types are defined in Section 11. 1469 9.2 MAC Generation 1471 The MAC calculation process computes a message authentication code 1472 (MAC) on either the content being authenticated or a message digest 1473 of content being authenticated together with the originator's 1474 authenticated attributes. 1476 If authAttrs field is absent, the input to the MAC calculation 1477 process is the value of the encapContentInfo eContent OCTET STRING. 1478 Only the octets comprising the value of the eContent OCTET STRING are 1479 input to the MAC algorithm; the tag and the length octets are 1480 omitted. This has the advantage that the length of the content being 1481 authenticated need not be known in advance of the MAC generation 1482 process. 1484 If authAttrs field is present, the content-type attribute (as 1485 described in Section 11.1) and the message-digest attribute (as 1486 described in section 11.2) MUST be included, and the input to the MAC 1487 calculation process is the DER encoding of authAttrs. A separate 1488 encoding of the authAttrs field is performed for message digest 1489 calculation. The IMPLICIT [2] tag in the authAttrs field is not used 1490 for the DER encoding, rather an EXPLICIT SET OF tag is used. That 1491 is, the DER encoding of the SET OF tag, rather than of the IMPLICIT 1492 [2] tag, is to be included in the message digest calculation along 1493 with the length and content octets of the authAttrs value. 1495 The message digest calculation process computes a message digest on 1496 the content being authenticated. The initial input to the message 1497 digest calculation process is the "value" of the encapsulated content 1498 being authenticated. Specifically, the input is the encapContentInfo 1499 eContent OCTET STRING to which the authentication process is applied. 1500 Only the octets comprising the value of the encapContentInfo eContent 1501 OCTET STRING are input to the message digest algorithm, not the tag 1502 or the length octets. This has the advantage that the length of the 1503 content being authenticated need not be known in advance. Although 1504 the encapContentInfo eContent OCTET STRING tag and length octets are 1505 not included in the message digest calculation, they are still 1506 protected by other means. The length octets are protected by the 1507 nature of the message digest algorithm since it is computationally 1508 infeasible to find any two distinct contents of any length that have 1509 the same message digest. 1511 The input to the MAC calculation process includes the MAC input data, 1512 defined above, and an authentication key conveyed in a recipientInfo 1513 structure. The details of MAC calculation depend on the MAC 1514 algorithm employed (e.g., HMAC). The object identifier, along with 1515 any parameters, that specifies the MAC algorithm employed by the 1516 originator is carried in the macAlgorithm field. The MAC value 1517 generated by the originator is encoded as an OCTET STRING and carried 1518 in the mac field. 1520 9.3 MAC Verification 1522 The input to the MAC verification process includes the input data 1523 (determined based on the presence or absence of the authAttrs field, 1524 as defined in 9.2), and the authentication key conveyed in 1525 recipientInfo. The details of the MAC verification process depend on 1526 the MAC algorithm employed. 1528 The recipient MUST NOT rely on any MAC values or message digest 1529 values computed by the originator. The content is authenticated as 1530 described in section 9.2. If the originator includes authenticated 1531 attributes, then the content of the authAttrs is authenticated as 1532 described in section 9.2. For authentication to succeed, the MAC 1533 value calculated by the recipient MUST be the same as the value of 1534 the mac field. Similarly, for authentication to succeed when the 1535 authAttrs field is present, the content message digest value 1536 calculated by the recipient MUST be the same as the message digest 1537 value included in the authAttrs message-digest attribute. 1539 If the AuthenticatedData includes authAttrs, then the content-type 1540 attribute value MUST match the AuthenticatedData encapContentInfo 1541 eContentType value. 1543 10. Useful Types 1545 This section is divided into two parts. The first part defines 1546 algorithm identifiers, and the second part defines other useful 1547 types. 1549 10.1 Algorithm Identifier Types 1551 All of the algorithm identifiers have the same type: 1552 AlgorithmIdentifier. The definition of AlgorithmIdentifier is taken 1553 from X.509 [X.509-88]. 1555 There are many alternatives for each algorithm type. 1557 10.1.1 DigestAlgorithmIdentifier 1559 The DigestAlgorithmIdentifier type identifies a message-digest 1560 algorithm. Examples include SHA-1, MD2, and MD5. A message-digest 1561 algorithm maps an octet string (the content) to another octet string 1562 (the message digest). 1564 DigestAlgorithmIdentifier ::= AlgorithmIdentifier 1566 10.1.2 SignatureAlgorithmIdentifier 1568 The SignatureAlgorithmIdentifier type identifies a signature 1569 algorithm. Examples include RSA, DSA, and ECDSA. A signature 1570 algorithm supports signature generation and verification operations. 1571 The signature generation operation uses the message digest and the 1572 signer's private key to generate a signature value. The signature 1573 verification operation uses the message digest and the signer's 1574 public key to determine whether or not a signature value is valid. 1575 Context determines which operation is intended. 1577 SignatureAlgorithmIdentifier ::= AlgorithmIdentifier 1579 10.1.3 KeyEncryptionAlgorithmIdentifier 1581 The KeyEncryptionAlgorithmIdentifier type identifies a key-encryption 1582 algorithm used to encrypt a content-encryption key. The encryption 1583 operation maps an octet string (the key) to another octet string (the 1584 encrypted key) under control of a key-encryption key. The decryption 1585 operation is the inverse of the encryption operation. Context 1586 determines which operation is intended. 1588 The details of encryption and decryption depend on the key management 1589 algorithm used. Key transport, key agreement, previously distributed 1590 symmetric key-encrypting keys, and symmetric key-encrypting keys 1591 derived from passwords are supported. 1593 KeyEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier 1595 10.1.4 ContentEncryptionAlgorithmIdentifier 1597 The ContentEncryptionAlgorithmIdentifier type identifies a content- 1598 encryption algorithm. Examples include Triple-DES and RC2. A 1599 content-encryption algorithm supports encryption and decryption 1600 operations. The encryption operation maps an octet string (the 1601 plaintext) to another octet string (the ciphertext) under control of 1602 a content-encryption key. The decryption operation is the inverse of 1603 the encryption operation. Context determines which operation is 1604 intended. 1606 ContentEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier 1608 10.1.5 MessageAuthenticationCodeAlgorithm 1610 The MessageAuthenticationCodeAlgorithm type identifies a message 1611 authentication code (MAC) algorithm. Examples include DES-MAC and 1612 HMAC-SHA-1. A MAC algorithm supports generation and verification 1613 operations. The MAC generation and verification operations use the 1614 same symmetric key. Context determines which operation is intended. 1616 MessageAuthenticationCodeAlgorithm ::= AlgorithmIdentifier 1618 10.1.6 KeyDerivationAlgorithmIdentifier 1620 The KeyDerivationAlgorithmIdentifier type is specified in RFC 3211 1621 [PWRI]. The KeyDerivationAlgorithmIdentifier definition is repeated 1622 here for completeness. 1624 Key derivation algorithms convert a password or shared secret value 1625 into a key-encryption key. 1627 KeyDerivationAlgorithmIdentifier ::= AlgorithmIdentifier 1629 10.2 Other Useful Types 1631 This section defines types that are used other places in the 1632 document. The types are not listed in any particular order. 1634 10.2.1 RevocationInfoChoices 1636 The RevocationInfoChoices type gives a set of revocation status 1637 information alternatives. It is intended that the set contain 1638 information sufficient to determine whether the certificates and 1639 attribute certificates with which the set is associated are revoked. 1640 However, there MAY be more revocation status information than 1641 necessary or there MAY be less revocation status information than 1642 necessary. X.509 Certificate revocation lists (CRLs) [X.509-97] are 1643 the primary source of revocation status information, but any other 1644 revocation information format can be supported. The 1645 OtherRevocationInfoFormat alternative is provided to support any 1646 other revocation information format without further modifications to 1647 the CMS. For example, Online Certificate Status Protocol (OCSP) 1648 Responses [OCSP] can be supported using the 1649 OtherRevocationInfoFormat. 1651 The CertificateList may contain a CRL, an Authority Revocation List 1652 (ARL), a Delta CRL, or an Attribute Certificate Revocation List. All 1653 of these lists share a common syntax. 1655 The CertificateList type gives a certificate revocation list (CRL). 1656 CRLs are specified in X.509 [X.509-97], and they are profiled for use 1657 in the Internet in RFC 3280 [PROFILE]. 1659 The definition of CertificateList is taken from X.509. 1661 RevocationInfoChoices ::= SET OF RevocationInfoChoice 1663 RevocationInfoChoice ::= CHOICE { 1664 crl CertificateList, 1665 other [1] IMPLICIT OtherRevocationInfoFormat } 1667 OtherRevocationInfoFormat ::= SEQUENCE { 1668 otherRevInfoFormat OBJECT IDENTIFIER, 1669 otherRevInfo ANY DEFINED BY otherRevInfoFormat } 1671 10.2.2 CertificateChoices 1673 The CertificateChoices type gives either a PKCS #6 extended 1674 certificate [PKCS#6], an X.509 certificate, a version 1 X.509 1675 attribute certificate (ACv1) [X.509-97], a version 2 X.509 attribute 1676 certificate (ACv2) [X.509-00], or any other certificate format. The 1677 PKCS #6 extended certificate is obsolete. The PKCS #6 certificate is 1678 included for backward compatibility, and PKCS #6 certificates SHOULD 1679 NOT be used. The ACv1 is also obsolete. ACv1 is included for 1680 backward compatibility, and ACv1 SHOULD NOT be used. The Internet 1681 profile of X.509 certificates is specified in the "Internet X.509 1682 Public Key Infrastructure: Certificate and CRL Profile" [PROFILE]. 1683 The Internet profile of ACv2 is specified in the "An Internet 1684 Attribute Certificate Profile for Authorization" [ACPROFILE]. The 1685 OtherCertificateFormat alternative is provided to support any other 1686 certificate format without further modifications to the CMS. 1688 The definition of Certificate is taken from X.509. 1690 The definitions of AttributeCertificate are taken from X.509-1997 and 1691 X.509-2000. The definition from X.509-1997 is assigned to 1692 AttributeCertificateV1 (see section 12.2), and the definition from 1693 X.509-2000 is assigned to AttributeCertificateV2. 1695 CertificateChoices ::= CHOICE { 1696 certificate Certificate, 1697 extendedCertificate [0] IMPLICIT ExtendedCertificate, -- Obsolete 1698 v1AttrCert [1] IMPLICIT AttributeCertificateV1, -- Obsolete 1699 v2AttrCert [2] IMPLICIT AttributeCertificateV2, 1700 other [3] IMPLICIT OtherCertificateFormat } 1702 OtherCertificateFormat ::= SEQUENCE { 1703 otherCertFormat OBJECT IDENTIFIER, 1704 otherCert ANY DEFINED BY otherCertFormat } 1706 10.2.3 CertificateSet 1708 The CertificateSet type provides a set of certificates. It is 1709 intended that the set be sufficient to contain certification paths 1710 from a recognized "root" or "top-level certification authority" to 1711 all of the sender certificates with which the set is associated. 1712 However, there may be more certificates than necessary, or there MAY 1713 be fewer than necessary. 1715 The precise meaning of a "certification path" is outside the scope of 1716 this document. However, [PROFILE] provides a definition for X.509 1717 certificates. Some applications may impose upper limits on the 1718 length of a certification path; others may enforce certain 1719 relationships between the subjects and issuers of certificates within 1720 a certification path. 1722 CertificateSet ::= SET OF CertificateChoices 1724 10.2.4 IssuerAndSerialNumber 1726 The IssuerAndSerialNumber type identifies a certificate, and thereby 1727 an entity and a public key, by the distinguished name of the 1728 certificate issuer and an issuer-specific certificate serial number. 1730 The definition of Name is taken from X.501 [X.501-88], and the 1731 definition of CertificateSerialNumber is taken from X.509 [X.509-97]. 1733 IssuerAndSerialNumber ::= SEQUENCE { 1734 issuer Name, 1735 serialNumber CertificateSerialNumber } 1737 CertificateSerialNumber ::= INTEGER 1739 10.2.5 CMSVersion 1741 The CMSVersion type gives a syntax version number, for compatibility 1742 with future revisions of this specification. 1744 CMSVersion ::= INTEGER 1745 { v0(0), v1(1), v2(2), v3(3), v4(4), v5(5) } 1747 10.2.6 UserKeyingMaterial 1749 The UserKeyingMaterial type gives a syntax for user keying material 1750 (UKM). Some key agreement algorithms require UKMs to ensure that a 1751 different key is generated each time the same two parties generate a 1752 pairwise key. The sender provides a UKM for use with a specific key 1753 agreement algorithm. 1755 UserKeyingMaterial ::= OCTET STRING 1757 10.2.7 OtherKeyAttribute 1759 The OtherKeyAttribute type gives a syntax for the inclusion of other 1760 key attributes that permit the recipient to select the key used by 1761 the sender. The attribute object identifier must be registered along 1762 with the syntax of the attribute itself. Use of this structure 1763 should be avoided since it might impede interoperability. 1765 OtherKeyAttribute ::= SEQUENCE { 1766 keyAttrId OBJECT IDENTIFIER, 1767 keyAttr ANY DEFINED BY keyAttrId OPTIONAL } 1769 11. Useful Attributes 1771 This section defines attributes that may be used with signed-data, 1772 enveloped-data, encrypted-data, or authenticated-data. The syntax of 1773 Attribute is compatible with X.501 [X.501-88] and RFC 3280 [PROFILE]. 1774 Some of the attributes defined in this section were originally 1775 defined in PKCS #9 [PKCS#9]; others were originally defined in a 1776 previous version of this specification [CMS1]. The attributes are 1777 not listed in any particular order. 1779 Additional attributes are defined in many places, notably the S/MIME 1780 Version 3 Message Specification [MSG] and the Enhanced Security 1781 Services for S/MIME [ESS], which also include recommendations on the 1782 placement of these attributes. 1784 11.1 Content Type 1786 The content-type attribute type specifies the content type of the 1787 ContentInfo within signed-data or authenticated-data. The content- 1788 type attribute type MUST be present whenever signed attributes are 1789 present in signed-data or authenticated attributes present in 1790 authenticated-data. The content-type attribute value MUST match the 1791 encapContentInfo eContentType value in the signed-data or 1792 authenticated-data. 1794 The content-type attribute MUST be a signed attribute or an 1795 authenticated attribute; it MUST NOT be an unsigned attribute, 1796 unauthenticated attribute, or unprotected attribute. 1798 The following object identifier identifies the content-type 1799 attribute: 1801 id-contentType OBJECT IDENTIFIER ::= { iso(1) member-body(2) 1802 us(840) rsadsi(113549) pkcs(1) pkcs9(9) 3 } 1804 Content-type attribute values have ASN.1 type ContentType: 1806 ContentType ::= OBJECT IDENTIFIER 1808 Even though the syntax is defined as a SET OF AttributeValue, a 1809 content-type attribute MUST have a single attribute value; zero or 1810 multiple instances of AttributeValue are not permitted. 1812 The SignedAttributes and AuthAttributes syntaxes are each defined as 1813 a SET OF Attributes. The SignedAttributes in a signerInfo MUST NOT 1814 include multiple instances of the content-type attribute. Similarly, 1815 the AuthAttributes in an AuthenticatedData MUST NOT include multiple 1816 instances of the content-type attribute. 1818 11.2 Message Digest 1820 The message-digest attribute type specifies the message digest of the 1821 encapContentInfo eContent OCTET STRING being signed in signed-data 1822 (see section 5.4) or authenticated in authenticated-data (see section 1823 9.2). For signed-data, the message digest is computed using the 1824 signer's message digest algorithm. For authenticated-data, the 1825 message digest is computed using the originator's message digest 1826 algorithm. 1828 Within signed-data, the message-digest signed attribute type MUST be 1829 present when there are any signed attributes present. Within 1830 authenticated-data, the message-digest authenticated attribute type 1831 MUST be present when there are any authenticated attributes present. 1833 The message-digest attribute MUST be a signed attribute or an 1834 authenticated attribute; it MUST NOT be an unsigned attribute, 1835 unauthenticated attribute, or unprotected attribute. 1837 The following object identifier identifies the message-digest 1838 attribute: 1840 id-messageDigest OBJECT IDENTIFIER ::= { iso(1) member-body(2) 1841 us(840) rsadsi(113549) pkcs(1) pkcs9(9) 4 } 1843 Message-digest attribute values have ASN.1 type MessageDigest: 1845 MessageDigest ::= OCTET STRING 1847 A message-digest attribute MUST have a single attribute value, even 1848 though the syntax is defined as a SET OF AttributeValue. There MUST 1849 NOT be zero or multiple instances of AttributeValue present. 1851 The SignedAttributes syntax and AuthAttributes syntax are each 1852 defined as a SET OF Attributes. The SignedAttributes in a signerInfo 1853 MUST include only one instance of the message-digest attribute. 1854 Similarly, the AuthAttributes in an AuthenticatedData MUST include 1855 only one instance of the message-digest attribute. 1857 11.3 Signing Time 1859 The signing-time attribute type specifies the time at which the 1860 signer (purportedly) performed the signing process. The signing-time 1861 attribute type is intended for use in signed-data. 1863 The signing-time attribute MUST be a signed attribute or an 1864 authenticated attribute; it MUST NOT be an unsigned attribute, 1865 unauthenticated attribute, or unprotected attribute. 1867 The following object identifier identifies the signing-time 1868 attribute: 1870 id-signingTime OBJECT IDENTIFIER ::= { iso(1) member-body(2) 1871 us(840) rsadsi(113549) pkcs(1) pkcs9(9) 5 } 1873 Signing-time attribute values have ASN.1 type SigningTime: 1875 SigningTime ::= Time 1877 Time ::= CHOICE { 1878 utcTime UTCTime, 1879 generalizedTime GeneralizedTime } 1881 Note: The definition of Time matches the one specified in the 1997 1882 version of X.509 [X.509-97]. 1884 Dates between 1 January 1950 and 31 December 2049 (inclusive) MUST be 1885 encoded as UTCTime. Any dates with year values before 1950 or after 1886 2049 MUST be encoded as GeneralizedTime. 1888 UTCTime values MUST be expressed in Coordinated Universal Time 1889 (formerly known as Greenwich Mean Time (GMT) and Zulu clock time) and 1890 MUST include seconds (i.e., times are YYMMDDHHMMSSZ), even where the 1891 number of seconds is zero. Midnight MUST be represented as 1892 "YYMMDD000000Z". Century information is implicit, and the century 1893 MUST be determined as follows: 1895 Where YY is greater than or equal to 50, the year MUST be 1896 interpreted as 19YY; and 1898 Where YY is less than 50, the year MUST be interpreted as 20YY. 1900 GeneralizedTime values MUST be expressed in Coordinated Universal 1901 Time and MUST include seconds (i.e., times are YYYYMMDDHHMMSSZ), even 1902 where the number of seconds is zero. GeneralizedTime values MUST NOT 1903 include fractional seconds. 1905 A signing-time attribute MUST have a single attribute value, even 1906 though the syntax is defined as a SET OF AttributeValue. There MUST 1907 NOT be zero or multiple instances of AttributeValue present. 1909 The SignedAttributes syntax and the AuthAttributes syntax are each 1910 defined as a SET OF Attributes. The SignedAttributes in a signerInfo 1911 MUST NOT include multiple instances of the signing-time attribute. 1912 Similarly, the AuthAttributes in an AuthenticatedData MUST NOT 1913 include multiple instances of the signing-time attribute. 1915 No requirement is imposed concerning the correctness of the signing 1916 time, and acceptance of a purported signing time is a matter of a 1917 recipient's discretion. It is expected, however, that some signers, 1918 such as time-stamp servers, will be trusted implicitly. 1920 11.4 Countersignature 1922 The countersignature attribute type specifies one or more signatures 1923 on the contents octets of the signature OCTET STRING in a SignerInfo 1924 value of the signed-data. That is, the message digest is computed 1925 over the octets comprising the value of the OCTET STRING, neither the 1926 tag nor length octets are included. Thus, the countersignature 1927 attribute type countersigns (signs in serial) another signature. 1929 The countersignature attribute MUST be an unsigned attribute; it MUST 1930 NOT be a signed attribute, an authenticated attribute, an 1931 unauthenticated attribute, or an unprotected attribute. 1933 The following object identifier identifies the countersignature 1934 attribute: 1936 id-countersignature OBJECT IDENTIFIER ::= { iso(1) member-body(2) 1937 us(840) rsadsi(113549) pkcs(1) pkcs9(9) 6 } 1939 Countersignature attribute values have ASN.1 type Countersignature: 1941 Countersignature ::= SignerInfo 1943 Countersignature values have the same meaning as SignerInfo values 1944 for ordinary signatures, except that: 1946 1. The signedAttributes field MUST NOT contain a content-type 1947 attribute; there is no content type for countersignatures. 1949 2. The signedAttributes field MUST contain a message-digest 1950 attribute if it contains any other attributes. 1952 3. The input to the message-digesting process is the contents 1953 octets of the DER encoding of the signatureValue field of the 1954 SignerInfo value with which the attribute is associated. 1956 A countersignature attribute can have multiple attribute values. The 1957 syntax is defined as a SET OF AttributeValue, and there MUST be one 1958 or more instances of AttributeValue present. 1960 The UnsignedAttributes syntax is defined as a SET OF Attributes. The 1961 UnsignedAttributes in a signerInfo may include multiple instances of 1962 the countersignature attribute. 1964 A countersignature, since it has type SignerInfo, can itself contain 1965 a countersignature attribute. Thus, it is possible to construct an 1966 arbitrarily long series of countersignatures. 1968 12. ASN.1 Modules 1970 Section 12.1 contains the ASN.1 module for the CMS, and section 12.2 1971 contains the ASN.1 module for the Version 1 Attribute Certificate. 1973 12.1 CMS ASN.1 Module 1975 CryptographicMessageSyntax2004 1976 { iso(1) member-body(2) us(840) rsadsi(113549) 1977 pkcs(1) pkcs-9(9) smime(16) modules(0) cms-2004(24) } 1979 DEFINITIONS IMPLICIT TAGS ::= 1980 BEGIN 1982 -- EXPORTS All 1983 -- The types and values defined in this module are exported for use 1984 -- in the other ASN.1 modules. Other applications may use them for 1985 -- their own purposes. 1987 IMPORTS 1989 -- Imports from RFC 3280 [PROFILE], Appendix A.1 1990 AlgorithmIdentifier, Certificate, CertificateList, 1991 CertificateSerialNumber, Name 1992 FROM PKIX1Explicit88 1993 { iso(1) identified-organization(3) dod(6) 1994 internet(1) security(5) mechanisms(5) pkix(7) 1995 mod(0) pkix1-explicit(18) } 1997 -- Imports from RFC 3281 [ACPROFILE], Appendix B 1998 AttributeCertificate 1999 FROM PKIXAttributeCertificate 2000 { iso(1) identified-organization(3) dod(6) 2001 internet(1) security(5) mechanisms(5) pkix(7) 2002 mod(0) attribute-cert(12) } 2004 -- Imports from Appendix B of this document 2005 AttributeCertificateV1 2006 FROM AttributeCertificateVersion1 2007 { iso(1) member-body(2) us(840) rsadsi(113549) 2008 pkcs(1) pkcs-9(9) smime(16) modules(0) 2009 v1AttrCert(15) } ; 2011 -- Cryptographic Message Syntax 2013 ContentInfo ::= SEQUENCE { 2014 contentType ContentType, 2015 content [0] EXPLICIT ANY DEFINED BY contentType } 2017 ContentType ::= OBJECT IDENTIFIER 2018 SignedData ::= SEQUENCE { 2019 version CMSVersion, 2020 digestAlgorithms DigestAlgorithmIdentifiers, 2021 encapContentInfo EncapsulatedContentInfo, 2022 certificates [0] IMPLICIT CertificateSet OPTIONAL, 2023 crls [1] IMPLICIT RevocationInfoChoices OPTIONAL, 2024 signerInfos SignerInfos } 2026 DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier 2028 SignerInfos ::= SET OF SignerInfo 2030 EncapsulatedContentInfo ::= SEQUENCE { 2031 eContentType ContentType, 2032 eContent [0] EXPLICIT OCTET STRING OPTIONAL } 2034 SignerInfo ::= SEQUENCE { 2035 version CMSVersion, 2036 sid SignerIdentifier, 2037 digestAlgorithm DigestAlgorithmIdentifier, 2038 signedAttrs [0] IMPLICIT SignedAttributes OPTIONAL, 2039 signatureAlgorithm SignatureAlgorithmIdentifier, 2040 signature SignatureValue, 2041 unsignedAttrs [1] IMPLICIT UnsignedAttributes OPTIONAL } 2043 SignerIdentifier ::= CHOICE { 2044 issuerAndSerialNumber IssuerAndSerialNumber, 2045 subjectKeyIdentifier [0] SubjectKeyIdentifier } 2047 SignedAttributes ::= SET SIZE (1..MAX) OF Attribute 2049 UnsignedAttributes ::= SET SIZE (1..MAX) OF Attribute 2051 Attribute ::= SEQUENCE { 2052 attrType OBJECT IDENTIFIER, 2053 attrValues SET OF AttributeValue } 2055 AttributeValue ::= ANY 2057 SignatureValue ::= OCTET STRING 2059 EnvelopedData ::= SEQUENCE { 2060 version CMSVersion, 2061 originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL, 2062 recipientInfos RecipientInfos, 2063 encryptedContentInfo EncryptedContentInfo, 2064 unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL } 2066 OriginatorInfo ::= SEQUENCE { 2067 certs [0] IMPLICIT CertificateSet OPTIONAL, 2068 crls [1] IMPLICIT RevocationInfoChoices OPTIONAL } 2070 RecipientInfos ::= SET SIZE (1..MAX) OF RecipientInfo 2072 EncryptedContentInfo ::= SEQUENCE { 2073 contentType ContentType, 2074 contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier, 2075 encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL } 2077 EncryptedContent ::= OCTET STRING 2079 UnprotectedAttributes ::= SET SIZE (1..MAX) OF Attribute 2081 RecipientInfo ::= CHOICE { 2082 ktri KeyTransRecipientInfo, 2083 kari [1] KeyAgreeRecipientInfo, 2084 kekri [2] KEKRecipientInfo, 2085 pwri [3] PasswordRecipientInfo, 2086 ori [4] OtherRecipientInfo } 2088 EncryptedKey ::= OCTET STRING 2089 KeyTransRecipientInfo ::= SEQUENCE { 2090 version CMSVersion, -- always set to 0 or 2 2091 rid RecipientIdentifier, 2092 keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier, 2093 encryptedKey EncryptedKey } 2095 RecipientIdentifier ::= CHOICE { 2096 issuerAndSerialNumber IssuerAndSerialNumber, 2097 subjectKeyIdentifier [0] SubjectKeyIdentifier } 2099 KeyAgreeRecipientInfo ::= SEQUENCE { 2100 version CMSVersion, -- always set to 3 2101 originator [0] EXPLICIT OriginatorIdentifierOrKey, 2102 ukm [1] EXPLICIT UserKeyingMaterial OPTIONAL, 2103 keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier, 2104 recipientEncryptedKeys RecipientEncryptedKeys } 2106 OriginatorIdentifierOrKey ::= CHOICE { 2107 issuerAndSerialNumber IssuerAndSerialNumber, 2108 subjectKeyIdentifier [0] SubjectKeyIdentifier, 2109 originatorKey [1] OriginatorPublicKey } 2111 OriginatorPublicKey ::= SEQUENCE { 2112 algorithm AlgorithmIdentifier, 2113 publicKey BIT STRING } 2115 RecipientEncryptedKeys ::= SEQUENCE OF RecipientEncryptedKey 2117 RecipientEncryptedKey ::= SEQUENCE { 2118 rid KeyAgreeRecipientIdentifier, 2119 encryptedKey EncryptedKey } 2121 KeyAgreeRecipientIdentifier ::= CHOICE { 2122 issuerAndSerialNumber IssuerAndSerialNumber, 2123 rKeyId [0] IMPLICIT RecipientKeyIdentifier } 2125 RecipientKeyIdentifier ::= SEQUENCE { 2126 subjectKeyIdentifier SubjectKeyIdentifier, 2127 date GeneralizedTime OPTIONAL, 2128 other OtherKeyAttribute OPTIONAL } 2130 SubjectKeyIdentifier ::= OCTET STRING 2132 KEKRecipientInfo ::= SEQUENCE { 2133 version CMSVersion, -- always set to 4 2134 kekid KEKIdentifier, 2135 keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier, 2136 encryptedKey EncryptedKey } 2138 KEKIdentifier ::= SEQUENCE { 2139 keyIdentifier OCTET STRING, 2140 date GeneralizedTime OPTIONAL, 2141 other OtherKeyAttribute OPTIONAL } 2143 PasswordRecipientInfo ::= SEQUENCE { 2144 version CMSVersion, -- always set to 0 2145 keyDerivationAlgorithm [0] KeyDerivationAlgorithmIdentifier 2146 OPTIONAL, 2147 keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier, 2148 encryptedKey EncryptedKey } 2150 OtherRecipientInfo ::= SEQUENCE { 2151 oriType OBJECT IDENTIFIER, 2152 oriValue ANY DEFINED BY oriType } 2154 DigestedData ::= SEQUENCE { 2155 version CMSVersion, 2156 digestAlgorithm DigestAlgorithmIdentifier, 2157 encapContentInfo EncapsulatedContentInfo, 2158 digest Digest } 2160 Digest ::= OCTET STRING 2162 EncryptedData ::= SEQUENCE { 2163 version CMSVersion, 2164 encryptedContentInfo EncryptedContentInfo, 2165 unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL } 2167 AuthenticatedData ::= SEQUENCE { 2168 version CMSVersion, 2169 originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL, 2170 recipientInfos RecipientInfos, 2171 macAlgorithm MessageAuthenticationCodeAlgorithm, 2172 digestAlgorithm [1] DigestAlgorithmIdentifier OPTIONAL, 2173 encapContentInfo EncapsulatedContentInfo, 2174 authAttrs [2] IMPLICIT AuthAttributes OPTIONAL, 2175 mac MessageAuthenticationCode, 2176 unauthAttrs [3] IMPLICIT UnauthAttributes OPTIONAL } 2178 AuthAttributes ::= SET SIZE (1..MAX) OF Attribute 2180 UnauthAttributes ::= SET SIZE (1..MAX) OF Attribute 2182 MessageAuthenticationCode ::= OCTET STRING 2184 DigestAlgorithmIdentifier ::= AlgorithmIdentifier 2185 SignatureAlgorithmIdentifier ::= AlgorithmIdentifier 2187 KeyEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier 2189 ContentEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier 2191 MessageAuthenticationCodeAlgorithm ::= AlgorithmIdentifier 2193 KeyDerivationAlgorithmIdentifier ::= AlgorithmIdentifier 2195 RevocationInfoChoices ::= SET OF RevocationInfoChoice 2197 RevocationInfoChoice ::= CHOICE { 2198 crl CertificateList, 2199 other [1] IMPLICIT OtherRevocationInfoFormat } 2201 OtherRevocationInfoFormat ::= SEQUENCE { 2202 otherRevInfoFormat OBJECT IDENTIFIER, 2203 otherRevInfo ANY DEFINED BY otherRevInfoFormat } 2205 CertificateChoices ::= CHOICE { 2206 certificate Certificate, 2207 extendedCertificate [0] IMPLICIT ExtendedCertificate, -- Obsolete 2208 v1AttrCert [1] IMPLICIT AttributeCertificateV1, -- Obsolete 2209 v2AttrCert [2] IMPLICIT AttributeCertificateV2, 2210 other [3] IMPLICIT OtherCertificateFormat } 2212 AttributeCertificateV2 ::= AttributeCertificate 2214 OtherCertificateFormat ::= SEQUENCE { 2215 otherCertFormat OBJECT IDENTIFIER, 2216 otherCert ANY DEFINED BY otherCertFormat } 2218 CertificateSet ::= SET OF CertificateChoices 2220 IssuerAndSerialNumber ::= SEQUENCE { 2221 issuer Name, 2222 serialNumber CertificateSerialNumber } 2224 CMSVersion ::= INTEGER { v0(0), v1(1), v2(2), v3(3), v4(4), v5(5) } 2226 UserKeyingMaterial ::= OCTET STRING 2228 OtherKeyAttribute ::= SEQUENCE { 2229 keyAttrId OBJECT IDENTIFIER, 2230 keyAttr ANY DEFINED BY keyAttrId OPTIONAL } 2232 -- Content Type Object Identifiers 2234 id-ct-contentInfo OBJECT IDENTIFIER ::= { iso(1) member-body(2) 2235 us(840) rsadsi(113549) pkcs(1) pkcs9(9) smime(16) ct(1) 6 } 2237 id-data OBJECT IDENTIFIER ::= { iso(1) member-body(2) 2238 us(840) rsadsi(113549) pkcs(1) pkcs7(7) 1 } 2240 id-signedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) 2241 us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 } 2243 id-envelopedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) 2244 us(840) rsadsi(113549) pkcs(1) pkcs7(7) 3 } 2246 id-digestedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) 2247 us(840) rsadsi(113549) pkcs(1) pkcs7(7) 5 } 2249 id-encryptedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) 2250 us(840) rsadsi(113549) pkcs(1) pkcs7(7) 6 } 2252 id-ct-authData OBJECT IDENTIFIER ::= { iso(1) member-body(2) 2253 us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) ct(1) 2 } 2255 -- The CMS Attributes 2257 MessageDigest ::= OCTET STRING 2259 SigningTime ::= Time 2261 Time ::= CHOICE { 2262 utcTime UTCTime, 2263 generalTime GeneralizedTime } 2265 Countersignature ::= SignerInfo 2267 -- Attribute Object Identifiers 2269 id-contentType OBJECT IDENTIFIER ::= { iso(1) member-body(2) 2270 us(840) rsadsi(113549) pkcs(1) pkcs9(9) 3 } 2272 id-messageDigest OBJECT IDENTIFIER ::= { iso(1) member-body(2) 2273 us(840) rsadsi(113549) pkcs(1) pkcs9(9) 4 } 2275 id-signingTime OBJECT IDENTIFIER ::= { iso(1) member-body(2) 2276 us(840) rsadsi(113549) pkcs(1) pkcs9(9) 5 } 2278 id-countersignature OBJECT IDENTIFIER ::= { iso(1) member-body(2) 2279 us(840) rsadsi(113549) pkcs(1) pkcs9(9) 6 } 2281 -- Obsolete Extended Certificate syntax from PKCS#6 2283 ExtendedCertificateOrCertificate ::= CHOICE { 2284 certificate Certificate, 2285 extendedCertificate [0] IMPLICIT ExtendedCertificate } 2287 ExtendedCertificate ::= SEQUENCE { 2288 extendedCertificateInfo ExtendedCertificateInfo, 2289 signatureAlgorithm SignatureAlgorithmIdentifier, 2290 signature Signature } 2292 ExtendedCertificateInfo ::= SEQUENCE { 2293 version CMSVersion, 2294 certificate Certificate, 2295 attributes UnauthAttributes } 2297 Signature ::= BIT STRING 2299 END -- of CryptographicMessageSyntax2004 2301 12.2 Version 1 Attribute Certificate ASN.1 Module 2303 AttributeCertificateVersion1 2304 { iso(1) member-body(2) us(840) rsadsi(113549) 2305 pkcs(1) pkcs-9(9) smime(16) modules(0) v1AttrCert(15) } 2307 DEFINITIONS EXPLICIT TAGS ::= 2308 BEGIN 2310 -- EXPORTS All 2312 IMPORTS 2314 -- Imports from RFC 3280 [PROFILE], Appendix A.1 2315 AlgorithmIdentifier, Attribute, CertificateSerialNumber, 2316 Extensions, UniqueIdentifier 2317 FROM PKIX1Explicit88 2318 { iso(1) identified-organization(3) dod(6) 2319 internet(1) security(5) mechanisms(5) pkix(7) 2320 mod(0) pkix1-explicit(18) } 2322 -- Imports from RFC 3280 [PROFILE], Appendix A.2 2323 GeneralNames 2324 FROM PKIX1Implicit88 2325 { iso(1) identified-organization(3) dod(6) 2326 internet(1) security(5) mechanisms(5) pkix(7) 2327 mod(0) pkix1-implicit(19) } 2329 -- Imports from RFC 3281 [ACPROFILE], Appendix B 2330 AttCertValidityPeriod, IssuerSerial 2331 FROM PKIXAttributeCertificate 2332 { iso(1) identified-organization(3) dod(6) 2333 internet(1) security(5) mechanisms(5) pkix(7) 2334 mod(0) attribute-cert(12) } ; 2336 -- Definition extracted from X.509-1997 [X.509-97], but 2337 -- different type names are used to avoid collisions. 2339 AttributeCertificateV1 ::= SEQUENCE { 2340 acInfo AttributeCertificateInfoV1, 2341 signatureAlgorithm AlgorithmIdentifier, 2342 signature BIT STRING } 2344 AttributeCertificateInfoV1 ::= SEQUENCE { 2345 version AttCertVersionV1 DEFAULT v1, 2346 subject CHOICE { 2347 baseCertificateID [0] IssuerSerial, 2348 -- associated with a Public Key Certificate 2349 subjectName [1] GeneralNames }, 2350 -- associated with a name 2351 issuer GeneralNames, 2352 signature AlgorithmIdentifier, 2353 serialNumber CertificateSerialNumber, 2354 attCertValidityPeriod AttCertValidityPeriod, 2355 attributes SEQUENCE OF Attribute, 2356 issuerUniqueID UniqueIdentifier OPTIONAL, 2357 extensions Extensions OPTIONAL } 2359 AttCertVersionV1 ::= INTEGER { v1(0) } 2361 END -- of AttributeCertificateVersion1 2363 13. Normative References 2365 [ACPROFILE] Farrell, S. and R. Housley, "An Internet Attribute 2366 Certificate Profile for Authorization", RFC 3281, 2367 April 2002. 2369 [PROFILE] Housley, R., Polk, W., Ford, W. and D. Solo, "Internet 2370 X.509 Public Key Infrastructure: Certificate and CRL 2371 Profile", RFC 3280, April 2002. 2373 [STDWORDS] Bradner, S., "Key Words for Use in RFCs to Indicate 2374 Requirement Levels", BCP 14, RFC 2119, March 1997. 2376 [X.208-88] CCITT. Recommendation X.208: Specification of Abstract 2377 Syntax Notation One (ASN.1). 1988. 2379 [X.209-88] CCITT. Recommendation X.209: Specification of Basic 2380 Encoding Rules for Abstract Syntax Notation One (ASN.1). 2381 1988. 2383 [X.501-88] CCITT. Recommendation X.501: The Directory - Models. 2384 1988. 2386 [X.509-88] CCITT. Recommendation X.509: The Directory - 2387 Authentication Framework. 1988. 2389 [X.509-97] ITU-T. Recommendation X.509: The Directory - 2390 Authentication Framework. 1997. 2392 [X.509-00] ITU-T. Recommendation X.509: The Directory - 2393 Authentication Framework. 2000. 2395 14. Informative References 2397 [CMS1] Housley, R., "Cryptographic Message Syntax", 2398 RFC 2630, June 1999. 2400 [CMS2] Housley, R., "Cryptographic Message Syntax", 2401 RFC 3369, August 2002. 2403 [CMSALG] Housley, R., "Cryptographic Message Syntax (CMS) 2404 Algorithms", RFC 3370, August 2002. 2406 [ESS] Hoffman, P., "Enhanced Security Services for S/MIME", 2407 RFC 2634, June 1999. 2409 [MSAC] Microsoft Development Network (MSDN) Library, 2410 "Authenticode", April 2004 Release. 2412 [MSG] Ramsdell, B., "S/MIME Version 3 Message Specification", 2413 RFC 2633, June 1999. 2415 [OCSP] Myers, M., Ankney, R., Malpani, A., Galperin, S., and 2416 C. Adams, "X.509 Internet Public Key Infrastructure 2417 Online Certificate Status Protocol - OCSP", RFC 2560, 2418 June 1999. 2420 [OLDMSG] Dusse, S., Hoffman, P., Ramsdell, B., Lundblade, L., and 2421 L. Repka, "S/MIME Version 2 Message Specification", 2422 RFC 2311, March 1998. 2424 [PKCS#6] RSA Laboratories. PKCS #6: Extended-Certificate Syntax 2425 Standard, Version 1.5. November 1993. 2427 [PKCS#7] Kaliski, B., "PKCS #7: Cryptographic Message Syntax, 2428 Version 1.5.", RFC 2315, March 1998. 2430 [PKCS#9] RSA Laboratories. PKCS #9: Selected Attribute Types, 2431 Version 1.1. November 1993. 2433 [PWRI] Gutmann, P., "Password-based Encryption for S/MIME", 2434 RFC 3211, December 2001. 2436 [RANDOM] Eastlake, D., Crocker, S. and J. Schiller, "Randomness 2437 Recommendations for Security", RFC 1750, December 1994. 2439 15. Security Considerations 2441 The Cryptographic Message Syntax provides a method for digitally 2442 signing data, digesting data, encrypting data, and authenticating 2443 data. 2445 Implementations must protect the signer's private key. Compromise of 2446 the signer's private key permits masquerade. 2448 Implementations must protect the key management private key, the key- 2449 encryption key, and the content-encryption key. Compromise of the 2450 key management private key or the key-encryption key may result in 2451 the disclosure of all contents protected with that key. Similarly, 2452 compromise of the content-encryption key may result in disclosure of 2453 the associated encrypted content. 2455 Implementations must protect the key management private key and the 2456 message-authentication key. Compromise of the key management private 2457 key permits masquerade of authenticated data. Similarly, compromise 2458 of the message-authentication key may result in undetectable 2459 modification of the authenticated content. 2461 The key management technique employed to distribute message- 2462 authentication keys must itself provide data origin authentication, 2463 otherwise the contents are delivered with integrity from an unknown 2464 source. Neither RSA [PKCS#1, NEWPKCS#1] nor Ephemeral-Static Diffie- 2465 Hellman [DH-X9.42] provide the necessary data origin authentication. 2466 Static-Static Diffie-Hellman [DH-X9.42] does provide the necessary 2467 data origin authentication when both the originator and recipient 2468 public keys are bound to appropriate identities in X.509 2469 certificates. 2471 When more than two parties share the same message-authentication key, 2472 data origin authentication is not provided. Any party that knows the 2473 message-authentication key can compute a valid MAC, therefore the 2474 contents could originate from any one of the parties. 2476 Implementations must randomly generate content-encryption keys, 2477 message-authentication keys, initialization vectors (IVs), and 2478 padding. Also, the generation of public/private key pairs relies on 2479 a random numbers. The use of inadequate pseudo-random number 2480 generators (PRNGs) to generate cryptographic keys can result in 2481 little or no security. An attacker may find it much easier to 2482 reproduce the PRNG environment that produced the keys, searching the 2483 resulting small set of possibilities, rather than brute force 2484 searching the whole key space. The generation of quality random 2485 numbers is difficult. RFC 1750 [RANDOM] offers important guidance in 2486 this area. 2488 When using key agreement algorithms or previously distributed 2489 symmetric key-encryption keys, a key-encryption key is used to 2490 encrypt the content-encryption key. If the key-encryption and 2491 content-encryption algorithms are different, the effective security 2492 is determined by the weaker of the two algorithms. If, for example, 2493 content is encrypted with Triple-DES using a 168-bit Triple-DES 2494 content-encryption key, and the content-encryption key is wrapped 2495 with RC2 using a 40-bit RC2 key-encryption key, then at most 40 bits 2496 of protection is provided. A trivial search to determine the value 2497 of the 40-bit RC2 key can recover the Triple-DES key, and then the 2498 Triple-DES key can be used to decrypt the content. Therefore, 2499 implementers must ensure that key-encryption algorithms are as strong 2500 or stronger than content-encryption algorithms. 2502 Implementers should be aware that cryptographic algorithms become 2503 weaker with time. As new cryptoanalysis techniques are developed and 2504 computing performance improves, the work factor to break a particular 2505 cryptographic algorithm will be reduced. Therefore, cryptographic 2506 algorithm implementations should be modular, allowing new algorithms 2507 to be readily inserted. That is, implementors should be prepared for 2508 the set of algorithms that must be supported to change over time. 2510 The countersignature unsigned attribute includes a digital signature 2511 that is computed on the content signature value, thus the 2512 countersigning process need not know the original signed content. 2513 This structure permits implementation efficiency advantages; however, 2514 this structure may also permit the countersigning of an inappropriate 2515 signature value. Therefore, implementations that perform 2516 countersignatures should either verify the original signature value 2517 prior to countersigning it (this verification requires processing of 2518 the original content), or implementations should perform 2519 countersigning in a context that ensures that only appropriate 2520 signature values are countersigned. 2522 16. Acknowledgments 2524 This document is the result of contributions from many professionals. 2525 I appreciate the hard work of all members of the IETF S/MIME Working 2526 Group. I extend a special thanks to Rich Ankney, Simon Blake-Wilson, 2527 Tim Dean, Steve Dusse, Carl Ellison, Peter Gutmann, Bob Jueneman, 2528 Stephen Henson, Paul Hoffman, Scott Hollenbeck, Don Johnson, Burt 2529 Kaliski, John Linn, John Pawling, Blake Ramsdell, Francois Rousseau, 2530 Jim Schaad, Dave Solo, Paul Timmel, and Sean Turner for their efforts 2531 and support. 2533 17. Authors' Address 2535 Russell Housley 2536 Vigil Security, LLC 2537 918 Spring Knoll Drive 2538 Herndon, VA 20170 2539 USA 2540 EMail: housley@vigilsec.com 2542 18. Full Copyright Statement 2544 Copyright (C) The Internet Society (2004). All Rights Reserved. 2546 This document and translations of it may be copied and furnished to 2547 others, and derivative works that comment on or otherwise explain it 2548 or assist in its implementation may be prepared, copied, published and 2549 distributed, in whole or in part, without restriction of any kind, 2550 provided that the above copyright notice and this paragraph are 2551 included on all such copies and derivative works. However, this 2552 document itself may not be modified in any way, such as by removing 2553 the copyright notice or references to the Internet Society or other 2554 Internet organizations, except as needed for the purpose of 2555 developing Internet standards in which case the procedures for 2556 copyrights defined in the Internet Standards process must be 2557 followed, or as required to translate it into languages other than 2558 English. 2560 The limited permissions granted above are perpetual and will not be 2561 revoked by the Internet Society or its successors or assigns. 2563 This document and the information contained herein is provided on an 2564 "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING 2565 TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT 2566 NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN 2567 WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF 2568 MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.