Request for Comments: 3851 Sendmail, Inc.
Obsoletes: 2633 July 2004
Category: Standards Track
Secure/Multipurpose Internet Mail Extensions (S/MIME) Version 3.1
Message Specification
Status of this Memo
This document specifies an Internet standards track protocol for the
Internet community, and requests discussion and suggestions for
improvements. Please refer to the current edition of the "Internet
Official Protocol Standards" (STD 1) for the standardization state
and status of this protocol. Distribution of this memo is unlimited.
Copyright Notice
Copyright (C) The Internet Society (2004).
Abstract
This document defines Secure/Multipurpose Internet Mail Extensions
(S/MIME) version 3.1. S/MIME provides a consistent way to send and
receive secure MIME data. Digital signatures provide authentication,
message integrity, and non-repudiation with proof of origin.
Encryption provides data confidentiality. Compression can be used to
reduce data size. This document obsoletes RFC 2633.
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1. Specification Overview . . . . . . . . . . . . . . . . . 3
1.2. Terminology. . . . . . . . . . . . . . . . . . . . . . . 3
1.3. Definitions. . . . . . . . . . . . . . . . . . . . . . . 4
1.4. Compatibility with Prior Practice of S/MIME. . . . . . . 5
1.5. Changes Since S/MIME v3. . . . . . . . . . . . . . . . . 5
2. CMS Options. . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1. DigestAlgorithmIdentifier. . . . . . . . . . . . . . . . 5
2.2. SignatureAlgorithmIdentifier . . . . . . . . . . . . . . 6
2.3. KeyEncryptionAlgorithmIdentifier . . . . . . . . . . . . 6
2.4. General Syntax . . . . . . . . . . . . . . . . . . . . . 6
2.5. Attributes and the SignerInfo Type . . . . . . . . . . . 7
2.6. SignerIdentifier SignerInfo Type . . . . . . . . . . . . 11
2.7. ContentEncryptionAlgorithmIdentifier . . . . . . . . . . 12
3. Creating S/MIME Messages . . . . . . . . . . . . . . . . . . . 14
3.1. Preparing the MIME Entity for Signing, Enveloping
or Compressing . . . . . . . . . . . . . . . . . . . . . 14
3.2. The application/pkcs7-mime Type. . . . . . . . . . . . . 19
3.3. Creating an Enveloped-only Message . . . . . . . . . . . 21
3.4. Creating a Signed-only Message . . . . . . . . . . . . . 22
3.5. Creating an Compressed-only Message. . . . . . . . . . . 26
3.6. Multiple Operations. . . . . . . . . . . . . . . . . . . 27
3.7. Creating a Certificate Management Messagetoc . . . . . . 27
3.8. Registration Requests. . . . . . . . . . . . . . . . . . 28
3.9. Identifying an S/MIME Message. . . . . . . . . . . . . . 28
4. Certificate Processing . . . . . . . . . . . . . . . . . . . . 29
4.1. Key Pair Generation. . . . . . . . . . . . . . . . . . . 29
5. Security Considerations. . . . . . . . . . . . . . . . . . . . 29
A. ASN.1 Module . . . . . . . . . . . . . . . . . . . . . . . . . 31
B. References . . . . . . . . . . . . . . . . . . . . . . . . . . 32
B.1. Normative References . . . . . . . . . . . . . . . . . . 32
B.2. Informative References . . . . . . . . . . . . . . . . . 34
C. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 35
D. Editor’s Address . . . . . . . . . . . . . . . . . . . . . . . 35
Full Copyright Statement . . . . . . . . . . . . . . . . . . . 36
1. Introduction
S/MIME (Secure/Multipurpose Internet Mail Extensions) provides a
consistent way to send and receive secure MIME data. Based on the
popular Internet MIME standard, S/MIME provides the following
cryptographic security services for electronic messaging
applications: authentication, message integrity and non-repudiation
of origin (using digital signatures), and data confidentiality (using
encryption).
S/MIME can be used by traditional mail user agents (MUAs) to add
cryptographic security services to mail that is sent, and to
interpret cryptographic security services in mail that is received.
However, S/MIME is not restricted to mail; it can be used with any
transport mechanism that transports MIME data, such as HTTP. As
such, S/MIME takes advantage of the object-based features of MIME and
allows secure messages to be exchanged in mixed-transport systems.
Further, S/MIME can be used in automated message transfer agents that
use cryptographic security services that do not require any human
intervention, such as the signing of software-generated documents and
the encryption of FAX messages sent over the Internet.
1.1. Specification Overview
This document describes a protocol for adding cryptographic signature
and encryption services to MIME data. The MIME standard [MIME-SPEC]
provides a general structure for the content type of Internet
messages and allows extensions for new content type applications.
This specification defines how to create a MIME body part that has
been cryptographically enhanced according to CMS [CMS], which is
derived from PKCS #7 [PKCS-7]. This specification also defines the
application/pkcs7-mime MIME type that can be used to transport those
body parts.
This document also discusses how to use the multipart/signed MIME
type defined in [MIME-SECURE] to transport S/MIME signed messages.
multipart/signed is used in conjunction with the application/pkcs7-
signature MIME type, which is used to transport a detached S/MIME
signature.
In order to create S/MIME messages, an S/MIME agent MUST follow the
specifications in this document, as well as the specifications listed
in the Cryptographic Message Syntax document [CMS] [CMSALG].
Throughout this specification, there are requirements and
recommendations made for how receiving agents handle incoming
messages. There are separate requirements and recommendations for
how sending agents create outgoing messages. In general, the best
strategy is to "be liberal in what you receive and conservative in
what you send". Most of the requirements are placed on the handling
of incoming messages while the recommendations are mostly on the
creation of outgoing messages.
The separation for requirements on receiving agents and sending
agents also derives from the likelihood that there will be S/MIME
systems that involve software other than traditional Internet mail
clients. S/MIME can be used with any system that transports MIME
data. An automated process that sends an encrypted message might not
be able to receive an encrypted message at all, for example. Thus,
the requirements and recommendations for the two types of agents are
listed separately when appropriate.
1.2. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in [MUSTSHOULD].
1.3. Definitions
For the purposes of this specification, the following definitions
apply.
ASN.1: Abstract Syntax Notation One, as defined in CCITT X.208
[X.208-88].
BER: Basic Encoding Rules for ASN.1, as defined in CCITT X.209
[X.209-88].
Certificate: A type that binds an entity’s name to a public key with
a digital signature.
DER: Distinguished Encoding Rules for ASN.1, as defined in CCITT
X.509 [X.509-88].
7-bit data: Text data with lines less than 998 characters long, where
none of the characters have the 8th bit set, and there are no NULL
characters. <CR> and <LF> occur only as part of a <CR><LF> end of
line delimiter.
8-bit data: Text data with lines less than 998 characters, and where
none of the characters are NULL characters. <CR> and <LF> occur only
as part of a <CR><LF> end of line delimiter.
Binary data: Arbitrary data.
Transfer Encoding: A reversible transformation made on data so 8-bit
or binary data can be sent via a channel that only transmits 7-bit
data.
Receiving agent: Software that interprets and processes S/MIME CMS
objects, MIME body parts that contain CMS content types, or both.
Sending agent: Software that creates S/MIME CMS content types, MIME
body parts that contain CMS content types, or both.
S/MIME agent: User software that is a receiving agent, a sending
agent, or both.
1.4. Compatibility with Prior Practice of S/MIME
S/MIME version 3.1 agents SHOULD attempt to have the greatest
interoperability possible with agents for prior versions of S/MIME.
S/MIME version 2 is described in RFC 2311 through RFC 2315, inclusive
and S/MIME version 3 is described in RFC 2630 through RFC 2634
inclusive. RFC 2311 also has historical information about the
development of S/MIME.
1.5. Changes Since S/MIME v3
The RSA public key algorithm was changed to a MUST implement key
wrapping algorithm, and the Diffie-Hellman algorithm changed to a
SHOULD implement.
The AES symmetric encryption algorithm has been included as a SHOULD
implement.
The RSA public key algorithm was changed to a MUST implement
signature algorithm.
Ambiguous language about the use of "empty" SignedData messages to
transmit certificates was clarified to reflect that transmission of
certificate revocation lists is also allowed.
The use of binary encoding for some MIME entities is now explicitly
discussed.
Header protection through the use of the message/rfc822 MIME type has
been added.
Use of the CompressedData CMS type is allowed, along with required
MIME type and file extension additions.
2. CMS Options
CMS allows for a wide variety of options in content and algorithm
support. This section puts forth a number of support requirements
and recommendations in order to achieve a base level of
interoperability among all S/MIME implementations. [CMSALG] provides
additional details regarding the use of the cryptographic algorithms.
2.1. DigestAlgorithmIdentifier
Sending and receiving agents MUST support SHA-1 [CMSALG]. Receiving
agents SHOULD support MD5 [CMSALG] for the purpose of providing
backward compatibility with MD5-digested S/MIME v2 SignedData
objects.
2.2. SignatureAlgorithmIdentifier
Receiving agents MUST support id-dsa-with-sha1 defined in [CMSALG].
The algorithm parameters MUST be absent (not encoded as NULL).
Receiving agents MUST support rsaEncryption, defined in [CMSALG].
Sending agents MUST support either id-dsa-with-sha1 or rsaEncryption.
If using rsaEncryption, sending and receiving agents MUST support the
digest algorithms in section 2.1 as specified.
Note that S/MIME v3 clients might only implement signing or signature
verification using id-dsa-with-sha1, and might also use id-dsa as an
AlgorithmIdentifier in this field. Receiving clients SHOULD
recognize id-dsa as equivalent to id-dsa-with-sha1, and sending
clients MUST use id-dsa-with-sha1 if using that algorithm. Also note
that S/MIME v2 clients are only required to verify digital signatures
using the rsaEncryption algorithm with SHA-1 or MD5, and might not
implement id-dsa-with-sha1 or id-dsa at all.
2.3. KeyEncryptionAlgorithmIdentifier
Sending and receiving agents MUST support rsaEncryption, defined in
[CMSALG].
Sending and receiving agents SHOULD support Diffie-Hellman defined in
[CMSALG], using the ephemeral-static mode.
Note that S/MIME v3 clients might only implement key encryption and
decryption using the Diffie-Hellman algorithm. Also note that S/MIME
v2 clients are only capable of decrypting content-encryption keys
using the rsaEncryption algorithm.
2.4. General Syntax
There are several CMS content types. Of these, only the Data,
SignedData, EnvelopedData, and CompressedData content types are
currently used for S/MIME.
2.4.1. Data Content Type
Sending agents MUST use the id-data content type identifier to
identify the "inner" MIME message content. For example, when
applying a digital signature to MIME data, the CMS SignedData
encapContentInfo eContentType MUST include the id-data object
identifier and the MIME content MUST be stored in the SignedData
encapContentInfo eContent OCTET STRING (unless the sending agent is
using multipart/signed, in which case the eContent is absent, per
section 3.4.3 of this document). As another example, when applying
encryption to MIME data, the CMS EnvelopedData encryptedContentInfo
contentType MUST include the id-data object identifier and the
encrypted MIME content MUST be stored in the EnvelopedData
encryptedContentInfo encryptedContent OCTET STRING.
2.4.2. SignedData Content Type
Sending agents MUST use the SignedData content type to apply a
digital signature to a message or, in a degenerate case where there
is no signature information, to convey certificates. Applying a
signature to a message provides authentication, message integrity,
and non-repudiation of origin.
2.4.3. EnvelopedData Content Type
This content type is used to apply data confidentiality to a message.
A sender needs to have access to a public key for each intended
message recipient to use this service.
2.4.4. CompressedData Content Type
This content type is used to apply data compression to a message.
This content type does not provide authentication, message integrity,
non-repudiation, or data confidentiality, and is only used to reduce
message size.
See section 3.6 for further guidance on the use of this type in
conjunction with other CMS types.
2.5. Attributes and the SignerInfo Type
The SignerInfo type allows the inclusion of unsigned and signed
attributes to be included along with a signature.
Receiving agents MUST be able to handle zero or one instance of each
of the signed attributes listed here. Sending agents SHOULD generate
one instance of each of the following signed attributes in each
S/MIME message:
- signingTime (section 2.5.1 in this document)
- sMIMECapabilities (section 2.5.2 in this document)
- sMIMEEncryptionKeyPreference (section 2.5.3 in this document)
- id-messageDigest (section 11.2 in [CMS])
- id-contentType (section 11.1 in [CMS])
Further, receiving agents SHOULD be able to handle zero or one
instance in the signingCertificate signed attribute, as defined in
section 5 of [ESS].
Sending agents SHOULD generate one instance of the signingCertificate
signed attribute in each SignerInfo structure.
Additional attributes and values for these attributes might be
defined in the future. Receiving agents SHOULD handle attributes or
values that it does not recognize in a graceful manner.
Interactive sending agents that include signed attributes that are
not listed here SHOULD display those attributes to the user, so that
the user is aware of all of the data being signed.
2.5.1. Signing-Time Attribute
The signing-time attribute is used to convey the time that a message
was signed. The time of signing will most likely be created by a
message originator and therefore is only as trustworthy as the
originator.
Sending agents MUST encode signing time through the year 2049 as
UTCTime; signing times in 2050 or later MUST be encoded as
GeneralizedTime. When the UTCTime CHOICE is used, S/MIME agents MUST
interpret the year field (YY) as follows:
if YY is greater than or equal to 50, the year is interpreted as
19YY; if YY is less than 50, the year is interpreted as 20YY.
2.5.2. SMIMECapabilities Attribute
The SMIMECapabilities attribute includes signature algorithms (such
as "sha1WithRSAEncryption"), symmetric algorithms (such as "DES-
EDE3-CBC"), and key encipherment algorithms (such as
"rsaEncryption"). There are also several identifiers which indicate
support for other optional features such as binary encoding and
compression. The SMIMECapabilities were designed to be flexible and
extensible so that, in the future, a means of identifying other
capabilities and preferences such as certificates can be added in a
way that will not cause current clients to break.
If present, the SMIMECapabilities attribute MUST be a
SignedAttribute; it MUST NOT be an UnsignedAttribute. CMS defines
SignedAttributes as a SET OF Attribute. The SignedAttributes in a
signerInfo MUST NOT include multiple instances of the
SMIMECapabilities attribute. CMS defines the ASN.1 syntax for
Attribute to include attrValues SET OF AttributeValue. A
SMIMECapabilities attribute MUST only include a single instance of
AttributeValue. There MUST NOT be zero or multiple instances of
AttributeValue present in the attrValues SET OF AttributeValue.
The semantics of the SMIMECapabilities attribute specify a partial
list as to what the client announcing the SMIMECapabilities can
support. A client does not have to list every capability it
supports, and need not list all its capabilities so that the
capabilities list doesn’t get too long. In an SMIMECapabilities
attribute, the object identifiers (OIDs) are listed in order of their
preference, but SHOULD be separated logically along the lines of
their categories (signature algorithms, symmetric algorithms, key
encipherment algorithms, etc.)
The structure of the SMIMECapabilities attribute is to facilitate
simple table lookups and binary comparisons in order to determine
matches. For instance, the DER-encoding for the SMIMECapability for
DES EDE3 CBC MUST be identically encoded regardless of the
implementation. Because of the requirement for identical encoding,
individuals documenting algorithms to be used in the
SMIMECapabilities attribute SHOULD explicitly document the correct
byte sequence for the common cases.
For any capability, the associated parameters for the OID MUST
specify all of the parameters necessary to differentiate between two
instances of the same algorithm. For instance, the number of rounds
and the block size for RC5 needs to be specified in addition to the
key length.
The OIDs that correspond to algorithms SHOULD use the same OID as the
actual algorithm, except in the case where the algorithm usage is
ambiguous from the OID. For instance, in an earlier specification,
rsaEncryption was ambiguous because it could refer to either a
signature algorithm or a key encipherment algorithm. In the event
that an OID is ambiguous, it needs to be arbitrated by the maintainer
of the registered SMIMECapabilities list as to which type of
algorithm will use the OID, and a new OID MUST be allocated under the
smimeCapabilities OID to satisfy the other use of the OID.
The registered SMIMECapabilities list specifies the parameters for
OIDs that need them, most notably key lengths in the case of
variable-length symmetric ciphers. In the event that there are no
differentiating parameters for a particular OID, the parameters MUST
be omitted, and MUST NOT be encoded as NULL.
Additional values for the SMIMECapabilities attribute might be
defined in the future. Receiving agents MUST handle a
SMIMECapabilities object that has values that it does not recognize
in a graceful manner.
Section 2.7.1 explains a strategy for caching capabilities.
2.5.2.1. SMIMECapability For the RC2 Algorithm
For the RC2 algorithm preference SMIMECapability, the capabilityID
MUST be set to the value rc2-cbc as defined in [CMSALG]. The
parameters field MUST contain SMIMECapabilitiesParametersForRC2CBC
(see appendix A).
Please note that the SMIMECapabilitiesParametersForRC2CBC is a single
INTEGER which contains the effective key length (NOT the
corresponding RC2 parameter version value). So, for example, for RC2
with a 128-bit effective key length, the parameter would be encoded
as the INTEGER value 128, NOT the corresponding parameter version of
58.
2.5.3. Encryption Key Preference Attribute
The encryption key preference attribute allows the signer to
unambiguously describe which of the signer’s certificates has the
signer’s preferred encryption key. This attribute is designed to
enhance behavior for interoperating with those clients that use
separate keys for encryption and signing. This attribute is used to
convey to anyone viewing the attribute which of the listed
certificates is appropriate for encrypting a session key for future
encrypted messages.
If present, the SMIMEEncryptionKeyPreference attribute MUST be a
SignedAttribute; it MUST NOT be an UnsignedAttribute. CMS defines
SignedAttributes as a SET OF Attribute. The SignedAttributes in a
signerInfo MUST NOT include multiple instances of the
SMIMEEncryptionKeyPreference attribute. CMS defines the ASN.1 syntax
for Attribute to include attrValues SET OF AttributeValue. A
SMIMEEncryptionKeyPreference attribute MUST only include a single
instance of AttributeValue. There MUST NOT be zero or multiple
instances of AttributeValue present in the attrValues SET OF
AttributeValue.
The sending agent SHOULD include the referenced certificate in the
set of certificates included in the signed message if this attribute
is used. The certificate MAY be omitted if it has been previously
made available to the receiving agent. Sending agents SHOULD use
this attribute if the commonly used or preferred encryption
certificate is not the same as the certificate used to sign the
message.
Receiving agents SHOULD store the preference data if the signature on
the message is valid and the signing time is greater than the
currently stored value. (As with the SMIMECapabilities, the clock
skew SHOULD be checked and the data not used if the skew is too
great.) Receiving agents SHOULD respect the sender’s encryption key
preference attribute if possible. This, however, represents only a
preference and the receiving agent can use any certificate in
replying to the sender that is valid.
Section 2.7.1 explains a strategy for caching preference data.
2.5.3.1. Selection of Recipient Key Management Certificate
In order to determine the key management certificate to be used when
sending a future CMS EnvelopedData message for a particular
recipient, the following steps SHOULD be followed:
- If an SMIMEEncryptionKeyPreference attribute is found in a
SignedData object received from the desired recipient, this
identifies the X.509 certificate that SHOULD be used as the X.509
key management certificate for the recipient.
- If an SMIMEEncryptionKeyPreference attribute is not found in a
SignedData object received from the desired recipient, the set of
X.509 certificates SHOULD be searched for a X.509 certificate with
the same subject name as the signing of a X.509 certificate which
can be used for key management.
- Or use some other method of determining the user’s key management
key. If a X.509 key management certificate is not found, then
encryption cannot be done with the signer of the message. If
multiple X.509 key management certificates are found, the S/MIME
agent can make an arbitrary choice between them.
2.6. SignerIdentifier SignerInfo Type
S/MIME v3.1 implementations MUST support both issuerAndSerialNumber
as well as subjectKeyIdentifier. Messages that use the
subjectKeyIdentifier choice cannot be read by S/MIME v2 clients.
It is important to understand that some certificates use a value for
subjectKeyIdentifier that is not suitable for uniquely identifying a
certificate. Implementations MUST be prepared for multiple
certificates for potentially different entities to have the same
value for subjectKeyIdentifier, and MUST be prepared to try each
matching certificate during signature verification before indicating
an error condition.