As per Relevance of the word receiving, we have this rfc below:
Network Working Group B. Ramsdell,
Request for Comments: 2633
Category: Standards Track June 1999
S/MIME Version 3 Message
Status of this
This document specifies an Internet standards track protocol for
Internet community, and requests discussion and suggestions
improvements. Please refer to the current edition of the "
Official Protocol Standards" (STD 1) for the standardization
and status of this protocol. Distribution of this memo is unlimited
Copyright
Copyright (C) The Internet Society (1999). All Rights Reserved
1.
S/MIME (Secure/Multipurpose Internet Mail Extensions) provides
consistent way to send and receive secure MIME data. Based on
popular Internet MIME standard, S/MIME provides the
cryptographic security services for electronic
applications: authentication, message integrity and non-
of origin (using digital signatures) and privacy and data
(using encryption).
S/MIME can be used by traditional mail user agents (MUAs) to
cryptographic security services to mail that is sent, and
interpret cryptographic security services in mail that is received
However, S/MIME is not restricted to mail; it can be used with
transport mechanism that transports MIME data, such as HTTP. As such
S/MIME takes advantage of the object-based features of MIME
allows secure messages to be exchanged in mixed-transport systems
Further, S/MIME can be used in automated message transfer agents
use cryptographic security services that do not require any
intervention, such as the signing of software-generated documents
the encryption of FAX messages sent over the Internet
1.1 Specification
This document describes a protocol for adding cryptographic
and encryption services to MIME data. The MIME standard [MIME-SPEC
provides a general structure for the content type of
messages and allows extensions for new content type applications
Ramsdell Standards Track [Page 1]
RFC 2633 S/MIME Version 3 Message Specification June 1999
This memo defines how to create a MIME body part that has
cryptographically enhanced according to CMS [CMS], which is
from PKCS #7 [PKCS-7]. This memo also defines the application/pkcs7-
mime MIME type that can be used to transport those body parts
This memo also discusses how to use the multipart/signed MIME
defined in [MIME-SECURE] to transport S/MIME signed messages.
memo also defines the application/pkcs7-signature MIME type, which
also used to transport S/MIME signed messages
In order to create S/MIME messages, an S/MIME agent has to
specifications in this memo, as well as the specifications listed
the Cryptographic Message Syntax [CMS].
Throughout this memo, there are requirements and recommendations
for how receiving agents handle incoming messages. There are
requirements and recommendations for how sending agents
outgoing messages. In general, the best strategy is to "be liberal
what you receive and conservative in what you send". Most of
requirements are placed on the handling of incoming messages
the recommendations are mostly on the creation of outgoing messages
The separation for requirements on receiving agents and
agents also derives from the likelihood that there will be S/
systems that involve software other than traditional Internet
clients. S/MIME can be used with any system that transports
data. An automated process that sends an encrypted message might
be able to receive an encrypted message at all, for example. Thus
the requirements and recommendations for the two types of agents
listed separately when appropriate
1.2
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in
document are to be interpreted as described in [MUSTSHOULD].
1.3
For the purposes of this memo, the following definitions apply
ASN.1: Abstract Syntax Notation One, as defined in CCITT X.208.
BER: Basic Encoding Rules for ASN.1, as defined in CCITT X.209.
Certificate: A type that binds an entity's distinguished name to
public key with a digital signature
Ramsdell Standards Track [Page 2]
RFC 2633 S/MIME Version 3 Message Specification June 1999
DER: Distinguished Encoding Rules for ASN.1, as defined in
X.509.
7-bit data: Text data with lines less than 998 characters long,
none of the characters have the 8th bit set, and there are no
characters. and occur only as part of a end
line delimiter
8-bit data: Text data with lines less than 998 characters, and
none of the characters are NULL characters. and occur
as part of a end of line delimiter
Binary data: Arbitrary data
Transfer Encoding: A reversible transformation made on data so 8-
or binary data may be sent via a channel that only transmits 7-
data
Receiving agent: software that interprets and processes S/MIME
objects, MIME body parts that contain CMS objects, or both
Sending agent: software that creates S/MIME CMS objects, MIME
parts that contain CMS objects, or both
S/MIME agent: user software that is a receiving agent, a
agent, or both
1.4 Compatibility with Prior Practice of S/
S/MIME version 3 agents should attempt to have the
interoperability possible with S/MIME version 2 agents. S/
version 2 is described in RFC 2311 through RFC 2315, inclusive.
2311 also has historical information about the development of S/MIME
2. CMS
CMS allows for a wide variety of options in content and
support. This section puts forth a number of support requirements
recommendations in order to achieve a base level of
among all S/MIME implementations. [CMS] provides additional
regarding the use of the cryptographic algorithms
2.1
Sending and receiving agents MUST support SHA-1 [SHA1].
agents SHOULD support MD5 [MD5] for the purpose of providing
compatibility with MD5-digested S/MIME v2 SignedData objects
Ramsdell Standards Track [Page 3]
RFC 2633 S/MIME Version 3 Message Specification June 1999
2.2
Sending and receiving agents MUST support id-dsa defined in [DSS].
The algorithm parameters MUST be absent (not encoded as NULL).
Receiving agents SHOULD support rsaEncryption, defined in [PKCS-1].
Sending agents SHOULD support rsaEncryption. Outgoing messages
signed with a user's private key. The size of the private key
determined during key generation
Note that S/MIME v2 clients are only capable of verifying
signatures using the rsaEncryption algorithm
2.3
Sending and receiving agents MUST support Diffie-Hellman defined
[DH].
Receiving agents SHOULD support rsaEncryption. Incoming
messages contain symmetric keys which are to be decrypted with
user's private key. The size of the private key is determined
key generation
Sending agents SHOULD support rsaEncryption
Note that S/MIME v2 clients are only capable of decrypting
encryption keys using the rsaEncryption algorithm
2.4 General
CMS defines multiple content types. Of these, only the Data
SignedData, and EnvelopedData content types are currently used
S/MIME
2.4.1 Data Content
Sending agents MUST use the id-data content type identifier
indicate the message content which has had security services
to it. For example, when applying a digital signature to MIME data
the CMS signedData encapContentInfo eContentType MUST include
id-data object identifier and the MIME content MUST be stored in
SignedData encapContentInfo eContent OCTET STRING (unless the
agent is using multipart/signed, in which case the eContent
absent, per section 3.4.3 of this document). As another example
when applying encryption to MIME data, the CMS
Ramsdell Standards Track [Page 4]
RFC 2633 S/MIME Version 3 Message Specification June 1999
encryptedContentInfo ContentType MUST include the id-data
identifier and the encrypted MIME content MUST be stored in
envelopedData encryptedContentInfo encryptedContent OCTET STRING
2.4.2 SignedData Content
Sending agents MUST use the signedData content type to apply
digital signature to a message or, in a degenerate case where
is no signature information, to convey certificates
2.4.3 EnvelopedData Content
This content type is used to apply privacy protection to a message.
sender needs to have access to a public key for each intended
recipient to use this service. This content type does not
authentication
2.5 Attribute SignerInfo
The SignerInfo type allows the inclusion of unsigned and
attributes to be included along with a signature
Receiving agents MUST be able to handle zero or one instance of
of the signed attributes listed here. Sending agents SHOULD
one instance of each of the following signed attributes in
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
Further, receiving agents SHOULD be able to handle zero or
instance in the signed attributes of the signingCertificate
(section 5 in [ESS]).
Sending agents SHOULD generate one instance of the
signed attribute in each S/MIME message
Additional attributes and values for these attributes may be
in the future. Receiving agents SHOULD handle attributes or
that it does not recognize in a graceful manner
Sending agents that include signed attributes that are not
here SHOULD display those attributes to the user, so that the user
aware of all of the data being signed
Ramsdell Standards Track [Page 5]
RFC 2633 S/MIME Version 3 Message Specification June 1999
2.5.1 Signing-Time
The signing-time attribute is used to convey the time that a
was signed. Until there are trusted timestamping services, the
of signing will most likely be created by a message originator
therefore is only as trustworthy as the originator
Sending agents MUST encode signing time through the year 2049
UTCTime; signing times in 2050 or later MUST be encoded
GeneralizedTime. When the UTCTime CHOICE is used, S/MIME agents
interpret the year field (YY) as follows
if YY is greater than or equal to 50, the year is interpreted
19YY; if YY is less than 50, the year is interpreted as 20YY
2.5.2 SMIMECapabilities
The SMIMECapabilities attribute includes signature algorithms (
as "sha1WithRSAEncryption"), symmetric algorithms (such as "DES
EDE3-CBC"), and key encipherment algorithms (such
"rsaEncryption"). It also includes a non-algorithm capability
is the preference for signedData. The SMIMECapabilities were
to be flexible and extensible so that, in the future, a means
identifying other capabilities and preferences such as
can be added in a way that will not cause current clients to break
If present, the SMIMECapabilities attribute MUST be
SignedAttribute; it MUST NOT be an UnsignedAttribute. CMS
SignedAttributes as a SET OF Attribute. The SignedAttributes in
signerInfo MUST NOT include multiple instances of
SMIMECapabilities attribute. CMS defines the ASN.1 syntax
Attribute to include attrValues SET OF AttributeValue.
SMIMECapabilities attribute MUST only include a single instance
AttributeValue. There MUST NOT be zero or multiple instances
AttributeValue present in the attrValues SET OF AttributeValue
The semantics of the SMIMECapabilites attribute specify a
list as to what the client announcing the SMIMECapabilites
support. A client does not have to list every capability it supports
and probably should not list all its capabilities so that
capabilities list doesn't get too long. In an
attribute, the OIDs are listed in order of their preference,
SHOULD be logically separated along the lines of their
(signature algorithms, symmetric algorithms, key
algorithms, etc.)
Ramsdell Standards Track [Page 6]
RFC 2633 S/MIME Version 3 Message Specification June 1999
The structure of the SMIMECapabilities attribute is to
simple table lookups and binary comparisons in order to
matches. For instance, the DER-encoding for the SMIMECapability
DES EDE3 CBC MUST be identically encoded regardless of
implementation
In the case of symmetric algorithms, the associated parameters
the OID MUST specify all of the parameters necessary to
between two instances of the same algorithm. For instance, the
of rounds and block size for RC5 must be specified in addition to
key length
There is a list of OIDs (OIDs Used with S/MIME) that is
maintained and is separate from this memo. The list of OIDs
maintained by the Internet Mail Consortium
. Note that all
associated with the MUST and SHOULD implement algorithms are
in section A of this document
The OIDs that correspond to algorithms SHOULD use the same OID as
actual algorithm, except in the case where the algorithm usage
ambiguous from the OID. For instance, in an earlier draft
rsaEncryption was ambiguous because it could refer to either
signature algorithm or a key encipherment algorithm. In the
that an OID is ambiguous, it needs to be arbitrated by the
of the registered SMIMECapabilities list as to which type
algorithm will use the OID, and a new OID MUST be allocated under
smimeCapabilities OID to satisfy the other use of the OID
The registered SMIMECapabilities list specifies the parameters
OIDs that need them, most notably key lengths in the case
variable-length symmetric ciphers. In the event that there are
differentiating parameters for a particular OID, the parameters
be omitted, and MUST NOT be encoded as NULL
Additional values for the SMIMECapabilities attribute may be
in the future. Receiving agents MUST handle a
object that has values that it does not recognize in a
manner
2.5.3 Encryption Key Preference
The encryption key preference attribute allows the signer
unambiguously describe which of the signer's certificates has
signer's preferred encryption key. This attribute is designed
enhance behavior for interoperating with those clients which
separate keys for encryption and signing. This attribute is used
Ramsdell Standards Track [Page 7]
RFC 2633 S/MIME Version 3 Message Specification June 1999
convey to anyone viewing the attribute which of the
certificates should be used for encrypting a session key for
encrypted messages
If present, the SMIMEEncryptionKeyPreference attribute MUST be
SignedAttribute; it MUST NOT be an UnsignedAttribute. CMS
SignedAttributes as a SET OF Attribute. The SignedAttributes in
signerInfo MUST NOT include multiple instances of
SMIMEEncryptionKeyPreference attribute. CMS defines the ASN.1
for Attribute to include attrValues SET OF AttributeValue.
SMIMEEncryptionKeyPreference attribute MUST only include a
instance of AttributeValue. There MUST NOT be zero or
instances of AttributeValue present in the attrValues SET
AttributeValue
The sending agent SHOULD include the referenced certificate in
set of certificates included in the signed message if this
is used. The certificate may be omitted if it has been
made available to the receiving agent. Sending agents SHOULD
this attribute if the commonly used or preferred
certificate is not the same as the certificate used to sign
message
Receiving agents SHOULD store the preference data if the signature
the message is valid and the signing time is greater than
currently stored value. (As with the SMIMECapabilities, the
skew should be checked and the data not used if the skew is
great.) Receiving agents SHOULD respect the sender's encryption
preference attribute if possible. This however represents only
preference and the receiving agent may use any certificate
replying to the sender that is valid
2.5.3.1 Selection of Recipient Key Management
In order to determine the key management certificate to be used
sending a future CMS envelopedData message for a
recipient, the following steps SHOULD be followed
- If an SMIMEEncryptionKeyPreference attribute is found in
signedData object received from the desired recipient,
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
signedData object received from the desired recipient, the set
X.509 certificates should be searched for a X.509 certificate
the same subject name as the signing X.509 certificate which
be used for key management
Ramsdell Standards Track [Page 8]
RFC 2633 S/MIME Version 3 Message Specification June 1999
- Or use some other method of determining the user's key
key. If a X.509 key management certificate is not found,
encryption cannot be done with the signer of the message. If
X.509 key management certificates are found, the S/MIME agent
make an arbitrary choice between them
2.6 SignerIdentifier SignerInfo
S/MIME v3 requires the use of SignerInfo version 1, that is
issuerAndSerialNumber CHOICE MUST be used for SignerIdentifier
2.7
Sending and receiving agents MUST support encryption and
with DES EDE3 CBC, hereinafter called "tripleDES" [3DES] [DES].
Receiving agents SHOULD support encryption and decryption using
RC2 [RC2] or a compatible algorithm at a key size of 40 bits
hereinafter called "RC2/40".
2.7.1 Deciding Which Encryption Method To
When a sending agent creates an encrypted message, it has to
which type of encryption to use. The decision process involves
information garnered from the capabilities lists included in
received from the recipient, as well as out-of-band information
as private agreements, user preferences, legal restrictions, and
on
Section 2.5 defines a method by which a sending agent can
announce, among other things, its decrypting capabilities in
order of preference. The following method for processing
remembering the encryption capabilities attribute in incoming
messages SHOULD be used
- If the receiving agent has not yet created a list of
for the sender's public key, then, after verifying the
on the incoming message and checking the timestamp, the
agent SHOULD create a new list containing at least the
time and the symmetric capabilities
- If such a list already exists, the receiving agent SHOULD
that the signing time in the incoming message is greater
the signing time stored in the list and that the signature
valid. If so, the receiving agent SHOULD update both the
time and capabilities in the list. Values of the signing time
lie far in the future (that is, a greater discrepancy than
reasonable clock skew), or a capabilities list in messages
signature could not be verified, MUST NOT be accepted
Ramsdell Standards Track [Page 9]
RFC 2633 S/MIME Version 3 Message Specification June 1999
The list of capabilities SHOULD be stored for future use in
messages
Before sending a message, the sending agent MUST decide whether it
willing to use weak encryption for the particular data in
message. If the sending agent decides that weak encryption
unacceptable for this data, then the sending agent MUST NOT use
weak algorithm such as RC2/40. The decision to use or not use
encryption overrides any other decision in this section about
encryption algorithm to use
Sections 2.7.2.1 through 2.7.2.4 describe the decisions a
agent SHOULD use in deciding which type of encryption should
applied to a message. These rules are ordered, so the sending
SHOULD make its decision in the order given
2.7.1.1 Rule 1: Known
If the sending agent has received a set of capabilities from
recipient for the message the agent is about to encrypt, then
sending agent SHOULD use that information by selecting the
capability in the list (that is, the capability most preferred by
intended recipient) for which the sending agent knows how to encrypt
The sending agent SHOULD use one of the capabilities in the list
the agent reasonably expects the recipient to be able to decrypt
message
2.7.1.2 Rule 2: Unknown Capabilities, Known Use of
If
- the sending agent has no knowledge of the encryption
of the recipient
- and the sending agent has received at least one message from
recipient
- and the last encrypted message received from the recipient had
trusted signature on it
then the outgoing message SHOULD use the same encryption algorithm
was used on the last signed and encrypted message received from
recipient
Ramsdell Standards Track [Page 10]
RFC 2633 S/MIME Version 3 Message Specification June 1999
2.7.1.3 Rule 3: Unknown Capabilities, Unknown Version of S/
If
- the sending agent has no knowledge of the encryption
of the recipient
- and the sending agent has no knowledge of the version of S/
of the recipient
then the sending agent SHOULD use tripleDES because it is a
algorithm and is required by S/MIME v3. If the sending agent
not to use tripleDES in this step, it SHOULD use RC2/40.
2.7.2 Choosing Weak
Like all algorithms that use 40 bit keys, RC2/40 is considered
many to be weak encryption. A sending agent that is controlled by
human SHOULD allow a human sender to determine the risks of
data using RC2/40 or a similarly weak encryption algorithm
sending the data, and possibly allow the human to use a
encryption method such as tripleDES
2.7.3 Multiple
If a sending agent is composing an encrypted message to a group
recipients where the encryption capabilities of some of
recipients do not overlap, the sending agent is forced to send
than one message. It should be noted that if the sending
chooses to send a message encrypted with a strong algorithm, and
send the same message encrypted with a weak algorithm,
watching the communications channel may be able to learn the
of the strongly-encrypted message simply by decrypting the weakly
encrypted message
3. Creating S/MIME
This section describes the S/MIME message formats and how they
created. S/MIME messages are a combination of MIME bodies and
objects. Several MIME types as well as several CMS objects are used
The data to be secured is always a canonical MIME entity. The
entity and other data, such as certificates and
identifiers, are given to CMS processing facilities which produces
CMS object. The CMS object is then finally wrapped in MIME.
Enhanced Security Services for S/MIME [ESS] document
examples of how nested, secured S/MIME messages are formatted.
provides an example of how a triple-wrapped S/MIME message
formatted using multipart/signed and application/pkcs7-mime for
signatures
Ramsdell Standards Track [Page 11]
RFC 2633 S/MIME Version 3 Message Specification June 1999
S/MIME provides one format for enveloped-only data, several
for signed-only data, and several formats for signed and
data. Several formats are required to accommodate
environments, in particular for signed messages. The criteria
choosing among these formats are also described
The reader of this section is expected to understand MIME
described in [MIME-SPEC] and [MIME-SECURE].
3.1 Preparing the MIME Entity for Signing or
S/MIME is used to secure MIME entities. A MIME entity may be a sub
part, sub-parts of a message, or the whole message with all its sub
parts. A MIME entity that is the whole message includes only the
headers and MIME body, and does not include the RFC-822 headers
Note that S/MIME can also be used to secure MIME entities used
applications other than Internet mail
The MIME entity that is secured and described in this section can
thought of as the "inside" MIME entity. That is, it is
"innermost" object in what is possibly a larger MIME message
Processing "outside" MIME entities into CMS objects is described
Section 3.2, 3.4 and elsewhere
The procedure for preparing a MIME entity is given in [MIME-SPEC].
The same procedure is used here with some additional
when signing. Description of the procedures from [MIME-SPEC]
repeated here, but the reader should refer to that document for
exact procedure. This section also describes additional requirements
A single procedure is used for creating MIME entities that are to
signed, enveloped, or both signed and enveloped. Some
steps are recommended to defend against known corruptions that
occur during mail transport that are of particular importance
clear- signing using the multipart/signed format. It is
that these additional steps be performed on enveloped messages,
signed and enveloped messages in order that the message can
forwarded to any environment without modification
These steps are descriptive rather than prescriptive. The
is free to use any procedure as long as the result is the same
Step 1. The MIME entity is prepared according to the
Step 2. The leaf parts of the MIME entity are converted to
Ramsdell Standards Track [Page 12]
RFC 2633 S/MIME Version 3 Message Specification June 1999
Step 3. Appropriate transfer encoding is applied to the leaves of
MIME
When an S/MIME message is received, the security services on
message are processed, and the result is the MIME entity. That
entity is typically passed to a MIME-capable user agent where, it
further decoded and presented to the user or receiving application
3.1.1
Each MIME entity MUST be converted to a canonical form that
uniquely and unambiguously representable in the environment where
signature is created and the environment where the signature will
verified. MIME entities MUST be canonicalized for enveloping as
as signing
The exact details of canonicalization depend on the actual MIME
and subtype of an entity, and are not described here. Instead,
standard for the particular MIME type should be consulted.
example, canonicalization of type text/plain is different
canonicalization of audio/basic. Other than text types, most
have only one representation regardless of computing platform
environment which can be considered their canonical representation
In general, canonicalization will be performed by the non-
part of the sending agent rather than the S/MIME implementation
The most common and important canonicalization is for text, which
often represented differently in different environments.
entities of major type "text" must have both their line endings
character set canonicalized. The line ending must be the pair
characters , and the charset should be a registered
[CHARSETS]. The details of the canonicalization are specified
[MIME-SPEC]. The chosen charset SHOULD be named in the
parameter so that the receiving agent can unambiguously determine
charset used
Note that some charsets such as ISO-2022 have
representations for the same characters. When preparing such text
signing, the canonical representation specified for the charset
be used
3.1.2 Transfer
When generating any of the secured MIME entities below, except
signing using the multipart/signed format, no transfer encoding
all is required. S/MIME implementations MUST be able to deal
binary MIME objects. If no Content-Transfer-Encoding header
present, the transfer encoding should be considered 7BIT
Ramsdell Standards Track [Page 13]
RFC 2633 S/MIME Version 3 Message Specification June 1999
S/MIME implementations SHOULD however use transfer encoding
in section 3.1.3 for all MIME entities they secure. The reason
securing only 7-bit MIME entities, even for enveloped data that
not exposed to the transport, is that it allows the MIME entity to
handled in any environment without changing it. For example,
trusted gateway might remove the envelope, but not the signature,
a message, and then forward the signed message on to the
recipient so that they can verify the signatures directly. If
transport internal to the site is not 8-bit clean, such as on
wide-area network with a single mail gateway, verifying the
will not be possible unless the original MIME entity was only 7-
data
3.1.3 Transfer Encoding for Signing Using multipart/
If a multipart/signed entity is EVER to be transmitted over
standard Internet SMTP infrastructure or other transport that
constrained to 7-bit text, it MUST have transfer encoding applied
that it is represented as 7-bit text. MIME entities that are 7-
data already need no transfer encoding. Entities such as 8-bit
and binary data can be encoded with quoted-printable or base-64
transfer encoding
The primary reason for the 7-bit requirement is that the
mail transport infrastructure cannot guarantee transport of 8-bit
binary data. Even though many segments of the
infrastructure now handle 8-bit and even binary data, it is
not possible to know whether the transport path is 8-bit clear. If
mail message with 8-bit data were to encounter a message
agent that can not transmit 8-bit or binary data, the agent has
options, none of which are acceptable for a clear-signed message
- The agent could change the transfer encoding; this would
the signature
- The agent could transmit the data anyway, which would most
result in the 8th bit being corrupted; this too would invalidate
signature
- The agent could return the message to the sender
[MIME-SECURE] prohibits an agent from changing the transfer
of the first part of a multipart/signed message. If a compliant
that can not transmit 8-bit or binary data encounters
multipart/signed message with 8-bit or binary data in the first part
it would have to return the message to the sender as undeliverable
Ramsdell Standards Track [Page 14]
RFC 2633 S/MIME Version 3 Message Specification June 1999
3.1.4 Sample Canonical MIME
This example shows a multipart/mixed message with full
encoding. This message contains a text part and an attachment.
sample message text includes characters that are not US-ASCII
thus must be transfer encoded. Though not shown here, the end of
line is . The line ending of the MIME headers, the text,
transfer encoded parts, all must be .
Note that this example is not of an S/MIME message
Content-Type: multipart/mixed; boundary=
--
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-
=A1Hola Michael
How do you like the new S/MIME specification
I agree. It's generally a good idea to encode lines that begin
From=20 because some mail transport agents will insert
greater-than (>) sign, thus invalidating the signature
Also, in some cases it might be desirable to encode any =20
trailing whitespace that occurs on lines in order to ensure =20
that the message signature is not invalidated when passing =20
a gateway that modifies such whitespace (like BITNET). =20
--
Content-Type: image/
Content-Transfer-Encoding: base64
iQCVAwUBMJrRF2N9oWBghPDJAQE9UQQAtl7LuRVndBjrk4EqYBIb3h5QXIX/LC//
jJV5bNvkZIGPIcEmI5iFd9boEgvpirHtIREEqLQRkYNoBActFBZmh9GC3C041
uMbrbxc+nIs1TIKlA08rVi9ig/2Yh7LFrK5Ein57U/W72vgSxLhe/zhdfolT9
HOxEa44b+EI
--bar--
3.2 The application/pkcs7-mime
The application/pkcs7-mime type is used to carry CMS objects
several types including envelopedData and signedData. The details
constructing these entities is described in subsequent sections.
section describes the general characteristics of
application/pkcs7-mime type
Ramsdell Standards Track [Page 15]
RFC 2633 S/MIME Version 3 Message Specification June 1999
The carried CMS object always contains a MIME entity that is
as described in section 3.1 if the eContentType is id-data.
contents may be carried when the eContentType contains
values. See [ESS] for an example of this with signed receipts
Since CMS objects are binary data, in most cases base-64
encoding is appropriate, in particular when used with SMTP transport
The transfer encoding used depends on the transport through which
object is to be sent, and is not a characteristic of the MIME type
Note that this discussion refers to the transfer encoding of the
object or "outside" MIME entity. It is completely distinct from,
unrelated to, the transfer encoding of the MIME entity secured by
CMS object, the "inside" object, which is described in section 3.1.
Because there are several types of application/pkcs7-mime objects,
sending agent SHOULD do as much as possible to help a receiving
know about the contents of the object without forcing the
agent to decode the ASN.1 for the object. The MIME headers of
application/pkcs7-mime objects SHOULD include the optional "smime
type" parameter, as described in the following sections
3.2.1 The name and filename
For the application/pkcs7-mime, sending agents SHOULD emit
optional "name" parameter to the Content-Type field for
with older systems. Sending agents SHOULD also emit the
Content-Disposition field [CONTDISP] with the "filename" parameter
If a sending agent emits the above parameters, the value of
parameters SHOULD be a file name with the appropriate extension
MIME Type File
Application/pkcs7-mime (signedData, .p7
envelopedData
Application/pkcs7-mime (degenerate .p7
signedData "certs-only" message
Application/pkcs7-signature .p7
In addition, the file name SHOULD be limited to eight
followed by a three letter extension. The eight character
base can be any distinct name; the use of the filename base "smime
SHOULD be used to indicate that the MIME entity is associated
S/MIME
Ramsdell Standards Track [Page 16]
RFC 2633 S/MIME Version 3 Message Specification June 1999
Including a file name serves two purposes. It facilitates easier
of S/MIME objects as files on disk. It also can convey
information across gateways. When a MIME entity of
application/pkcs7-mime (for example) arrives at a gateway that has
special knowledge of S/MIME, it will default the entity's MIME
to application/octet-stream and treat it as a generic attachment
thus losing the type information. However, the suggested filename
an attachment is often carried across a gateway. This often
the receiving systems to determine the appropriate application
hand the attachment off to, in this case a stand-alone S/
processing application. Note that this mechanism is provided as
convenience for implementations in certain environments. A
S/MIME implementation MUST use the MIME types and MUST NOT rely
the file extensions
3.2.2 The smime-type
The application/pkcs7-mime content type defines the optional "smime
type" parameter. The intent of this parameter is to convey
about the security applied (signed or enveloped) along
infomation about the contained content. This memo defines
following smime-types
Name Security Inner
enveloped-data EnvelopedData id-
signed-data SignedData id-
certs-only SignedData
In order that consistency can be obtained with future, the
guidelines should be followed when assigning a new smime-
parameter
1. If both signing and encryption can be applied to the content,
two values for smime-type SHOULD be assigned "signed-*"
"encrypted-*". If one operation can be assigned then this may
omitted. Thus since "certs-only" can only be signed, "signed-"
omitted
2. A common string for a content oid should be assigned. We
"data" for the id-data content OID when MIME is the inner content
3. If no common string is assigned. Then the common string
"OID." is recommended (for example, "OID.1.3.6.1.5.5.7.6.1"
would be DES40).
Ramsdell Standards Track [Page 17]
RFC 2633 S/MIME Version 3 Message Specification June 1999
3.3 Creating an Enveloped-only
This section describes the format for enveloping a MIME
without signing it. It is important to note that sending
but not signed messages does not provide for data integrity. It
possible to replace ciphertext in such a way that the
message will still be valid, but the meaning may be altered
Step 1. The MIME entity to be enveloped is prepared according
section 3.1.
Step 2. The MIME entity and other required data is processed into
CMS object of type envelopedData. In addition to encrypting a copy
the content-encryption key for each recipient, a copy of the
encryption key SHOULD be encrypted for the originator and included
the envelopedData (see CMS Section 6).
Step 3. The CMS object is inserted into an application/pkcs7-
MIME entity
The smime-type parameter for enveloped-only messages is "enveloped
data". The file extension for this type of message is ".p7m".
A sample message would be
Content-Type: application/pkcs7-mime; smime-type=enveloped-data
name=smime.p7
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=smime.p7
rfvbnj756tbBghyHhHUujhJhjH77n8HHGT9HG4VQpfyF467GhIGfHfYT
7n8HHGghyHhHUujhJh4VQpfyF467GhIGfHfYGTrfvbnjT6jH7756tbB9
f8HHGTrfvhJhjH776tbB9HG4VQbnj7567GhIGfHfYT6ghyHhHUujpfyF
0GhIGfHfQbnj756YT64
3.4 Creating a Signed-only
There are two formats for signed messages defined for S/MIME
application/pkcs7-mime with SignedData, and multipart/signed.
general, the multipart/signed form is preferred for sending,
receiving agents SHOULD be able to handle both
Ramsdell Standards Track [Page 18]
RFC 2633 S/MIME Version 3 Message Specification June 1999
3.4.1 Choosing a Format for Signed-only
There are no hard-and-fast rules when a particular signed-only
should be chosen because it depends on the capabilities of all
receivers and the relative importance of receivers with S/
facilities being able to verify the signature versus the
of receivers without S/MIME software being able to view the message
Messages signed using the multipart/signed format can always
viewed by the receiver whether they have S/MIME software or not.
can also be viewed whether they are using a MIME-native user agent
they have messages translated by a gateway. In this context, "
viewed" means the ability to process the message essentially as if
were not a signed message, including any other MIME structure
message might have
Messages signed using the signedData format cannot be viewed by
recipient unless they have S/MIME facilities. However, if they
S/MIME facilities, these messages can always be verified if they
not changed in transit
3.4.2 Signing Using application/pkcs7-mime with
This signing format uses the application/pkcs7-mime MIME type.
steps to create this format are
Step 1. The MIME entity is prepared according to section 3.1
Step 2. The MIME entity and other required data is processed into
CMS object of type
Step 3. The CMS object is inserted into an application/pkcs7-
MIME
The smime-type parameter for messages using application/pkcs7-
with SignedData is "signed-data". The file extension for this type
message is ".p7m".
A sample message would be
Content-Type: application/pkcs7-mime; smime-type=signed-data
name=smime.p7
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=smime.p7
Ramsdell Standards Track [Page 19]
RFC 2633 S/MIME Version 3 Message Specification June 1999
567GhIGfHfYT6ghyHhHUujpfyF4f8HHGTrfvhJhjH776tbB9HG4VQbnj
77n8HHGT9HG4VQpfyF467GhIGfHfYT6rfvbnj756
HUujhJh4VQpfyF467GhIGfHfYGTrfvbnjT6jH7756tbB9H7n8
6YT64V0GhIGfHfQbnj75
3.4.3 Signing Using the multipart/signed
This format is a clear-signing format. Recipients without any S/
or CMS processing facilities are able to view the message. It
use of the multipart/signed MIME type described in [MIME-SECURE].
multipart/signed MIME type has two parts. The first part contains
MIME entity that is signed; the second part contains the "
signature" CMS SignedData object in which the
eContent field is absent
3.4.3.1 The application/pkcs7-signature MIME
This MIME type always contains a single CMS object of
signedData. The signedData encapContentInfo eContent field MUST
absent. The signerInfos field contains the signatures for the
entity
The file extension for signed-only messages using application/pkcs7-
signature is ".p7s".
3.4.3.2 Creating a multipart/signed
Step 1. The MIME entity to be signed is prepared according to
3.1, taking special care for clear-signing
Step 2. The MIME entity is presented to CMS processing in order
obtain an object of type signedData in which the
eContent field is absent
Step 3. The MIME entity is inserted into the first part of
multipart/signed message with no processing other than that
in section 3.1.
Step 4. Transfer encoding is applied to the "detached signature"
SignedData object and it is inserted into a MIME entity of
application/pkcs7-signature
Step 5. The MIME entity of the application/pkcs7-signature
inserted into the second part of the multipart/signed entity
The multipart/signed Content type has two required parameters:
protocol parameter and the micalg parameter
Ramsdell Standards Track [Page 20]
RFC 2633 S/MIME Version 3 Message Specification June 1999
The protocol parameter MUST be "application/pkcs7-signature".
that quotation marks are required around the protocol
because MIME requires that the "/" character in the parameter
MUST be quoted
The micalg parameter allows for one-pass processing when
signature is being verified. The value of the micalg parameter
dependent on the message digest algorithm(s) used in the
of the Message Integrity Check. If multiple message digest
are used they MUST be separated by commas per [MIME-SECURE].
values to be placed in the micalg parameter SHOULD be from
following
Algorithm
MD5 md
SHA-1 sha
Any other
(Historical note: some early implementations of S/MIME emitted
expected "rsa-md5" and "rsa-sha1" for the micalg parameter.)
Receiving agents SHOULD be able to recover gracefully from a
parameter value that they do not recognize
3.4.3.3 Sample multipart/signed
Content-Type: multipart/signed
protocol="application/pkcs7-signature";
micalg=sha1; boundary=boundary42
--boundary42
Content-Type: text/
This is a clear-signed message
--boundary42
Content-Type: application/pkcs7-signature; name=smime.p7
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=smime.p7
ghyHhHUujhJhjH77n8HHGTrfvbnj756tbB9HG4VQpfyF467GhIGfHfYT
4VQpfyF467GhIGfHfYT6jH77n8HHGghyHhHUujhJh756tbB9
n8HHGTrfvhJhjH776tbB9HG4VQbnj7567GhIGfHfYT6ghyHhHUujpfyF
7GhIGfHfYT64VQbnj756
--boundary42--
Ramsdell Standards Track [Page 21]
RFC 2633 S/MIME Version 3 Message Specification June 1999
3.5 Signing and
To achieve signing and enveloping, any of the signed-only
encrypted-only formats may be nested. This is allowed because
above formats are all MIME entities, and because they all secure
entities
An S/MIME implementation MUST be able to receive and
arbitrarily nested S/MIME within reasonable resource limits of
recipient computer
It is possible to either sign a message first, or to envelope
message first. It is up to the implementor and the user to choose
When signing first, the signatories are then securely obscured by
enveloping. When enveloping first the signatories are exposed, but
is possible to verify signatures without removing the enveloping
This may be useful in an environment were automatic
verification is desired, as no private key material is required
verify a signature
There are security ramifications to choosing whether to sign first
encrypt first. A recipient of a message that is encrypted and
signed can validate that the encrypted block was unaltered,
cannot determine any relationship between the signer and
unencrypted contents of the message. A recipient of a message that
signed-then-encrypted can assume that the signed message itself
not been altered, but that a careful attacker may have changed
unauthenticated portions of the encrypted message
3.6 Creating a Certificates-only
The certificates only message or MIME entity is used to
certificates, such as in response to a registration request.
format can also be used to convey CRLs
Step 1. The certificates are made available to the CMS
process which creates a CMS object of type signedData. The
encapContentInfo eContent field MUST be absent and signerInfos
MUST be empty
Step 2. The CMS signedData object is enclosed in
application/pkcs7-mime MIME
The smime-type parameter for a certs-only message is "certs-only".
The file extension for this type of message is ".p7c".
Ramsdell Standards Track [Page 22]
RFC 2633 S/MIME Version 3 Message Specification June 1999
3.7 Registration
A sending agent that signs messages MUST have a certificate for
signature so that a receiving agent can verify the signature.
are many ways of getting certificates, such as through an
with a certificate authority, through a hardware token or diskette
and so on
S/MIME v2 [SMIMEV2] specified a method for "registering" public
with certificate authorities using an application/pkcs10 body part
The IETF's PKIX Working Group is preparing another method
requesting certificates; however, that work was not finished at
time of this memo. S/MIME v3 does not specify how to request
certificate, but instead mandates that every sending agent
has a certificate. Standardization of certificate management is
pursued separately in the IETF
3.8 Identifying an S/MIME
Because S/MIME takes into account interoperation in non-
environments, several different mechanisms are employed to carry
type information, and it becomes a bit difficult to identify S/
messages. The following table lists criteria for determining
or not a message is an S/MIME message. A message is considered
S/MIME message if it matches any below
The file suffix in the table below comes from the "name" parameter
the content-type header, or the "filename" parameter on the content
disposition header. These parameters that give the file suffix
not listed below as part of the parameter section
MIME type: application/pkcs7-
parameters:
file suffix:
MIME type: multipart/
parameters: protocol="application/pkcs7-signature
file suffix:
MIME type: application/octet-
parameters:
file suffix: p7m, p7s, p7
Ramsdell Standards Track [Page 23]
RFC 2633 S/MIME Version 3 Message Specification June 1999
4. Certificate
A receiving agent MUST provide some certificate retrieval
in order to gain access to certificates for recipients of
envelopes. This memo does not cover how S/MIME agents
certificates, only what they do after a certificate has
validated or rejected. S/MIME certification issues are covered
[CERT3].
At a minimum, for initial S/MIME deployment, a user agent
automatically generate a message to an intended recipient
that recipient's certificate in a signed return message.
and sending agents SHOULD also provide a mechanism to allow a user
"store and protect" certificates for correspondents in such a way
as to guarantee their later retrieval
4.1 Key Pair
If an S/MIME agent needs to generate a key pair, then the S/
agent or some related administrative utility or function MUST
capable of generating separate DH and DSS public/private key pairs
behalf of the user. Each key pair MUST be generated from a
source of non-deterministic random input [RANDOM] and the private
MUST be protected in a secure fashion
If an S/MIME agent needs to generate a key pair, then the S/
agent or some related administrative utility or function
generate RSA key pairs
A user agent SHOULD generate RSA key pairs at a minimum key size
768 bits. A user agent MUST NOT generate RSA key pairs less than 512
bits long. Creating keys longer than 1024 bits may cause some
S/MIME receiving agents to not be able to verify signatures,
gives better security and is therefore valuable. A receiving
SHOULD be able to verify signatures with keys of any size over 512
bits. Some agents created in the United States have chosen to
512 bit keys in order to get more advantageous export licenses
However, 512 bit keys are considered by many to be
insecure. Implementors should be aware that multiple (active)
pairs may be associated with a single individual. For example,
key pair may be used to support confidentiality, while a
key pair may be used for authentication
Ramsdell Standards Track [Page 24]
RFC 2633 S/MIME Version 3 Message Specification June 1999
5.
This entire memo discusses security. Security issues not covered
other parts of the memo include
40-bit encryption is considered weak by most cryptographers.
weak cryptography in S/MIME offers little actual security
sending plaintext. However, other features of S/MIME, such as
specification of tripleDES and the ability to announce
cryptographic capabilities to parties with whom you communicate
allow senders to create messages that use strong encryption.
weak cryptography is never recommended unless the only alternative
no cryptography. When feasible, sending and receiving agents
inform senders and recipients the relative cryptographic strength
messages
It is impossible for most software or people to estimate the value
a message. Further, it is impossible for most software or people
estimate the actual cost of decrypting a message that is
with a key of a particular size. Further, it is quite difficult
determine the cost of a failed decryption if a recipient
decode a message. Thus, choosing between different key sizes (
choosing whether to just use plaintext) is also impossible. However
decisions based on these criteria are made all the time,
therefore this memo gives a framework for using those estimates
choosing algorithms
If a sending agent is sending the same message using
strengths of cryptography, an attacker watching the
channel may be able to determine the contents of the strongly
encrypted message by decrypting the weakly-encrypted version.
other words, a sender should not send a copy of a message
weaker cryptography than they would use for the original of
message
Modification of the ciphertext can go undetected if authentication
not also used, which is the case when sending EnvelopedData
wrapping it in SignedData or enclosing SignedData within it
Ramsdell Standards Track [Page 25]
RFC 2633 S/MIME Version 3 Message Specification June 1999
A. ASN.1
SecureMimeMessageV
{ iso(1) member-body(2) us(840) rsadsi(113549)
pkcs(1) pkcs-9(9) smime(16) modules(0) smime(4) }
DEFINITIONS IMPLICIT TAGS ::=
-- Cryptographic Message
SubjectKeyIdentifier, IssuerAndSerialNumber
FROM
{ iso(1) member-body(2) us(840) rsadsi(113549)
pkcs(1) pkcs-9(9) smime(16) modules(0) cms(1) };
-- id-aa is the arc with all new authenticated and
-- attributes produced the by S/MIME Working
id-aa OBJECT IDENTIFIER ::= {iso(1) member-body(2) usa(840)
rsadsi(113549)
pkcs(1) pkcs-9(9) smime(16) attributes(2)}
-- S/MIME Capabilities provides a method of broadcasting the
-- capabilities understood. Algorithms should be ordered by
-- and grouped by
smimeCapabilities OBJECT IDENTIFIER ::=
{iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) 15}
SMIMECapability ::= SEQUENCE {
capabilityID OBJECT IDENTIFIER
parameters ANY DEFINED BY capabilityID OPTIONAL }
SMIMECapabilities ::= SEQUENCE OF
-- Encryption Key Preference provides a method of broadcasting
-- preferred encryption certificate
id-aa-encrypKeyPref OBJECT IDENTIFIER ::= {id-aa 11}
SMIMEEncryptionKeyPreference ::= CHOICE {
issuerAndSerialNumber [0] IssuerAndSerialNumber
receipentKeyId [1] RecipientKeyIdentifier
subjectAltKeyIdentifier [2]
Ramsdell Standards Track [Page 26]
RFC 2633 S/MIME Version 3 Message Specification June 1999
-- The Content Encryption Algorithms defined for SMIME are
-- Triple-DES is the manditory algorithm with CBCParameter being
--
dES-EDE3-CBC OBJECT IDENTIFIER ::=
{iso(1) member-body(2) us(840) rsadsi(113549)
encryptionAlgorithm(3) 7}
CBCParameter ::=
IV ::= OCTET STRING (SIZE (8..8))
-- RC2 (or compatable) is an optional algorithm w/ RC2-CBC-
-- as the
rC2-CBC OBJECT IDENTIFIER ::=
{iso(1) member-body(2) us(840) rsadsi(113549)
encryptionAlgorithm(3) 2}
-- For the effective-key-bits (key size) greater than 32 and less
-- 256, the RC2-CBC algorithm parameters are encoded as
RC2-CBC-parameter ::= SEQUENCE {
rc2ParameterVersion INTEGER
iv IV
-- For the effective-key-bits of 40, 64, and 128,
-- rc2ParameterVersion values are 160, 120, 58 respectively
-- The following list the OIDs to be used with S/MIME V
-- Digest Algorithms
-- md5 OBJECT IDENTIFIER ::=
-- {iso(1) member-body(2) us(840) rsadsi(113549)
-- digestAlgorithm(2) 5}
-- sha-1 OBJECT IDENTIFIER ::=
-- {iso(1) identified-organization(3) oiw(14) secsig(3)
-- algorithm(2) 26}
-- Asymmetric Encryption
--
-- rsaEncryption OBJECT IDENTIFIER ::=
-- {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1)
-- 1}
--
Ramsdell Standards Track [Page 27]
RFC 2633 S/MIME Version 3 Message Specification June 1999
-- rsa OBJECT IDENTIFIER ::=
-- {joint-iso-ccitt(2) ds(5) algorithm(8) encryptionAlgorithm(1) 1}
--
-- id-dsa OBJECT IDENTIFIER ::=
-- {iso(1) member-body(2) us(840) x9-57(10040) x9cm(4) 1 }
-- Signature
--
-- md2WithRSAEncryption OBJECT IDENTIFIER ::=
-- {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1)
-- 2}
--
-- md5WithRSAEncryption OBJECT IDENTIFIER ::=
-- {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1)
-- 4}
--
-- sha-1WithRSAEncryption OBJECT IDENTIFIER ::=
-- {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1)
-- 5}
--
-- id-dsa-with-sha1 OBJECT IDENTIFIER ::=
-- {iso(1) member-body(2) us(840) x9-57(10040) x9cm(4) 3}
-- Other Signed
--
-- signingTime OBJECT IDENTIFIER ::=
-- {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9)
-- 5}
-- See [CMS] for a description of how to encode the
-- value
Ramsdell Standards Track [Page 28]
RFC 2633 S/MIME Version 3 Message Specification June 1999
B.
[3DES] ANSI X9.52-1998, "Triple Data Encryption
Modes of Operation", American National
Institute, 1998.
[CERT3]