idnits 2.17.1 draft-ietf-smime-rfc3369bis-00.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 5 instances of too long lines in the document, the longest one being 4 characters 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 (March 2004) is 7346 days in the past. Is this intentional? 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 2208 -- Looks like a reference, but probably isn't: '1' on line 2210 -- Looks like a reference, but probably isn't: '2' on line 2095 -- Looks like a reference, but probably isn't: '3' on line 2096 -- Looks like a reference, but probably isn't: '4' on line 1978 ** 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 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 (==), 12 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 March 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 Changes Since RFC 2630 ...................................... ?? 43 1.2 Changes Since RFC 3369 ...................................... ?? 44 1.3 Terminology ................................................. ?? 45 2. General Overview ............................................ ?? 46 3. General Syntax .............................................. ?? 47 4. Data Content Type ........................................... ?? 48 5. Signed-data Content Type .................................... ?? 49 5.1 SignedData Type ............................................. ?? 50 5.2 EncapsulatedContentInfo Type ................................ ?? 51 5.2.1 Compatibility with PKCS #7 ................................ ?? 52 5.3 SignerInfo Type ............................................. ?? 53 5.4 Message Digest Calculation Process .......................... ?? 54 5.5 Signature Generation Process ................................ ?? 55 5.6 Signature Verification Process .............................. ?? 56 6. Enveloped-data Content Type ................................. ?? 57 6.1 EnvelopedData Type .......................................... ?? 58 6.2 RecipientInfo Type .......................................... ?? 59 6.2.1 KeyTransRecipientInfo Type ................................ ?? 60 6.2.2 KeyAgreeRecipientInfo Type ................................ ?? 61 6.2.3 KEKRecipientInfo Type ..................................... ?? 62 6.2.4 PasswordRecipientInfo Type ................................ ?? 63 6.2.5 OtherRecipientInfo Type ................................... ?? 64 6.3 Content-encryption Process .................................. ?? 65 6.4 Key-encryption Process ...................................... ?? 66 7. Digested-data Content Type .................................. ?? 67 8. Encrypted-data Content Type ................................. ?? 68 9. Authenticated-data Content Type ............................. ?? 69 9.1 AuthenticatedData Type ...................................... ?? 70 9.2 MAC Generation .............................................. ?? 71 9.3 MAC Verification ............................................ ?? 72 10. Useful Types ................................................ ?? 73 10.1 Algorithm Identifier Types ................................. ?? 74 10.1.1 DigestAlgorithmIdentifier ................................ ?? 75 10.1.2 SignatureAlgorithmIdentifier ............................. ?? 76 10.1.3 KeyEncryptionAlgorithmIdentifier ......................... ?? 77 10.1.4 ContentEncryptionAlgorithmIdentifier ..................... ?? 78 10.1.5 MessageAuthenticationCodeAlgorithm ....................... ?? 79 10.1.6 KeyDerivationAlgorithmIdentifier ......................... ?? 80 10.2 Other Useful Types ......................................... ?? 81 10.2.1 CertificateRevocationLists ............................... ?? 82 10.2.2 CertificateChoices ....................................... ?? 83 10.2.3 CertificateSet ........................................... ?? 84 10.2.4 IssuerAndSerialNumber .................................... ?? 85 10.2.5 CMSVersion ............................................... ?? 86 10.2.6 UserKeyingMaterial ....................................... ?? 87 10.2.7 OtherKeyAttribute ........................................ ?? 88 11. Useful Attributes ........................................... ?? 89 11.1 Content Type ............................................... ?? 90 11.2 Message Digest ............................................. ?? 91 11.3 Signing Time ............................................... ?? 92 11.4 Countersignature ........................................... ?? 93 12. ASN.1 Modules ............................................... ?? 94 12.1 CMS ASN.1 Module ........................................... ?? 95 12.2 Version 1 Attribute Certificate ASN.1 Module ............... ?? 96 13. Normative References ........................................ ?? 97 14. Informative References ...................................... ?? 98 15. Security Considerations ..................................... ?? 99 16. Acknowledgments ............................................. ?? 100 17. Author Address .............................................. ?? 101 17. Full Copyright Statement .................................... ?? 103 1. Introduction 105 This document describes the Cryptographic Message Syntax (CMS). This 106 syntax is used to digitally sign, digest, authenticate, or encrypt 107 arbitrary message content. 109 The CMS describes an encapsulation syntax for data protection. It 110 supports digital signatures and encryption. The syntax allows 111 multiple encapsulations; one encapsulation envelope can be nested 112 inside another. Likewise, one party can digitally sign some 113 previously encapsulated data. It also allows arbitrary attributes, 114 such as signing time, to be signed along with the message content, 115 and provides for other attributes such as countersignatures to be 116 associated with a signature. 118 The CMS can support a variety of architectures for certificate-based 119 key management, such as the one defined by the PKIX working group 120 [PROFILE]. 122 The CMS values are generated using ASN.1 [X.208-88], using BER- 123 encoding [X.209-88]. Values are typically represented as octet 124 strings. While many systems are capable of transmitting arbitrary 125 octet strings reliably, it is well known that many electronic mail 126 systems are not. This document does not address mechanisms for 127 encoding octet strings for reliable transmission in such 128 environments. 130 The CMS is derived from PKCS #7 version 1.5 as specified in RFC 2315 131 [PKCS#7]. Wherever possible, backward compatibility is preserved; 132 however, changes were necessary to accommodate version 1 attribute 133 certificate transfer, key agreement and symmetric key-encryption key 134 techniques for key management. 136 1.1 Changes Since RFC 2630 138 RFC 3369 [CMS2] obsoletes RFC 2630 [CMS1] and RFC 3211 [PWRI]. 139 Password-based key management is included in the CMS specification, 140 and an extension mechanism to support new key management schemes 141 without further changes to the CMS is specified. Backward 142 compatibility with RFC 2630 and RFC 3211 is preserved; however, 143 version 2 attribute certificate transfer is added. The use of 144 version 1 attribute certificates is deprecated. 146 S/MIME v2 signatures [OLDMSG], which are based on PKCS#7 version 1.5, 147 are compatible with S/MIME v3 signatures [MSG], which are based on 148 RFC 2630. However, there are some subtle compatibility issues with 149 signatures using PKCS#7 version 1.5 and the CMS. These issues are 150 discussed in section 5.2.1. 152 Specific cryptographic algorithms are not discussed in this document, 153 but they were discussed in RFC 2630. The discussion of specific 154 cryptographic algorithms has been moved to a separate document 155 [CMSALG]. Separation of the protocol and algorithm specifications 156 allows the IETF to update each document independently. This 157 specification does not require the implementation of any particular 158 algorithms. Rather, protocols that rely on the CMS are expected to 159 choose appropriate algorithms for their environment. The algorithms 160 may be selected from [CMSALG] or elsewhere. 162 1.2 Changes Since RFC 3369 164 This document obsoletes RFC 3369 [CMS2]. As discussed above, RFC 165 3369 introduced an extension mechanism to support new key management 166 schemes without further changes to the CMS. This document introduces 167 a similar extension mechanism to support additional certificate 168 formats for the verification of digital signatures without further 169 changes to the CMS. Backward compatibility with both RFC 2630 and 170 RFC 3369 is preserved. 172 1.3 Terminology 174 In this document, the key words MUST, MUST NOT, REQUIRED, SHOULD, 175 SHOULD NOT, RECOMMENDED, MAY, and OPTIONAL are to be interpreted as 176 described in [STDWORDS]. 178 2 General Overview 180 The CMS is general enough to support many different content types. 181 This document defines one protection content, ContentInfo. 182 ContentInfo encapsulates a single identified content type, and the 183 identified type may provide further encapsulation. This document 184 defines six content types: data, signed-data, enveloped-data, 185 digested-data, encrypted-data, and authenticated-data. Additional 186 content types can be defined outside this document. 188 An implementation that conforms to this specification MUST implement 189 the protection content, ContentInfo, and MUST implement the data, 190 signed-data, and enveloped-data content types. The other content 191 types MAY be implemented. 193 As a general design philosophy, each content type permits single pass 194 processing using indefinite-length Basic Encoding Rules (BER) 195 encoding. Single-pass operation is especially helpful if content is 196 large, stored on tapes, or is "piped" from another process. Single- 197 pass operation has one significant drawback: it is difficult to 198 perform encode operations using the Distinguished Encoding Rules 199 (DER) [X.509-88] encoding in a single pass since the lengths of the 200 various components may not be known in advance. However, signed 201 attributes within the signed-data content type and authenticated 202 attributes within the authenticated-data content type need to be 203 transmitted in DER form to ensure that recipients can verify a 204 content that contains one or more unrecognized attributes. Signed 205 attributes and authenticated attributes are the only data types used 206 in the CMS that require DER encoding. 208 3 General Syntax 210 The following object identifier identifies the content information 211 type: 213 id-ct-contentInfo OBJECT IDENTIFIER ::= { iso(1) member-body(2) 214 us(840) rsadsi(113549) pkcs(1) pkcs9(9) smime(16) ct(1) 6 } 216 The CMS associates a content type identifier with a content. The 217 syntax MUST have ASN.1 type ContentInfo: 219 ContentInfo ::= SEQUENCE { 220 contentType ContentType, 221 content [0] EXPLICIT ANY DEFINED BY contentType } 223 ContentType ::= OBJECT IDENTIFIER 225 The fields of ContentInfo have the following meanings: 227 contentType indicates the type of the associated content. It is 228 an object identifier; it is a unique string of integers assigned 229 by an authority that defines the content type. 231 content is the associated content. The type of content can be 232 determined uniquely by contentType. Content types for data, 233 signed-data, enveloped-data, digested-data, encrypted-data, and 234 authenticated-data are defined in this document. If additional 235 content types are defined in other documents, the ASN.1 type 236 defined SHOULD NOT be a CHOICE type. 238 4 Data Content Type 240 The following object identifier identifies the data content type: 242 id-data OBJECT IDENTIFIER ::= { iso(1) member-body(2) 243 us(840) rsadsi(113549) pkcs(1) pkcs7(7) 1 } 245 The data content type is intended to refer to arbitrary octet 246 strings, such as ASCII text files; the interpretation is left to the 247 application. Such strings need not have any internal structure 248 (although they could have their own ASN.1 definition or other 249 structure). 251 S/MIME uses id-data to identify MIME encoded content. The use of 252 this content identifier is specified in RFC 2311 for S/MIME v2 253 [OLDMSG] and RFC 2633 for S/MIME v3 [MSG]. 255 The data content type is generally encapsulated in the signed-data, 256 enveloped-data, digested-data, encrypted-data, or authenticated-data 257 content type. 259 5. Signed-data Content Type 261 The signed-data content type consists of a content of any type and 262 zero or more signature values. Any number of signers in parallel can 263 sign any type of content. 265 The typical application of the signed-data content type represents 266 one signer's digital signature on content of the data content type. 267 Another typical application disseminates certificates and certificate 268 revocation lists (CRLs). 270 The process by which signed-data is constructed involves the 271 following steps: 273 1. For each signer, a message digest, or hash value, is computed 274 on the content with a signer-specific message-digest algorithm. 275 If the signer is signing any information other than the content, 276 the message digest of the content and the other information are 277 digested with the signer's message digest algorithm (see Section 278 5.4), and the result becomes the "message digest." 280 2. For each signer, the message digest is digitally signed using 281 the signer's private key. 283 3. For each signer, the signature value and other signer-specific 284 information are collected into a SignerInfo value, as defined in 285 Section 5.3. Certificates and CRLs for each signer, and those not 286 corresponding to any signer, are collected in this step. 288 4. The message digest algorithms for all the signers and the 289 SignerInfo values for all the signers are collected together with 290 the content into a SignedData value, as defined in Section 5.1. 292 A recipient independently computes the message digest. This message 293 digest and the signer's public key are used to verify the signature 294 value. The signer's public key is referenced either by an issuer 295 distinguished name along with an issuer-specific serial number or by 296 a subject key identifier that uniquely identifies the certificate 297 containing the public key. The signer's certificate can be included 298 in the SignedData certificates field. 300 This section is divided into six parts. The first part describes the 301 top-level type SignedData, the second part describes 302 EncapsulatedContentInfo, the third part describes the per-signer 303 information type SignerInfo, and the fourth, fifth, and sixth parts 304 describe the message digest calculation, signature generation, and 305 signature verification processes, respectively. 307 5.1 SignedData Type 309 The following object identifier identifies the signed-data content 310 type: 312 id-signedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) 313 us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 } 315 The signed-data content type shall have ASN.1 type SignedData: 317 SignedData ::= SEQUENCE { 318 version CMSVersion, 319 digestAlgorithms DigestAlgorithmIdentifiers, 320 encapContentInfo EncapsulatedContentInfo, 321 certificates [0] IMPLICIT CertificateSet OPTIONAL, 322 crls [1] IMPLICIT CertificateRevocationLists OPTIONAL, 323 signerInfos SignerInfos } 325 DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier 327 SignerInfos ::= SET OF SignerInfo 329 The fields of type SignedData have the following meanings: 331 version is the syntax version number. The appropriate value 332 depends on certificates, eContentType, and SignerInfo. The 333 version MUST be assigned as follows: 335 IF (certificates is present) AND 336 (any certificates with a type of other are present) 337 THEN version MUST be 5 338 ELSE 339 IF (certificates is present) AND 340 (any version 2 attribute certificates are present) 341 THEN version MUST be 4 342 ELSE 343 IF ((certificates is present) AND 344 (any version 1 attribute certificates are present)) OR 345 (encapContentInfo eContentType is other than id-data) OR 346 (any SignerInfo structures are version 3) 347 THEN version MUST be 3 348 ELSE version MUST be 1 350 digestAlgorithms is a collection of message digest algorithm 351 identifiers. There MAY be any number of elements in the 352 collection, including zero. Each element identifies the message 353 digest algorithm, along with any associated parameters, used by 354 one or more signer. The collection is intended to list the 355 message digest algorithms employed by all of the signers, in any 356 order, to facilitate one-pass signature verification. 357 Implementations MAY fail to validate signatures that use a digest 358 algorithm that is not included in this set. The message digesting 359 process is described in Section 5.4. 361 encapContentInfo is the signed content, consisting of a content 362 type identifier and the content itself. Details of the 363 EncapsulatedContentInfo type are discussed in section 5.2. 365 certificates is a collection of certificates. It is intended that 366 the set of certificates be sufficient to contain certification 367 paths from a recognized "root" or "top-level certification 368 authority" to all of the signers in the signerInfos field. There 369 may be more certificates than necessary, and there may be 370 certificates sufficient to contain certification paths from two or 371 more independent top-level certification authorities. There may 372 also be fewer certificates than necessary, if it is expected that 373 recipients have an alternate means of obtaining necessary 374 certificates (e.g., from a previous set of certificates). The 375 signer's certificate MAY be included. The use of version 1 376 attribute certificates is strongly discouraged. 378 crls is a collection of certificate revocation lists (CRLs). It 379 is intended that the set contain information sufficient to 380 determine whether or not the certificates in the certificates 381 field are valid, but such correspondence is not necessary. There 382 MAY be more CRLs than necessary, and there MAY also be fewer CRLs 383 than necessary. 385 signerInfos is a collection of per-signer information. There MAY 386 be any number of elements in the collection, including zero. The 387 details of the SignerInfo type are discussed in section 5.3. 388 Since each signer can employ a digital signature technique and 389 future specifications could update the syntax, all implementations 390 MUST gracefully handle unimplemented versions of SignerInfo. 391 Further, since all implementations will not support every possible 392 signature algorithm, all implementations MUST gracefully handle 393 unimplemented signature algorithms when they are encountered. 395 5.2 EncapsulatedContentInfo Type 397 The content is represented in the type EncapsulatedContentInfo: 399 EncapsulatedContentInfo ::= SEQUENCE { 400 eContentType ContentType, 401 eContent [0] EXPLICIT OCTET STRING OPTIONAL } 403 ContentType ::= OBJECT IDENTIFIER 405 The fields of type EncapsulatedContentInfo have the following 406 meanings: 408 eContentType is an object identifier. The object identifier 409 uniquely specifies the content type. 411 eContent is the content itself, carried as an octet string. The 412 eContent need not be DER encoded. 414 The optional omission of the eContent within the 415 EncapsulatedContentInfo field makes it possible to construct 416 "external signatures." In the case of external signatures, the 417 content being signed is absent from the EncapsulatedContentInfo value 418 included in the signed-data content type. If the eContent value 419 within EncapsulatedContentInfo is absent, then the signatureValue is 420 calculated and the eContentType is assigned as though the eContent 421 value was present. 423 In the degenerate case where there are no signers, the 424 EncapsulatedContentInfo value being "signed" is irrelevant. In this 425 case, the content type within the EncapsulatedContentInfo value being 426 "signed" MUST be id-data (as defined in section 4), and the content 427 field of the EncapsulatedContentInfo value MUST be omitted. 429 5.2.1 Compatibility with PKCS #7 431 This section contains a word of warning to implementers that wish to 432 support both the CMS and PKCS #7 [PKCS#7] SignedData content types. 433 Both the CMS and PKCS #7 identify the type of the encapsulated 434 content with an object identifier, but the ASN.1 type of the content 435 itself is variable in PKCS #7 SignedData content type. 437 PKCS #7 defines content as: 439 content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL 441 The CMS defines eContent as: 443 eContent [0] EXPLICIT OCTET STRING OPTIONAL 445 The CMS definition is much easier to use in most applications, and it 446 is compatible with both S/MIME v2 and S/MIME v3. S/MIME signed 447 messages using the CMS and PKCS #7 are compatible because identical 448 signed message formats are specified in RFC 2311 for S/MIME v2 449 [OLDMSG] and RFC 2633 for S/MIME v3 [MSG]. S/MIME v2 encapsulates 450 the MIME content in a Data type (that is, an OCTET STRING) carried in 451 the SignedData contentInfo content ANY field, and S/MIME v3 carries 452 the MIME content in the SignedData encapContentInfo eContent OCTET 453 STRING. Therefore, in both S/MIME v2 and S/MIME v3, the MIME content 454 is placed in an OCTET STRING and the message digest is computed over 455 the identical portions of the content. That is, the message digest 456 is computed over the octets comprising the value of the OCTET STRING, 457 neither the tag nor length octets are included. 459 There are incompatibilities between the CMS and PKCS #7 signedData 460 types when the encapsulated content is not formatted using the Data 461 type. For example, when an RFC 2634 [ESS] signed receipt is 462 encapsulated in the CMS signedData type, then the Receipt SEQUENCE is 463 encoded in the signedData encapContentInfo eContent OCTET STRING and 464 the message digest is computed using the entire Receipt SEQUENCE 465 encoding (including tag, length and value octets). However, if an 466 RFC 2634 signed receipt is encapsulated in the PKCS #7 signedData 467 type, then the Receipt SEQUENCE is DER encoded [X.509-88] in the 468 SignedData contentInfo content ANY field (a SEQUENCE, not an OCTET 469 STRING). Therefore, the message digest is computed using only the 470 value octets of the Receipt SEQUENCE encoding. 472 The following strategy can be used to achieve backward compatibility 473 with PKCS #7 when processing SignedData content types. If the 474 implementation is unable to ASN.1 decode the signedData type using 475 the CMS signedData encapContentInfo eContent OCTET STRING syntax, 476 then the implementation MAY attempt to decode the signedData type 477 using the PKCS #7 SignedData contentInfo content ANY syntax and 478 compute the message digest accordingly. 480 The following strategy can be used to achieve backward compatibility 481 with PKCS #7 when creating a SignedData content type in which the 482 encapsulated content is not formatted using the Data type. 483 Implementations MAY examine the value of the eContentType, and then 484 adjust the expected DER encoding of eContent based on the object 485 identifier value. For example, to support Microsoft AuthentiCode, 486 the following information MAY be included: 488 eContentType Object Identifier is set to { 1 3 6 1 4 1 311 2 1 4 } 490 eContent contains DER encoded AuthentiCode signing information 492 5.3 SignerInfo Type 494 Per-signer information is represented in the type SignerInfo: 496 SignerInfo ::= SEQUENCE { 497 version CMSVersion, 498 sid SignerIdentifier, 499 digestAlgorithm DigestAlgorithmIdentifier, 500 signedAttrs [0] IMPLICIT SignedAttributes OPTIONAL, 501 signatureAlgorithm SignatureAlgorithmIdentifier, 502 signature SignatureValue, 503 unsignedAttrs [1] IMPLICIT UnsignedAttributes OPTIONAL } 505 SignerIdentifier ::= CHOICE { 506 issuerAndSerialNumber IssuerAndSerialNumber, 507 subjectKeyIdentifier [0] SubjectKeyIdentifier } 509 SignedAttributes ::= SET SIZE (1..MAX) OF Attribute 511 UnsignedAttributes ::= SET SIZE (1..MAX) OF Attribute 513 Attribute ::= SEQUENCE { 514 attrType OBJECT IDENTIFIER, 515 attrValues SET OF AttributeValue } 517 AttributeValue ::= ANY 519 SignatureValue ::= OCTET STRING 521 The fields of type SignerInfo have the following meanings: 523 version is the syntax version number. If the SignerIdentifier is 524 the CHOICE issuerAndSerialNumber, then the version MUST be 1. If 525 the SignerIdentifier is subjectKeyIdentifier, then the version 526 MUST be 3. 528 sid specifies the signer's certificate (and thereby the signer's 529 public key). The signer's public key is needed by the recipient 530 to verify the signature. SignerIdentifier provides two 531 alternatives for specifying the signer's public key. The 532 issuerAndSerialNumber alternative identifies the signer's 533 certificate by the issuer's distinguished name and the certificate 534 serial number; the subjectKeyIdentifier identifies the signer's 535 certificate by the X.509 subjectKeyIdentifier extension value. 536 Implementations MUST support the reception of the 537 issuerAndSerialNumber and subjectKeyIdentifier forms of 538 SignerIdentifier. When generating a SignerIdentifier, 539 implementations MAY support one of the forms (either 540 issuerAndSerialNumber or subjectKeyIdentifier) and always use it, 541 or implementations MAY arbitrarily mix the two forms. 543 digestAlgorithm identifies the message digest algorithm, and any 544 associated parameters, used by the signer. The message digest is 545 computed on either the content being signed or the content 546 together with the signed attributes using the process described in 547 section 5.4. The message digest algorithm SHOULD be among those 548 listed in the digestAlgorithms field of the associated SignerData. 549 Implementations MAY fail to validate signatures that use a digest 550 algorithm that is not included in the SignedData digestAlgorithms 551 set. 553 signedAttrs is a collection of attributes that are signed. The 554 field is optional, but it MUST be present if the content type of 555 the EncapsulatedContentInfo value being signed is not id-data. 556 SignedAttributes MUST be DER encoded, even if the rest of the 557 structure is BER encoded. Useful attribute types, such as signing 558 time, are defined in Section 11. If the field is present, it MUST 559 contain, at a minimum, the following two attributes: 561 A content-type attribute having as its value the content type 562 of the EncapsulatedContentInfo value being signed. Section 563 11.1 defines the content-type attribute. However, the content- 564 type attribute MUST NOT be used as part of a countersignature 565 unsigned attribute as defined in section 11.4. 567 A message-digest attribute, having as its value the message 568 digest of the content. Section 11.2 defines the message-digest 569 attribute. 571 signatureAlgorithm identifies the signature algorithm, and any 572 associated parameters, used by the signer to generate the digital 573 signature. 575 signature is the result of digital signature generation, using the 576 message digest and the signer's private key. The details of the 577 signature depend on the signature algorithm employed. 579 unsignedAttrs is a collection of attributes that are not signed. 580 The field is optional. Useful attribute types, such as 581 countersignatures, are defined in Section 11. 583 The fields of type SignedAttribute and UnsignedAttribute have the 584 following meanings: 586 attrType indicates the type of attribute. It is an object 587 identifier. 589 attrValues is a set of values that comprise the attribute. The 590 type of each value in the set can be determined uniquely by 591 attrType. The attrType can impose restrictions on the number of 592 items in the set. 594 5.4 Message Digest Calculation Process 596 The message digest calculation process computes a message digest on 597 either the content being signed or the content together with the 598 signed attributes. In either case, the initial input to the message 599 digest calculation process is the "value" of the encapsulated content 600 being signed. Specifically, the initial input is the 601 encapContentInfo eContent OCTET STRING to which the signing process 602 is applied. Only the octets comprising the value of the eContent 603 OCTET STRING are input to the message digest algorithm, not the tag 604 or the length octets. 606 The result of the message digest calculation process depends on 607 whether the signedAttrs field is present. When the field is absent, 608 the result is just the message digest of the content as described 609 above. When the field is present, however, the result is the message 610 digest of the complete DER encoding of the SignedAttrs value 611 contained in the signedAttrs field. Since the SignedAttrs value, 612 when present, must contain the content-type and the message-digest 613 attributes, those values are indirectly included in the result. The 614 content-type attribute MUST NOT be included in a countersignature 615 unsigned attribute as defined in section 11.4. A separate encoding 616 of the signedAttrs field is performed for message digest calculation. 617 The IMPLICIT [0] tag in the signedAttrs is not used for the DER 618 encoding, rather an EXPLICIT SET OF tag is used. That is, the DER 619 encoding of the EXPLICIT SET OF tag, rather than of the IMPLICIT [0] 620 tag, MUST be included in the message digest calculation along with 621 the length and content octets of the SignedAttributes value. 623 When the signedAttrs field is absent, only the octets comprising the 624 value of the signedData encapContentInfo eContent OCTET STRING (e.g., 625 the contents of a file) are input to the message digest calculation. 626 This has the advantage that the length of the content being signed 627 need not be known in advance of the signature generation process. 629 Although the encapContentInfo eContent OCTET STRING tag and length 630 octets are not included in the message digest calculation, they are 631 protected by other means. The length octets are protected by the 632 nature of the message digest algorithm since it is computationally 633 infeasible to find any two distinct message contents of any length 634 that have the same message digest. 636 5.5 Signature Generation Process 638 The input to the signature generation process includes the result of 639 the message digest calculation process and the signer's private key. 640 The details of the signature generation depend on the signature 641 algorithm employed. The object identifier, along with any 642 parameters, that specifies the signature algorithm employed by the 643 signer is carried in the signatureAlgorithm field. The signature 644 value generated by the signer MUST be encoded as an OCTET STRING and 645 carried in the signature field. 647 5.6 Signature Verification Process 649 The input to the signature verification process includes the result 650 of the message digest calculation process and the signer's public 651 key. The recipient MAY obtain the correct public key for the signer 652 by any means, but the preferred method is from a certificate obtained 653 from the SignedData certificates field. The selection and validation 654 of the signer's public key MAY be based on certification path 655 validation (see [PROFILE]) as well as other external context, but is 656 beyond the scope of this document. The details of the signature 657 verification depend on the signature algorithm employed. 659 The recipient MUST NOT rely on any message digest values computed by 660 the originator. If the SignedData signerInfo includes 661 signedAttributes, then the content message digest MUST be calculated 662 as described in section 5.4. For the signature to be valid, the 663 message digest value calculated by the recipient MUST be the same as 664 the value of the messageDigest attribute included in the 665 signedAttributes of the SignedData signerInfo. 667 If the SignedData signerInfo includes signedAttributes, then the 668 content-type attribute value MUST match the SignedData 669 encapContentInfo eContentType value. 671 6. Enveloped-data Content Type 673 The enveloped-data content type consists of an encrypted content of 674 any type and encrypted content-encryption keys for one or more 675 recipients. The combination of the encrypted content and one 676 encrypted content-encryption key for a recipient is a "digital 677 envelope" for that recipient. Any type of content can be enveloped 678 for an arbitrary number of recipients using any of the three key 679 management techniques for each recipient. 681 The typical application of the enveloped-data content type will 682 represent one or more recipients' digital envelopes on content of the 683 data or signed-data content types. 685 Enveloped-data is constructed by the following steps: 687 1. A content-encryption key for a particular content-encryption 688 algorithm is generated at random. 690 2. The content-encryption key is encrypted for each recipient. 691 The details of this encryption depend on the key management 692 algorithm used, but four general techniques are supported: 694 key transport: the content-encryption key is encrypted in the 695 recipient's public key; 697 key agreement: the recipient's public key and the sender's 698 private key are used to generate a pairwise symmetric key, then 699 the content-encryption key is encrypted in the pairwise 700 symmetric key; 702 symmetric key-encryption keys: the content-encryption key is 703 encrypted in a previously distributed symmetric key-encryption 704 key; and 706 passwords: the content-encryption key is encrypted in a key- 707 encryption key that is derived from a password or other shared 708 secret value. 710 3. For each recipient, the encrypted content-encryption key and 711 other recipient-specific information are collected into a 712 RecipientInfo value, defined in Section 6.2. 714 4. The content is encrypted with the content-encryption key. 715 Content encryption may require that the content be padded to a 716 multiple of some block size; see Section 6.3. 718 5. The RecipientInfo values for all the recipients are collected 719 together with the encrypted content to form an EnvelopedData value 720 as defined in Section 6.1. 722 A recipient opens the digital envelope by decrypting one of the 723 encrypted content-encryption keys and then decrypting the encrypted 724 content with the recovered content-encryption key. 726 This section is divided into four parts. The first part describes 727 the top-level type EnvelopedData, the second part describes the per- 728 recipient information type RecipientInfo, and the third and fourth 729 parts describe the content-encryption and key-encryption processes. 731 6.1 EnvelopedData Type 733 The following object identifier identifies the enveloped-data content 734 type: 736 id-envelopedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) 737 us(840) rsadsi(113549) pkcs(1) pkcs7(7) 3 } 739 The enveloped-data content type shall have ASN.1 type EnvelopedData: 741 EnvelopedData ::= SEQUENCE { 742 version CMSVersion, 743 originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL, 744 recipientInfos RecipientInfos, 745 encryptedContentInfo EncryptedContentInfo, 746 unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL } 748 OriginatorInfo ::= SEQUENCE { 749 certs [0] IMPLICIT CertificateSet OPTIONAL, 750 crls [1] IMPLICIT CertificateRevocationLists OPTIONAL } 752 RecipientInfos ::= SET SIZE (1..MAX) OF RecipientInfo 754 EncryptedContentInfo ::= SEQUENCE { 755 contentType ContentType, 756 contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier, 757 encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL } 759 EncryptedContent ::= OCTET STRING 761 UnprotectedAttributes ::= SET SIZE (1..MAX) OF Attribute 763 The fields of type EnvelopedData have the following meanings: 765 version is the syntax version number. The appropriate value 766 depends on originatorInfo, RecipientInfo, and unprotectedAttrs. 767 The version MUST be assigned as follows: 769 IF ((originatorInfo is present) AND 770 (any version 2 attribute certificates are present)) OR 771 (any RecipientInfo structures include pwri) OR 772 (any RecipientInfo structures include ori) 773 THEN version is 3 774 ELSE 775 IF (originatorInfo is present) OR 776 (unprotectedAttrs is present) OR 777 (any RecipientInfo structures are a version other than 0) 778 THEN version is 2 779 ELSE version is 0 781 originatorInfo optionally provides information about the 782 originator. It is present only if required by the key management 783 algorithm. It may contain certificates and CRLs: 785 certs is a collection of certificates. certs may contain 786 originator certificates associated with several different key 787 management 789 algorithms. certs may also contain attribute certificates 790 associated with the originator. The certificates contained in 791 certs are intended to be sufficient for all recipients to build 792 certification paths from a recognized "root" or "top-level 793 certification authority." However, certs may contain more 794 certificates than necessary, and there may be certificates 795 sufficient to make certification paths from two or more 796 independent top-level certification authorities. 797 Alternatively, certs may contain fewer certificates than 798 necessary, if it is expected that recipients have an alternate 799 means of obtaining necessary certificates (e.g., from a 800 previous set of certificates). 802 crls is a collection of CRLs. It is intended that the set 803 contain information sufficient to determine whether or not the 804 certificates in the certs field are valid, but such 805 correspondence is not necessary. There MAY be more CRLs than 806 necessary, and there MAY also be fewer CRLs than necessary. 808 recipientInfos is a collection of per-recipient information. 809 There MUST be at least one element in the collection. 811 encryptedContentInfo is the encrypted content information. 813 unprotectedAttrs is a collection of attributes that are not 814 encrypted. The field is optional. Useful attribute types are 815 defined in Section 11. 817 The fields of type EncryptedContentInfo have the following meanings: 819 contentType indicates the type of content. 821 contentEncryptionAlgorithm identifies the content-encryption 822 algorithm, and any associated parameters, used to encrypt the 823 content. The content-encryption process is described in Section 824 6.3. The same content-encryption algorithm and content-encryption 825 key are used for all recipients. 827 encryptedContent is the result of encrypting the content. The 828 field is optional, and if the field is not present, its intended 829 value must be supplied by other means. 831 The recipientInfos field comes before the encryptedContentInfo field 832 so that an EnvelopedData value may be processed in a single pass. 834 6.2 RecipientInfo Type 836 Per-recipient information is represented in the type RecipientInfo. 837 RecipientInfo has a different format for each of the supported key 838 management techniques. Any of the key management techniques can be 839 used for each recipient of the same encrypted content. In all cases, 840 the encrypted content-encryption key is transferred to one or more 841 recipients. 843 Since all implementations will not support every possible key 844 management algorithm, all implementations MUST gracefully handle 845 unimplemented algorithms when they are encountered. For example, if 846 a recipient receives a content-encryption key encrypted in their RSA 847 public key using RSA-OAEP and the implementation only supports RSA 848 PKCS #1 v1.5, then a graceful failure must be implemented. 850 Implementations MUST support key transport, key agreement, and 851 previously distributed symmetric key-encryption keys, as represented 852 by ktri, kari, and kekri, respectively. Implementations MAY support 853 the password-based key management as represented by pwri. 854 Implementations MAY support any other key management technique as 855 represented by ori. Since each recipient can employ a different key 856 management technique and future specifications could define 857 additional key management techniques, all implementations MUST 858 gracefully handle unimplemented alternatives within the RecipientInfo 859 CHOICE, all implementations MUST gracefully handle unimplemented 860 versions of otherwise supported alternatives within the RecipientInfo 861 CHOICE, and all implementations MUST gracefully handle unimplemented 862 or unknown ori alternatives. 864 RecipientInfo ::= CHOICE { 865 ktri KeyTransRecipientInfo, 866 kari [1] KeyAgreeRecipientInfo, 867 kekri [2] KEKRecipientInfo, 868 pwri [3] PasswordRecipientinfo, 869 ori [4] OtherRecipientInfo } 871 EncryptedKey ::= OCTET STRING 873 6.2.1 KeyTransRecipientInfo Type 875 Per-recipient information using key transport is represented in the 876 type KeyTransRecipientInfo. Each instance of KeyTransRecipientInfo 877 transfers the content-encryption key to one recipient. 879 KeyTransRecipientInfo ::= SEQUENCE { 880 version CMSVersion, -- always set to 0 or 2 881 rid RecipientIdentifier, 882 keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier, 883 encryptedKey EncryptedKey } 885 RecipientIdentifier ::= CHOICE { 886 issuerAndSerialNumber IssuerAndSerialNumber, 887 subjectKeyIdentifier [0] SubjectKeyIdentifier } 889 The fields of type KeyTransRecipientInfo have the following meanings: 891 version is the syntax version number. If the RecipientIdentifier 892 is the CHOICE issuerAndSerialNumber, then the version MUST be 0. 893 If the RecipientIdentifier is subjectKeyIdentifier, then the 894 version MUST be 2. 896 rid specifies the recipient's certificate or key that was used by 897 the sender to protect the content-encryption key. The 898 RecipientIdentifier provides two alternatives for specifying the 899 recipient's certificate, and thereby the recipient's public key. 900 The recipient's certificate must contain a key transport public 901 key. Therefore, a recipient X.509 version 3 certificate that 902 contains a key usage extension MUST assert the keyEncipherment 903 bit. The content-encryption key is encrypted with the recipient's 904 public key. The issuerAndSerialNumber alternative identifies the 905 recipient's certificate by the issuer's distinguished name and the 906 certificate serial number; the subjectKeyIdentifier identifies the 907 recipient's certificate by the X.509 subjectKeyIdentifier 908 extension value. For recipient processing, implementations MUST 909 support both of these alternatives for specifying the recipient's 910 certificate; and for sender processing, implementations MUST 911 support at least one of these alternatives. 913 keyEncryptionAlgorithm identifies the key-encryption algorithm, 914 and any associated parameters, used to encrypt the content- 915 encryption key for the recipient. The key-encryption process is 916 described in Section 6.4. 918 encryptedKey is the result of encrypting the content-encryption 919 key for the recipient. 921 6.2.2 KeyAgreeRecipientInfo Type 923 Recipient information using key agreement is represented in the type 924 KeyAgreeRecipientInfo. Each instance of KeyAgreeRecipientInfo will 925 transfer the content-encryption key to one or more recipients that 926 use the same key agreement algorithm and domain parameters for that 927 algorithm. 929 KeyAgreeRecipientInfo ::= SEQUENCE { 930 version CMSVersion, -- always set to 3 931 originator [0] EXPLICIT OriginatorIdentifierOrKey, 932 ukm [1] EXPLICIT UserKeyingMaterial OPTIONAL, 933 keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier, 934 recipientEncryptedKeys RecipientEncryptedKeys } 936 OriginatorIdentifierOrKey ::= CHOICE { 937 issuerAndSerialNumber IssuerAndSerialNumber, 938 subjectKeyIdentifier [0] SubjectKeyIdentifier, 939 originatorKey [1] OriginatorPublicKey } 941 OriginatorPublicKey ::= SEQUENCE { 942 algorithm AlgorithmIdentifier, 943 publicKey BIT STRING } 945 RecipientEncryptedKeys ::= SEQUENCE OF RecipientEncryptedKey 947 RecipientEncryptedKey ::= SEQUENCE { 948 rid KeyAgreeRecipientIdentifier, 949 encryptedKey EncryptedKey } 951 KeyAgreeRecipientIdentifier ::= CHOICE { 952 issuerAndSerialNumber IssuerAndSerialNumber, 953 rKeyId [0] IMPLICIT RecipientKeyIdentifier } 955 RecipientKeyIdentifier ::= SEQUENCE { 956 subjectKeyIdentifier SubjectKeyIdentifier, 957 date GeneralizedTime OPTIONAL, 958 other OtherKeyAttribute OPTIONAL } 960 SubjectKeyIdentifier ::= OCTET STRING 962 The fields of type KeyAgreeRecipientInfo have the following meanings: 964 version is the syntax version number. It MUST always be 3. 966 originator is a CHOICE with three alternatives specifying the 967 sender's key agreement public key. The sender uses the 968 corresponding private key and the recipient's public key to 969 generate a pairwise key. The content-encryption key is encrypted 970 in the pairwise key. The issuerAndSerialNumber alternative 971 identifies the sender's certificate, and thereby the sender's 972 public key, by the issuer's distinguished name and the certificate 973 serial number. The subjectKeyIdentifier alternative identifies 974 the sender's certificate, and thereby the sender's public key, by 975 the X.509 subjectKeyIdentifier extension value. The originatorKey 976 alternative includes the algorithm identifier and sender's key 977 agreement public key. This alternative permits originator 978 anonymity since the public key is not certified. Implementations 979 MUST support all three alternatives for specifying the sender's 980 public key. 982 ukm is optional. With some key agreement algorithms, the sender 983 provides a User Keying Material (UKM) to ensure that a different 984 key is generated each time the same two parties generate a 985 pairwise key. Implementations MUST support recipient processing 986 of a KeyAgreeRecipientInfo SEQUENCE that includes a ukm field. 987 Implementations that do not support key agreement algorithms that 988 make use of UKMs MUST gracefully handle the presence of UKMs. 990 keyEncryptionAlgorithm identifies the key-encryption algorithm, 991 and any associated parameters, used to encrypt the content- 992 encryption key with the key-encryption key. The key-encryption 993 process is described in Section 6.4. 995 recipientEncryptedKeys includes a recipient identifier and 996 encrypted key for one or more recipients. The 997 KeyAgreeRecipientIdentifier is a CHOICE with two alternatives 998 specifying the recipient's certificate, and thereby the 999 recipient's public key, that was used by the sender to generate a 1000 pairwise key-encryption key. The recipient's certificate must 1001 contain a key agreement public key. Therefore, a recipient X.509 1002 version 3 certificate that contains a key usage extension MUST 1003 assert the keyAgreement bit. The content-encryption key is 1004 encrypted in the pairwise key-encryption key. The 1005 issuerAndSerialNumber alternative identifies the recipient's 1006 certificate by the issuer's distinguished name and the certificate 1007 serial number; the RecipientKeyIdentifier is described below. The 1008 encryptedKey is the result of encrypting the content-encryption 1009 key in the pairwise key-encryption key generated using the key 1010 agreement algorithm. Implementations MUST support both 1011 alternatives for specifying the recipient's certificate. 1013 The fields of type RecipientKeyIdentifier have the following 1014 meanings: 1016 subjectKeyIdentifier identifies the recipient's certificate by the 1017 X.509 subjectKeyIdentifier extension value. 1019 date is optional. When present, the date specifies which of the 1020 recipient's previously distributed UKMs was used by the sender. 1022 other is optional. When present, this field contains additional 1023 information used by the recipient to locate the public keying 1024 material used by the sender. 1026 6.2.3 KEKRecipientInfo Type 1028 Recipient information using previously distributed symmetric keys is 1029 represented in the type KEKRecipientInfo. Each instance of 1030 KEKRecipientInfo will transfer the content-encryption key to one or 1031 more recipients who have the previously distributed key-encryption 1032 key. 1034 KEKRecipientInfo ::= SEQUENCE { 1035 version CMSVersion, -- always set to 4 1036 kekid KEKIdentifier, 1037 keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier, 1038 encryptedKey EncryptedKey } 1040 KEKIdentifier ::= SEQUENCE { 1041 keyIdentifier OCTET STRING, 1042 date GeneralizedTime OPTIONAL, 1043 other OtherKeyAttribute OPTIONAL } 1045 The fields of type KEKRecipientInfo have the following meanings: 1047 version is the syntax version number. It MUST always be 4. 1049 kekid specifies a symmetric key-encryption key that was previously 1050 distributed to the sender and one or more recipients. 1052 keyEncryptionAlgorithm identifies the key-encryption algorithm, 1053 and any associated parameters, used to encrypt the content- 1054 encryption key with the key-encryption key. The key-encryption 1055 process is described in Section 6.4. 1057 encryptedKey is the result of encrypting the content-encryption 1058 key in the key-encryption key. 1060 The fields of type KEKIdentifier have the following meanings: 1062 keyIdentifier identifies the key-encryption key that was 1063 previously distributed to the sender and one or more recipients. 1065 date is optional. When present, the date specifies a single key- 1066 encryption key from a set that was previously distributed. 1068 other is optional. When present, this field contains additional 1069 information used by the recipient to determine the key-encryption 1070 key used by the sender. 1072 6.2.4 PasswordRecipientInfo Type 1074 Recipient information using a password or shared secret value is 1075 represented in the type PasswordRecipientInfo. Each instance of 1076 PasswordRecipientInfo will transfer the content-encryption key to one 1077 or more recipients who possess the password or shared secret value. 1079 The PasswordRecipientInfo Type is specified in RFC 3211 [PWRI]. The 1080 PasswordRecipientInfo structure is repeated here for completeness. 1082 PasswordRecipientInfo ::= SEQUENCE { 1083 version CMSVersion, -- Always set to 0 1084 keyDerivationAlgorithm [0] KeyDerivationAlgorithmIdentifier 1085 OPTIONAL, 1086 keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier, 1087 encryptedKey EncryptedKey } 1089 The fields of type PasswordRecipientInfo have the following meanings: 1091 version is the syntax version number. It MUST always be 0. 1093 keyDerivationAlgorithm identifies the key-derivation algorithm, 1094 and any associated parameters, used to derive the key-encryption 1095 key from the password or shared secret value. If this field is 1096 absent, the key-encryption key is supplied from an external 1097 source, for example a hardware crypto token such as a smart card. 1099 keyEncryptionAlgorithm identifies the encryption algorithm, and 1100 any associated parameters, used to encrypt the content-encryption 1101 key with the key-encryption key. 1103 encryptedKey is the result of encrypting the content-encryption 1104 key with the key-encryption key. 1106 6.2.5 OtherRecipientInfo Type 1108 Recipient information for additional key management techniques are 1109 represented in the type OtherRecipientInfo. The OtherRecipientInfo 1110 type allows key management techniques beyond key transport, key 1111 agreement, previously distributed symmetric key-encryption keys, and 1112 password-based key management to be specified in future documents. 1113 An object identifier uniquely identifies such key management 1114 techniques. 1116 OtherRecipientInfo ::= SEQUENCE { 1117 oriType OBJECT IDENTIFIER, 1118 oriValue ANY DEFINED BY oriType } 1120 The fields of type OtherRecipientInfo have the following meanings: 1122 oriType identifies the key management technique. 1124 oriValue contains the protocol data elements needed by a recipient 1125 using the identified key management technique. 1127 6.3 Content-encryption Process 1129 The content-encryption key for the desired content-encryption 1130 algorithm is randomly generated. The data to be protected is padded 1131 as described below, then the padded data is encrypted using the 1132 content-encryption key. The encryption operation maps an arbitrary 1133 string of octets (the data) to another string of octets (the 1134 ciphertext) under control of a content-encryption key. The encrypted 1135 data is included in the envelopedData encryptedContentInfo 1136 encryptedContent OCTET STRING. 1138 Some content-encryption algorithms assume the input length is a 1139 multiple of k octets, where k is greater than one. For such 1140 algorithms, the input shall be padded at the trailing end with 1141 k-(lth mod k) octets all having value k-(lth mod k), where lth is 1142 the length of the input. In other words, the input is padded at 1143 the trailing end with one of the following strings: 1145 01 -- if lth mod k = k-1 1146 02 02 -- if lth mod k = k-2 1147 . 1148 . 1149 . 1150 k k ... k k -- if lth mod k = 0 1152 The padding can be removed unambiguously since all input is padded, 1153 including input values that are already a multiple of the block size, 1154 and no padding string is a suffix of another. This padding method is 1155 well defined if and only if k is less than 256. 1157 6.4 Key-encryption Process 1159 The input to the key-encryption process -- the value supplied to the 1160 recipient's key-encryption algorithm -- is just the "value" of the 1161 content-encryption key. 1163 Any of the aforementioned key management techniques can be used for 1164 each recipient of the same encrypted content. 1166 7. Digested-data Content Type 1168 The digested-data content type consists of content of any type and a 1169 message digest of the content. 1171 Typically, the digested-data content type is used to provide content 1172 integrity, and the result generally becomes an input to the 1173 enveloped-data content type. 1175 The following steps construct digested-data: 1177 1. A message digest is computed on the content with a message- 1178 digest algorithm. 1180 2. The message-digest algorithm and the message digest are 1181 collected together with the content into a DigestedData value. 1183 A recipient verifies the message digest by comparing the message 1184 digest to an independently computed message digest. 1186 The following object identifier identifies the digested-data content 1187 type: 1189 id-digestedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) 1190 us(840) rsadsi(113549) pkcs(1) pkcs7(7) 5 } 1192 The digested-data content type shall have ASN.1 type DigestedData: 1194 DigestedData ::= SEQUENCE { 1195 version CMSVersion, 1196 digestAlgorithm DigestAlgorithmIdentifier, 1197 encapContentInfo EncapsulatedContentInfo, 1198 digest Digest } 1200 Digest ::= OCTET STRING 1202 The fields of type DigestedData have the following meanings: 1204 version is the syntax version number. If the encapsulated content 1205 type is id-data, then the value of version MUST be 0; however, if 1206 the encapsulated content type is other than id-data, then the 1207 value of version MUST be 2. 1209 digestAlgorithm identifies the message digest algorithm, and any 1210 associated parameters, under which the content is digested. The 1211 message-digesting process is the same as in Section 5.4 in the 1212 case when there are no signed attributes. 1214 encapContentInfo is the content that is digested, as defined in 1215 section 5.2. 1217 digest is the result of the message-digesting process. 1219 The ordering of the digestAlgorithm field, the encapContentInfo 1220 field, and the digest field makes it possible to process a 1221 DigestedData value in a single pass. 1223 8. Encrypted-data Content Type 1225 The encrypted-data content type consists of encrypted content of any 1226 type. Unlike the enveloped-data content type, the encrypted-data 1227 content type has neither recipients nor encrypted content-encryption 1228 keys. Keys MUST be managed by other means. 1230 The typical application of the encrypted-data content type will be to 1231 encrypt the content of the data content type for local storage, 1232 perhaps where the encryption key is derived from a password. 1234 The following object identifier identifies the encrypted-data content 1235 type: 1237 id-encryptedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) 1238 us(840) rsadsi(113549) pkcs(1) pkcs7(7) 6 } 1240 The encrypted-data content type shall have ASN.1 type EncryptedData: 1242 EncryptedData ::= SEQUENCE { 1243 version CMSVersion, 1244 encryptedContentInfo EncryptedContentInfo, 1245 unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL } 1247 The fields of type EncryptedData have the following meanings: 1249 version is the syntax version number. If unprotectedAttrs is 1250 present, then version MUST be 2. If unprotectedAttrs is absent, 1251 then version MUST be 0. 1253 encryptedContentInfo is the encrypted content information, as 1254 defined in Section 6.1. 1256 unprotectedAttrs is a collection of attributes that are not 1257 encrypted. The field is optional. Useful attribute types are 1258 defined in Section 11. 1260 9. Authenticated-data Content Type 1262 The authenticated-data content type consists of content of any type, 1263 a message authentication code (MAC), and encrypted authentication 1264 keys for one or more recipients. The combination of the MAC and one 1265 encrypted authentication key for a recipient is necessary for that 1266 recipient to verify the integrity of the content. Any type of 1267 content can be integrity protected for an arbitrary number of 1268 recipients. 1270 The process by which authenticated-data is constructed involves the 1271 following steps: 1273 1. A message-authentication key for a particular message- 1274 authentication algorithm is generated at random. 1276 2. The message-authentication key is encrypted for each 1277 recipient. The details of this encryption depend on the key 1278 management algorithm used. 1280 3. For each recipient, the encrypted message-authentication key 1281 and other recipient-specific information are collected into a 1282 RecipientInfo value, defined in Section 6.2. 1284 4. Using the message-authentication key, the originator computes 1285 a MAC value on the content. If the originator is authenticating 1286 any information in addition to the content (see Section 9.2), a 1287 message digest is calculated on the content, the message digest of 1288 the content and the other information are authenticated using the 1289 message-authentication key, and the result becomes the "MAC 1290 value." 1292 9.1 AuthenticatedData Type 1294 The following object identifier identifies the authenticated-data 1295 content type: 1297 id-ct-authData OBJECT IDENTIFIER ::= { iso(1) member-body(2) 1298 us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) 1299 ct(1) 2 } 1301 The authenticated-data content type shall have ASN.1 type 1302 AuthenticatedData: 1304 AuthenticatedData ::= SEQUENCE { 1305 version CMSVersion, 1306 originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL, 1307 recipientInfos RecipientInfos, 1308 macAlgorithm MessageAuthenticationCodeAlgorithm, 1309 digestAlgorithm [1] DigestAlgorithmIdentifier OPTIONAL, 1310 encapContentInfo EncapsulatedContentInfo, 1311 authAttrs [2] IMPLICIT AuthAttributes OPTIONAL, 1312 mac MessageAuthenticationCode, 1313 unauthAttrs [3] IMPLICIT UnauthAttributes OPTIONAL } 1315 AuthAttributes ::= SET SIZE (1..MAX) OF Attribute 1317 UnauthAttributes ::= SET SIZE (1..MAX) OF Attribute 1319 MessageAuthenticationCode ::= OCTET STRING 1321 The fields of type AuthenticatedData have the following meanings: 1323 version is the syntax version number. The version MUST be 1324 assigned as follows: 1326 IF ((originatorInfo is present) AND 1327 (any version 2 attribute certificates are present)) 1328 THEN version is 1 1329 ELSE version is 0 1331 originatorInfo optionally provides information about the 1332 originator. It is present only if required by the key management 1333 algorithm. It MAY contain certificates, attribute certificates, 1334 and CRLs, as defined in Section 6.1. 1336 recipientInfos is a collection of per-recipient information, as 1337 defined in Section 6.1. There MUST be at least one element in the 1338 collection. 1340 macAlgorithm is a message authentication code (MAC) algorithm 1341 identifier. It identifies the MAC algorithm, along with any 1342 associated parameters, used by the originator. Placement of the 1343 macAlgorithm field facilitates one-pass processing by the 1344 recipient. 1346 digestAlgorithm identifies the message digest algorithm, and any 1347 associated parameters, used to compute a message digest on the 1348 encapsulated content if authenticated attributes are present. The 1349 message digesting process is described in Section 9.2. Placement 1350 of the digestAlgorithm field facilitates one-pass processing by 1351 the recipient. If the digestAlgorithm field is present, then the 1352 authAttrs field MUST also be present. 1354 encapContentInfo is the content that is authenticated, as defined 1355 in section 5.2. 1357 authAttrs is a collection of authenticated attributes. The 1358 authAttrs structure is optional, but it MUST be present if the 1359 content type of the EncapsulatedContentInfo value being 1360 authenticated is not id-data. If the authAttrs field is present, 1361 then the digestAlgorithm field MUST also be present. The 1362 AuthAttributes structure MUST be DER encoded, even if the rest of 1363 the structure is BER encoded. Useful attribute types are defined 1364 in Section 11. If the authAttrs field is present, it MUST 1365 contain, at a minimum, the following two attributes: 1367 A content-type attribute having as its value the content type 1368 of the EncapsulatedContentInfo value being authenticated. 1369 Section 11.1 defines the content-type attribute. 1371 A message-digest attribute, having as its value the message 1372 digest of the content. Section 11.2 defines the message-digest 1373 attribute. 1375 mac is the message authentication code. 1377 unauthAttrs is a collection of attributes that are not 1378 authenticated. The field is optional. To date, no attributes 1379 have been defined for use as unauthenticated attributes, but other 1380 useful attribute types are defined in Section 11. 1382 9.2 MAC Generation 1384 The MAC calculation process computes a message authentication code 1385 (MAC) on either the content being authenticated or a message digest 1386 of content being authenticated together with the originator's 1387 authenticated attributes. 1389 If authAttrs field is absent, the input to the MAC calculation 1390 process is the value of the encapContentInfo eContent OCTET STRING. 1391 Only the octets comprising the value of the eContent OCTET STRING are 1392 input to the MAC algorithm; the tag and the length octets are 1393 omitted. This has the advantage that the length of the content being 1394 authenticated need not be known in advance of the MAC generation 1395 process. 1397 If authAttrs field is present, the content-type attribute (as 1398 described in Section 11.1) and the message-digest attribute (as 1399 described in section 11.2) MUST be included, and the input to the MAC 1400 calculation process is the DER encoding of authAttrs. A separate 1401 encoding of the authAttrs field is performed for message digest 1402 calculation. The IMPLICIT [2] tag in the authAttrs field is not used 1403 for the DER encoding, rather an EXPLICIT SET OF tag is used. That 1404 is, the DER encoding of the SET OF tag, rather than of the IMPLICIT 1405 [2] tag, is to be included in the message digest calculation along 1406 with the length and content octets of the authAttrs value. 1408 The message digest calculation process computes a message digest on 1409 the content being authenticated. The initial input to the message 1410 digest calculation process is the "value" of the encapsulated content 1411 being authenticated. Specifically, the input is the encapContentInfo 1412 eContent OCTET STRING to which the authentication process is applied. 1413 Only the octets comprising the value of the encapContentInfo eContent 1414 OCTET STRING are input to the message digest algorithm, not the tag 1415 or the length octets. This has the advantage that the length of the 1416 content being authenticated need not be known in advance. Although 1417 the encapContentInfo eContent OCTET STRING tag and length octets are 1418 not included in the message digest calculation, they are still 1419 protected by other means. The length octets are protected by the 1420 nature of the message digest algorithm since it is computationally 1421 infeasible to find any two distinct contents of any length that have 1422 the same message digest. 1424 The input to the MAC calculation process includes the MAC input data, 1425 defined above, and an authentication key conveyed in a recipientInfo 1426 structure. The details of MAC calculation depend on the MAC 1427 algorithm employed (e.g., HMAC). The object identifier, along with 1428 any parameters, that specifies the MAC algorithm employed by the 1429 originator is carried in the macAlgorithm field. The MAC value 1430 generated by the originator is encoded as an OCTET STRING and carried 1431 in the mac field. 1433 9.3 MAC Verification 1435 The input to the MAC verification process includes the input data 1436 (determined based on the presence or absence of the authAttrs field, 1437 as defined in 9.2), and the authentication key conveyed in 1438 recipientInfo. The details of the MAC verification process depend on 1439 the MAC algorithm employed. 1441 The recipient MUST NOT rely on any MAC values or message digest 1442 values computed by the originator. The content is authenticated as 1443 described in section 9.2. If the originator includes authenticated 1444 attributes, then the content of the authAttrs is authenticated as 1445 described in section 9.2. For authentication to succeed, the MAC 1446 value calculated by the recipient MUST be the same as the value of 1447 the mac field. Similarly, for authentication to succeed when the 1448 authAttrs field is present, the content message digest value 1449 calculated by the recipient MUST be the same as the message digest 1450 value included in the authAttrs message-digest attribute. 1452 If the AuthenticatedData includes authAttrs, then the content-type 1453 attribute value MUST match the AuthenticatedData encapContentInfo 1454 eContentType value. 1456 10. Useful Types 1458 This section is divided into two parts. The first part defines 1459 algorithm identifiers, and the second part defines other useful 1460 types. 1462 10.1 Algorithm Identifier Types 1464 All of the algorithm identifiers have the same type: 1465 AlgorithmIdentifier. The definition of AlgorithmIdentifier is taken 1466 from X.509 [X.509-88]. 1468 There are many alternatives for each algorithm type. 1470 10.1.1 DigestAlgorithmIdentifier 1472 The DigestAlgorithmIdentifier type identifies a message-digest 1473 algorithm. Examples include SHA-1, MD2, and MD5. A message-digest 1474 algorithm maps an octet string (the content) to another octet string 1475 (the message digest). 1477 DigestAlgorithmIdentifier ::= AlgorithmIdentifier 1479 10.1.2 SignatureAlgorithmIdentifier 1481 The SignatureAlgorithmIdentifier type identifies a signature 1482 algorithm. Examples include RSA, DSA, and ECDSA. A signature 1483 algorithm supports signature generation and verification operations. 1484 The signature generation operation uses the message digest and the 1485 signer's private key to generate a signature value. The signature 1486 verification operation uses the message digest and the signer's 1487 public key to determine whether or not a signature value is valid. 1488 Context determines which operation is intended. 1490 SignatureAlgorithmIdentifier ::= AlgorithmIdentifier 1492 10.1.3 KeyEncryptionAlgorithmIdentifier 1494 The KeyEncryptionAlgorithmIdentifier type identifies a key-encryption 1495 algorithm used to encrypt a content-encryption key. The encryption 1496 operation maps an octet string (the key) to another octet string (the 1497 encrypted key) under control of a key-encryption key. The decryption 1498 operation is the inverse of the encryption operation. Context 1499 determines which operation is intended. 1501 The details of encryption and decryption depend on the key management 1502 algorithm used. Key transport, key agreement, previously distributed 1503 symmetric key-encrypting keys, and symmetric key-encrypting keys 1504 derived from passwords are supported. 1506 KeyEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier 1508 10.1.4 ContentEncryptionAlgorithmIdentifier 1510 The ContentEncryptionAlgorithmIdentifier type identifies a content- 1511 encryption algorithm. Examples include Triple-DES and RC2. A 1512 content-encryption algorithm supports encryption and decryption 1513 operations. The encryption operation maps an octet string (the 1514 plaintext) to another octet string (the ciphertext) under control of 1515 a content-encryption key. The decryption operation is the inverse of 1516 the encryption operation. Context determines which operation is 1517 intended. 1519 ContentEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier 1521 10.1.5 MessageAuthenticationCodeAlgorithm 1523 The MessageAuthenticationCodeAlgorithm type identifies a message 1524 authentication code (MAC) algorithm. Examples include DES-MAC and 1525 HMAC-SHA-1. A MAC algorithm supports generation and verification 1526 operations. The MAC generation and verification operations use the 1527 same symmetric key. Context determines which operation is intended. 1529 MessageAuthenticationCodeAlgorithm ::= AlgorithmIdentifier 1531 10.1.6 KeyDerivationAlgorithmIdentifier 1533 The KeyDerivationAlgorithmIdentifier type is specified in RFC 3211 1534 [PWRI]. The KeyDerivationAlgorithmIdentifier definition is repeated 1535 here for completeness. 1537 Key derivation algorithms convert a password or shared secret value 1538 into a key-encryption key. 1540 KeyDerivationAlgorithmIdentifier ::= AlgorithmIdentifier 1542 10.2 Other Useful Types 1544 This section defines types that are used other places in the 1545 document. The types are not listed in any particular order. 1547 10.2.1 CertificateRevocationLists 1549 The CertificateRevocationLists type gives a set of certificate 1550 revocation lists (CRLs). It is intended that the set contain 1551 information sufficient to determine whether the certificates and 1552 attribute certificates with which the set is associated are revoked. 1553 However, there may be more CRLs than necessary or there MAY be fewer 1554 CRLs than necessary. 1556 The CertificateList may contain a CRL, an Authority Revocation List 1557 (ARL), a Delta CRL, or an Attribute Certificate Revocation List. All 1558 of these lists share a common syntax. 1560 CRLs are specified in X.509 [X.509-97], and they are profiled for use 1561 in the Internet in RFC 3280 [PROFILE]. 1563 The definition of CertificateList is taken from X.509. 1565 CertificateRevocationLists ::= SET OF CertificateList 1567 10.2.2 CertificateChoices 1569 The CertificateChoices type gives either a PKCS #6 extended 1570 certificate [PKCS#6], an X.509 certificate, a version 1 X.509 1571 attribute certificate (ACv1) [X.509-97], a version 2 X.509 attribute 1572 certificate (ACv2) [X.509-00], or any other certificate format. The 1573 PKCS #6 extended certificate is obsolete. The PKCS #6 certificate is 1574 included for backward compatibility, and PKCS #6 certificates SHOULD 1575 NOT be used. The ACv1 is also obsolete. ACv1 is included for 1576 backward compatibility, and ACv1 SHOULD NOT be used. The Internet 1577 profile of X.509 certificates is specified in the "Internet X.509 1578 Public Key Infrastructure: Certificate and CRL Profile" [PROFILE]. 1579 The Internet profile of ACv2 is specified in the "An Internet 1580 Attribute Certificate Profile for Authorization" [ACPROFILE]. The 1581 OtherCertificateFormat alternative is provided to support any other 1582 certificate format without further modifications to the CMS. 1584 The definition of Certificate is taken from X.509. 1586 The definitions of AttributeCertificate are taken from X.509-1997 and 1587 X.509-2000. The definition from X.509-1997 is assigned to 1588 AttributeCertificateV1 (see section 12.2), and the definition from 1589 X.509-2000 is assigned to AttributeCertificateV2. 1591 CertificateChoices ::= CHOICE { 1592 certificate Certificate, 1593 extendedCertificate [0] IMPLICIT ExtendedCertificate, -- Obsolete 1594 v1AttrCert [1] IMPLICIT AttributeCertificateV1, -- Obsolete 1595 v2AttrCert [2] IMPLICIT AttributeCertificateV2, 1596 other [3] IMPLICIT OtherCertificateFormat } 1598 OtherCertificateFormat ::= SEQUENCE { 1599 otherCertFormat OBJECT IDENTIFIER, 1600 otherCert ANY DEFINED BY otherCertFormat } 1602 10.2.3 CertificateSet 1604 The CertificateSet type provides a set of certificates. It is 1605 intended that the set be sufficient to contain certification paths 1606 from a recognized "root" or "top-level certification authority" to 1607 all of the sender certificates with which the set is associated. 1608 However, there may be more certificates than necessary, or there MAY 1609 be fewer than necessary. 1611 The precise meaning of a "certification path" is outside the scope of 1612 this document. However, [PROFILE] provides a definition for X.509 1613 certificates. Some applications may impose upper limits on the 1614 length of a certification path; others may enforce certain 1615 relationships between the subjects and issuers of certificates within 1616 a certification path. 1618 CertificateSet ::= SET OF CertificateChoices 1620 10.2.4 IssuerAndSerialNumber 1622 The IssuerAndSerialNumber type identifies a certificate, and thereby 1623 an entity and a public key, by the distinguished name of the 1624 certificate issuer and an issuer-specific certificate serial number. 1626 The definition of Name is taken from X.501 [X.501-88], and the 1627 definition of CertificateSerialNumber is taken from X.509 [X.509-97]. 1629 IssuerAndSerialNumber ::= SEQUENCE { 1630 issuer Name, 1631 serialNumber CertificateSerialNumber } 1633 CertificateSerialNumber ::= INTEGER 1635 10.2.5 CMSVersion 1637 The CMSVersion type gives a syntax version number, for compatibility 1638 with future revisions of this specification. 1640 CMSVersion ::= INTEGER { v0(0), v1(1), v2(2), v3(3), v4(4), v5(5) } 1642 10.2.6 UserKeyingMaterial 1644 The UserKeyingMaterial type gives a syntax for user keying material 1645 (UKM). Some key agreement algorithms require UKMs to ensure that a 1646 different key is generated each time the same two parties generate a 1647 pairwise key. The sender provides a UKM for use with a specific key 1648 agreement algorithm. 1650 UserKeyingMaterial ::= OCTET STRING 1652 10.2.7 OtherKeyAttribute 1654 The OtherKeyAttribute type gives a syntax for the inclusion of other 1655 key attributes that permit the recipient to select the key used by 1656 the sender. The attribute object identifier must be registered along 1657 with the syntax of the attribute itself. Use of this structure 1658 should be avoided since it might impede interoperability. 1660 OtherKeyAttribute ::= SEQUENCE { 1661 keyAttrId OBJECT IDENTIFIER, 1662 keyAttr ANY DEFINED BY keyAttrId OPTIONAL } 1664 11. Useful Attributes 1666 This section defines attributes that may be used with signed-data, 1667 enveloped-data, encrypted-data, or authenticated-data. The syntax of 1668 Attribute is compatible with X.501 [X.501-88] and RFC 3280 [PROFILE]. 1669 Some of the attributes defined in this section were originally 1670 defined in PKCS #9 [PKCS#9]; others were originally defined in a 1671 previous version of this specification [CMS1]. The attributes are 1672 not listed in any particular order. 1674 Additional attributes are defined in many places, notably the S/MIME 1675 Version 3 Message Specification [MSG] and the Enhanced Security 1676 Services for S/MIME [ESS], which also include recommendations on the 1677 placement of these attributes. 1679 11.1 Content Type 1681 The content-type attribute type specifies the content type of the 1682 ContentInfo within signed-data or authenticated-data. The content- 1683 type attribute type MUST be present whenever signed attributes are 1684 present in signed-data or authenticated attributes present in 1685 authenticated-data. The content-type attribute value MUST match the 1686 encapContentInfo eContentType value in the signed-data or 1687 authenticated-data. 1689 The content-type attribute MUST be a signed attribute or an 1690 authenticated attribute; it MUST NOT be an unsigned attribute, 1691 unauthenticated attribute, or unprotected attribute. 1693 The following object identifier identifies the content-type 1694 attribute: 1696 id-contentType OBJECT IDENTIFIER ::= { iso(1) member-body(2) 1697 us(840) rsadsi(113549) pkcs(1) pkcs9(9) 3 } 1699 Content-type attribute values have ASN.1 type ContentType: 1701 ContentType ::= OBJECT IDENTIFIER 1703 Even though the syntax is defined as a SET OF AttributeValue, a 1704 content-type attribute MUST have a single attribute value; zero or 1705 multiple instances of AttributeValue are not permitted. 1707 The SignedAttributes and AuthAttributes syntaxes are each defined as 1708 a SET OF Attributes. The SignedAttributes in a signerInfo MUST NOT 1709 include multiple instances of the content-type attribute. Similarly, 1710 the AuthAttributes in an AuthenticatedData MUST NOT include multiple 1711 instances of the content-type attribute. 1713 11.2 Message Digest 1715 The message-digest attribute type specifies the message digest of the 1716 encapContentInfo eContent OCTET STRING being signed in signed-data 1717 (see section 5.4) or authenticated in authenticated-data (see section 1718 9.2). For signed-data, the message digest is computed using the 1719 signer's message digest algorithm. For authenticated-data, the 1720 message digest is computed using the originator's message digest 1721 algorithm. 1723 Within signed-data, the message-digest signed attribute type MUST be 1724 present when there are any signed attributes present. Within 1725 authenticated-data, the message-digest authenticated attribute type 1726 MUST be present when there are any authenticated attributes present. 1728 The message-digest attribute MUST be a signed attribute or an 1729 authenticated attribute; it MUST NOT be an unsigned attribute, 1730 unauthenticated attribute, or unprotected attribute. 1732 The following object identifier identifies the message-digest 1733 attribute: 1735 id-messageDigest OBJECT IDENTIFIER ::= { iso(1) member-body(2) 1736 us(840) rsadsi(113549) pkcs(1) pkcs9(9) 4 } 1738 Message-digest attribute values have ASN.1 type MessageDigest: 1740 MessageDigest ::= OCTET STRING 1742 A message-digest attribute MUST have a single attribute value, even 1743 though the syntax is defined as a SET OF AttributeValue. There MUST 1744 NOT be zero or multiple instances of AttributeValue present. 1746 The SignedAttributes syntax and AuthAttributes syntax are each 1747 defined as a SET OF Attributes. The SignedAttributes in a signerInfo 1748 MUST include only one instance of the message-digest attribute. 1749 Similarly, the AuthAttributes in an AuthenticatedData MUST include 1750 only one instance of the message-digest attribute. 1752 11.3 Signing Time 1754 The signing-time attribute type specifies the time at which the 1755 signer (purportedly) performed the signing process. The signing-time 1756 attribute type is intended for use in signed-data. 1758 The signing-time attribute MUST be a signed attribute or an 1759 authenticated attribute; it MUST NOT be an unsigned attribute, 1760 unauthenticated attribute, or unprotected attribute. 1762 The following object identifier identifies the signing-time 1763 attribute: 1765 id-signingTime OBJECT IDENTIFIER ::= { iso(1) member-body(2) 1766 us(840) rsadsi(113549) pkcs(1) pkcs9(9) 5 } 1768 Signing-time attribute values have ASN.1 type SigningTime: 1770 SigningTime ::= Time 1772 Time ::= CHOICE { 1773 utcTime UTCTime, 1774 generalizedTime GeneralizedTime } 1776 Note: The definition of Time matches the one specified in the 1997 1777 version of X.509 [X.509-97]. 1779 Dates between 1 January 1950 and 31 December 2049 (inclusive) MUST be 1780 encoded as UTCTime. Any dates with year values before 1950 or after 1781 2049 MUST be encoded as GeneralizedTime. 1783 UTCTime values MUST be expressed in Greenwich Mean Time (Zulu) and 1784 MUST include seconds (i.e., times are YYMMDDHHMMSSZ), even where the 1785 number of seconds is zero. Midnight (GMT) MUST be represented as 1786 "YYMMDD000000Z". Century information is implicit, and the century 1787 MUST be determined as follows: 1789 Where YY is greater than or equal to 50, the year MUST be 1790 interpreted as 19YY; and 1792 Where YY is less than 50, the year MUST be interpreted as 20YY. 1794 GeneralizedTime values MUST be expressed in Greenwich Mean Time 1795 (Zulu) and MUST include seconds (i.e., times are YYYYMMDDHHMMSSZ), 1796 even where the number of seconds is zero. GeneralizedTime values 1797 MUST NOT include fractional seconds. 1799 A signing-time attribute MUST have a single attribute value, even 1800 though the syntax is defined as a SET OF AttributeValue. There MUST 1801 NOT be zero or multiple instances of AttributeValue present. 1803 The SignedAttributes syntax and the AuthAttributes syntax are each 1804 defined as a SET OF Attributes. The SignedAttributes in a signerInfo 1805 MUST NOT include multiple instances of the signing-time attribute. 1806 Similarly, the AuthAttributes in an AuthenticatedData MUST NOT 1807 include multiple instances of the signing-time attribute. 1809 No requirement is imposed concerning the correctness of the signing 1810 time, and acceptance of a purported signing time is a matter of a 1811 recipient's discretion. It is expected, however, that some signers, 1812 such as time-stamp servers, will be trusted implicitly. 1814 11.4 Countersignature 1816 The countersignature attribute type specifies one or more signatures 1817 on the contents octets of the DER encoding of the signatureValue 1818 field of a SignerInfo value in signed-data. Thus, the 1819 countersignature attribute type countersigns (signs in serial) 1820 another signature. 1822 The countersignature attribute MUST be an unsigned attribute; it MUST 1823 NOT be a signed attribute, an authenticated attribute, an 1824 unauthenticated attribute, or an unprotected attribute. 1826 The following object identifier identifies the countersignature 1827 attribute: 1829 id-countersignature OBJECT IDENTIFIER ::= { iso(1) member-body(2) 1830 us(840) rsadsi(113549) pkcs(1) pkcs9(9) 6 } 1832 Countersignature attribute values have ASN.1 type Countersignature: 1834 Countersignature ::= SignerInfo 1836 Countersignature values have the same meaning as SignerInfo values 1837 for ordinary signatures, except that: 1839 1. The signedAttributes field MUST NOT contain a content-type 1840 attribute; there is no content type for countersignatures. 1842 2. The signedAttributes field MUST contain a message-digest 1843 attribute if it contains any other attributes. 1845 3. The input to the message-digesting process is the contents 1846 octets of the DER encoding of the signatureValue field of the 1847 SignerInfo value with which the attribute is associated. 1849 A countersignature attribute can have multiple attribute values. The 1850 syntax is defined as a SET OF AttributeValue, and there MUST be one 1851 or more instances of AttributeValue present. 1853 The UnsignedAttributes syntax is defined as a SET OF Attributes. The 1854 UnsignedAttributes in a signerInfo may include multiple instances of 1855 the countersignature attribute. 1857 A countersignature, since it has type SignerInfo, can itself contain 1858 a countersignature attribute. Thus, it is possible to construct an 1859 arbitrarily long series of countersignatures. 1861 12. ASN.1 Modules 1863 Section 12.1 contains the ASN.1 module for the CMS, and section 12.2 1864 contains the ASN.1 module for the Version 1 Attribute Certificate. 1866 12.1 CMS ASN.1 Module 1868 CryptographicMessageSyntax2004 1869 { iso(1) member-body(2) us(840) rsadsi(113549) 1870 pkcs(1) pkcs-9(9) smime(16) modules(0) cms-2004(24) } 1872 DEFINITIONS IMPLICIT TAGS ::= 1873 BEGIN 1875 -- EXPORTS All 1876 -- The types and values defined in this module are exported for use 1877 -- in the other ASN.1 modules. Other applications may use them for 1878 -- their own purposes. 1880 IMPORTS 1882 -- Imports from RFC 3280 [PROFILE], Appendix A.1 1883 AlgorithmIdentifier, Certificate, CertificateList, 1884 CertificateSerialNumber, Name 1885 FROM PKIX1Explicit88 1886 { iso(1) identified-organization(3) dod(6) 1887 internet(1) security(5) mechanisms(5) pkix(7) 1888 mod(0) pkix1-explicit(18) } 1890 -- Imports from RFC 3281 [ACPROFILE], Appendix B 1891 AttributeCertificate 1892 FROM PKIXAttributeCertificate 1893 { iso(1) identified-organization(3) dod(6) 1894 internet(1) security(5) mechanisms(5) pkix(7) 1895 mod(0) attribute-cert(12) } 1897 -- Imports from Appendix B of this document 1898 AttributeCertificateV1 1899 FROM AttributeCertificateVersion1 1900 { iso(1) member-body(2) us(840) rsadsi(113549) 1901 pkcs(1) pkcs-9(9) smime(16) modules(0) 1902 v1AttrCert(15) } ; 1904 -- Cryptographic Message Syntax 1906 ContentInfo ::= SEQUENCE { 1907 contentType ContentType, 1908 content [0] EXPLICIT ANY DEFINED BY contentType } 1910 ContentType ::= OBJECT IDENTIFIER 1911 SignedData ::= SEQUENCE { 1912 version CMSVersion, 1913 digestAlgorithms DigestAlgorithmIdentifiers, 1914 encapContentInfo EncapsulatedContentInfo, 1915 certificates [0] IMPLICIT CertificateSet OPTIONAL, 1916 crls [1] IMPLICIT CertificateRevocationLists OPTIONAL, 1917 signerInfos SignerInfos } 1919 DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier 1921 SignerInfos ::= SET OF SignerInfo 1923 EncapsulatedContentInfo ::= SEQUENCE { 1924 eContentType ContentType, 1925 eContent [0] EXPLICIT OCTET STRING OPTIONAL } 1927 SignerInfo ::= SEQUENCE { 1928 version CMSVersion, 1929 sid SignerIdentifier, 1930 digestAlgorithm DigestAlgorithmIdentifier, 1931 signedAttrs [0] IMPLICIT SignedAttributes OPTIONAL, 1932 signatureAlgorithm SignatureAlgorithmIdentifier, 1933 signature SignatureValue, 1934 unsignedAttrs [1] IMPLICIT UnsignedAttributes OPTIONAL } 1936 SignerIdentifier ::= CHOICE { 1937 issuerAndSerialNumber IssuerAndSerialNumber, 1938 subjectKeyIdentifier [0] SubjectKeyIdentifier } 1940 SignedAttributes ::= SET SIZE (1..MAX) OF Attribute 1942 UnsignedAttributes ::= SET SIZE (1..MAX) OF Attribute 1944 Attribute ::= SEQUENCE { 1945 attrType OBJECT IDENTIFIER, 1946 attrValues SET OF AttributeValue } 1948 AttributeValue ::= ANY 1950 SignatureValue ::= OCTET STRING 1952 EnvelopedData ::= SEQUENCE { 1953 version CMSVersion, 1954 originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL, 1955 recipientInfos RecipientInfos, 1956 encryptedContentInfo EncryptedContentInfo, 1957 unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL } 1959 OriginatorInfo ::= SEQUENCE { 1960 certs [0] IMPLICIT CertificateSet OPTIONAL, 1961 crls [1] IMPLICIT CertificateRevocationLists OPTIONAL } 1963 RecipientInfos ::= SET SIZE (1..MAX) OF RecipientInfo 1965 EncryptedContentInfo ::= SEQUENCE { 1966 contentType ContentType, 1967 contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier, 1968 encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL } 1970 EncryptedContent ::= OCTET STRING 1972 UnprotectedAttributes ::= SET SIZE (1..MAX) OF Attribute 1973 RecipientInfo ::= CHOICE { 1974 ktri KeyTransRecipientInfo, 1975 kari [1] KeyAgreeRecipientInfo, 1976 kekri [2] KEKRecipientInfo, 1977 pwri [3] PasswordRecipientInfo, 1978 ori [4] OtherRecipientInfo } 1980 EncryptedKey ::= OCTET STRING 1982 KeyTransRecipientInfo ::= SEQUENCE { 1983 version CMSVersion, -- always set to 0 or 2 1984 rid RecipientIdentifier, 1985 keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier, 1986 encryptedKey EncryptedKey } 1988 RecipientIdentifier ::= CHOICE { 1989 issuerAndSerialNumber IssuerAndSerialNumber, 1990 subjectKeyIdentifier [0] SubjectKeyIdentifier } 1992 KeyAgreeRecipientInfo ::= SEQUENCE { 1993 version CMSVersion, -- always set to 3 1994 originator [0] EXPLICIT OriginatorIdentifierOrKey, 1995 ukm [1] EXPLICIT UserKeyingMaterial OPTIONAL, 1996 keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier, 1997 recipientEncryptedKeys RecipientEncryptedKeys } 1999 OriginatorIdentifierOrKey ::= CHOICE { 2000 issuerAndSerialNumber IssuerAndSerialNumber, 2001 subjectKeyIdentifier [0] SubjectKeyIdentifier, 2002 originatorKey [1] OriginatorPublicKey } 2004 OriginatorPublicKey ::= SEQUENCE { 2005 algorithm AlgorithmIdentifier, 2006 publicKey BIT STRING } 2008 RecipientEncryptedKeys ::= SEQUENCE OF RecipientEncryptedKey 2010 RecipientEncryptedKey ::= SEQUENCE { 2011 rid KeyAgreeRecipientIdentifier, 2012 encryptedKey EncryptedKey } 2014 KeyAgreeRecipientIdentifier ::= CHOICE { 2015 issuerAndSerialNumber IssuerAndSerialNumber, 2016 rKeyId [0] IMPLICIT RecipientKeyIdentifier } 2018 RecipientKeyIdentifier ::= SEQUENCE { 2019 subjectKeyIdentifier SubjectKeyIdentifier, 2020 date GeneralizedTime OPTIONAL, 2021 other OtherKeyAttribute OPTIONAL } 2023 SubjectKeyIdentifier ::= OCTET STRING 2025 KEKRecipientInfo ::= SEQUENCE { 2026 version CMSVersion, -- always set to 4 2027 kekid KEKIdentifier, 2028 keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier, 2029 encryptedKey EncryptedKey } 2031 KEKIdentifier ::= SEQUENCE { 2032 keyIdentifier OCTET STRING, 2033 date GeneralizedTime OPTIONAL, 2034 other OtherKeyAttribute OPTIONAL } 2036 PasswordRecipientInfo ::= SEQUENCE { 2037 version CMSVersion, -- always set to 0 2038 keyDerivationAlgorithm [0] KeyDerivationAlgorithmIdentifier 2039 OPTIONAL, 2040 keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier, 2041 encryptedKey EncryptedKey } 2043 OtherRecipientInfo ::= SEQUENCE { 2044 oriType OBJECT IDENTIFIER, 2045 oriValue ANY DEFINED BY oriType } 2047 DigestedData ::= SEQUENCE { 2048 version CMSVersion, 2049 digestAlgorithm DigestAlgorithmIdentifier, 2050 encapContentInfo EncapsulatedContentInfo, 2051 digest Digest } 2053 Digest ::= OCTET STRING 2055 EncryptedData ::= SEQUENCE { 2056 version CMSVersion, 2057 encryptedContentInfo EncryptedContentInfo, 2058 unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL } 2060 AuthenticatedData ::= SEQUENCE { 2061 version CMSVersion, 2062 originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL, 2063 recipientInfos RecipientInfos, 2064 macAlgorithm MessageAuthenticationCodeAlgorithm, 2065 digestAlgorithm [1] DigestAlgorithmIdentifier OPTIONAL, 2066 encapContentInfo EncapsulatedContentInfo, 2067 authAttrs [2] IMPLICIT AuthAttributes OPTIONAL, 2068 mac MessageAuthenticationCode, 2069 unauthAttrs [3] IMPLICIT UnauthAttributes OPTIONAL } 2071 AuthAttributes ::= SET SIZE (1..MAX) OF Attribute 2073 UnauthAttributes ::= SET SIZE (1..MAX) OF Attribute 2075 MessageAuthenticationCode ::= OCTET STRING 2077 DigestAlgorithmIdentifier ::= AlgorithmIdentifier 2079 SignatureAlgorithmIdentifier ::= AlgorithmIdentifier 2081 KeyEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier 2083 ContentEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier 2085 MessageAuthenticationCodeAlgorithm ::= AlgorithmIdentifier 2087 KeyDerivationAlgorithmIdentifier ::= AlgorithmIdentifier 2089 CertificateRevocationLists ::= SET OF CertificateList 2091 CertificateChoices ::= CHOICE { 2092 certificate Certificate, 2093 extendedCertificate [0] IMPLICIT ExtendedCertificate, -- Obsolete 2094 v1AttrCert [1] IMPLICIT AttributeCertificateV1, -- Obsolete 2095 v2AttrCert [2] IMPLICIT AttributeCertificateV2, 2096 other [3] IMPLICIT OtherCertificateFormat } 2098 AttributeCertificateV2 ::= AttributeCertificate 2100 OtherCertificateFormat ::= SEQUENCE { 2101 otherCertFormat OBJECT IDENTIFIER, 2102 otherCert ANY DEFINED BY otherCertFormat } 2104 CertificateSet ::= SET OF CertificateChoices 2105 IssuerAndSerialNumber ::= SEQUENCE { 2106 issuer Name, 2107 serialNumber CertificateSerialNumber } 2109 CMSVersion ::= INTEGER { v0(0), v1(1), v2(2), v3(3), v4(4) v5(5) } 2111 UserKeyingMaterial ::= OCTET STRING 2113 OtherKeyAttribute ::= SEQUENCE { 2114 keyAttrId OBJECT IDENTIFIER, 2115 keyAttr ANY DEFINED BY keyAttrId OPTIONAL } 2117 -- The CMS Attributes 2119 MessageDigest ::= OCTET STRING 2121 SigningTime ::= Time 2123 Time ::= CHOICE { 2124 utcTime UTCTime, 2125 generalTime GeneralizedTime } 2127 Countersignature ::= SignerInfo 2129 -- Attribute Object Identifiers 2131 id-contentType OBJECT IDENTIFIER ::= { iso(1) member-body(2) 2132 us(840) rsadsi(113549) pkcs(1) pkcs9(9) 3 } 2134 id-messageDigest OBJECT IDENTIFIER ::= { iso(1) member-body(2) 2135 us(840) rsadsi(113549) pkcs(1) pkcs9(9) 4 } 2137 id-signingTime OBJECT IDENTIFIER ::= { iso(1) member-body(2) 2138 us(840) rsadsi(113549) pkcs(1) pkcs9(9) 5 } 2140 id-countersignature OBJECT IDENTIFIER ::= { iso(1) member-body(2) 2141 us(840) rsadsi(113549) pkcs(1) pkcs9(9) 6 } 2143 -- Obsolete Extended Certificate syntax from PKCS#6 2145 ExtendedCertificateOrCertificate ::= CHOICE { 2146 certificate Certificate, 2147 extendedCertificate [0] IMPLICIT ExtendedCertificate } 2148 ExtendedCertificate ::= SEQUENCE { 2149 extendedCertificateInfo ExtendedCertificateInfo, 2150 signatureAlgorithm SignatureAlgorithmIdentifier, 2151 signature Signature } 2153 ExtendedCertificateInfo ::= SEQUENCE { 2154 version CMSVersion, 2155 certificate Certificate, 2156 attributes UnauthAttributes } 2158 Signature ::= BIT STRING 2160 END -- of CryptographicMessageSyntax2004 2162 12.2 Version 1 Attribute Certificate ASN.1 Module 2164 AttributeCertificateVersion1 2165 { iso(1) member-body(2) us(840) rsadsi(113549) 2166 pkcs(1) pkcs-9(9) smime(16) modules(0) v1AttrCert(15) } 2168 DEFINITIONS IMPLICIT TAGS ::= 2169 BEGIN 2171 -- EXPORTS All 2173 IMPORTS 2175 -- Imports from RFC 3280 [PROFILE], Appendix A.1 2176 AlgorithmIdentifier, Attribute, CertificateSerialNumber, 2177 Extensions, UniqueIdentifier 2178 FROM PKIX1Explicit88 2179 { iso(1) identified-organization(3) dod(6) 2180 internet(1) security(5) mechanisms(5) pkix(7) 2181 mod(0) pkix1-explicit(18) } 2183 -- Imports from RFC 3280 [PROFILE], Appendix A.2 2184 GeneralNames 2185 FROM PKIX1Implicit88 2186 { iso(1) identified-organization(3) dod(6) 2187 internet(1) security(5) mechanisms(5) pkix(7) 2188 mod(0) pkix1-implicit(19) } 2190 -- Imports from RFC 3281 [ACPROFILE], Appendix B 2191 AttCertValidityPeriod, IssuerSerial 2192 FROM PKIXAttributeCertificate 2193 { iso(1) identified-organization(3) dod(6) 2194 internet(1) security(5) mechanisms(5) pkix(7) 2195 mod(0) attribute-cert(12) } ; 2197 -- Definition extracted from X.509-1997 [X.509-97], but 2198 -- different type names are used to avoid collisions. 2200 AttributeCertificateV1 ::= SEQUENCE { 2201 acInfo AttributeCertificateInfoV1, 2202 signatureAlgorithm AlgorithmIdentifier, 2203 signature BIT STRING } 2205 AttributeCertificateInfoV1 ::= SEQUENCE { 2206 version AttCertVersionV1 DEFAULT v1, 2207 subject CHOICE { 2208 baseCertificateID [0] IssuerSerial, 2209 -- associated with a Public Key Certificate 2210 subjectName [1] GeneralNames }, 2211 -- associated with a name 2212 issuer GeneralNames, 2213 signature AlgorithmIdentifier, 2214 serialNumber CertificateSerialNumber, 2215 attCertValidityPeriod AttCertValidityPeriod, 2216 attributes SEQUENCE OF Attribute, 2217 issuerUniqueID UniqueIdentifier OPTIONAL, 2218 extensions Extensions OPTIONAL } 2220 AttCertVersionV1 ::= INTEGER { v1(0) } 2222 END -- of AttributeCertificateVersion1 2224 13. Normative References 2226 [ACPROFILE] Farrell, S. and R. Housley, "An Internet Attribute 2227 Certificate Profile for Authorization", RFC 3281, 2228 April 2002. 2230 [PROFILE] Housley, R., Polk, W., Ford, W. and D. Solo, "Internet 2231 X.509 Public Key Infrastructure: Certificate and CRL 2232 Profile", RFC 3280, April 2002. 2234 [STDWORDS] Bradner, S., "Key Words for Use in RFCs to Indicate 2235 Requirement Levels", BCP 14, RFC 2119, March 1997. 2237 [X.208-88] CCITT. Recommendation X.208: Specification of Abstract 2238 Syntax Notation One (ASN.1). 1988. 2240 [X.209-88] CCITT. Recommendation X.209: Specification of Basic 2241 Encoding Rules for Abstract Syntax Notation One (ASN.1). 2242 1988. 2244 [X.501-88] CCITT. Recommendation X.501: The Directory - Models. 2245 1988. 2247 [X.509-88] CCITT. Recommendation X.509: The Directory - 2248 Authentication Framework. 1988. 2250 [X.509-97] ITU-T. Recommendation X.509: The Directory - 2251 Authentication Framework. 1997. 2253 [X.509-00] ITU-T. Recommendation X.509: The Directory - 2254 Authentication Framework. 2000. 2256 14. Informative References 2258 [CMS1] Housley, R., "Cryptographic Message Syntax", 2259 RFC 2630, June 1999. 2261 [CMS2] Housley, R., "Cryptographic Message Syntax", 2262 RFC 3369, August 2002. 2264 [CMSALG] Housley, R., "Cryptographic Message Syntax (CMS) 2265 Algorithms", RFC 3269, August 2002. 2267 [DSS] National Institute of Standards and Technology. 2268 FIPS Pub 186: Digital Signature Standard. 19 May 1994. 2270 [ESS] Hoffman, P., "Enhanced Security Services for S/MIME", 2271 RFC 2634, June 1999. 2273 [MSG] Ramsdell, B., "S/MIME Version 3 Message Specification", 2274 RFC 2633, June 1999. 2276 [OLDMSG] Dusse, S., Hoffman, P., Ramsdell, B., Lundblade, L. and 2277 L. Repka, "S/MIME Version 2 Message Specification", 2278 RFC 2311, March 1998. 2280 [PKCS#6] RSA Laboratories. PKCS #6: Extended-Certificate Syntax 2281 Standard, Version 1.5. November 1993. 2283 [PKCS#7] Kaliski, B., "PKCS #7: Cryptographic Message Syntax, 2284 Version 1.5.", RFC 2315, March 1998. 2286 [PKCS#9] RSA Laboratories. PKCS #9: Selected Attribute Types, 2287 Version 1.1. November 1993. 2289 [PWRI] Gutmann, P., "Password-based Encryption for S/MIME", 2290 RFC 3211, December 2001. 2292 [RANDOM] Eastlake, D., Crocker, S. and J. Schiller, "Randomness 2293 Recommendations for Security", RFC 1750, December 1994. 2295 15. Security Considerations 2297 The Cryptographic Message Syntax provides a method for digitally 2298 signing data, digesting data, encrypting data, and authenticating 2299 data. 2301 Implementations must protect the signer's private key. Compromise of 2302 the signer's private key permits masquerade. 2304 Implementations must protect the key management private key, the key- 2305 encryption key, and the content-encryption key. Compromise of the 2306 key management private key or the key-encryption key may result in 2307 the disclosure of all contents protected with that key. Similarly, 2308 compromise of the content-encryption key may result in disclosure of 2309 the associated encrypted content. 2311 Implementations must protect the key management private key and the 2312 message-authentication key. Compromise of the key management private 2313 key permits masquerade of authenticated data. Similarly, compromise 2314 of the message-authentication key may result in undetectable 2315 modification of the authenticated content. 2317 The key management technique employed to distribute message- 2318 authentication keys must itself provide data origin authentication, 2319 otherwise the contents are delivered with integrity from an unknown 2320 source. Neither RSA [PKCS#1, NEWPKCS#1] nor Ephemeral-Static Diffie- 2321 Hellman [DH-X9.42] provide the necessary data origin authentication. 2322 Static-Static Diffie-Hellman [DH-X9.42] does provide the necessary 2323 data origin authentication when both the originator and recipient 2324 public keys are bound to appropriate identities in X.509 2325 certificates. 2327 When more than two parties share the same message-authentication key, 2328 data origin authentication is not provided. Any party that knows the 2329 message-authentication key can compute a valid MAC, therefore the 2330 contents could originate from any one of the parties. 2332 Implementations must randomly generate content-encryption keys, 2333 message-authentication keys, initialization vectors (IVs), and 2334 padding. Also, the generation of public/private key pairs relies on 2335 a random numbers. The use of inadequate pseudo-random number 2336 generators (PRNGs) to generate cryptographic keys can result in 2337 little or no security. An attacker may find it much easier to 2338 reproduce the PRNG environment that produced the keys, searching the 2339 resulting small set of possibilities, rather than brute force 2340 searching the whole key space. The generation of quality random 2341 numbers is difficult. RFC 1750 [RANDOM] offers important guidance in 2342 this area, and Appendix 3 of FIPS Pub 186 [DSS] provides one quality 2343 PRNG technique. 2345 When using key agreement algorithms or previously distributed 2346 symmetric key-encryption keys, a key-encryption key is used to 2347 encrypt the content-encryption key. If the key-encryption and 2348 content-encryption algorithms are different, the effective security 2349 is determined by the weaker of the two algorithms. If, for example, 2350 content is encrypted with Triple-DES using a 168-bit Triple-DES 2351 content-encryption key, and the content-encryption key is wrapped 2352 with RC2 using a 40-bit RC2 key-encryption key, then at most 40 bits 2353 of protection is provided. A trivial search to determine the value 2354 of the 40-bit RC2 key can recover the Triple-DES key, and then the 2355 Triple-DES key can be used to decrypt the content. Therefore, 2356 implementers must ensure that key-encryption algorithms are as strong 2357 or stronger than content-encryption algorithms. 2359 Implementers should be aware that cryptographic algorithms become 2360 weaker with time. As new cryptoanalysis techniques are developed and 2361 computing performance improves, the work factor to break a particular 2362 cryptographic algorithm will be reduced. Therefore, cryptographic 2363 algorithm implementations should be modular, allowing new algorithms 2364 to be readily inserted. That is, implementors should be prepared for 2365 the set of algorithms that must be supported to change over time. 2367 The countersignature unsigned attribute includes a digital signature 2368 that is computed on the content signature value, thus the 2369 countersigning process need not know the original signed content. 2370 This structure permits implementation efficiency advantages; however, 2371 this structure may also permit the countersigning of an inappropriate 2372 signature value. Therefore, implementations that perform 2373 countersignatures should either verify the original signature value 2374 prior to countersigning it (this verification requires processing of 2375 the original content), or implementations should perform 2376 countersigning in a context that ensures that only appropriate 2377 signature values are countersigned. 2379 16. Acknowledgments 2381 This document is the result of contributions from many professionals. 2382 I appreciate the hard work of all members of the IETF S/MIME Working 2383 Group. I extend a special thanks to Rich Ankney, Simon Blake-Wilson, 2384 Tim Dean, Steve Dusse, Carl Ellison, Peter Gutmann, Bob Jueneman, 2385 Stephen Henson, Paul Hoffman, Scott Hollenbeck, Don Johnson, Burt 2386 Kaliski, John Linn, John Pawling, Blake Ramsdell, Francois Rousseau, 2387 Jim Schaad, Dave Solo, Paul Timmel, and Sean Turner for their efforts 2388 and support. 2390 17. Authors' Address 2392 Russell Housley 2393 Vigil Security, LLC 2394 918 Spring Knoll Drive 2395 Herndon, VA 20170 2396 USA 2397 EMail: housley@vigilsec.com 2399 18. Full Copyright Statement 2401 Copyright (C) The Internet Society (2004). All Rights Reserved. 2403 This document and translations of it may be copied and furnished to 2404 others, and derivative works that comment on or otherwise explain it 2405 or assist in its implementation may be prepared, copied, published 2406 and distributed, in whole or in part, without restriction of any 2407 kind, provided that the above copyright notice and this paragraph are 2408 included on all such copies and derivative works. However, this 2409 document itself may not be modified in any way, such as by removing 2410 the copyright notice or references to the Internet Society or other 2411 Internet organizations, except as needed for the purpose of 2412 developing Internet standards in which case the procedures for 2413 copyrights defined in the Internet Standards process must be 2414 followed, or as required to translate it into languages other than 2415 English. 2417 The limited permissions granted above are perpetual and will not be 2418 revoked by the Internet Society or its successors or assigns. 2420 This document and the information contained herein is provided on an 2421 "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING 2422 TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING 2423 BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION 2424 HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF 2425 MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.