As per Relevance of the word receiving, we have this rfc below:
Network Working Group S.
Request for Comments: 2311 RSA Data
Category: Informational P.
Internet Mail
B.
L.
L.
March 1998
S/MIME Version 2 Message
Status of this
This memo provides information for the Internet community. It
not specify an Internet standard of any kind. Distribution of
memo is unlimited
Copyright
Copyright (C) The Internet Society (1998). 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
Dusse, et. al. Informational [Page 1]
RFC 2311 S/MIME Version 2 Message Specification March 1998
Please note: The information in this document is historical
being published for the public record. It is not an IETF standard
The use of the word "standard" in this document indicates a
for adopters of S/MIME version 2, not an IETF standard
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
This memo defines how to create a MIME body part that has
cryptographically enhanced according to PKCS #7 [PKCS-7]. This
also defines the application/pkcs7-mime MIME type that can be used
transport those body parts. This memo also defines how to
certification requests that conform to PKCS #10 [PKCS-10], and
application/pkcs10 MIME type for transporting those requests
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. This specification
compatible with PKCS #7 in that it uses the data types defined
PKCS #7.
In order to create S/MIME messages, an agent has to
specifications in this memo, as well as some of the
listed in the following documents
- "PKCS #1: RSA Encryption", [PKCS-1]
- "PKCS #7: Cryptographic Message Syntax", [PKCS-7]
- "PKCS #10: Certification Request Syntax", [PKCS-10]
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
Dusse, et. al. Informational [Page 2]
RFC 2311 S/MIME Version 2 Message Specification March 1998
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
Throughout this memo, the terms MUST, MUST NOT, SHOULD, and
NOT are used in capital letters. This conforms to the definitions
[MUSTSHOULD]. [MUSTSHOULD] defines the use of these key words
help make the intent of standards track documents as clear
possible. The same key words are used in this document to
implementors achieve interoperability
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
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
1.4 Compatibility with Prior Practice of S/
Appendix C contains important information about how S/MIME
following this specification should act in order to have the
interoperability with earlier implementations of S/MIME
Dusse, et. al. Informational [Page 3]
RFC 2311 S/MIME Version 2 Message Specification March 1998
2. PKCS #7
The PKCS #7 message format allows for a wide variety of options
content and algorithm support. This section puts forth a number
support requirements and recommendations in order to achieve a
level of interoperability among all S/MIME implementations
2.1
Receiving agents MUST support SHA-1 [SHA1] and MD5 [MD5].
Sending agents SHOULD use SHA-1.
2.2
Receiving agents MUST support rsaEncryption, defined in [PKCS-1].
Receiving agents MUST support verification of signatures using
public key sizes from 512 bits to 1024 bits
Sending agents MUST support rsaEncryption. Outgoing messages
signed with a user's private key. The size of the private key
determined during key generation
2.3
Receiving agents MUST 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 MUST support rsaEncryption. Sending agents
support encryption of symmetric keys with RSA public keys at
sizes from 512 bits to 1024 bits
2.4 General
The PKCS #7 defines six distinct content types: "data", "signedData",
"envelopedData", "signedAndEnvelopedData", "digestedData",
"encryptedData". Receiving agents MUST support the "data",
"signedData" and "envelopedData" content types. Sending agents may
may not send out any of the content types, depending on the
that the agent supports
2.4.1 Data Content
Sending agents MUST use the "data" content type as the content
other content types to indicate the message content which has
security services applied to it
Dusse, et. al. Informational [Page 4]
RFC 2311 S/MIME Version 2 Message Specification March 1998
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 unauthenticated
authenticated attributes to be included along with a signature
Receiving agents MUST be able to handle zero or one instance of
of the signed attributes described in this section
Sending agents SHOULD be able to generate one instance of each of
signed attributes described in this section, and SHOULD include
attributes in each signed message sent
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
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. Agents MUST interpret the year field (YY)
follows: if YY is greater than or equal to 50, the year
interpreted as 19YY; if YY is less than 50, the year is
as 20YY
2.5.2 S/MIME Capabilities
The S/MIME capabilities attribute includes signature algorithms (
as "md5WithRSAEncryption"), symmetric algorithms (such as "DES-CBC"),
and key encipherment algorithms (such as "rsaEncryption"). It
Dusse, et. al. Informational [Page 5]
RFC 2311 S/MIME Version 2 Message Specification March 1998
includes a non-algorithm capability which is the preference
signedData. SMIMECapabilities was designed to be flexible
extensible so that, in the future, a means of identifying
capabilities and preferences such as certificates can be added in
way that will not cause current clients to break
The semantics of the S/MIME capabilites 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
encoding, 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.)
The structure of SMIMECapabilities was designed to facilitate
table lookups and binary comparisons in order to determine matches
For instance, the DER-encoding for the SMIMECapability for DES EDE
CBC MUST be identically encoded regardless of the 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 (the registered SMIMECapability list) that
centrally maintained and is separate from this memo. The list of
is maintained by the Internet Mail Consortium
.
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 memo
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 S/MIME capabilities 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 S/MIME capabilities 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
Dusse, et. al. Informational [Page 6]
RFC 2311 S/MIME Version 2 Message Specification March 1998
Additional values for SMIMECapability may be defined in the future
Receiving agents MUST handle a SMIMECapabilities object that
values that it does not recognize in a graceful manner
2.6
Receiving agents MUST support decryption using the RC2 [RC2] or
compatible algorithm at a key size of 40 bits, hereinafter
"RC2/40". Receiving agents SHOULD support decryption using DES EDE
CBC, hereinafter called "tripleDES" [3DES] [DES].
Sending agents SHOULD support encryption with RC2/40 and tripleDES
2.6.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 than
signing time stored in the list and that the signature is valid
If so, the receiving agent SHOULD update both the signing time
capabilities in the list. Values of the signing time that lie
in the future (that is, a greater discrepancy than any
clock skew), or a capabilitie lists in messages whose
could not be verified, MUST NOT be accepted
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
Dusse, et. al. Informational [Page 7]
RFC 2311 S/MIME Version 2 Message Specification March 1998
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.6.2.1 through 2.6.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.6.2.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.6.2.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
2.6.2.3 Rule 3: Unknown Capabilities, Risk of Failed
If
- the sending agent has no knowledge of the encryption
of the recipient
- and the sending agent is willing to risk that the recipient
not be able to decrypt the message
then the sending agent SHOULD use tripleDES
Dusse, et. al. Informational [Page 8]
RFC 2311 S/MIME Version 2 Message Specification March 1998
2.6.2.4 Rule 4: Unknown Capabilities, No Risk of Failed
If
- the sending agent has no knowledge of the encryption
of the recipient
- and the sending agent is not willing to risk that the
may not be able to decrypt the message
then the sending agent MUST use RC2/40.
2.6.3 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.6.4 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 can decipher the contents of
strongly-encrypted message simply by decrypting the weakly-
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 PKCS 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 PKCS processing facilities which produces
PKCS object. The PKCS object is then finally wrapped in MIME
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].
Dusse, et. al. Informational [Page 9]
RFC 2311 S/MIME Version 2 Message Specification March 1998
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.
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 PKCS #7 objects is
in 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
canonical
Step 3. Appropriate transfer encoding is applied to the leaves
the MIME
When an S/MIME message is received, the security services on
message are removed, 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
Dusse, et. al. Informational [Page 10]
RFC 2311 S/MIME Version 2 Message Specification March 1998
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 sending
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
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
Dusse, et. al. Informational [Page 11]
RFC 2311 S/MIME Version 2 Message Specification March 1998
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
invalidate the signature
- The agent could transmit the data anyway, which would most
result in the 8th bit being corrupted; this too would
the 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
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
Dusse, et. al. Informational [Page 12]
RFC 2311 S/MIME Version 2 Message Specification March 1998
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=20because some mail transport agents will insert a 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 PKCS #7 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
This MIME type always carries a single PKCS #7 object. The PKCS #7
object must always be BER encoding of the ASN.1 syntax describing
object. The contentInfo field of the carried PKCS #7 object
contains a MIME entity that is prepared as described in section 3.1.
The contentInfo field must never be empty
Since PKCS #7 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
Dusse, et. al. Informational [Page 13]
RFC 2311 S/MIME Version 2 Message Specification March 1998
Note that this discussion refers to the transfer encoding of the
#7 object or "outside" MIME entity. It is completely distinct from
and unrelated to, the transfer encoding of the MIME entity secured
the PKCS #7 object, the "inside" object, which is described
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 .p7
(signedData, envelopedData
application/pkcs7-mime .p7
(degenerate
"certs-only" message
application/pkcs7-signature .p7
application/pkcs10 .p10
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
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
Dusse, et. al. Informational [Page 14]
RFC 2311 S/MIME Version 2 Message Specification March 1998
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.3 Creating an Enveloped-only
This section describes the format for enveloping a MIME
without signing it
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
PKCS #7 object of type envelopedData
Step 3. The PKCS #7 object is inserted into an application/pkcs7-
mime 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 and SignedData, and multipart/signed.
general, the multipart/signed form is preferred for sending,
receiving agents SHOULD be able to handle both
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
Dusse, et. al. Informational [Page 15]
RFC 2311 S/MIME Version 2 Message Specification March 1998
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 and
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
PKCS #7 object of type
Step 3. The PKCS #7 object is inserted into
application/pkcs7-mime MIME
The smime-type parameter for messages using application/pkcs7-
and 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
567GhIGfHfYT6ghyHhHUujpfyF4f8HHGTrfvhJhjH776tbB9HG4VQbnj
77n8HHGT9HG4VQpfyF467GhIGfHfYT6rfvbnj756
HUujhJh4VQpfyF467GhIGfHfYGTrfvbnjT6jH7756tbB9H7n8
6YT64V0GhIGfHfQbnj75
Dusse, et. al. Informational [Page 16]
RFC 2311 S/MIME Version 2 Message Specification March 1998
3.4.3 Signing Using the multipart/signed
This format is a clear-signing format. Recipients without any S/
or PKCS 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 to be signed; the second part contains
signature, which is a PKCS #7 detached signature
3.4.3.1 The application/pkcs7-signature MIME
This MIME type always contains a single PKCS #7 object of
signedData. The contentInfo field of the PKCS #7 object must
empty. The signerInfos field contains the signatures for the
entity. The details of the registered type are given in Appendix D
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
section 3.1, taking special care for clear-signing
Step 2. The MIME entity is presented to PKCS #7 processing in
to obtain an object of type signedData with an
contentInfo field
Step 3. The MIME entity is inserted into the first part of
multipart/signed message with no processing other than
described in section 3.1.
Step 4. Transfer encoding is applied to the detached signature
it is inserted into a MIME entity of
application/pkcs7-
Step 5. The MIME entity of the application/pkcs7-signature
inserted into the second part of the multipart/
The multipart/signed Content type has two required parameters:
protocol parameter and the micalg parameter
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
Dusse, et. al. Informational [Page 17]
RFC 2311 S/MIME Version 2 Message Specification March 1998
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 used in the calculation
the Message Integrity Check. The value of the micalg parameter
be one of the following
Algorithm used
-------------- ---------
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--
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
Dusse, et. al. Informational [Page 18]
RFC 2311 S/MIME Version 2 Message Specification March 1998
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
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 PKCS #7
generating process which creates a PKCS #7 object of
signedData. The contentInfo and signerInfos fields must
empty
Step 2. The PKCS #7 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".
3.7 Creating a Registration
A typical application which allows a user to generate
information has to submit that information to a
authority, who transforms it into a certificate. PKCS #10 describes
syntax for certification requests. The application/pkcs10 body
MUST be used to transfer a PKCS #10 certification request
The details of certification requests and the process of obtaining
certificate are beyond the scope of this memo. Instead, only
format of data used in application/pkcs10 is defined
3.7.1 Format of the application/pkcs10
PKCS #10 defines the ASN.1 type CertificationRequest for use
submitting a certification request. Therefore, when the MIME
type application/pkcs10 is used, the body MUST be
CertificationRequest, encoded using the Basic Encoding Rules (BER).
Dusse, et. al. Informational [Page 19]
RFC 2311 S/MIME Version 2 Message Specification March 1998
Although BER is specified, instead of the more restrictive DER,
typical application will use DER since the CertificationRequest'
CertificationRequestInfo has to be DER-encoded in order to be signed
A robust application SHOULD output DER, but allow BER or DER
input
Data produced by BER or DER is 8-bit, but many transports are
to 7-bit data. Therefore, a suitable 7-bit Content-Transfer-
SHOULD be applied. The base64 Content-Transfer-Encoding SHOULD
used with application/pkcs10, although any 7-bit transfer
may work
3.7.2 Sending and Receiving an application/pkcs10 Body
For sending a certificate-signing request, the application/pkcs10
message format MUST be used to convey a PKCS #10 certificate-
request. Note that for sending certificates and CRLs messages
any signed content, the application/pkcs7-mime message format MUST
used to convey a degenerate PKCS #7 signedData "certs-only" message
To send an application/pkcs10 body, the application generates
cryptographic information for the user. The details of
cryptographic information are beyond the scope of this memo
Step 1. The cryptographic information is placed within a PKCS #10
CertificationRequest
Step 2. The CertificationRequest is encoded according to BER or
(typically, DER).
Step 3. As a typical step, the DER-encoded CertificationRequest
also base64 encoded so that it is 7-bit data suitable
transfer in SMTP. This then becomes the body of
application/pkcs10 body part
The result might look like this
Content-Type: application/pkcs10; name=smime.p10
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=smime.p10
rfvbnj756tbBghyHhHUujhJhjH77n8HHGT9HG4VQpfyF467GhIGfHfYT
7n8HHGghyHhHUujhJh4VQpfyF467GhIGfHfYGTrfvbnjT6jH7756tbB9
f8HHGTrfvhJhjH776tbB9HG4VQbnj7567GhIGfHfYT6ghyHhHUujpfyF
0GhIGfHfQbnj756YT64
A typical application only needs to send a certification request.
is a certification authority that has to receive and process
Dusse, et. al. Informational [Page 20]
RFC 2311 S/MIME Version 2 Message Specification March 1998
request. The steps for recovering the CertificationRequest from
message are straightforward but are not presented here.
procedures for processing the certification request are beyond
scope of this document
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: application/pkcs10
parameters:
file suffix:
MIME type: multipart/
parameters: protocol="application/pkcs7-signature
file suffix:
MIME type: application/octet-
parameters:
file suffix: p7m, p7s, aps, p7c, p10
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 in
different document
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
Dusse, et. al. Informational [Page 21]
RFC 2311 S/MIME Version 2 Message Specification March 1998
"store and protect" certificates for correspondents in such a way
as to guarantee their later retrieval
4.1 Key Pair
An S/MIME agent or some related administrative utility or
MUST be capable of generating RSA key pairs on behalf of the user
Each key pair MUST be generated from a good source of non
deterministic random input and protected in a secure fashion
A user agent SHOULD generate RSA key pairs at a minimum key size
768 bits and a maximum key size of 1024 bits. A user agent MUST
generate RSA key pairs less than 512 bits long. Some agents
in the United States have chosen to create 512 bit keys in order
get more advantageous export licenses. However, 512 bit keys
considered by many to be cryptographically insecure
Implementors should be aware that multiple (active) key pairs may
associated with a single individual. For example, one key pair may
used to support confidentiality, while a different key pair may
used for authentication
5. Security
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
Dusse, et. al. Informational [Page 22]
RFC 2311 S/MIME Version 2 Message Specification March 1998
If a sending agent is sending the same message using
strengths of cryptography, an attacker watching the
channel can determine the contents of the strongly-encrypted
by decrypting the weakly-encrypted version. In other words, a
should not send a copy of a message using weaker cryptography
they would use for the original of the message
Dusse, et. al. Informational [Page 23]
RFC 2311 S/MIME Version 2 Message Specification March 1998
A. Object Identifiers and
The syntax for SMIMECapability is
SMIMECapability ::= SEQUENCE {
capabilityID OBJECT IDENTIFIER
parameters OPTIONAL ANY DEFINED BY capabilityID }
SMIMECapabilities ::= SEQUENCE OF
A.1 Content Encryption
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 OCTET STRING (8)}
For the effective-key-bits of 40, 64, and 128,
rc2ParameterVersion values are 160, 120, 58 respectively
DES-EDE3-CBC OBJECT IDENTIFIER ::=
{iso(1) member-body(2) us(840) rsadsi(113549) encryptionAlgorithm(3) 7}
For DES-CBC and DES-EDE3-CBC, the parameter should be encoded as
CBCParameter ::
where IV ::= OCTET STRING -- 8 octets
A.2 Digest
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}
A.3 Asymmetric Encryption
rsaEncryption OBJECT IDENTIFIER ::=
{iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1) 1}
Dusse, et. al. Informational [Page 24]
RFC 2311 S/MIME Version 2 Message Specification March 1998
rsa OBJECT IDENTIFIER ::=
{joint-iso-ccitt(2) ds(5) algorithm(8) encryptionAlgorithm(1) 1}
A.4 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}
A.5 Signed
signingTime OBJECT IDENTIFIER ::=
{iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) 5}
smimeCapabilities OBJECT IDENTIFIER ::=
{iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) 15}
Dusse, et. al. Informational [Page 25]
RFC 2311 S/MIME Version 2 Message Specification March 1998
B.
[3DES] W. Tuchman, "Hellman Presents No Shortcut Solutions To DES,"
IEEE Spectrum, v. 16, n. 7, July 1979, pp40-41.
[CHARSETS] Character sets assigned by IANA.
character-sets>.
[CONTDISP] Troost, R., Dorner, S and K. Moore, "
Presentation Information in Internet Messages: The Content
Disposition Header Field", RFC 2183, August 1997.
[DES] ANSI X3.106, "American National Standard for
Systems-Data Link Encryption," American National Standards Institute
1983.
[MD5] Rivest, R., "The MD5 Message Digest Algorithm", RFC 1321,
1992.
[MIME-SPEC] The primary definition of MIME
Freed, N., and N. Borenstein, "MIME Part 1: Format of
Message Bodies", RFC 2045, November 1996.
Freed, N., and N. Borenstein, "MIME Part 2: Media Types", RFC 2046,
November 1996.
Moore, K., "MIME Part 3: Message Header Extensions for Non-
Text", RFC 2047, November 1996.
Freed, N., Klensin, J., and J. Postel, "MIME Part 4:
Procedures", RFC 2048, November 1996.
Freed, N., and N. Borenstein, "MIME Part 5: Conformance Criteria
Examples", RFC 2049, November 1996.
[MIME-SECURE] Galvin, J., Murphy, S., Crocker, S., and N. Freed
"Security Multiparts for MIME: Multipart/Signed
Multipart/Encrypted", RFC 1847, October 1995.
[MUSTSHOULD] Bradner, S., "Key words for use in RFCs to
Requirement Levels", BCP 14, RFC 2119, March 1997.
[PKCS-1] Kaliski, B., "PKCS #1: RSA Encryption Version 1.5",
2313, March 1998.
[PKCS-7] Kaliski, B., "PKCS #7: Cryptographic Message Syntax
1.5", RFC 2315, March 1998.
Dusse, et. al. Informational [Page 26]
RFC 2311 S/MIME Version 2 Message Specification March 1998
[PKCS-10] Kaliski, B., "PKCS #10: Certification Request
Version 1.5", RFC 2314, March 1998.
[RC2] Rivest, R., "Description of the RC2(r) Encryption Algorithm",
RFC 2268, January 1998.
[SHA1] NIST FIPS PUB 180-1, "Secure Hash Standard,"
Institute of Standards and Technology, U.S. Department of Commerce
DRAFT, 31 May 1994.
Dusse, et. al. Informational [Page 27]
RFC 2311 S/MIME Version 2 Message Specification March 1998
C. Compatibility with Prior Practice in S/
S/MIME was originally developed by RSA Data Security, Inc.
developers implemented S/MIME agents before this document
published. All S/MIME receiving agents SHOULD make every attempt
interoperate with these earlier implementations of S/MIME
C.1 Early MIME
Some early implementations of S/MIME agents used the following
types
application/x-pkcs7-
application/x-pkcs7-
application/x-pkcs10
In each case, the "x-" subtypes correspond to the subtypes
in this document without the "x-".
C.2
Early S/MIME documentation had two profiles for encryption
"restricted" and "unrestricted". The difference between
profiles historically came about due to US Government
regulations, as described at the end of this section. It is
that in the future, there will be few agents that only use
restricted profile
Briefly, the restricted profile required the ability to encrypt
decrypt using RSA's trade-secret RC2 algorithm in CBC mode with 40-
bit keys. The unrestricted profile required the ability to
and decrypt using RSA's trade-secret RC2 algorithm in CBC mode
40-bit keys, and to encrypt and decrypt using tripleDES.
restricted profile also had non-mandatory suggestions for
algorithms, but these were not widely implemented
It is important to note that many current implementations of S/
use the restricted profile
C.2.1 Historical Reasons for the Existence of Two Encryption
Due to US Government export regulations, an S/MIME agent
supports a strong content encryption algorithm such as DES would
be freely exportable outside of North America. US
manufacturers have been compelled to incorporate an exportable
"restricted" content encryption algorithm in order to create a
exportable version of their product. S/MIME agents created in the
and intended for US domestic use (or use under special
Dusse, et. al. Informational [Page 28]
RFC 2311 S/MIME Version 2 Message Specification March 1998
Department export licenses) can utilize stronger, "unrestricted
content encryption. However, in order to achieve interoperability
such agents need to support whatever exportable algorithm
incorporated in restricted S/MIME agents
The RC2 symmetric encryption algorithm has been approved by the
Government for "expedited" export licensing at certain key sizes
Consequently, support for the RC2 algorithm in CBC mode is
for baseline interoperability in all S/MIME implementations.
for other strong symmetric encryption algorithms such as RC5 CBC,
CBC and DES EDE3-CBC for content encryption is strongly
where possible
Dusse, et. al. Informational [Page 29]
RFC 2311 S/MIME Version 2 Message Specification March 1998
D. Request for New MIME
D.1 application/pkcs7-
To: ietf-types@iana.
Subject: Registration of MIME media type application/pkcs7-
MIME media type name:
MIME subtype name: pkcs7-
Required parameters:
Optional parameters: name, filename, smime-
Encoding considerations: Will be binary data, therefore should
base64
Security considerations: Described in [PKCS-7]
Interoperability considerations: Designed to carry data
with PKCS-7, as described in [PKCS-7]
Published specification: RFC 2311
Applications which use this media type: Secure Internet mail
other secure data transports
Additional information
File extension(s): .p7m and .p7
Macintosh File Type Code(s):
Person & email address to contact for further information
Steve Dusse, spock@rsa.
Intended usage:
D.2 application/pkcs7-
To: ietf-types@iana.
Subject: Registration of MIME media type application/pkcs7-
MIME media type name:
MIME subtype name: pkcs7-
Required parameters:
Dusse, et. al. Informational [Page 30]
RFC 2311 S/MIME Version 2 Message Specification March 1998
Optional parameters: name,
Encoding considerations: Will be binary data, therefore should
base64
Security considerations: Described in [PKCS-7]
Interoperability considerations: Designed to carry
signatures with PKCS-7, as described in [PKCS-7]
Published specification: RFC 2311
Applications which use this media type: Secure Internet mail
other secure data transports
Additional information
File extension(s): .p7
Macintosh File Type Code(s):
Person & email address to contact for further information
Steve Dusse, spock@rsa.
Intended usage:
D.3 application/pkcs10
To: ietf-types@iana.
Subject: Registration of MIME media type application/pkcs10
MIME media type name:
MIME subtype name: pkcs10
Required parameters:
Optional parameters: name,
Encoding considerations: Will be binary data, therefore should
base64
Security considerations: Described in [PKCS-