idnits 2.17.1 draft-ietf-smime-rfc2633bis-09.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: ---------------------------------------------------------------------------- ** The document is more than 15 pages and seems to lack a Table of Contents. == No 'Intended status' indicated for this document; assuming Proposed Standard == The page length should not exceed 58 lines per page, but there was 1 longer page, the longest (page 1) being 1559 lines 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.) ** The document seems to lack a both a reference to RFC 2119 and the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. RFC 2119 keyword, line 78: '...sages, an S/MIME agent MUST follow the...' RFC 2119 keyword, line 149: '...rsion 3.1 agents SHOULD attempt to hav...' RFC 2119 keyword, line 158: '...hm was changed to a MUST implement key...' RFC 2119 keyword, line 162: '...lgorithm has been included as a SHOULD...' RFC 2119 keyword, line 165: '...was changed to a MUST implement signat...' (121 more instances...) Miscellaneous warnings: ---------------------------------------------------------------------------- ** The document contains RFC2119-like boilerplate, but doesn't seem to mention RFC 2119. The boilerplate contains a reference [MUSTSHOULD], but that reference does not seem to mention RFC 2119 either. -- 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 (October 19, 2004) is 7122 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) -- Missing reference section? 'MIME-SPEC' on line 1432 looks like a reference -- Missing reference section? 'CMS' on line 1414 looks like a reference -- Missing reference section? 'PKCS-7' on line 1460 looks like a reference -- Missing reference section? 'MIME-SECURE' on line 1438 looks like a reference -- Missing reference section? 'CMSALG' on line 1419 looks like a reference -- Missing reference section? 'MUSTSHOULD' on line 1441 looks like a reference -- Missing reference section? 'ESS' on line 1427 looks like a reference -- Missing reference section? 'CMSAES' on line 1416 looks like a reference -- Missing reference section? 'CHARSETS' on line 1411 looks like a reference -- Missing reference section? 'CONTDISP' on line 1424 looks like a reference -- Missing reference section? 'FIPS180-2' on line 1429 looks like a reference -- Missing reference section? 'CMSCOMPR' on line 1421 looks like a reference -- Missing reference section? 'SMIMEV2' on line 1464 looks like a reference -- Missing reference section? 'CERT31' on line 1408 looks like a reference -- Missing reference section? 'RANDOM' on line 1462 looks like a reference -- Missing reference section? 'MMA' on line 1458 looks like a reference -- Missing reference section? 'DHSUB' on line 1455 looks like a reference -- Missing reference section? '0' on line 1370 looks like a reference -- Missing reference section? '1' on line 1371 looks like a reference -- Missing reference section? '2' on line 1372 looks like a reference Summary: 5 errors (**), 0 flaws (~~), 2 warnings (==), 22 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 Internet Draft Editor: Blake Ramsdell, 2 draft-ietf-smime-rfc2633bis-09.txt Sendmail, Inc. 3 April 19, 2004 4 Expires October 19, 2004 6 S/MIME Version 3.1 Message Specification 8 Status of this memo 10 This document is an Internet-Draft and is in full conformance with all 11 provisions of Section 10 of RFC2026. 13 Internet-Drafts are working documents of the Internet Engineering Task 14 Force (IETF), its areas, and its working groups. Note that other 15 groups may also distribute working documents as Internet-Drafts. 17 Internet-Drafts are draft documents valid for a maximum of six months 18 and may be updated, replaced, or obsoleted by other documents at any 19 time. It is inappropriate to use Internet-Drafts as reference material 20 or to cite them other than as "work in progress." 22 The list of current Internet-Drafts can be accessed at 23 http://www.ietf.org/ietf/1id-abstracts.txt 25 The list of Internet-Draft Shadow Directories can be accessed at 26 http://www.ietf.org/shadow.html. 28 Abstract 30 This document defines S/MIME (Secure/Multipurpose Internet Mail 31 extensions) version 3.1. S/MIME provides a consistent way to send and 32 receive secure MIME data. Digital signatures provide authentication, 33 message integrity and non-repudiation with proof of origin, encryption 34 provides data confidentiality and compression provides data 35 compression. 37 1. Introduction 39 S/MIME (Secure/Multipurpose Internet Mail Extensions) provides a 40 consistent way to send and receive secure MIME data. Based on the 41 popular Internet MIME standard, S/MIME provides the following 42 cryptographic security services for electronic messaging applications: 43 authentication, message integrity and non-repudiation of origin (using 44 digital signatures) and data confidentiality (using encryption). 46 S/MIME can be used by traditional mail user agents (MUAs) to add 47 cryptographic security services to mail that is sent, and to interpret 48 cryptographic security services in mail that is received. However, 49 S/MIME is not restricted to mail; it can be used with any transport 50 mechanism that transports MIME data, such as HTTP. As such, S/MIME 51 takes advantage of the object-based features of MIME and allows secure 52 messages to be exchanged in mixed-transport systems. 54 Further, S/MIME can be used in automated message transfer agents that 55 use cryptographic security services that do not require any human 56 intervention, such as the signing of software-generated documents and 57 the encryption of FAX messages sent over the Internet. 59 1.1 Specification Overview 61 This document describes a protocol for adding cryptographic signature 62 and encryption services to MIME data. The MIME standard [MIME-SPEC] 63 provides a general structure for the content type of Internet messages 64 and allows extensions for new content type applications. 66 This specification defines how to create a MIME body part that has 67 been cryptographically enhanced according to CMS [CMS], which is 68 derived from PKCS #7 [PKCS-7]. This specification also defines the 69 application/pkcs7-mime MIME type that can be used to transport those 70 body parts. 72 This document also discusses how to use the multipart/signed MIME 73 type defined in [MIME-SECURE] to transport S/MIME signed messages. 74 multipart/signed is used in conjunction with the 75 application/pkcs7-signature MIME type, which is used to transport 76 a detached S/MIME signature. 78 In order to create S/MIME messages, an S/MIME agent MUST follow the 79 specifications in this document, as well as the specifications 80 listed in the Cryptographic Message Syntax document [CMS] [CMSALG]. 82 Throughout this specification, there are requirements and 83 recommendations made for how receiving agents handle incoming 84 messages. There are separate requirements and recommendations for how 85 sending agents create outgoing messages. In general, the best strategy 86 is to "be liberal in what you receive and conservative in what you 87 send". Most of the requirements are placed on the handling of incoming 88 messages while the recommendations are mostly on the creation of 89 outgoing messages. 91 The separation for requirements on receiving agents and sending agents 92 also derives from the likelihood that there will be S/MIME systems 93 that involve software other than traditional Internet mail clients. 94 S/MIME can be used with any system that transports MIME data. An 95 automated process that sends an encrypted message might not be able to 96 receive an encrypted message at all, for example. Thus, the 97 requirements and recommendations for the two types of agents are 98 listed separately when appropriate. 100 1.2 Terminology 102 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 103 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 104 document are to be interpreted as described in [MUSTSHOULD]. 106 1.3 Definitions 108 For the purposes of this specification, the following definitions 109 apply. 111 ASN.1: Abstract Syntax Notation One, as defined in CCITT X.208 112 [X.208-88]. 114 BER: Basic Encoding Rules for ASN.1, as defined in CCITT X.209 115 [X.209-88]. 117 Certificate: A type that binds an entity's name to a public key with a 118 digital signature. 120 DER: Distinguished Encoding Rules for ASN.1, as defined in CCITT 121 X.509 [X.509-88]. 123 7-bit data: Text data with lines less than 998 characters long, where 124 none of the characters have the 8th bit set, and there are no NULL 125 characters. and occur only as part of a end of line 126 delimiter. 128 8-bit data: Text data with lines less than 998 characters, and where 129 none of the characters are NULL characters. and occur only 130 as part of a end of line delimiter. 132 Binary data: Arbitrary data. 134 Transfer Encoding: A reversible transformation made on data so 8-bit 135 or binary data can be sent via a channel that only transmits 7-bit 136 data. 138 Receiving agent: Software that interprets and processes S/MIME CMS 139 objects, MIME body parts that contain CMS content types, or both. 141 Sending agent: Software that creates S/MIME CMS content types, MIME 142 body parts that contain CMS content types, or both. 144 S/MIME agent: User software that is a receiving agent, a sending 145 agent, or both. 147 1.4 Compatibility with Prior Practice of S/MIME 149 S/MIME version 3.1 agents SHOULD attempt to have the greatest 150 interoperability possible with agents for prior versions of S/MIME. 151 S/MIME version 2 is described in RFC 2311 through RFC 2315, inclusive 152 and S/MIME version 3 is described in RFC 2630 through RFC 2634 153 inclusive. RFC 2311 also has historical information about the 154 development of S/MIME. 156 1.5 Changes Since S/MIME v3.0 158 The RSA public key algorithm was changed to a MUST implement key 159 wrapping algorithm, and the Diffie-Hellman algorithm changed to a 160 SHOULD implement. 162 The AES symmetric encryption algorithm has been included as a SHOULD 163 implement. 165 The RSA public key algorithm was changed to a MUST implement signature 166 algorithm. 168 Ambiguous language about the use of "empty" SignedData messages to 169 transmit certificates was clarified to reflect that transmission of 170 certificate revocation lists is also allowed. 172 The use of binary encoding for some MIME entities is now explicitly 173 discussed. 175 Header protection through the use of the message/rfc822 MIME type has 176 been added. 178 Use of the CompressedData CMS type is allowed, along with required 179 MIME type and file extension additions. 181 2. CMS Options 183 CMS allows for a wide variety of options in content and algorithm 184 support. This section puts forth a number of support requirements and 185 recommendations in order to achieve a base level of interoperability 186 among all S/MIME implementations. [CMSALG] provides additional details 187 regarding the use of the cryptographic algorithms. 189 2.1 DigestAlgorithmIdentifier 191 Sending and receiving agents MUST support SHA-1 [CMSALG]. Receiving 192 agents SHOULD support MD5 [CMSALG] for the purpose of providing 193 backward compatibility with MD5-digested S/MIME v2 SignedData objects. 195 2.2 SignatureAlgorithmIdentifier 197 Receiving agents MUST support id-dsa-with-sha1 defined in [CMSALG]. 198 The algorithm parameters MUST be absent (not encoded as NULL). 199 Receiving agents MUST support rsaEncryption, defined in [CMSALG]. 201 Sending agents MUST support either id-dsa-with-sha1 or rsaEncryption. 203 If using rsaEncryption, sending and receiving agents MUST support the 204 digest algorithms in section 2.1 as specified. 206 Note that S/MIME v3 clients might only implement signing or signature 207 verification using id-dsa-with-sha1, and might also use id-dsa as an 208 AlgorithmIdentifier in this field. Receiving clients SHOULD recognize 209 id-dsa as equivalent to id-dsa-with-sha1, and sending clients MUST use 210 id-dsa-with-sha1 if using that algorithm. Also note that S/MIME v2 211 clients are only required to verify digital signatures using the 212 rsaEncryption algorithm with SHA-1 or MD5, and might not implement 213 id-dsa-with-sha1 or id-dsa at all. 215 2.3 KeyEncryptionAlgorithmIdentifier 217 Sending and receiving agents MUST support rsaEncryption, defined in 218 [CMSALG]. 220 Sending and receiving agents SHOULD support Diffie-Hellman defined in 221 [CMSALG], using the ephemeral-static mode. 223 Note that S/MIME v3 clients might only implement key encryption and 224 decryption using the Diffie-Hellman algorithm. Also note that S/MIME 225 v2 clients are only capable of decrypting content-encryption keys 226 using the rsaEncryption algorithm. 228 2.4 General Syntax 230 There are several CMS content types. Of these, only the Data, 231 SignedData, EnvelopedData and CompressedData content types are 232 currently used for S/MIME. 234 2.4.1 Data Content Type 236 Sending agents MUST use the id-data content type identifier to 237 identify the "inner" MIME message content. For example, when applying 238 a digital signature to MIME data, the CMS SignedData encapContentInfo 239 eContentType MUST include the id-data object identifier and the MIME 240 content MUST be stored in the SignedData encapContentInfo eContent 241 OCTET STRING (unless the sending agent is using multipart/signed, in 242 which case the eContent is absent, per section 3.4.3 of this 243 document). As another example, when applying encryption to MIME data, 244 the CMS EnvelopedData encryptedContentInfo contentType MUST include 245 the id-data object identifier and the encrypted MIME content MUST be 246 stored in the EnvelopedData encryptedContentInfo encryptedContent 247 OCTET STRING. 249 2.4.2 SignedData Content Type 251 Sending agents MUST use the SignedData content type to apply a digital 252 signature to a message or, in a degenerate case where there is no 253 signature information, to convey certificates. Applying a signature to 254 a message provides authentication, message integrity, and 255 non-repudiation of origin. 257 2.4.3 EnvelopedData Content Type 259 This content type is used to apply data confidentiality to a message. 260 A sender needs to have access to a public key for each intended 261 message recipient to use this service. 263 2.4.4 CompressedData Content Type 265 This content type is used to apply data compression to a message. This 266 content type does not provide authentication, message integrity, 267 non-repudiation, or data confidentiality, and is only used to reduce 268 message size. 270 See section 3.6 for further guidance on the use of this type in 271 conjunction with other CMS types. 273 2.5 Attributes and the SignerInfo Type 275 The SignerInfo type allows the inclusion of unsigned and signed 276 attributes to be included along with a signature. 278 Receiving agents MUST be able to handle zero or one instance of each 279 of the signed attributes listed here. Sending agents SHOULD generate 280 one instance of each of the following signed attributes in each S/MIME 281 message: 283 - signingTime (section 2.5.1 in this document) 284 - sMIMECapabilities (section 2.5.2 in this document) 285 - sMIMEEncryptionKeyPreference (section 2.5.3 in this document) 286 - id-messageDigest (section 11.2 in [CMS]) 287 - id-contentType (section 11.1 in [CMS]) 289 Further, receiving agents SHOULD be able to handle zero or one 290 instance in the signingCertificate signed attribute, as defined in 291 section 5 of [ESS]. 293 Sending agents SHOULD generate one instance of the signingCertificate 294 signed attribute in each SignerInfo structure. 296 Additional attributes and values for these attributes might be defined 297 in the future. Receiving agents SHOULD handle attributes or values 298 that it does not recognize in a graceful manner. 300 Interactive sending agents that include signed attributes that are not 301 listed here SHOULD display those attributes to the user, so that the 302 user is aware of all of the data being signed. 304 2.5.1 Signing-Time Attribute 306 The signing-time attribute is used to convey the time that a message 307 was signed. The time of signing will most likely be created by a 308 message originator and therefore is only as trustworthy as the 309 originator. 311 Sending agents MUST encode signing time through the year 2049 as 312 UTCTime; signing times in 2050 or later MUST be encoded as 313 GeneralizedTime. When the UTCTime CHOICE is used, S/MIME agents MUST 314 interpret the year field (YY) as follows: 316 if YY is greater than or equal to 50, the year is interpreted as 19YY; 317 if YY is less than 50, the year is interpreted as 20YY. 319 2.5.2 SMIMECapabilities Attribute 321 The SMIMECapabilities attribute includes signature algorithms (such as 322 "sha1WithRSAEncryption"), symmetric algorithms (such as "DES-EDE3- 323 CBC"), and key encipherment algorithms (such as "rsaEncryption"). 324 There are also several identifiers which indicate support for other 325 optional features such as binary encoding and compression. The 326 SMIMECapabilities were designed to be flexible and extensible so that, 327 in the future, a means of identifying other capabilities and 328 preferences such as certificates can be added in a way that will not 329 cause current clients to break. 331 If present, the SMIMECapabilities attribute MUST be a SignedAttribute; 332 it MUST NOT be an UnsignedAttribute. CMS defines SignedAttributes as a 333 SET OF Attribute. The SignedAttributes in a signerInfo MUST NOT 334 include multiple instances of the SMIMECapabilities attribute. CMS 335 defines the ASN.1 syntax for Attribute to include attrValues SET OF 336 AttributeValue. A SMIMECapabilities attribute MUST only include a 337 single instance of AttributeValue. There MUST NOT be zero or multiple 338 instances of AttributeValue present in the attrValues SET OF 339 AttributeValue. 341 The semantics of the SMIMECapabilities attribute specify a partial 342 list as to what the client announcing the SMIMECapabilities can 343 support. A client does not have to list every capability it supports, 344 and need not list all its capabilities so that the capabilities list 345 doesn't get too long. In an SMIMECapabilities attribute, the object 346 identifiers (OIDs) are listed in order of their preference, but SHOULD 347 be logically separated along the lines of their categories (signature 348 algorithms, symmetric algorithms, key encipherment algorithms, etc.) 350 The structure of the SMIMECapabilities attribute is to facilitate 351 simple table lookups and binary comparisons in order to determine 352 matches. For instance, the DER-encoding for the SMIMECapability for 353 DES EDE3 CBC MUST be identically encoded regardless of the 354 implementation. Because of the requirement for identical encoding, 355 individuals documenting algorithms to be used in the SMIMECapabilities 356 attribute SHOULD explicitly document the correct byte sequence for the 357 common cases. 359 For any capability, the associated parameters for the OID MUST specify 360 all of the parameters necessary to differentiate between two instances 361 of the same algorithm. For instance, the number of rounds and block 362 size for RC5 needs to be specified in addition to the key length. 364 The OIDs that correspond to algorithms SHOULD use the same OID as the 365 actual algorithm, except in the case where the algorithm usage is 366 ambiguous from the OID. For instance, in an earlier specification, 367 rsaEncryption was ambiguous because it could refer to either a 368 signature algorithm or a key encipherment algorithm. In the event that 369 an OID is ambiguous, it needs to be arbitrated by the maintainer of 370 the registered SMIMECapabilities list as to which type of algorithm 371 will use the OID, and a new OID MUST be allocated under the 372 smimeCapabilities OID to satisfy the other use of the OID. 374 The registered SMIMECapabilities list specifies the parameters for 375 OIDs that need them, most notably key lengths in the case of variable- 376 length symmetric ciphers. In the event that there are no 377 differentiating parameters for a particular OID, the parameters MUST 378 be omitted, and MUST NOT be encoded as NULL. 380 Additional values for the SMIMECapabilities attribute might be defined 381 in the future. Receiving agents MUST handle a SMIMECapabilities object 382 that has values that it does not recognize in a graceful manner. 384 Section 2.7.1 explains a strategy for caching capabilities. 386 2.5.2.1 SMIMECapability For the RC2 Algorithm 388 For the RC2 algorithm preference SMIMECapability, the capabilityID 389 MUST be set to the value rC2-CBC as defined in [CMSALG]. The 390 parameters field MUST contain SMIMECapabilitiesParametersForRC2CBC 391 (see appendix A). 393 Please note that the SMIMECapabilitiesParametersForRC2CBC is a single 394 INTEGER which contains the effective key length (NOT the corresponding 395 RC2 parameter version value). So, for example, for RC2 with a 128-bit 396 effective key length, the parameter would be encoded as the INTEGER 397 value 128, NOT the corresponding parameter version of 58. 399 2.5.3 Encryption Key Preference Attribute 401 The encryption key preference attribute allows the signer to 402 unambiguously describe which of the signer's certificates has the 403 signer's preferred encryption key. This attribute is designed to 404 enhance behavior for interoperating with those clients which use 405 separate keys for encryption and signing. This attribute is used to 406 convey to anyone viewing the attribute which of the listed 407 certificates is appropriate for encrypting a session key for future 408 encrypted messages. 410 If present, the SMIMEEncryptionKeyPreference attribute MUST be a 411 SignedAttribute; it MUST NOT be an UnsignedAttribute. CMS defines 412 SignedAttributes as a SET OF Attribute. The SignedAttributes in a 413 signerInfo MUST NOT include multiple instances of the 414 SMIMEEncryptionKeyPreference attribute. CMS defines the ASN.1 syntax 415 for Attribute to include attrValues SET OF AttributeValue. A 416 SMIMEEncryptionKeyPreference attribute MUST only include a single 417 instance of AttributeValue. There MUST NOT be zero or multiple 418 instances of AttributeValue present in the attrValues SET OF 419 AttributeValue. 421 The sending agent SHOULD include the referenced certificate in the set 422 of certificates included in the signed message if this attribute is 423 used. The certificate MAY be omitted if it has been previously made 424 available to the receiving agent. Sending agents SHOULD use this 425 attribute if the commonly used or preferred encryption certificate is 426 not the same as the certificate used to sign the message. 428 Receiving agents SHOULD store the preference data if the signature on 429 the message is valid and the signing time is greater than the 430 currently stored value. (As with the SMIMECapabilities, the clock skew 431 SHOULD be checked and the data not used if the skew is too great.) 432 Receiving agents SHOULD respect the sender's encryption key preference 433 attribute if possible. This however represents only a preference and 434 the receiving agent can use any certificate in replying to the sender 435 that is valid. 437 Section 2.7.1 explains a strategy for caching preference data. 439 2.5.3.1 Selection of Recipient Key Management Certificate 441 In order to determine the key management certificate to be used when 442 sending a future CMS EnvelopedData message for a particular recipient, 443 the following steps SHOULD be followed: 445 - If an SMIMEEncryptionKeyPreference attribute is found in a 446 SignedData object received from the desired recipient, this 447 identifies the X.509 certificate that SHOULD be used as the X.509 448 key management certificate for the recipient. 450 - If an SMIMEEncryptionKeyPreference attribute is not found in a 451 SignedData object received from the desired recipient, the set of 452 X.509 certificates SHOULD be searched for a X.509 certificate with 453 the same subject name as the signing X.509 certificate which can be 454 used for key management. 456 - Or use some other method of determining the user's key management 457 key. If a X.509 key management certificate is not found, then 458 encryption cannot be done with the signer of the message. If 459 multiple X.509 key management certificates are found, the S/MIME 460 agent can make an arbitrary choice between them. 462 2.6 SignerIdentifier SignerInfo Type 464 S/MIME v3.1 implementations MUST support both issuerAndSerialNumber as 465 well as subjectKeyIdentifier. Messages that use the 466 subjectKeyIdentifier choice cannot be read by S/MIME v2 clients. 468 It is important to understand that some certificates use a value for 469 subjectKeyIdentifier that is not suitable for uniquely identifying a 470 certificate. Implementations MUST be prepared for multiple 471 certificates for potentially different entities to have the same value 472 for subjectKeyIdentifier, and MUST be prepared to try each matching 473 certificate during signature verification before indicating an error 474 condition. 476 2.7 ContentEncryptionAlgorithmIdentifier 478 Sending and receiving agents MUST support encryption and decryption 479 with DES EDE3 CBC, hereinafter called "tripleDES" [CMSALG]. Receiving 480 agents SHOULD support encryption and decryption using the RC2 [CMSALG] 481 or a compatible algorithm at a key size of 40 bits, hereinafter called 482 "RC2/40". Sending and receiving agents SHOULD support encryption and 483 decryption with AES [CMSAES] at a key size of 128, 192 and 256 bits. 485 2.7.1 Deciding Which Encryption Method To Use 487 When a sending agent creates an encrypted message, it has to decide 488 which type of encryption to use. The decision process involves using 489 information garnered from the capabilities lists included in messages 490 received from the recipient, as well as out-of-band information such 491 as private agreements, user preferences, legal restrictions, and so 492 on. 494 Section 2.5.2 defines a method by which a sending agent can optionally 495 announce, among other things, its decrypting capabilities in its order 496 of preference. The following method for processing and remembering the 497 encryption capabilities attribute in incoming signed messages SHOULD 498 be used. 500 - If the receiving agent has not yet created a list of capabilities 501 for the sender's public key, then, after verifying the signature on 502 the incoming message and checking the timestamp, the receiving agent 503 SHOULD create a new list containing at least the signing time and 504 the symmetric capabilities. 506 - If such a list already exists, the receiving agent SHOULD verify 507 that the signing time in the incoming message is greater than the 508 signing time stored in the list and that the signature is valid. If 509 so, the receiving agent SHOULD update both the signing time and 510 capabilities in the list. Values of the signing time that lie far in 511 the future (that is, a greater discrepancy than any reasonable clock 512 skew), or a capabilities list in messages whose signature could not 513 be verified, MUST NOT be accepted. 515 The list of capabilities SHOULD be stored for future use in creating 516 messages. 518 Before sending a message, the sending agent MUST decide whether it is 519 willing to use weak encryption for the particular data in the message. 520 If the sending agent decides that weak encryption is unacceptable for 521 this data, then the sending agent MUST NOT use a weak algorithm such 522 as RC2/40. The decision to use or not use weak encryption overrides 523 any other decision in this section about which encryption algorithm to 524 use. 526 Sections 2.7.2.1 through 2.7.2.4 describe the decisions a sending 527 agent SHOULD use in deciding which type of encryption will be 528 applied to a message. These rules are ordered, so the sending agent 529 SHOULD make its decision in the order given. 531 2.7.1.1 Rule 1: Known Capabilities 533 If the sending agent has received a set of capabilities from the 534 recipient for the message the agent is about to encrypt, then the 535 sending agent SHOULD use that information by selecting the first 536 capability in the list (that is, the capability most preferred by the 537 intended recipient) for which the sending agent knows how to encrypt. 538 The sending agent SHOULD use one of the capabilities in the list if 539 the agent reasonably expects the recipient to be able to decrypt the 540 message. 542 2.7.1.2 Rule 2: Unknown Capabilities, Unknown Version of S/MIME 544 If the following two conditions are met: 545 - the sending agent has no knowledge of the encryption capabilities 546 of the recipient, 547 - and the sending agent has no knowledge of the version of S/MIME 548 of the recipient, 549 then the sending agent SHOULD use tripleDES because it is a stronger 550 algorithm and is required by S/MIME v3. If the sending agent chooses 551 not to use tripleDES in this step, it SHOULD use RC2/40. 553 2.7.2 Choosing Weak Encryption 555 Like all algorithms that use 40 bit keys, RC2/40 is considered by many 556 to be weak encryption. A sending agent that is controlled by a human 557 SHOULD allow a human sender to determine the risks of sending data 558 using RC2/40 or a similarly weak encryption algorithm before sending 559 the data, and possibly allow the human to use a stronger encryption 560 method such as tripleDES. 562 2.7.3 Multiple Recipients 564 If a sending agent is composing an encrypted message to a group of 565 recipients where the encryption capabilities of some of the recipients 566 do not overlap, the sending agent is forced to send more than one 567 message. Please note that if the sending agent chooses to send a 568 message encrypted with a strong algorithm, and then send the same 569 message encrypted with a weak algorithm, someone watching the 570 communications channel could learn the contents of the 571 strongly-encrypted message simply by decrypting the weakly-encrypted 572 message. 574 3. Creating S/MIME Messages 576 This section describes the S/MIME message formats and how they are 577 created. S/MIME messages are a combination of MIME bodies and CMS 578 content types. Several MIME types as well as several CMS content types 579 are used. The data to be secured is always a canonical MIME entity. 580 The MIME entity and other data, such as certificates and algorithm 581 identifiers, are given to CMS processing facilities which produces a 582 CMS object. The CMS object is then finally wrapped in MIME. The 583 Enhanced Security Services for S/MIME [ESS] document provides 584 descriptions of how nested, secured S/MIME messages are formatted. ESS 585 provides a description of how a triple-wrapped S/MIME message is 586 formatted using multipart/signed and application/pkcs7-mime for the 587 signatures. 589 S/MIME provides one format for enveloped-only data, several formats 590 for signed-only data, and several formats for signed and enveloped 591 data. Several formats are required to accommodate several 592 environments, in particular for signed messages. The criteria for 593 choosing among these formats are also described. 595 The reader of this section is expected to understand MIME as described 596 in [MIME-SPEC] and [MIME-SECURE]. 598 3.1 Preparing the MIME Entity for Signing, Enveloping or Compressing 600 S/MIME is used to secure MIME entities. A MIME entity can be a sub- 601 part, sub-parts of a message, or the whole message with all its sub- 602 parts. A MIME entity that is the whole message includes only the MIME 603 headers and MIME body, and does not include the RFC-822 headers. Note 604 that S/MIME can also be used to secure MIME entities used in 605 applications other than Internet mail. If protection of the RFC-822 606 headers is required, the use of the message/rfc822 MIME type is 607 explained later in this section. 609 The MIME entity that is secured and described in this section can be 610 thought of as the "inside" MIME entity. That is, it is the "innermost" 611 object in what is possibly a larger MIME message. Processing "outside" 612 MIME entities into CMS content types is described in Section 3.2, 3.4 613 and elsewhere. 615 The procedure for preparing a MIME entity is given in [MIME-SPEC]. The 616 same procedure is used here with some additional restrictions when 617 signing. Description of the procedures from [MIME-SPEC] are repeated 618 here, but it is suggested that the reader refer to that document for 619 the exact procedure. This section also describes additional 620 requirements. 622 A single procedure is used for creating MIME entities that are to have 623 any combination of signing, enveloping and compressing applied. Some 624 additional steps are recommended to defend against known corruptions 625 that can occur during mail transport that are of particular importance 626 for clear- signing using the multipart/signed format. It is 627 recommended that these additional steps be performed on enveloped 628 messages, or signed and enveloped messages in order that the message 629 can be forwarded to any environment without modification. 631 These steps are descriptive rather than prescriptive. The implementer 632 is free to use any procedure as long as the result is the same. 634 Step 1. The MIME entity is prepared according to the local 635 conventions. 637 Step 2. The leaf parts of the MIME entity are converted to canonical 638 form. 640 Step 3. Appropriate transfer encoding is applied to the leaves of the 641 MIME entity. 643 When an S/MIME message is received, the security services on the 644 message are processed, and the result is the MIME entity. That MIME 645 entity is typically passed to a MIME-capable user agent where, it is 646 further decoded and presented to the user or receiving application. 648 In order to protect outer, non-content related message headers (for 649 instance, the "Subject", "To", "From" and "CC" fields), the sending 650 client MAY wrap a full MIME message in a message/rfc822 wrapper in 651 order to apply S/MIME security services to these headers. It is up to 652 the receiving client to decide how to present these "inner" headers 653 along with the unprotected "outer" headers. 655 When an S/MIME message is received, if the top-level protected MIME 656 entity has a Content-Type of message/rfc822, it can be assumed that 657 the intent was to provide header protection. This entity SHOULD be 658 presented as the top-level message, taking into account header merging 659 issues as previously discussed. 661 3.1.1 Canonicalization 663 Each MIME entity MUST be converted to a canonical form that is 664 uniquely and unambiguously representable in the environment where the 665 signature is created and the environment where the signature will be 666 verified. MIME entities MUST be canonicalized for enveloping and 667 compressing as well as signing. 669 The exact details of canonicalization depend on the actual MIME type 670 and subtype of an entity, and are not described here. Instead, the 671 standard for the particular MIME type SHOULD be consulted. For 672 example, canonicalization of type text/plain is different from 673 canonicalization of audio/basic. Other than text types, most types 674 have only one representation regardless of computing platform or 675 environment which can be considered their canonical representation. In 676 general, canonicalization will be performed by the non-security part 677 of the sending agent rather than the S/MIME implementation. 679 The most common and important canonicalization is for text, which is 680 often represented differently in different environments. MIME entities 681 of major type "text" MUST have both their line endings and character 682 set canonicalized. The line ending MUST be the pair of characters 683 , and the charset SHOULD be a registered charset [CHARSETS]. 684 The details of the canonicalization are specified in [MIME-SPEC]. The 685 chosen charset SHOULD be named in the charset parameter so that the 686 receiving agent can unambiguously determine the charset used. 688 Note that some charsets such as ISO-2022 have multiple representations 689 for the same characters. When preparing such text for signing, the 690 canonical representation specified for the charset MUST be used. 692 3.1.2 Transfer Encoding 694 When generating any of the secured MIME entities below, except the 695 signing using the multipart/signed format, no transfer encoding at all 696 is required. S/MIME implementations MUST be able to deal with binary 697 MIME objects. If no Content-Transfer-Encoding header is present, the 698 transfer encoding is presumed to be 7BIT. 700 S/MIME implementations SHOULD however use transfer encoding described 701 in section 3.1.3 for all MIME entities they secure. The reason for 702 securing only 7-bit MIME entities, even for enveloped data that are 703 not exposed to the transport, is that it allows the MIME entity to be 704 handled in any environment without changing it. For example, a trusted 705 gateway might remove the envelope, but not the signature, of a 706 message, and then forward the signed message on to the end recipient 707 so that they can verify the signatures directly. If the transport 708 internal to the site is not 8-bit clean, such as on a wide-area 709 network with a single mail gateway, verifying the signature will not 710 be possible unless the original MIME entity was only 7-bit data. 712 S/MIME implementations which "know" that all intended recipient(s) are 713 capable of handling inner (all but the outermost) binary MIME objects 714 SHOULD use binary encoding as opposed to a 7-bit-safe transfer 715 encoding for the inner entities. The use of a 7-bit-safe encoding 716 (such as base64) would unnecessarily expand the message size. 717 Implementations MAY "know" that recipient implementations are capable 718 of handling inner binary MIME entities either by interpreting the 719 id-cap-preferBinaryInside sMIMECapabilities attribute, by prior 720 agreement, or by other means. 722 If one or more intended recipients are unable to handle inner binary 723 MIME objects, or if this capability in unknown for any of the intended 724 recipients, S/MIME implementations SHOULD use transfer encoding 725 described in section 3.1.3 for all MIME entities they secure. 727 3.1.3 Transfer Encoding for Signing Using multipart/signed 729 If a multipart/signed entity is ever to be transmitted over the 730 standard Internet SMTP infrastructure or other transport that is 731 constrained to 7-bit text, it MUST have transfer encoding applied so 732 that it is represented as 7-bit text. MIME entities that are 7-bit 733 data already need no transfer encoding. Entities such as 8-bit text 734 and binary data can be encoded with quoted-printable or base-64 735 transfer encoding. 737 The primary reason for the 7-bit requirement is that the Internet mail 738 transport infrastructure cannot guarantee transport of 8-bit or binary 739 data. Even though many segments of the transport infrastructure now 740 handle 8-bit and even binary data, it is sometimes not possible to 741 know whether the transport path is 8-bit clean. If a mail message with 742 8-bit data were to encounter a message transfer agent that can not 743 transmit 8-bit or binary data, the agent has three options, none of 744 which are acceptable for a clear-signed message: 746 - The agent could change the transfer encoding; this would invalidate 747 the signature. 748 - The agent could transmit the data anyway, which would most likely 749 result in the 8th bit being corrupted; this too would invalidate the 750 signature. 751 - The agent could return the message to the sender. 753 [MIME-SECURE] prohibits an agent from changing the transfer encoding 754 of the first part of a multipart/signed message. If a compliant agent 755 that can not transmit 8-bit or binary data encounters a 756 multipart/signed message with 8-bit or binary data in the first part, 757 it would have to return the message to the sender as undeliverable. 759 3.1.4 Sample Canonical MIME Entity 761 This example shows a multipart/mixed message with full transfer 762 encoding. This message contains a text part and an attachment. The 763 sample message text includes characters that are not US-ASCII and thus 764 need to be transfer encoded. Though not shown here, the end of each 765 line is . The line ending of the MIME headers, the text, and 766 transfer encoded parts, all MUST be . 768 Note that this example is not of an S/MIME message. 770 Content-Type: multipart/mixed; boundary=bar 772 --bar 773 Content-Type: text/plain; charset=iso-8859-1 774 Content-Transfer-Encoding: quoted-printable 776 =A1Hola Michael! 778 How do you like the new S/MIME specification? 780 It's generally a good idea to encode lines that begin with 781 From=20because some mail transport agents will insert a greater- 782 than (>) sign, thus invalidating the signature. 784 Also, in some cases it might be desirable to encode any =20 785 trailing whitespace that occurs on lines in order to ensure =20 786 that the message signature is not invalidated when passing =20 787 a gateway that modifies such whitespace (like BITNET). =20 789 --bar 790 Content-Type: image/jpeg 791 Content-Transfer-Encoding: base64 793 iQCVAwUBMJrRF2N9oWBghPDJAQE9UQQAtl7LuRVndBjrk4EqYBIb3h5QXIX/LC// 794 jJV5bNvkZIGPIcEmI5iFd9boEgvpirHtIREEqLQRkYNoBActFBZmh9GC3C041WGq 795 uMbrbxc+nIs1TIKlA08rVi9ig/2Yh7LFrK5Ein57U/W72vgSxLhe/zhdfolT9Brn 796 HOxEa44b+EI= 798 --bar-- 800 3.2 The application/pkcs7-mime Type 802 The application/pkcs7-mime type is used to carry CMS content types 803 including EnvelopedData, SignedData and CompressedData. The details of 804 constructing these entities is described in subsequent sections. This 805 section describes the general characteristics of the 806 application/pkcs7-mime type. 808 The carried CMS object always contains a MIME entity that is prepared 809 as described in section 3.1 if the eContentType is id-data. Other 810 contents MAY be carried when the eContentType contains different 811 values. See [ESS] for an example of this with signed receipts. 813 Since CMS content types are binary data, in most cases base-64 814 transfer encoding is appropriate, in particular when used with SMTP 815 transport. The transfer encoding used depends on the transport through 816 which the object is to be sent, and is not a characteristic of the 817 MIME type. 819 Note that this discussion refers to the transfer encoding of the CMS 820 object or "outside" MIME entity. It is completely distinct from, and 821 unrelated to, the transfer encoding of the MIME entity secured by the 822 CMS object, the "inside" object, which is described in section 3.1. 824 Because there are several types of application/pkcs7-mime objects, a 825 sending agent SHOULD do as much as possible to help a receiving agent 826 know about the contents of the object without forcing the receiving 827 agent to decode the ASN.1 for the object. The MIME headers of all 828 application/pkcs7-mime objects SHOULD include the optional "smime- 829 type" parameter, as described in the following sections. 831 3.2.1 The name and filename Parameters 833 For the application/pkcs7-mime, sending agents SHOULD emit the 834 optional "name" parameter to the Content-Type field for compatibility 835 with older systems. Sending agents SHOULD also emit the optional 836 Content-Disposition field [CONTDISP] with the "filename" parameter. If 837 a sending agent emits the above parameters, the value of the 838 parameters SHOULD be a file name with the appropriate extension: 840 MIME Type File Extension 842 Application/pkcs7-mime (SignedData, EnvelopedData) .p7m 844 Application/pkcs7-mime (degenerate SignedData .p7c 845 certificate management message) 847 Application/pkcs7-mime (CompressedData) .p7z 849 Application/pkcs7-signature (SignedData) .p7s 851 In addition, the file name SHOULD be limited to eight characters 852 followed by a three letter extension. The eight character filename 853 base can be any distinct name; the use of the filename base "smime" 854 SHOULD be used to indicate that the MIME entity is associated with 855 S/MIME. 857 Including a file name serves two purposes. It facilitates easier use 858 of S/MIME objects as files on disk. It also can convey type 859 information across gateways. When a MIME entity of type 860 application/pkcs7-mime (for example) arrives at a gateway that has no 861 special knowledge of S/MIME, it will default the entity's MIME type to 862 application/octet-stream and treat it as a generic attachment, thus 863 losing the type information. However, the suggested filename for an 864 attachment is often carried across a gateway. This often allows the 865 receiving systems to determine the appropriate application to hand the 866 attachment off to, in this case a stand-alone S/MIME processing 867 application. Note that this mechanism is provided as a convenience for 868 implementations in certain environments. A proper S/MIME 869 implementation MUST use the MIME types and MUST NOT rely on the file 870 extensions. 872 3.2.2 The smime-type parameter 874 The application/pkcs7-mime content type defines the optional "smime- 875 type" parameter. The intent of this parameter is to convey details 876 about the security applied (signed or enveloped) along with 877 information about the contained content. This specification defines 878 the following smime-types. 880 Name CMS type Inner Content 882 enveloped-data EnvelopedData id-data 884 signed-data SignedData id-data 886 certs-only SignedData none 888 compressed-data CompressedData id-data 890 In order that consistency can be obtained with future, the following 891 guidelines SHOULD be followed when assigning a new smime-type 892 parameter. 894 1. If both signing and encryption can be applied to the content, then 895 two values for smime-type SHOULD be assigned "signed-*" and 896 "encrypted-*". If one operation can be assigned then this can be 897 omitted. Thus since "certs-only" can only be signed, "signed-" is 898 omitted. 900 2. A common string for a content oid SHOULD be assigned. We use "data" 901 for the id-data content OID when MIME is the inner content. 903 3. If no common string is assigned. Then the common string of 904 "OID." is recommended (for example, "OID.1.3.6.1.5.5.7.6.1" would 905 be DES40). 907 It is explicitly intended that this field be a suitable hint for mail 908 client applications to indicate whether a message is "signed" or 909 "encrypted" without having to tunnel into the CMS payload. 911 3.3 Creating an Enveloped-only Message 913 This section describes the format for enveloping a MIME entity without 914 signing it. It is important to note that sending enveloped but not 915 signed messages does not provide for data integrity. It is possible to 916 replace ciphertext in such a way that the processed message will still 917 be valid, but the meaning can be altered. 919 Step 1. The MIME entity to be enveloped is prepared according to 920 section 3.1. 922 Step 2. The MIME entity and other required data is processed into a 923 CMS object of type EnvelopedData. In addition to encrypting a copy of 924 the content-encryption key for each recipient, a copy of the content- 925 encryption key SHOULD be encrypted for the originator and included in 926 the EnvelopedData (see [CMS] Section 6). 928 Step 3. The EnvelopedData object is wrapped in a CMS ContentInfo 929 object. 931 Step 4. The ContentInfo object is inserted into an 932 application/pkcs7-mime MIME entity. 934 The smime-type parameter for enveloped-only messages is "enveloped- 935 data". The file extension for this type of message is ".p7m". 937 A sample message would be: 939 Content-Type: application/pkcs7-mime; smime-type=enveloped-data; 940 name=smime.p7m 941 Content-Transfer-Encoding: base64 942 Content-Disposition: attachment; filename=smime.p7m 944 rfvbnj756tbBghyHhHUujhJhjH77n8HHGT9HG4VQpfyF467GhIGfHfYT6 945 7n8HHGghyHhHUujhJh4VQpfyF467GhIGfHfYGTrfvbnjT6jH7756tbB9H 946 f8HHGTrfvhJhjH776tbB9HG4VQbnj7567GhIGfHfYT6ghyHhHUujpfyF4 947 0GhIGfHfQbnj756YT64V 949 3.4 Creating a Signed-only Message 951 There are two formats for signed messages defined for S/MIME: 952 application/pkcs7-mime with SignedData, and multipart/signed. In 953 general, the multipart/signed form is preferred for sending, and 954 receiving agents MUST be able to handle both. 956 3.4.1 Choosing a Format for Signed-only Messages 958 There are no hard-and-fast rules when a particular signed-only format 959 is chosen because it depends on the capabilities of all the receivers 960 and the relative importance of receivers with S/MIME facilities being 961 able to verify the signature versus the importance of receivers 962 without S/MIME software being able to view the message. 964 Messages signed using the multipart/signed format can always be viewed 965 by the receiver whether they have S/MIME software or not. They can 966 also be viewed whether they are using a MIME-native user agent or they 967 have messages translated by a gateway. In this context, "be viewed" 968 means the ability to process the message essentially as if it were not 969 a signed message, including any other MIME structure the message might 970 have. 972 Messages signed using the SignedData format cannot be viewed by a 973 recipient unless they have S/MIME facilities. However, the SignedData 974 format protects the message content from being changed by benign 975 intermediate agents. Such agents might do line wrapping or 976 content-transfer encoding changes which would break the signature. 978 3.4.2 Signing Using application/pkcs7-mime with SignedData 980 This signing format uses the application/pkcs7-mime MIME type. The 981 steps to create this format are: 983 Step 1. The MIME entity is prepared according to section 3.1. 985 Step 2. The MIME entity and other required data is processed into a 986 CMS object of type SignedData. 988 Step 3. The SignedData object is wrapped in a CMS ContentInfo 989 object. 991 Step 4. The ContentInfo object is inserted into an 992 application/pkcs7-mime MIME entity. 994 The smime-type parameter for messages using application/pkcs7-mime 995 with SignedData is "signed-data". The file extension for this type of 996 message is ".p7m". 998 A sample message would be: 1000 Content-Type: application/pkcs7-mime; smime-type=signed-data; 1001 name=smime.p7m 1002 Content-Transfer-Encoding: base64 1003 Content-Disposition: attachment; filename=smime.p7m 1005 567GhIGfHfYT6ghyHhHUujpfyF4f8HHGTrfvhJhjH776tbB9HG4VQbnj7 1006 77n8HHGT9HG4VQpfyF467GhIGfHfYT6rfvbnj756tbBghyHhHUujhJhjH 1007 HUujhJh4VQpfyF467GhIGfHfYGTrfvbnjT6jH7756tbB9H7n8HHGghyHh 1008 6YT64V0GhIGfHfQbnj75 1010 3.4.3 Signing Using the multipart/signed Format 1012 This format is a clear-signing format. Recipients without any S/MIME 1013 or CMS processing facilities are able to view the message. It makes 1014 use of the multipart/signed MIME type described in [MIME-SECURE]. The 1015 multipart/signed MIME type has two parts. The first part contains the 1016 MIME entity that is signed; the second part contains the "detached 1017 signature" CMS SignedData object in which the encapContentInfo 1018 eContent field is absent. 1020 3.4.3.1 The application/pkcs7-signature MIME Type 1022 This MIME type always contains a CMS ContentInfo containing a single 1023 CMS object of type SignedData. The SignedData encapContentInfo 1024 eContent field MUST be absent. The signerInfos field contains the 1025 signatures for the MIME entity. 1027 The file extension for signed-only messages using application/pkcs7- 1028 signature is ".p7s". 1030 3.4.3.2 Creating a multipart/signed Message 1032 Step 1. The MIME entity to be signed is prepared according to section 1033 3.1, taking special care for clear-signing. 1035 Step 2. The MIME entity is presented to CMS processing in order to 1036 obtain an object of type SignedData in which the encapContentInfo 1037 eContent field is absent. 1039 Step 3. The MIME entity is inserted into the first part of a 1040 multipart/signed message with no processing other than that described 1041 in section 3.1. 1043 Step 4. Transfer encoding is applied to the "detached signature" CMS 1044 SignedData object and it is inserted into a MIME entity of type 1045 application/pkcs7-signature. 1047 Step 5. The MIME entity of the application/pkcs7-signature is inserted 1048 into the second part of the multipart/signed entity. 1050 The multipart/signed Content type has two required parameters: the 1051 protocol parameter and the micalg parameter. 1053 The protocol parameter MUST be "application/pkcs7-signature". Note 1054 that quotation marks are required around the protocol parameter 1055 because MIME requires that the "/" character in the parameter value 1056 MUST be quoted. 1058 The micalg parameter allows for one-pass processing when the signature 1059 is being verified. The value of the micalg parameter is dependent on 1060 the message digest algorithm(s) used in the calculation of the Message 1061 Integrity Check. If multiple message digest algorithms are used they 1062 MUST be separated by commas per [MIME-SECURE]. The values to be placed 1063 in the micalg parameter SHOULD be from the following: 1065 Algorithm Value 1066 used 1068 MD5 md5 1069 SHA-1 sha1 1070 SHA-256 sha256 1071 SHA-384 sha384 1072 SHA-512 sha512 1073 Any other (defined separately in algorithm profile or "unknown" 1074 if not defined) 1076 (Historical note: some early implementations of S/MIME emitted and 1077 expected "rsa-md5" and "rsa-sha1" for the micalg parameter.) Receiving 1078 agents SHOULD be able to recover gracefully from a micalg parameter 1079 value that they do not recognize. 1081 The SHA-256, SHA-384 and SHA-512 algorithms [FIPS180-2] are not 1082 currently recommended in S/MIME, and are included here for completeness. 1084 3.4.3.3 Sample multipart/signed Message 1086 Content-Type: multipart/signed; 1087 protocol="application/pkcs7-signature"; 1088 micalg=sha1; boundary=boundary42 1090 --boundary42 1091 Content-Type: text/plain 1093 This is a clear-signed message. 1095 --boundary42 1096 Content-Type: application/pkcs7-signature; name=smime.p7s 1097 Content-Transfer-Encoding: base64 1098 Content-Disposition: attachment; filename=smime.p7s 1100 ghyHhHUujhJhjH77n8HHGTrfvbnj756tbB9HG4VQpfyF467GhIGfHfYT6 1101 4VQpfyF467GhIGfHfYT6jH77n8HHGghyHhHUujhJh756tbB9HGTrfvbnj 1102 n8HHGTrfvhJhjH776tbB9HG4VQbnj7567GhIGfHfYT6ghyHhHUujpfyF4 1103 7GhIGfHfYT64VQbnj756 1105 --boundary42-- 1107 The content that is digested (the first part of the multipart/signed) 1108 are the bytes: 1110 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 74 65 78 74 2f 70 6c 61 69 1111 6e 0d 0a 0d 0a 54 68 69 73 20 69 73 20 61 20 63 6c 65 61 72 2d 73 69 1112 67 6e 65 64 20 6d 65 73 73 61 67 65 2e 0d 0a 1114 3.5 Creating an Compressed-only Message 1116 This section describes the format for compressing a MIME entity. 1117 Please note that versions of S/MIME prior to 3.1 did not specify any 1118 use of CompressedData, and will not recognize it. The use of a 1119 capability to indicate the ability to receive CompressedData is 1120 described in [CMSCOMPR] and is the preferred method for compatibility. 1122 Step 1. The MIME entity to be compressed is prepared according to 1123 section 3.1. 1125 Step 2. The MIME entity and other required data is processed into a 1126 CMS object of type CompressedData. 1128 Step 3. The CompressedData object is wrapped in a CMS ContentInfo 1129 object. 1131 Step 4. The ContentInfo object is inserted into an 1132 application/pkcs7-mime MIME entity. 1134 The smime-type parameter for compressed-only messages is "compressed- 1135 data". The file extension for this type of message is ".p7z". 1137 A sample message would be: 1139 Content-Type: application/pkcs7-mime; smime-type=compressed-data; 1140 name=smime.p7z 1141 Content-Transfer-Encoding: base64 1142 Content-Disposition: attachment; filename=smime.p7z 1144 rfvbnj756tbBghyHhHUujhJhjH77n8HHGT9HG4VQpfyF467GhIGfHfYT6 1145 7n8HHGghyHhHUujhJh4VQpfyF467GhIGfHfYGTrfvbnjT6jH7756tbB9H 1146 f8HHGTrfvhJhjH776tbB9HG4VQbnj7567GhIGfHfYT6ghyHhHUujpfyF4 1147 0GhIGfHfQbnj756YT64V 1149 3.6 Multiple Operations 1151 The signed-only, encrypted-only, and compressed-only MIME formats can 1152 be nested. This works because these formats are all MIME entities that 1153 encapsulate other MIME entities. 1155 An S/MIME implementation MUST be able to receive and process 1156 arbitrarily nested S/MIME within reasonable resource limits of the 1157 recipient computer. 1159 It is possible to apply any of the signing, encrypting and compressing 1160 operations in any order. It is up to the implementer and the user to 1161 choose. When signing first, the signatories are then securely obscured 1162 by the enveloping. When enveloping first the signatories are exposed, 1163 but it is possible to verify signatures without removing the 1164 enveloping. This can be useful in an environment were automatic 1165 signature verification is desired, as no private key material is 1166 required to verify a signature. 1168 There are security ramifications to choosing whether to sign first or 1169 encrypt first. A recipient of a message that is encrypted and then 1170 signed can validate that the encrypted block was unaltered, but cannot 1171 determine any relationship between the signer and the unencrypted 1172 contents of the message. A recipient of a message that is signed-then- 1173 encrypted can assume that the signed message itself has not been 1174 altered, but that a careful attacker could have changed the 1175 unauthenticated portions of the encrypted message. 1177 When using compression, keep the following guidelines in mind: 1179 - Compression of binary encoded encrypted data is discouraged, since 1180 it will not yield significant compression. Base64 encrypted data 1181 could very well benefit, however. 1182 - If a lossy compression algorithm is used with signing, you will need 1183 to compress first, then sign. 1185 3.7 Creating a Certificate Management Message 1187 The certificate management message or MIME entity is used to transport 1188 certificates and/or certificate revocation lists, such as in response 1189 to a registration request. 1191 Step 1. The certificates and/or certificate revocation lists are made 1192 available to the CMS generating process which creates a CMS object of 1193 type SignedData. The SignedData encapContentInfo eContent field MUST 1194 be absent and signerInfos field MUST be empty. 1196 Step 2. The SignedData object is wrapped in a CMS ContentInfo 1197 object. 1199 Step 3. The ContentInfo object is enclosed in an application/pkcs7- 1200 mime MIME entity. 1202 The smime-type parameter for a certificate management message is 1203 "certs-only". The file extension for this type of message is ".p7c". 1205 3.8 Registration Requests 1207 A sending agent that signs messages MUST have a certificate for the 1208 signature so that a receiving agent can verify the signature. There 1209 are many ways of getting certificates, such as through an exchange 1210 with a certificate authority, through a hardware token or diskette, 1211 and so on. 1213 S/MIME v2 [SMIMEV2] specified a method for "registering" public keys 1214 with certificate authorities using an application/pkcs10 body part. 1215 Since that time, the IETF PKIX Working Group has developed other 1216 methods for requesting certificates. However, S/MIME v3.1 does not 1217 require a particular certificate request mechanism. 1219 3.9 Identifying an S/MIME Message 1221 Because S/MIME takes into account interoperation in non-MIME 1222 environments, several different mechanisms are employed to carry the 1223 type information, and it becomes a bit difficult to identify S/MIME 1224 messages. The following table lists criteria for determining whether 1225 or not a message is an S/MIME message. A message is considered an 1226 S/MIME message if it matches any of the criteria listed below. 1228 The file suffix in the table below comes from the "name" parameter in 1229 the content-type header, or the "filename" parameter on the content- 1230 disposition header. These parameters that give the file suffix are not 1231 listed below as part of the parameter section. 1233 MIME type: application/pkcs7-mime 1234 parameters: any 1235 file suffix: any 1237 MIME type: multipart/signed 1238 parameters: protocol="application/pkcs7-signature" 1239 file suffix: any 1241 MIME type: application/octet-stream 1242 parameters: any 1243 file suffix: p7m, p7s, p7c, p7z 1245 4. Certificate Processing 1247 A receiving agent MUST provide some certificate retrieval mechanism in 1248 order to gain access to certificates for recipients of digital 1249 envelopes. This specification does not cover how S/MIME agents handle 1250 certificates, only what they do after a certificate has been validated 1251 or rejected. S/MIME certificate issues are covered in [CERT31]. 1253 At a minimum, for initial S/MIME deployment, a user agent could 1254 automatically generate a message to an intended recipient requesting 1255 that recipient's certificate in a signed return message. Receiving and 1256 sending agents SHOULD also provide a mechanism to allow a user to 1257 "store and protect" certificates for correspondents in such a way so 1258 as to guarantee their later retrieval. 1260 4.1 Key Pair Generation 1262 All generated key pairs MUST be generated from a good source of non- 1263 deterministic random input [RANDOM] and the private key MUST be 1264 protected in a secure fashion. 1266 If an S/MIME agent needs to generate an RSA key pair, then the S/MIME 1267 agent or some related administrative utility or function SHOULD 1268 generate RSA key pairs using the following guidelines. A user agent 1269 SHOULD generate RSA key pairs at a minimum key size of 768 bits. A 1270 user agent MUST NOT generate RSA key pairs less than 512 bits long. 1271 Creating keys longer than 1024 bits can cause some older S/MIME 1272 receiving agents to not be able to verify signatures, but gives better 1273 security and is therefore valuable. A receiving agent SHOULD be able 1274 to verify signatures with keys of any size over 512 bits. Some agents 1275 created in the United States have chosen to create 512 bit keys in 1276 order to get more advantageous export licenses. However, 512 bit keys 1277 are considered by many to be cryptographically insecure. Implementers 1278 SHOULD be aware that multiple (active) key pairs can be associated 1279 with a single individual. For example, one key pair can be used to 1280 support confidentiality, while a different key pair can be used for 1281 authentication. 1283 5. Security 1285 40-bit encryption is considered weak by most cryptographers. Using 1286 weak cryptography in S/MIME offers little actual security over sending 1287 plaintext. However, other features of S/MIME, such as the 1288 specification of tripleDES and the ability to announce stronger 1289 cryptographic capabilities to parties with whom you communicate, allow 1290 senders to create messages that use strong encryption. Using weak 1291 cryptography is never recommended unless the only alternative is no 1292 cryptography. When feasible, sending and receiving agents SHOULD 1293 inform senders and recipients the relative cryptographic strength of 1294 messages. 1296 It is impossible for most software or people to estimate the value of 1297 a message. Further, it is impossible for most software or people to 1298 estimate the actual cost of decrypting a message that is encrypted 1299 with a key of a particular size. Further, it is quite difficult to 1300 determine the cost of a failed decryption if a recipient cannot decode 1301 a message. Thus, choosing between different key sizes (or choosing 1302 whether to just use plaintext) is also impossible. However, decisions 1303 based on these criteria are made all the time, and therefore this 1304 specification gives a framework for using those estimates in choosing 1305 algorithms. 1307 If a sending agent is sending the same message using different 1308 strengths of cryptography, an attacker watching the communications 1309 channel might be able to determine the contents of the strongly- 1310 encrypted message by decrypting the weakly-encrypted version. In other 1311 words, a sender SHOULD NOT send a copy of a message using weaker 1312 cryptography than they would use for the original of the message. 1314 Modification of the ciphertext can go undetected if authentication is 1315 not also used, which is the case when sending EnvelopedData without 1316 wrapping it in SignedData or enclosing SignedData within it. 1318 See RFC 3218 [MMA] for more information about thwarting the adaptive 1319 chosen ciphertext vulnerability in PKCS #1 Version 1.5 1320 implementations. 1322 In some circumstances the use of the Diffie-Hellman key agreement 1323 scheme in a prime order subgroup of a large prime p is vulnerable to 1324 certain attacks known as "small-subgroup" attacks. Methods exist, 1325 however, to prevent these attacks. These methods are described in RFC 1326 2785 [DHSUB]. 1328 A. ASN.1 Module 1330 SecureMimeMessageV3dot1 1331 { iso(1) member-body(2) us(840) rsadsi(113549) 1332 pkcs(1) pkcs-9(9) smime(16) modules(0) msg-v3dot1(21) } 1334 DEFINITIONS IMPLICIT TAGS ::= 1335 BEGIN 1337 IMPORTS 1338 -- Cryptographic Message Syntax 1339 SubjectKeyIdentifier, IssuerAndSerialNumber, 1340 RecipientKeyIdentifier 1341 FROM CryptographicMessageSyntax 1342 { iso(1) member-body(2) us(840) rsadsi(113549) 1343 pkcs(1) pkcs-9(9) smime(16) modules(0) cms-2001(14) }; 1345 -- id-aa is the arc with all new authenticated and unauthenticated 1346 -- attributes produced the by S/MIME Working Group 1348 id-aa OBJECT IDENTIFIER ::= {iso(1) member-body(2) usa(840) 1349 rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) attributes(2)} 1351 -- S/MIME Capabilities provides a method of broadcasting the symetric 1352 -- capabilities understood. Algorithms SHOULD be ordered by 1353 -- preference and grouped by type 1355 smimeCapabilities OBJECT IDENTIFIER ::= 1356 {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) 15} 1358 SMIMECapability ::= SEQUENCE { 1359 capabilityID OBJECT IDENTIFIER, 1360 parameters ANY DEFINED BY capabilityID OPTIONAL } 1362 SMIMECapabilities ::= SEQUENCE OF SMIMECapability 1364 -- Encryption Key Preference provides a method of broadcasting the 1365 -- preferred encryption certificate. 1367 id-aa-encrypKeyPref OBJECT IDENTIFIER ::= {id-aa 11} 1369 SMIMEEncryptionKeyPreference ::= CHOICE { 1370 issuerAndSerialNumber [0] IssuerAndSerialNumber, 1371 receipentKeyId [1] RecipientKeyIdentifier, 1372 subjectAltKeyIdentifier [2] SubjectKeyIdentifier 1373 } 1375 id-smime OBJECT IDENTIFIER ::= { iso(1) member-body(2) 1376 us(840) rsadsi(113549) pkcs(1) pkcs9(9) 16 } 1378 id-cap OBJECT IDENTIFIER ::= { id-smime 11 } 1380 -- The preferBinaryInside indicates an ability to receive messages 1381 -- with binary encoding inside the CMS wrapper 1383 id-cap-preferBinaryInside OBJECT IDENTIFIER ::= { id-cap 1 } 1385 -- The following list the OIDs to be used with S/MIME V3 1387 -- Signature Algorithms Not Found in [CMSALG] 1388 -- 1389 -- md2WithRSAEncryption OBJECT IDENTIFIER ::= 1390 -- {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1) 1391 -- 2} 1392 -- 1393 -- Other Signed Attributes 1394 -- 1395 -- signingTime OBJECT IDENTIFIER ::= 1396 -- {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) 1397 -- 5} 1398 -- See [CMS] for a description of how to encode the attribute 1399 -- value. 1401 SMIMECapabilitiesParametersForRC2CBC ::= INTEGER 1402 -- (RC2 Key Length (number of bits)) 1404 END 1406 B. Normative References 1408 [CERT31] "S/MIME Version 3.1 Certificate Handling", Internet Draft 1409 draft-ietf-smime-rfc2632bis 1411 [CHARSETS] Character sets assigned by IANA. See . 1414 [CMS] "Cryptographic Message Syntax", RFC 3369 1416 [CMSAES] "Use of the AES Encryption Algorithm in CMS", 1417 RFC 3565 1419 [CMSALG] "Cryptographic Message Syntax (CMS) Algorithms", RFC 3370 1421 [CMSCOMPR] "Compressed Data Content Type for Cryptographic Message 1422 Syntax (CMS)", RFC 3274 1424 [CONTDISP] "Communicating Presentation Information in Internet 1425 Messages: The Content-Disposition Header Field", RFC 2183 1427 [ESS] "Enhanced Security Services for S/MIME", RFC 2634 1429 [FIPS180-2] "Secure Hash Signature Standard (SHS)", National Institute 1430 of Standards and Technology (NIST). FIPS Publication 180-2 1432 [MIME-SPEC] The primary definition of MIME. "MIME Part 1: Format of 1433 Internet Message Bodies", RFC 2045; "MIME Part 2: Media Types", RFC 1434 2046; "MIME Part 3: Message Header Extensions for Non-ASCII Text", RFC 1435 2047; "MIME Part 4: Registration Procedures", RFC 2048; "MIME Part 5: 1436 Conformance Criteria and Examples", RFC 2049 1438 [MIME-SECURE] "Security Multiparts for MIME: Multipart/Signed and 1439 Multipart/Encrypted", RFC 1847 1441 [MUSTSHOULD] "Key words for use in RFCs to Indicate Requirement 1442 Levels", RFC 2119 1444 [X.208-88] CCITT. Recommendation X.208: Specification of Abstract 1445 Syntax Notation One (ASN.1). 1988. 1447 [X.209-88] CCITT. Recommendation X.209: Specification of Basic 1448 Encoding Rules for Abstract Syntax Notation One (ASN.1). 1988. 1450 [X.509-88] CCITT. Recommendation X.509: The Directory - Authentication 1451 Framework. 1988. 1453 C. Informative References 1455 [DHSUB] "Methods for Avoiding the "Small-Subgroup" Attacks on the 1456 Diffie-Hellman Key Agreement Method for S/MIME", RFC 2785 1458 [MMA] "Preventing the Million Message Attack on CMS", RFC 3218 1460 [PKCS-7] "PKCS #7: Cryptographic Message Syntax Version 1.5", RFC 2315 1462 [RANDOM] "Randomness Recommendations for Security", RFC 1750 1464 [SMIMEV2] "S/MIME Version 2 Message Specification", RFC 2311 1466 D. Acknowledgements 1468 Many thanks go out to the other authors of the S/MIME Version 2 1469 Message Specification RFC: Steve Dusse, Paul Hoffman, Laurence 1470 Lundblade and Lisa Repka. 1472 A number of the members of the S/MIME Working Group have also worked 1473 very hard and contributed to this document. Any list of people is 1474 doomed to omission, and for that I apologize. In alphabetical order, 1475 the following people stand out in my mind due to the fact that they 1476 made direct contributions to this document. 1478 Tony Capel 1479 Piers Chivers 1480 Dave Crocker 1481 Bill Flanigan 1482 Peter Gutmann 1483 Paul Hoffman 1484 Russ Housley 1485 William Ottaway 1486 John Pawling 1487 Jim Schaad 1489 E. Editor's address 1491 Blake Ramsdell 1492 Sendmail, Inc. 1493 704 228th Ave NE #775 1494 Sammamish, WA 98074 1496 blake@sendmail.com