draft-ietf-smime-cms-02.txt   draft-ietf-smime-cms-03.txt 
S/MIME Working Group R. Housley S/MIME Working Group R. Housley
Internet Draft SPYRUS Internet Draft SPYRUS
expires in six months December 1997 expires in six months January 1998
Cryptographic Message Syntax Cryptographic Message Syntax
<draft-ietf-smime-cms-02.txt> <draft-ietf-smime-cms-03.txt>
Status of this Memo Status of this Memo
This document is an Internet-Draft. Internet-Drafts are working This document is an Internet-Draft. Internet-Drafts are working
documents of the Internet Engineering Task Force (IETF), its areas, documents of the Internet Engineering Task Force (IETF), its areas,
and its working groups. Note that other groups may also distribute and its working groups. Note that other groups may also distribute
working documents as Internet-Drafts. working documents as Internet-Drafts.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
skipping to change at page 1, line 32 skipping to change at page 1, line 32
To learn the current status of any Internet-Draft, please check the To learn the current status of any Internet-Draft, please check the
"1id-abstracts.txt" listing contained in the Internet- Drafts Shadow "1id-abstracts.txt" listing contained in the Internet- Drafts Shadow
Directories on ftp.is.co.za (Africa), ftp.nordu.net (Europe), Directories on ftp.is.co.za (Africa), ftp.nordu.net (Europe),
munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or
ftp.isi.edu (US West Coast). ftp.isi.edu (US West Coast).
Abstract Abstract
This document describes the Cryptographic Message Syntax. This This document describes the Cryptographic Message Syntax. This
syntax is used to digitally sign, digest, or encrypt arbitrary syntax is used to digitally sign, digest, authenticate, or encrypt
messages. arbitrary messages.
The Cryptographic Message Syntax is derived from PKCS #7 version 1.5. The Cryptographic Message Syntax is derived from PKCS #7 version 1.5.
Wherever possible, backward compatibility is preserved; however, Wherever possible, backward compatibility is preserved; however,
changes were necessary to accommodate attribute certificate transfer changes were necessary to accommodate attribute certificate transfer
and key agreement techniques for key management. and key agreement techniques for key management.
This draft is being discussed on the ''ietf-smime'' mailing list. To This draft is being discussed on the "ietf-smime" mailing list. To
subscribe, send a message to: join the list, send a message to <ietf-smime-request@imc.org> with
ietf-smime-request@imc.org the single word "subscribe" in the body of the message. Also, there
with the single ''subscribe'' word in the body of the message. Also, is a Web site for the mailing list at <http://www.imc.org/ietf-
there is a Web site for the mailing list at: smime/>.
<http://www.imc.org/ietf-smime/>.
1 Introduction 1 Introduction
This document describes the Cryptographic Message Syntax. This This document describes the Cryptographic Message Syntax. This
syntax is used to digitally sign or encrypt arbitrary messages. syntax is used to digitally sign or encrypt arbitrary messages.
The Cryptographic Message Syntax describes an encapsulation syntax The Cryptographic Message Syntax describes an encapsulation syntax
for data protection. It supports digital signatures and encryption. for data protection. It supports digital signatures and encryption.
The syntax allows multiple encapsulation, so one encapsulation The syntax allows multiple encapsulation, so one encapsulation
envelope can be nested inside another. Likewise, one party can envelope can be nested inside another. Likewise, one party can
skipping to change at page 2, line 34 skipping to change at page 2, line 34
using BER-encoding. Values are typically represented as octet using BER-encoding. Values are typically represented as octet
strings. While many systems are capable of transmitting arbitrary strings. While many systems are capable of transmitting arbitrary
octet strings reliably, it is well known that many electronic-mail octet strings reliably, it is well known that many electronic-mail
systems are not. This document does not address mechanisms for systems are not. This document does not address mechanisms for
encoding octet strings for reliable transmission in such encoding octet strings for reliable transmission in such
environments. environments.
2 General Overview 2 General Overview
The Cryptographic Message Syntax is general enough to support many The Cryptographic Message Syntax is general enough to support many
different content types. This document defines three: data, signed different content types. This document defines six content types:
data, and enveloped data. Other content types may be added in the data, signed-data, enveloped-data, digested-data, encrypted-data, and
future, and additional content types can be defined outside this authenticated-data. Also, additional content types can be defined
document. outside this document.
An implementation that conforms to this specification must implement
the data, signed-data, and enveloped-data content types. The other
content types may be implemented if desired.
The Cryptographic Message Syntax exports one content type, The Cryptographic Message Syntax exports one content type,
ContentInfo, as well as the various object identifiers. ContentInfo, as well as the various object identifiers.
As a general design philosophy, content types permit single pass As a general design philosophy, content types permit single pass
processing using indefinite-length Basic Encoding Rules (BER) processing using indefinite-length Basic Encoding Rules (BER)
encoding. Single-pass operation is especially helpful if content is encoding. Single-pass operation is especially helpful if content is
large, stored on tapes, or is "piped" from another process. Single- large, stored on tapes, or is "piped" from another process. Single-
pass operation has one significant drawback; it is difficult to pass operation has one significant drawback: it is difficult to
perform encode operations using the Distinguished Encoding Rules perform encode operations using the Distinguished Encoding Rules
(DER) encoding in a single pass since the lengths of the various (DER) encoding in a single pass since the lengths of the various
components may not be known in advance. Since DER encoding is components may not be known in advance. Since the signed-data
required by the signed-data content type, an extra pass may be content type requires DER encoding, an extra pass may be necessary
necessary when a content type other than data is encapsulated. when a content type other than data is encapsulated.
3 General Syntax 3 General Syntax
The Cryptographic Message Syntax associates a content type with a The Cryptographic Message Syntax associates a protection content type
content. The syntax shall have ASN.1 type ContentInfo: with a protection content. The syntax shall have ASN.1 type
ContentInfo:
ContentInfo ::= SEQUENCE { ContentInfo ::= SEQUENCE {
contentType ContentType, contentType ContentType,
content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL } content [0] EXPLICIT ANY DEFINED BY contentType }
ContentType ::= OBJECT IDENTIFIER ContentType ::= OBJECT IDENTIFIER
The fields of ContentInfo have the following meanings: The fields of ContentInfo have the following meanings:
contentType indicates the type of content. It is an object contentType indicates the type of protection content. It is an
identifier, which means it is a unique string of integers assigned object identifier; it is a unique string of integers assigned by
by the authority that defines the content type. an authority that defines the content type.
content is the content. The field is optional, although it is
generally present. In the rare cases where it is absent, the
intended value must be supplied by other means.
The type of content can be determined uniquely by contentType, so the
type defined along with the object identifier should not be a CHOICE
type.
The optional omission of the content field makes it possible to content is the protection content. The type of protection content
construct "external signatures." In the case of external signatures, can be determined uniquely by contentType. Protection content
the content being signed would be absent from the encapsulated types for signed-data, enveloped-data, digested-data, encrypted-
ContentInfo value included in the signed-data content type. If the data, and authenticated-data are defined in this document. If
ContentInfo value is absent, the signatureValue is calculated as additional protection content types are defined in other
though the ContentInfo value were present. The presumed ContentInfo documents, the ASN.1 type defined along with the object identifier
must have the content type set to id-data and the content omitted. should not be a CHOICE type.
4 Data Content Type 4 Data Content Type
The data content type is identified by the following object The following object identifier identifies the data content type:
identifier:
id-data OBJECT IDENTIFIER ::= { iso(1) member-body(2) id-data OBJECT IDENTIFIER ::= { iso(1) member-body(2)
us(840) rsadsi(113549) pkcs(1) pkcs7(7) 1 } us(840) rsadsi(113549) pkcs(1) pkcs7(7) 1 }
The data content type is just an octet string. It shall have ASN.1
type Data:
Data ::= OCTET STRING
The data content type is intended to refer to arbitrary octet The data content type is intended to refer to arbitrary octet
strings, such as ASCII text files; the interpretation is left to the strings, such as ASCII text files; the interpretation is left to the
application. Such strings need not have any internal structure application. Such strings need not have any internal structure
(although they may; they could even be DER encoded). (although they could have their own ASN.1 definition or other
structure).
The data content type is generally used in conjunction with the
signed-data, enveloped-data, digested-data, encrypted-data, and
authenticated-data protection content types. The data content type
is encapsulated in one of these protection content types.
5 Signed-data Content Type 5 Signed-data Content Type
The signed-data content type consists of a content of any type and The signed-data content type consists of a content of any type and
zero or more signature values. Any type of content can be signed by zero or more signature values. Any number of signers in parallel can
any number of signers in parallel. sign any type of content.
The typical application of the signed-data content type represents The typical application of the signed-data content type represents
one signer's digital signature on content of the data content type. one signer's digital signature on content of the data content type.
Another typical application disseminates certificates and certificate Another typical application disseminates certificates and certificate
revocation lists (CRLs). revocation lists (CRLs).
The process by which signed data is constructed involves the The process by which signed-data is constructed involves the
following steps: following steps:
1. For each signer, a message digest, or hash value, is computed 1. For each signer, a message digest, or hash value, is computed
on the content with a signer-specific message-digest algorithm. If on the content with a signer-specific message-digest algorithm.
two signers employ the same message digest algorithm, then the If two signers employ the same message digest algorithm, then the
message digest need be computed for only one of them. If the message digest need be computed for only one of them. If the
signer is authenticating any information other than the content signer is authenticating any information other than the content
(see Section 5.2), the message digest of the content and the other (see Section 5.2), the message digest of the content and the other
information are digested with the signer's message digest information are digested with the signer's message digest
algorithm, and the result becomes the "message digest." algorithm, and the result becomes the "message digest."
2. For each signer, the message digest is digitally signed using 2. For each signer, the message digest is digitally signed using
the signer's private key. the signer's private key.
3. For each signer, the signature value and other signer-specific 3. For each signer, the signature value and other signer-specific
information are collected into a SignerInfo value, as defined in information are collected into a SignerInfo value, as defined in
Section 5.2. Certificates and CRLs for each signer, and those not Section 5.2. Certificates and CRLs for each signer, and those not
corresponding to any signer, are collected in this step. corresponding to any signer, are collected in this step.
4. The message digest algorithms for all the signers and the 4. The message digest algorithms for all the signers and the
SignerInfo values for all the signers are collected together with SignerInfo values for all the signers are collected together with
the content into a SignedData value, as defined in Section 5.1. the content into a SignedData value, as defined in Section 5.1.
A recipient independently computes the message digest. This message A recipient independently computes the message digest. This message
digest and the signer's public key are used it to validate the digest and the signer's public key are used to validate the signature
signature value. The signer's public key is referenced by an issuer value. The signer's public key is referenced by an issuer
distinguished name and an issuer-specific serial number that uniquely distinguished name and an issuer-specific serial number that uniquely
identify the certificate containing the public key. The signer's identify the certificate containing the public key. The signer's
certificate may be included in the SignedData certificates field. certificate may be included in the SignedData certificates field.
This section is divided into four parts. The first part describes the This section is divided into five parts. The first part describes
top-level type SignedData, the second part describes the per-signer the top-level type SignedData, the second part describes the per-
information type SignerInfo, and the third and fourth parts describe signer information type SignerInfo, and the third, fourth, and fifth
the message digest calculation and signature generation processes. parts describe the message digest calculation, signature generation,
and signature validation processes, respectively.
5.1 SignedData Type 5.1 SignedData Type
The signed-data content type is identified by the following object The following object identifier identifies the signed-data content
identifier: type:
id-signedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) id-signedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 } us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 }
The signed-data content type shall have ASN.1 type SignedData: The signed-data content type shall have ASN.1 type SignedData:
SignedData ::= SEQUENCE { SignedData ::= SEQUENCE {
version Version, version Version,
digestAlgorithms DigestAlgorithmIdentifiers, digestAlgorithms DigestAlgorithmIdentifiers,
contentInfo ContentInfo, encapContentInfo EncapsulatedContentInfo,
certificates [0] IMPLICIT CertificateSet OPTIONAL, certificates [0] IMPLICIT CertificateSet OPTIONAL,
crls [1] IMPLICIT CertificateRevocationLists OPTIONAL, crls [1] IMPLICIT CertificateRevocationLists OPTIONAL,
signerInfos SignerInfos } signerInfos SignerInfos }
DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier
EncapsulatedContentInfo ::= SEQUENCE {
eContentType ContentType,
eContent [0] EXPLICIT OCTET STRING OPTIONAL }
ContentType ::= OBJECT IDENTIFIER
SignerInfos ::= SET OF SignerInfo SignerInfos ::= SET OF SignerInfo
The fields of type SignedData have the following meanings: The fields of type SignedData have the following meanings:
version is the syntax version number. If no attribute certificates version is the syntax version number. If no attribute
are present in the certificates field, then the value of version certificates are present in the certificates field, then the value
shall be 1; however, if attribute certificates are present, then of version shall be 1; however, if attribute certificates are
the value of version shall be 3. present, then the value of version shall be 3.
digestAlgorithms is a collection of message digest algorithm digestAlgorithms is a collection of message digest algorithm
identifiers. There may be any number of elements in the identifiers. There may be any number of elements in the
collection, including zero. Each element identifies the message collection, including zero. Each element identifies the message
digest algorithm, along with any associated parameters, used by digest algorithm, along with any associated parameters, used by
one or more signer. The collection is intended to list the message one or more signer. The collection is intended to list the
digest algorithms employed by all of the signers, in any order, to message digest algorithms employed by all of the signers, in any
facilitate one-pass signature verification. The message digesting order, to facilitate one-pass signature verification. The message
process is described in Section 5.3. digesting process is described in Section 5.3.
contentInfo is the content that is signed. It can have any type. encapContentInfo is the content that is signed. It is a sequence
of a content type identifier and the content itself. An object
identifier uniquely specifies the content type. The content
itself is carried in an octet string.
certificates is a collection of certificates. It is intended that certificates is a collection of certificates. It is intended that
the set of certificates be sufficient to contain chains from a the set of certificates be sufficient to contain chains from a
recognized "root" or "top-level certification authority" to all of recognized "root" or "top-level certification authority" to all of
the signers in the signerInfos field. There may be more the signers in the signerInfos field. There may be more
certificates than necessary, and there may be certificates certificates than necessary, and there may be certificates
sufficient to contain chains from two or more independent top- sufficient to contain chains from two or more independent top-
level certification authorities. There may also be fewer level certification authorities. There may also be fewer
certificates than necessary, if it is expected recipients have an certificates than necessary, if it is expected that recipients
alternate means of obtaining necessary certificates (e.g., from a have an alternate means of obtaining necessary certificates (e.g.,
previous set of certificates). If no attribute certificates are from a previous set of certificates). If no attribute
present in the collection, then the value of version shall be 1; certificates are present in the collection, then the value of
however, if attribute certificates are present, then the value of version shall be 1; however, if attribute certificates are
version shall be 3. present, then the value of version shall be 3.
crls is a collection of certificate revocation lists (CRLs). It is crls is a collection of certificate revocation lists (CRLs). It
intended that the set contain information sufficient to determine is intended that the set contain information sufficient to
whether or not the certificates in the certificates field are determine whether or not the certificates in the certificates
valid, but such correspondence is not necessary. There may be more field are valid, but such correspondence is not necessary. There
CRLs than necessary, and there may also be fewer CRLs than may be more CRLs than necessary, and there may also be fewer CRLs
necessary. than necessary.
signerInfos is a collection of per-signer information. There may signerInfos is a collection of per-signer information. There may
be any number of elements in the collection, including zero. be any number of elements in the collection, including zero.
In the degenerate case where there are no signers, the ContentInfo The optional omission of the encapContentInfo field makes it possible
value being "signed" is irrelevant. In this case, the content type to construct "external signatures." In the case of external
within the ContentInfo value being "signed" should be data, and the signatures, the content being signed would be absent from the
content field of the ContentInfo value should be omitted. EncapsulatedContentInfo value included in the signed-data content
type. If the EncapsulatedContentInfo value is absent, the
signatureValue is calculated as though the EncapsulatedContentInfo
value was present. The presumed EncapsulatedContentInfo must have
the content type set to id-data (as defined in section 4) and the
content omitted.
In the degenerate case where there are no signers, the
EncapsulatedContentInfo value being "signed" is irrelevant. In this
case, the content type within the EncapsulatedContentInfo value being
"signed" should be data (as defined in section 4), and the content
field of the EncapsulatedContentInfo value should be omitted.
5.2 SignerInfo Type 5.2 SignerInfo Type
Per-signer information is represented in the type SignerInfo: Per-signer information is represented in the type SignerInfo:
SignerInfo ::= SEQUENCE { SignerInfo ::= SEQUENCE {
version Version, version Version,
issuerAndSerialNumber IssuerAndSerialNumber, issuerAndSerialNumber IssuerAndSerialNumber,
digestAlgorithm DigestAlgorithmIdentifier, digestAlgorithm DigestAlgorithmIdentifier,
authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL, authenticatedAttributes [0] IMPLICIT CMSAttributes OPTIONAL,
signatureAlgorithm SignatureAlgorithmIdentifier, signatureAlgorithm SignatureAlgorithmIdentifier,
signature SignatureValue, signature SignatureValue,
unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL } unauthenticatedAttributes [1] IMPLICIT CMSAttributes OPTIONAL }
Attributes ::= SET OF Attribute CMSAttributes ::= SET OF CMSAttribute
CMSAttribute ::= SEQUENCE {
cmsAttrType OBJECT IDENTIFIER,
critical BOOLEAN DEFAULT FALSE,
cmsAttrValues SET OF CMSAttributeValue }
CMSAttributeValue ::= ANY
SignatureValue ::= OCTET STRING SignatureValue ::= OCTET STRING
The fields of type SignerInfo have the following meanings: The fields of type SignerInfo have the following meanings:
version is the syntax version number. It shall always be 1. version is the syntax version number. If any of the authenticated
attributes, are critical, then the version shall be 3. If all of
the authenticated attributes are non-critical, then the version
shall be 1. If the authenticatedAttributes and field is absent,
then version shall be 1.
issuerAndSerialNumber specifies the signer's certificate (and issuerAndSerialNumber specifies the signer's certificate (and
thereby the signer's public key) by issuer distinguished name and thereby the signer's public key) by issuer distinguished name and
issuer-specific serial number. issuer-specific serial number.
digestAlgorithm identifies the message digest algorithm, and any digestAlgorithm identifies the message digest algorithm, and any
associated parameters, used by the signer. The message digest is associated parameters, used by the signer. The message digest is
computed over the content and authenticated attributes, if computed over the encapsulated content and authenticated
present. The message digest algorithm should be among those listed attributes, if present. The message digest algorithm should be
in the digestAlgorithms field of the superior SignerInfo value. among those listed in the digestAlgorithms field of the associated
The message digesting process is described in Section 5.3. SignerInfo value. The message digesting process is described in
Section 5.3.
authenticatedAttributes is a collection of attributes that are authenticatedAttributes is a collection of attributes that are
signed. The field is optional, but it must be present if the signed. The field is optional, but it must be present if the
content type of the ContentInfo value being signed is not data. If content type of the EncapsulatedContentInfo value being signed is
the field is present, it must contain, at a minimum, two not data. The field may include critical and non-critical
attributes: attributes. Useful attribute types, such as signing time, are
defined in Section 11. If the field is present, it must contain,
at a minimum, the following two attributes:
A content-type attribute having as its value the content type A content-type attribute having as its value the content type
of the ContentInfo value being signed. Section 8.1 defines the of the EncapsulatedContentInfo value being signed. Section
content-type attribute. 11.1 defines the content-type attribute.
A message-digest attribute, having as its value the message A message-digest attribute, having as its value the message
digest of the content. Section 8.2 defines the message-digest digest of the content. Section 11.2 defines the message-digest
attribute. attribute.
Other attribute types that might be useful here, such as
signing time, are defined in Section 8.
signatureAlgorithm identifies the signature algorithm, and any signatureAlgorithm identifies the signature algorithm, and any
associated parameters, used by the signer to generate the digital associated parameters, used by the signer to generate the digital
signature. signature.
signature is the result of digital signature generation, using the signature is the result of digital signature generation, using the
message digest and the signer's private key. message digest and the signer's private key.
unauthenticatedAttributes is a collection of attributes that are unauthenticatedAttributes is a collection of attributes that are
not signed. The field is optional. Attribute types that might be not signed. The field is optional, and it may not include
useful here, such as countersignatures, are defined in Section 10. critical attributes. Useful attribute types, such as
countersignatures, are defined in Section 11.
The fields of type CMSAttribute have the following meanings:
cmsAttrType indicates the type of attribute. It is an object
identifier.
critical is a boolean value. TRUE indicates that the attribute is
critical, and FALSE indicates that the attribute is non-critical.
A recipient must reject the signed-data if it encounters a
critical attribute that it does not recognize; however, an
unrecognized non-critical attribute may be ignored.
cmsAttrValues is a set of values that comprise the attribute. The
type each value in the set can be determined uniquely by
attributeType.
5.3 Message Digest Calculation Process 5.3 Message Digest Calculation Process
The message digest calculation process computes a message digest on The message digest calculation process computes a message digest on
either the content being signed or the content together with the either the content being signed or the content together with the
signer's authenticated attributes. In either case, the initial input signer's authenticated attributes. In either case, the initial input
to the message digest calculation process is the "value" of the to the message digest calculation process is the "value" of the
content being signed. Specifically, the initial input is the content encapsulated content being signed. Specifically, the initial input
octets of the DER encoding of the content field of the ContentInfo is the content OCTET STRING of the content field of the
value to which the signing process is applied. Only the contents EncapsulatedContentInfo value to which the signing process is
octets of the DER encoding of that field are input to the message applied. Only the contents of the OCTET STRING are input to the
digest algorithm, not the identifier octets or the length octets. message digest algorithm, not the identifier octets or the length
octets.
The result of the message digest calculation process depends on The result of the message digest calculation process depends on
whether the authenticatedAttributes field is present. When the field whether the authenticatedAttributes field is present. When the field
is absent, the result is just the message digest of the content as is absent, the result is just the message digest of the content as
described above. When the field is present, however, the result is described above. When the field is present, however, the result is
the message digest of the complete DER encoding of the Attributes the message digest of the complete DER encoding of the Attributes
value contained in the authenticatedAttributes field. Since the value contained in the authenticatedAttributes field. Since the
Attributes value, when the field is present, must contain as Attributes value, when present, must contain as attributes the
attributes the content type and the message digest of the content, content type and the content message digest, those values are
those values are indirectly included in the result. A separate indirectly included in the result. A separate encoding of the
encoding of the authenticatedAttributes field is performed for authenticatedAttributes field is performed for message digest
message digest calculation. The IMPLICIT [0] tag in the calculation. The IMPLICIT [0] tag in the authenticatedAttributes
authenticatedAttributes field is not used for the DER encoding, field is not used for the DER encoding, rather an EXPLICIT SET OF tag
rather an EXPLICIT SET OF tag is used. That is, the DER encoding of is used. That is, the DER encoding of the SET OF tag, rather than of
the SET OF tag, rather than of the IMPLICIT [0] tag, is to be the IMPLICIT [0] tag, is to be included in the message digest
included in the message digest calculation along with the length and calculation along with the length and content octets of the
contents octets of the Attributes value. CMSAttributes value.
When the content being signed has content type data and the When the content being signed has a content type of data (as defined
authenticatedAttributes field is absent, then just the value of the in section 4) and the authenticatedAttributes field is absent, then
data (e.g., the contents of a file) is input to the message digest just the value of the data (e.g., the contents of a file) is input to
calculation. This has the advantage that the length of the content the message digest calculation. This has the advantage that the
being signed need not be known in advance of the encryption process. length of the content being signed need not be known in advance of
the signature generation process.
Although the identifier octets and the length octets are not included Although the identifier octets and the length octets are not included
in the message digest calculation, they are still protected by other in the message digest calculation, they are still protected by other
means. The length octets are protected by the nature of the message means. The length octets are protected by the nature of the message
digest algorithm since it is computationally infeasible to find any digest algorithm since it is computationally infeasible to find any
two distinct messages of any length that have the same message two distinct messages of any length that have the same message
digest. digest.
The fact that the message digest is computed on part of a DER The fact that the message digest is computed on part of a DER
encoding does not mean that DER is the required method of encoding does not mean that DER is the required method of
representing that part for data transfer. Indeed, it is expected that representing that part for data transfer. Indeed, it is expected
some implementations will store objects in forms other than their DER that some implementations will store objects in forms other than
encodings, but such practices do not affect message digest their DER encodings, but such practices do not affect message digest
computation. computation.
5.4 Message Signature Generation Process 5.4 Message Signature Generation Process
The input to the signature generation process includes the result of The input to the signature generation process includes the result of
the message digest calculation process and the signer's private key. the message digest calculation process and the signer's private key.
The details of the signature generation depend on the signature The details of the signature generation depend on the signature
algorithm employed. The object identifier, along with any algorithm employed. The object identifier, along with any
parameters, that specifies the signature algorithm employed by the parameters, that specifies the signature algorithm employed by the
signer is carried in the signatureAlgorithm field. The signature signer is carried in the signatureAlgorithm field. The signature
value generated by the signer is encoded as an OCTET STRING and value generated by the signer is encoded as an OCTET STRING and
carried in the signature field. carried in the signature field.
5.5 Message Signature Validation Process 5.5 Message Signature Validation Process
The input to the signature validation process includes the result of The input to the signature validation process includes the result of
the message digest calculation process and the signer's public key. the message digest calculation process and the signer's public key.
The details of the signature generation depend on the signature The details of the signature validation depend on the signature
algorithm employed. algorithm employed.
The recipient may not rely on any message digest values computed by The recipient may not rely on any message digest values computed by
the originator. If the signedData signerInfo includes the originator. If the signedData signerInfo includes
authenticatedAttributes, then the ASN.1 DER encoded content of the authenticatedAttributes, then content message digest must be
signedData object must be digested as described in section 5.3. For calculated as described in section 5.3. For the signature to be
the signature to be valid, the message digest value calculated by the valid, the message digest value calculated by the recipient must be
recipient must be the same as the value of the messageDigest the same as the value of the messageDigest attribute included in the
attribute included in the authenticatedAttributes of the signedData authenticatedAttributes of the signedData signerInfo.
signerInfo.
6 Enveloped-data Content Type 6 Enveloped-data Content Type
The enveloped-data content type consists of an encrypted content of The enveloped-data content type consists of an encrypted content of
any type and encrypted content-encryption keys for one or more any type and encrypted content-encryption keys for one or more
recipients. The combination of the encrypted content and one recipients. The combination of the encrypted content and one
encrypted content-encryption key for a recipient is a "digital encrypted content-encryption key for a recipient is a "digital
envelope" for that recipient. Any type of content can be enveloped envelope" for that recipient. Any type of content can be enveloped
for any number of recipients. for an arbitrary number of recipients.
The typical application of the enveloped-data content type will The typical application of the enveloped-data content type will
represent one or more recipients' digital envelopes on content of the represent one or more recipients' digital envelopes on content of the
data or signed-data content types. data or signed-data content types.
Enveloped-data is constructed by the following steps: Enveloped-data is constructed by the following steps:
1. A content-encryption key for a particular content-encryption 1. A content-encryption key for a particular content-encryption
algorithm is generated at random. algorithm is generated at random.
skipping to change at page 10, line 5 skipping to change at page 11, line 9
recipient's public key; recipient's public key;
key agreement: the recipient's public key and the sender's key agreement: the recipient's public key and the sender's
private key are used to generate a pairwise symmetric key, then private key are used to generate a pairwise symmetric key, then
the content-encryption key is encrypted in the pairwise the content-encryption key is encrypted in the pairwise
symmetric key; and symmetric key; and
mail list keys: the content-encryption key is encrypted in a mail list keys: the content-encryption key is encrypted in a
previously distributed symmetric key. previously distributed symmetric key.
3. For the originator and each recipient, the encrypted content- 3. For each recipient, the encrypted content-encryption key and
encryption key and other recipient-specific information are other recipient-specific information are collected into a
collected into a RecipientInfo value, defined in Section 6.2. RecipientInfo value, defined in Section 6.2.
4. The content is encrypted with the content-encryption key. 4. The content is encrypted with the content-encryption key.
Content encryption may require that the content be padded to a Content encryption may require that the content be padded to a
multiple of some block size; see Section 6.3. multiple of some block size; see Section 6.3.
5. The RecipientInfo values for all the recipients are collected 5. The RecipientInfo values for all the recipients are collected
together with the encrypted content into a EnvelopedData value as together with the encrypted content to form an EnvelopedData value
defined in Section 6.1. as defined in Section 6.1.
A recipient opens the envelope by decrypting one of the encrypted A recipient opens the digital envelope by decrypting one of the
content-encryption keys and decrypting the encrypted content with the encrypted content-encryption keys and then decrypting the encrypted
recovered content-encryption key. content with the recovered content-encryption key.
This section is divided into four parts. The first part describes the This section is divided into four parts. The first part describes
top-level type EnvelopedData, the second part describes the per- the top-level type EnvelopedData, the second part describes the per-
recipient information type RecipientInfo, and the third and fourth recipient information type RecipientInfo, and the third and fourth
parts describe the content-encryption and key-encryption processes. parts describe the content-encryption and key-encryption processes.
6.1 EnvelopedData Type 6.1 EnvelopedData Type
The enveloped-data content type is identified by the following object The following object identifier identifies the enveloped-data content
identifier: type:
id-envelopedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) id-envelopedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
us(840) rsadsi(113549) pkcs(1) pkcs7(7) 3 } us(840) rsadsi(113549) pkcs(1) pkcs7(7) 3 }
The enveloped-data content type shall have ASN.1 type EnvelopedData: The enveloped-data content type shall have ASN.1 type EnvelopedData:
EnvelopedData ::= SEQUENCE { EnvelopedData ::= SEQUENCE {
version Version, version Version,
originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL, originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
recipientInfos RecipientInfos, recipientInfos RecipientInfos,
skipping to change at page 11, line 38 skipping to change at page 12, line 43
certificates than necessary, if it is expected that recipients certificates than necessary, if it is expected that recipients
have an alternate means of obtaining necessary certificates have an alternate means of obtaining necessary certificates
(e.g., from a previous set of certificates). (e.g., from a previous set of certificates).
crls is a collection of CRLs. It is intended that the set crls is a collection of CRLs. It is intended that the set
contain information sufficient to determine whether or not the contain information sufficient to determine whether or not the
certificates in the certs field are valid, but such certificates in the certs field are valid, but such
correspondence is not necessary. There may be more CRLs than correspondence is not necessary. There may be more CRLs than
necessary, and there may also be fewer CRLs than necessary. necessary, and there may also be fewer CRLs than necessary.
ukms is a collection of UKMs. The set includes a member for ukms is a collection of UKMs. The set includes a UKM for each
each key management algorithm employed by the originator that key management algorithm employed by the originator that
requires a UKM. In general, several recipients will use each requires one. In general, several recipients will use each UKM
UKM in the set. in the set.
recipientInfos is a collection of per-recipient information. There recipientInfos is a collection of per-recipient information.
must be at least one element in the collection. There must be at least one element in the collection.
encryptedContentInfo is the encrypted content information. encryptedContentInfo is the encrypted content information.
The fields of type EncryptedContentInfo have the following meanings: The fields of type EncryptedContentInfo have the following meanings:
contentType indicates the type of content. contentType indicates the type of content.
contentEncryptionAlgorithm identifies the content-encryption contentEncryptionAlgorithm identifies the content-encryption
algorithm, and any associated parameters, used to encrypt the algorithm, and any associated parameters, used to encrypt the
content. The content-encryption process is described in Section content. The content-encryption process is described in Section
skipping to change at page 14, line 21 skipping to change at page 15, line 25
encryption key from a set that was previously distributed to the encryption key from a set that was previously distributed to the
sender and the recipient. sender and the recipient.
other is optional. When present, this field contains additional other is optional. When present, this field contains additional
information used by the recipient to locate the keying material information used by the recipient to locate the keying material
used by the sender. used by the sender.
6.3 Content-encryption Process 6.3 Content-encryption Process
The input to the content-encryption process is the "value" of the The input to the content-encryption process is the "value" of the
content being enveloped. Specifically, the input is the content content being enveloped. Only the content octets; identifier or
octets of a definite-length BER encoding of the content field of the length octets are not included.
ContentInfo value. Only the content octets of the BER encoding are
encrypted, not the identifier octets or length octets; those other
octets are not included.
When the content being enveloped has content type data, then just the When the content being enveloped has content type of data (as defined
value of the data (e.g., the contents of a file) is encrypted. This in section 4), then just the value of the data (e.g., the contents of
has the advantage that the length of the content being encrypted need a file) is encrypted. This has the advantage that the length of the
not be known in advance of the encryption process. content being encrypted need not be known in advance of the
encryption process.
The identifier octets and the length octets are not encrypted. The The identifier octets and the length octets are not encrypted. The
length octets may be protected implicitly by the encryption process, length octets may be protected implicitly by the encryption process,
depending on the encryption algorithm. The identifier octets are not depending on the encryption algorithm. The identifier octets are not
protected at all, although they can be recovered from the content protected at all, although they can be recovered from the content
type, assuming that the content type uniquely determines the type, assuming that the content type uniquely determines the
identifier octets. Explicit protection of the identifier and length identifier octets. Explicit protection of the identifier and length
octets requires that the signed-data content type be employed prior octets requires that the signed-data content type be employed prior
to enveloping. to digital enveloping.
A definite-length BER encoding is used to ensure that the bit
indicating whether the length is definite or indefinite is not
recorded in the enveloped-data content type. Definite-length encoding
is more appropriate for simple types such as octet strings, so
definite-length encoding is chosen.
Some content-encryption algorithms assume the input length is a Some content-encryption algorithms assume the input length is a
multiple of k octets, where k is greater than one. For such multiple of k octets, where k is greater than one. For such
algorithms, the input shall be padded at the trailing end with algorithms, the input shall be padded at the trailing end with
k-(l mod k) octets all having value k-(l mod k), where l is the k-(l mod k) octets all having value k-(l mod k), where l is the
length of the input. In other words, the input is padded at the length of the input. In other words, the input is padded at the
trailing end with one of the following strings: trailing end with one of the following strings:
01 -- if l mod k = k-1 01 -- if l mod k = k-1
02 02 -- if l mod k = k-2 02 02 -- if l mod k = k-2
. .
. .
. .
k k ... k k -- if l mod k = 0 k k ... k k -- if l mod k = 0
The padding can be removed unambiguously since all input is padded, The padding can be removed unambiguously since all input is padded,
including input values that are already a multiple of the block size, including input values that are already a multiple of the block size,
and no padding string is a suffix of another. This padding method is and no padding string is a suffix of another. This padding method is
well-defined if and only if k is less than 256. well defined if and only if k is less than 256.
6.4 Key-encryption Process 6.4 Key-encryption Process
The input to the key-encryption process -- the value supplied to the The input to the key-encryption process -- the value supplied to the
recipient's key-encryption algorithm --is just the "value" of the recipient's key-encryption algorithm --is just the "value" of the
content-encryption key. content-encryption key.
7 Digested-data Content Type 7 Digested-data Content Type
The digested-data content type consists of content of any type and a The digested-data content type consists of content of any type and a
message digest of the content. message digest of the content.
The typical application of the digested-data content type will be to Typically, the digested-data content type is used to provide content
provide content integrity, and that the result generally becomes the integrity, and the result generally becomes an input to the
input to the enveloped-data content type. enveloped-data content type.
Digested-data is constructed by the following steps: The following steps construct digested-data:
1. A message digest is computed on the content with a message- 1. A message digest is computed on the content with a message-
digest algorithm. digest algorithm.
2. The message-digest algorithm and the message digest are 2. The message-digest algorithm and the message digest are
collected together with the content into a DigestedData value. collected together with the content into a DigestedData value.
A recipient verifies the message digest by comparing the message A recipient verifies the message digest by comparing the message
digest to an independently computed message digest. digest to an independently computed message digest.
The digested-data content type is identified by the following object The following object identifier identifies the digested-data content
identifier: type:
id-digestedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) id-digestedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
us(840) rsadsi(113549) pkcs(1) pkcs7(7) 5 } us(840) rsadsi(113549) pkcs(1) pkcs7(7) 5 }
The digested-data content type shall have ASN.1 type DigestedData: The digested-data content type shall have ASN.1 type DigestedData:
DigestedData ::= SEQUENCE { DigestedData ::= SEQUENCE {
version Version, version Version,
digestAlgorithm DigestAlgorithmIdentifier, digestAlgorithm DigestAlgorithmIdentifier,
contentInfo ContentInfo, encapContentInfo EncapsulatedContentInfo,
digest Digest } digest Digest }
Digest ::= OCTET STRING Digest ::= OCTET STRING
The fields of type DigestedData have the following meanings: The fields of type DigestedData have the following meanings:
version is the syntax version number. It shall be 0. version is the syntax version number. It shall be 0.
digestAlgorithm identifies the message digest algorithm, and any digestAlgorithm identifies the message digest algorithm, and any
associated parameters, under which the content is digested. The associated parameters, under which the content is digested. The
message-digesting process is the same as in Section 5.3 in the message-digesting process is the same as in Section 5.3 in the
case when there are no authenticated attributes. case when there are no authenticated attributes.
contentInfo is the content that is digested. It may have any of encapContentInfo is the content that is digested, as defined in
the defined content types. section 5.1.
digest is the result of the message-digesting process. digest is the result of the message-digesting process.
The ordering of the digestAlgorithm field, the contentInfo field, and The ordering of the digestAlgorithm field, the encapContentInfo
the digest field makes it possible to process a DigestedData value in field, and the digest field makes it possible to process a
a single pass. DigestedData value in a single pass.
8 Encrypted-data Content Type 8 Encrypted-data Content Type
The encrypted-data content type consists of encrypted content of any The encrypted-data content type consists of encrypted content of any
type. Unlike the enveloped-data content type, the encrypted-data type. Unlike the enveloped-data content type, the encrypted-data
content type has neither recipients nor encrypted content-encryption content type has neither recipients nor encrypted content-encryption
keys. Keys are assumed to be managed by other means. keys. Keys must be managed by other means.
The typical application of the encrypted-data content type will be to The typical application of the encrypted-data content type will be to
encrypt the content of the data content type for local storage, encrypt the content of the data content type for local storage,
perhaps where the encryption key is a password. perhaps where the encryption key is a password.
The encrypted-data content type is identified by the following object The following object identifier identifies the encrypted-data content
identifier: type:
id-encryptedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) id-encryptedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
us(840) rsadsi(113549) pkcs(1) pkcs7(7) 6 } us(840) rsadsi(113549) pkcs(1) pkcs7(7) 6 }
The encrypted-data content type shall have ASN.1 type EncryptedData: The encrypted-data content type shall have ASN.1 type EncryptedData:
EncryptedData ::= SEQUENCE { EncryptedData ::= SEQUENCE {
version Version, version Version,
encryptedContentInfo EncryptedContentInfo } encryptedContentInfo EncryptedContentInfo }
The fields of type EncryptedData have the following meanings: The fields of type EncryptedData have the following meanings:
version is the syntax version number. It shall be 0. version is the syntax version number. It shall be 0.
encryptedContentInfo is the encrypted content information, as encryptedContentInfo is the encrypted content information, as
defined in Section 6.1. defined in Section 6.1.
9 Useful Types 9 Authenticated-data Content Type
The authenticated-data content type consists of content of any type,
a message authentication code (MAC), and encrypted authentication
keys for one or more recipients. The combination of the MAC and one
encrypted authentication key for a recipient is necessary for that
recipient to validate the integrity of the content. Any type of
content can be integrity protected for an arbitrary number of
recipients.
The following object identifier identifies the authenticated-data
content type:
id-ct-authData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16)
ct(1) 2 }
The authenticated-data content type shall have ASN.1 type
AuthenticatedData:
AuthenticatedData ::= SEQUENCE {
version Version,
originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
recipientInfos RecipientInfos,
macAlgorithm MessageAuthenticationCodeAlgorithm,
encapContentInfo EncapsulatedContentInfo,
mac MessageAuthenticationCode }
MessageAuthenticationCode ::= OCTET STRING
The fields of type AuthenticatedData have the following meanings:
version is the syntax version number. It shall be 0.
originatorInfo optionally provides information about the
originator. It is present only if required by the key management
algorithm. It may contain certificates, CRLs, and user keying
material (UKMs), as defined in Section 6.1.
recipientInfos is a collection of per-recipient information, as
defined in Section 6.1. There must be at least one element in the
collection.
macAlgorithm is a message authentication code algorithm
identifier. It identifies the message authentication code
algorithm, along with any associated parameters, used by the
originator. Placement of the macAlgorithm field facilitates one-
pass processing by the recipient.
encapContentInfo is the content that is authenticated, as defined
in section 5.1.
mac is the message authentication code.
10 Useful Types
This section defines types that are used other places in the This section defines types that are used other places in the
document. The types are not listed in any particular order. document. The types are not listed in any particular order.
9.1 CertificateRevocationLists 10.1 CertificateRevocationLists
The CertificateRevocationLists type gives a set of certificate The CertificateRevocationLists type gives a set of certificate
revocation lists (CRLs). It is intended that the set contain revocation lists (CRLs). It is intended that the set contain
information sufficient to determine whether the certificates with information sufficient to determine whether the certificates with
which the set is associated are revoked or not. However, there may which the set is associated are revoked or not. However, there may
be more CRLs than necessary, or there may be fewer than necessary. be more CRLs than necessary or there may be fewer CRLs than
necessary.
The definition of CertificateList is imported from X.509. The definition of CertificateList is imported from X.509.
CertificateRevocationLists ::= SET OF CertificateList CertificateRevocationLists ::= SET OF CertificateList
9.2 ContentEncryptionAlgorithmIdentifier 10.2 ContentEncryptionAlgorithmIdentifier
The ContentEncryptionAlgorithmIdentifier type identifies a content- The ContentEncryptionAlgorithmIdentifier type identifies a content-
encryption algorithm such as DES. A content-encryption algorithm encryption algorithm such as DES. A content-encryption algorithm
supports encryption and decryption operations. The encryption supports encryption and decryption operations. The encryption
operation maps an octet string (the message) to another octet string operation maps an octet string (the message) to another octet string
(the ciphertext) under control of a content-encryption key. The (the ciphertext) under control of a content-encryption key. The
decryption operation is the inverse of the encryption operation. decryption operation is the inverse of the encryption operation.
Context determines which operation is intended. Context determines which operation is intended.
The definition of AlgorithmIdentifier is imported from X.509. The definition of AlgorithmIdentifier is imported from X.509.
ContentEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier ContentEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
9.3 DigestAlgorithmIdentifier 10.3 DigestAlgorithmIdentifier
The DigestAlgorithmIdentifier type identifies a message-digest The DigestAlgorithmIdentifier type identifies a message-digest
algorithm. Examples include SHA-1, MD2, and MD5. A message-digest algorithm. Examples include SHA-1, MD2, and MD5. A message-digest
algorithm maps an octet string (the message) to another octet string algorithm maps an octet string (the message) to another octet string
(the message digest). (the message digest).
The definition of AlgorithmIdentifier is imported from X.509. The definition of AlgorithmIdentifier is imported from X.509.
DigestAlgorithmIdentifier ::= AlgorithmIdentifier DigestAlgorithmIdentifier ::= AlgorithmIdentifier
9.4 SignatureAlgorithmIdentifier 10.4 SignatureAlgorithmIdentifier
The SignatureAlgorithmIdentifier type identifies a signature The SignatureAlgorithmIdentifier type identifies a signature
algorithm. Examples include DSS and RSA. A signature algorithm algorithm. Examples include DSS and RSA. A signature algorithm
supports signature generation and verification operations. The supports signature generation and verification operations. The
signature generation operation uses the message digest and the signature generation operation uses the message digest and the
signer's private key to generate a signature value. The signature signer's private key to generate a signature value. The signature
verification operation uses the message digest and the signer's verification operation uses the message digest and the signer's
public key to determine whether or not a signature value is valid. public key to determine whether or not a signature value is valid.
Context determines which operation is intended. Context determines which operation is intended.
The definition of AlgorithmIdentifier is imported from X.509. The definition of AlgorithmIdentifier is imported from X.509.
SignatureAlgorithmIdentifier ::= AlgorithmIdentifier SignatureAlgorithmIdentifier ::= AlgorithmIdentifier
9.5 CertificateChoices 10.5 CertificateChoices
The CertificateChoices type gives either a PKCS #6 extended The CertificateChoices type gives either a PKCS #6 extended
certificate, an X.509 certificate, or an X.509 attribute certificate. certificate, an X.509 certificate, or an X.509 attribute certificate.
The PKCS #6 extended certificate is obsolete. It is included for The PKCS #6 extended certificate is obsolete. It is included for
backwards compatibility, and its use should be avoided. backward compatibility, and its use should be avoided.
The definitions of Certificate and AttributeCertificate are imported The definitions of Certificate and AttributeCertificate are imported
from X.509. from X.509.
CertificateChoices ::= CHOICE { CertificateChoices ::= CHOICE {
certificate Certificate, -- See X.509 certificate Certificate, -- See X.509
extendedCertificate [0] IMPLICIT ExtendedCertificate, -- Obsolete extendedCertificate [0] IMPLICIT ExtendedCertificate, -- Obsolete
attrCert [1] IMPLICIT AttributeCertificate } -- See X.509 and X9.57 attrCert [1] IMPLICIT AttributeCertificate } -- See X.509 and X9.57
9.6 CertificateSet 10.6 CertificateSet
The CertificateSet type provides a set of certificates. It is The CertificateSet type provides a set of certificates. It is
intended that the set be sufficient to contain chains from a intended that the set be sufficient to contain chains from a
recognized "root" or "top-level certification authority" to all of recognized "root" or "top-level certification authority" to all of
the sender certificates with which the set is associated. However, the sender certificates with which the set is associated. However,
there may be more certificates than necessary, or there may be fewer there may be more certificates than necessary, or there may be fewer
than necessary. than necessary.
The precise meaning of a "chain" is outside the scope of this The precise meaning of a "chain" is outside the scope of this
document. Some applications may impose upper limits on the length of document. Some applications may impose upper limits on the length of
a chain; others may enforce certain relationships between the a chain; others may enforce certain relationships between the
subjects and issuers of certificates within a chain. subjects and issuers of certificates within a chain.
CertificateSet ::= SET OF CertificateChoices CertificateSet ::= SET OF CertificateChoices
9.7 IssuerAndSerialNumber 10.7 IssuerAndSerialNumber
The IssuerAndSerialNumber type identifies a certificate, and thereby The IssuerAndSerialNumber type identifies a certificate, and thereby
an entity and a public key, by the distinguished name of the an entity and a public key, by the distinguished name of the
certificate issuer and an issuer-specific certificate serial number. certificate issuer and an issuer-specific certificate serial number.
The definition of Name is imported from X.501, and the definition of The definition of Name is imported from X.501, and the definition of
SerialNumber is imported from X.509. SerialNumber is imported from X.509.
IssuerAndSerialNumber ::= SEQUENCE { IssuerAndSerialNumber ::= SEQUENCE {
issuer Name, issuer Name,
serialNumber SerialNumber } serialNumber SerialNumber }
SerialNumber ::= INTEGER SerialNumber ::= INTEGER
9.8 KeyEncryptionAlgorithmIdentifier 10.8 KeyEncryptionAlgorithmIdentifier
The KeyEncryptionAlgorithmIdentifier type identifies a key-encryption The KeyEncryptionAlgorithmIdentifier type identifies a key-encryption
algorithm used to encrypt a content-encryption key. The encryption algorithm used to encrypt a content-encryption key. The encryption
operation maps an octet string (the key) to another octet string (the operation maps an octet string (the key) to another octet string (the
encrypted key) under control of a key-encryption key. The decryption encrypted key) under control of a key-encryption key. The decryption
operation is the inverse of the encryption operation. Context operation is the inverse of the encryption operation. Context
determines which operation is intended. determines which operation is intended.
The details of encryption and decryption depend on the key management The details of encryption and decryption depend on the key management
algorithm used. Key transport, key agreement, and previously algorithm used. Key transport, key agreement, and previously
distributed symmetric key-encrypting keys are supported. distributed symmetric key-encrypting keys are supported.
The definition of AlgorithmIdentifier is imported from X.509. The definition of AlgorithmIdentifier is imported from X.509.
KeyEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier KeyEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
9.9 Version 10.9 Version
The Version type gives a syntax version number, for compatibility The Version type gives a syntax version number, for compatibility
with future revisions of this document. with future revisions of this document.
Version ::= INTEGER Version ::= INTEGER
9.10 UserKeyingMaterial 10.10 UserKeyingMaterial
The UserKeyingMaterial type gives a syntax user keying material The UserKeyingMaterial type gives a syntax user keying material
(UKM). Some key management algorithms require UKMs. The sender (UKM). Some key management algorithms require UKMs. The sender
provides a UKM for the specific key management algorithm. provides a UKM for the specific key management algorithm. The UKM is
employed by all of the recipients that use the same key encryption
The definition of AlgorithmIdentifier is imported from X.509. algorithm.
UserKeyingMaterial ::= SEQUENCE { UserKeyingMaterial ::= SEQUENCE {
algorithm AlgorithmIdentifier, keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
ukm OCTET STRING } ukm OCTET STRING }
9.11 UserKeyingMaterials 10.11 UserKeyingMaterials
The UserKeyingMaterial type provides a set of user keying materials The UserKeyingMaterial type provides a set of user keying materials
(UKMs). This allows the sender to provide a UKM for each key (UKMs). This allows the sender to provide a UKM for each key
management algorithm that requires one. management algorithm that requires one.
UserKeyingMaterials ::= SET OF UserKeyingMaterial UserKeyingMaterials ::= SET OF UserKeyingMaterial
9.12 OtherKeyAttribute 10.12 OtherKeyAttribute
The OtherKeyAttribute type gives a syntax for the inclusion of other The OtherKeyAttribute type gives a syntax for the inclusion of other
key attributes that permit the recipient to select the key used by key attributes that permit the recipient to select the key used by
the sender. The attribute object identifier must be registered along the sender. The attribute object identifier must be registered along
with the syntax of the attribute itself. Use of this structure should with the syntax of the attribute itself. Use of this structure
be avoided since it may impede interoperability. should be avoided since it may impede interoperability.
OtherKeyAttribute ::= SEQUENCE { OtherKeyAttribute ::= SEQUENCE {
keyAttrId OBJECT IDENTIFIER, keyAttrId OBJECT IDENTIFIER,
keyAttr ANY DEFINED BY keyAttrId OPTIONAL } keyAttr ANY DEFINED BY keyAttrId OPTIONAL }
10 Useful Attributes 10.13 MessageAuthenticationCodeAlgorithm
The MessageAuthenticationCodeAlgorithm type identifies a message
authentication code (MAC) algorithm. Examples include DES MAC and
HMAC. A MAC algorithm supports generation and verification
operations. The MAC generation and verification operations use the
same symmetric key. Context determines which operation is intended.
The definition of AlgorithmIdentifier is imported from X.509.
MessageAuthenticationCodeAlgorithm ::= AlgorithmIdentifier
11 Useful Attributes
This section defines attributes that may used with signed-data. All This section defines attributes that may used with signed-data. All
of these attributes ware originally defined in PKCS #9, and they are of these attributes were originally defined in PKCS #9, and they are
included here for easy reference. The attributes are not listed in included here for easy reference. The attributes are not listed in
any particular order. any particular order.
10.1 Content Type 11.1 Content Type
The content-type attribute type specifies the content type of the The content-type attribute type specifies the content type of the
ContentInfo value being signed in signed-data. The content-type ContentInfo value being signed in signed-data. The content-type
attribute type is required if there are any authenticated attributes attribute type is required if there are any authenticated attributes
present. present.
The content-type attribute is identified by the following object The following object identifier identifies the content-type
identifier: attribute:
id-contentType OBJECT IDENTIFIER ::= { iso(1) member-body(2) id-contentType OBJECT IDENTIFIER ::= { iso(1) member-body(2)
us(840) rsadsi(113549) pkcs(1) pkcs9(9) 3 } us(840) rsadsi(113549) pkcs(1) pkcs9(9) 3 }
Content-type attribute values have ASN.1 type ContentType: Content-type attribute values have ASN.1 type ContentType:
ContentType ::= OBJECT IDENTIFIER ContentType ::= OBJECT IDENTIFIER
A content-type attribute must have a single attribute value. A content-type attribute must have a single attribute value.
10.2 Message Digest 11.2 Message Digest
The message-digest attribute type specifies the message digest of the The message-digest attribute type specifies the message digest of the
contents octets of the DER encoding of the content field of the contents octets of the DER encoding of the content field of the
ContentInfo value being signed in signed-data, where the message ContentInfo value being signed in signed-data, where the message
digest is computed using the signer's message digest algorithm. The digest is computed using the signer's message digest algorithm. The
message-digest attribute type is required if there are any message-digest attribute type is required if there are any
authenticated attributes present. authenticated attributes present.
The message-digest attribute is identified by the following object The following object identifier identifies the message-digest
identifier: attribute:
id-messageDigest OBJECT IDENTIFIER ::= { iso(1) member-body(2) id-messageDigest OBJECT IDENTIFIER ::= { iso(1) member-body(2)
us(840) rsadsi(113549) pkcs(1) pkcs9(9) 4 } us(840) rsadsi(113549) pkcs(1) pkcs9(9) 4 }
Message-digest attribute values have ASN.1 type MessageDigest: Message-digest attribute values have ASN.1 type MessageDigest:
MessageDigest ::= OCTET STRING MessageDigest ::= OCTET STRING
A message-digest attribute must have a single attribute value. A message-digest attribute must have a single attribute value.
10.3 Signing Time 11.3 Signing Time
The signing-time attribute type specifies the time at which the The signing-time attribute type specifies the time at which the
signer (purportedly) performed the signing process. The signing-time signer (purportedly) performed the signing process. The signing-time
attribute type is intended for use in signed-data. attribute type is intended for use in signed-data.
The signing-time attribute is identified by the following object The following object identifier identifies the signing-time
identifier: attribute:
id-signingTime OBJECT IDENTIFIER ::= { iso(1) member-body(2) id-signingTime OBJECT IDENTIFIER ::= { iso(1) member-body(2)
us(840) rsadsi(113549) pkcs(1) pkcs9(9) 5 } us(840) rsadsi(113549) pkcs(1) pkcs9(9) 5 }
Signing-time attribute values have ASN.1 type SigningTime: Signing-time attribute values have ASN.1 type SigningTime:
SigningTime ::= Time SigningTime ::= Time
Time ::= CHOICE { Time ::= CHOICE {
utcTime UTCTime, utcTime UTCTime,
skipping to change at page 22, line 24 skipping to change at page 24, line 39
Dates through the year 2049 must be encoded as UTCTime, and dates in Dates through the year 2049 must be encoded as UTCTime, and dates in
the year 2050 or later must be encoded as GeneralizedTime. the year 2050 or later must be encoded as GeneralizedTime.
A signing-time attribute must have a single attribute value. A signing-time attribute must have a single attribute value.
No requirement is imposed concerning the correctness of the signing No requirement is imposed concerning the correctness of the signing
time, and acceptance of a purported signing time is a matter of a time, and acceptance of a purported signing time is a matter of a
recipient's discretion. It is expected, however, that some signers, recipient's discretion. It is expected, however, that some signers,
such as time-stamp servers, will be trusted implicitly. such as time-stamp servers, will be trusted implicitly.
10.4 Countersignature 11.4 Countersignature
The countersignature attribute type specifies one or more signatures The countersignature attribute type specifies one or more signatures
on the contents octets of the DER encoding of the signatureValue on the contents octets of the DER encoding of the signatureValue
field of a SignerInfo value in signed-data. Thus, the field of a SignerInfo value in signed-data. Thus, the
countersignature attribute type countersigns (signs in serial) countersignature attribute type countersigns (signs in serial)
another signature. The countersignature attribute must be an another signature. The countersignature attribute must be an
unauthenticated attribute; it cannot be an authenticated attribute. unauthenticated attribute; it cannot be an authenticated attribute.
The signing-time attribute is identified by the following object
identifier: The following object identifier identifies the countersignature
attribute:
id-countersignature OBJECT IDENTIFIER ::= { iso(1) member-body(2) id-countersignature OBJECT IDENTIFIER ::= { iso(1) member-body(2)
us(840) rsadsi(113549) pkcs(1) pkcs9(9) 6 } us(840) rsadsi(113549) pkcs(1) pkcs9(9) 6 }
Countersignature attribute values have ASN.1 type Countersignature: Countersignature attribute values have ASN.1 type Countersignature:
Countersignature ::= SignerInfo Countersignature ::= SignerInfo
Countersignature values have the same meaning as SignerInfo values Countersignature values have the same meaning as SignerInfo values
for ordinary signatures, except that: for ordinary signatures, except that:
skipping to change at page 23, line 15 skipping to change at page 25, line 37
A countersignature attribute can have multiple attribute values. A countersignature attribute can have multiple attribute values.
The fact that a countersignature is computed on a signature value The fact that a countersignature is computed on a signature value
means that the countersigning process need not know the original means that the countersigning process need not know the original
content input to the signing process. This has advantages both in content input to the signing process. This has advantages both in
efficiency and in confidentiality. A countersignature, since it has efficiency and in confidentiality. A countersignature, since it has
type SignerInfo, can itself contain a countersignature attribute. type SignerInfo, can itself contain a countersignature attribute.
Thus it is possible to construct arbitrarily long series of Thus it is possible to construct arbitrarily long series of
countersignatures. countersignatures.
11 Supported Algorithms 12 Supported Algorithms
To be supplied. However, this section will list the must implement To be supplied. However, this section will list the must implement
algorithms and other algorithms that may be implemented. Here are my algorithms and other algorithms that may be implemented. It will
current thoughts... include:
MUST implement: DSS, SHA-1, Diffie-Hellman (X9.42), and Triple-DES MUST implement: DSS, SHA-1, Diffie-Hellman (X9.42), and Triple-DES
CBC (with three keys). CBC (with three keys).
MAY implement: RSA (signature and key management), MD5, KEA, RC2, DES MAY implement: RSA (signature and key management), MD5, RC2 (40 bit),
CBC, and SKIPJACK. DES CBC, and DES MAC.
Appendix A: ASN.1 Module Appendix A: ASN.1 Module
CryptographicMessageSyntax CryptographicMessageSyntax
{ iso(1) member-body(2) us(840) rsadsi(113549) { iso(1) member-body(2) us(840) rsadsi(113549)
pkcs(1) pkcs-9(9) smime(16) modules(0) cms(1) } pkcs(1) pkcs-9(9) smime(16) modules(0) cms(1) }
DEFINITIONS IMPLICIT TAGS ::= DEFINITIONS IMPLICIT TAGS ::=
BEGIN BEGIN
IMPORTS IMPORTS
-- Directory Information Framework (X.501) -- Directory Information Framework (X.501)
Attribute, Name Name
FROM InformationFramework { joint-iso-itu-t ds(5) modules(1) FROM InformationFramework { joint-iso-itu-t ds(5) modules(1)
informationFramework(1) 3 } informationFramework(1) 3 }
-- Directory Authentication Framework (X.509) -- Directory Authentication Framework (X.509)
AlgorithmIdentifier, AttributeCertificate, Certificate, AlgorithmIdentifier, AttributeCertificate, Certificate,
CertificateList, CertificateSerialNumber CertificateList, CertificateSerialNumber
FROM AuthenticationFramework { joint-iso-itu-t ds(5) module(1) FROM AuthenticationFramework { joint-iso-itu-t ds(5)
authenticationFramework(7) 3 } ; module(1) authenticationFramework(7) 3 } ;
-- Cryptographic Message Syntax -- Cryptographic Message Syntax
ContentInfo ::= SEQUENCE { ContentInfo ::= SEQUENCE {
contentType ContentType, contentType ContentType,
content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL } content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
ContentType ::= OBJECT IDENTIFIER ContentType ::= OBJECT IDENTIFIER
Data ::= OCTET STRING
SignedData ::= SEQUENCE { SignedData ::= SEQUENCE {
version Version, version Version,
digestAlgorithms DigestAlgorithmIdentifiers, digestAlgorithms DigestAlgorithmIdentifiers,
contentInfo ContentInfo, encapContentInfo EncapsulatedContentInfo,
certificates [0] IMPLICIT CertificateSet OPTIONAL, certificates [0] IMPLICIT CertificateSet OPTIONAL,
crls [1] IMPLICIT CertificateRevocationLists OPTIONAL, crls [1] IMPLICIT CertificateRevocationLists OPTIONAL,
signerInfos SignerInfos } signerInfos SignerInfos }
DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier
SignerInfos ::= SET OF SignerInfo
EncapsulatedContentInfo ::= SEQUENCE {
eContentType ContentType,
eContent [0] EXPLICIT OCTET STRING OPTIONAL }
SignerInfos ::= SET OF SignerInfo
SignerInfo ::= SEQUENCE { SignerInfo ::= SEQUENCE {
version Version, version Version,
issuerAndSerialNumber IssuerAndSerialNumber, issuerAndSerialNumber IssuerAndSerialNumber,
digestAlgorithm DigestAlgorithmIdentifier, digestAlgorithm DigestAlgorithmIdentifier,
authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL, authenticatedAttributes [0] IMPLICIT CMSAttributes OPTIONAL,
signatureAlgorithm SignatureAlgorithmIdentifier, signatureAlgorithm SignatureAlgorithmIdentifier,
signature SignatureValue, signature SignatureValue,
unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL } unauthenticatedAttributes [1] IMPLICIT CMSAttributes OPTIONAL }
Attributes ::= SET OF Attribute CMSAttributes ::= SET OF CMSAttribute
CMSAttribute ::= SEQUENCE {
cmsAttrType OBJECT IDENTIFIER,
critical BOOLEAN DEFAULT FALSE,
cmsAttrValues SET OF CMSAttributeValue }
CMSAttributeValue ::= ANY
SignatureValue ::= OCTET STRING SignatureValue ::= OCTET STRING
EnvelopedData ::= SEQUENCE { EnvelopedData ::= SEQUENCE {
version Version, version Version,
originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL, originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
recipientInfos RecipientInfos, recipientInfos RecipientInfos,
encryptedContentInfo EncryptedContentInfo } encryptedContentInfo EncryptedContentInfo }
OriginatorInfo ::= SEQUENCE { OriginatorInfo ::= SEQUENCE {
skipping to change at page 26, line 25 skipping to change at page 28, line 30
issuerAndSerialNumber IssuerAndSerialNumber, issuerAndSerialNumber IssuerAndSerialNumber,
subjectKeyIdentifier SubjectKeyIdentifier } subjectKeyIdentifier SubjectKeyIdentifier }
SubjectKeyIdentifier ::= OCTET STRING SubjectKeyIdentifier ::= OCTET STRING
EncryptedKey ::= OCTET STRING EncryptedKey ::= OCTET STRING
DigestedData ::= SEQUENCE { DigestedData ::= SEQUENCE {
version Version, version Version,
digestAlgorithm DigestAlgorithmIdentifier, digestAlgorithm DigestAlgorithmIdentifier,
contentInfo ContentInfo, encapContentInfo EncapsulatedContentInfo,
digest Digest } digest Digest }
Digest ::= OCTET STRING Digest ::= OCTET STRING
EncryptedData ::= SEQUENCE { EncryptedData ::= SEQUENCE {
version Version, version Version,
encryptedContentInfo EncryptedContentInfo } encryptedContentInfo EncryptedContentInfo }
AuthenticatedData ::= SEQUENCE {
version Version,
originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
recipientInfos RecipientInfos,
macAlgorithm MessageAuthenticationCodeAlgorithm,
encapContentInfo EncapsulatedContentInfo,
mac MessageAuthenticationCode }
MessageAuthenticationCode ::= OCTET STRING
CertificateRevocationLists ::= SET OF CertificateList CertificateRevocationLists ::= SET OF CertificateList
ContentEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier ContentEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
DigestAlgorithmIdentifier ::= AlgorithmIdentifier DigestAlgorithmIdentifier ::= AlgorithmIdentifier
SignatureAlgorithmIdentifier ::= AlgorithmIdentifier SignatureAlgorithmIdentifier ::= AlgorithmIdentifier
CertificateChoices ::= CHOICE { CertificateChoices ::= CHOICE {
certificate Certificate, -- See X.509 certificate Certificate, -- See X.509
extendedCertificate [0] IMPLICIT ExtendedCertificate, -- Obsolete extendedCertificate [0] IMPLICIT ExtendedCertificate, -- Obsolete
attrCert [1] IMPLICIT AttributeCertificate } -- See X.509 and X9.57 attrCert [1] IMPLICIT AttributeCertificate } -- See X.509 and X9.57
CertificateSet ::= SET OF CertificateChoices CertificateSet ::= SET OF CertificateChoices
skipping to change at page 27, line 20 skipping to change at page 29, line 35
UserKeyingMaterial ::= SEQUENCE { UserKeyingMaterial ::= SEQUENCE {
algorithm AlgorithmIdentifier, algorithm AlgorithmIdentifier,
ukm OCTET STRING } ukm OCTET STRING }
UserKeyingMaterials ::= SET OF UserKeyingMaterial UserKeyingMaterials ::= SET OF UserKeyingMaterial
OtherKeyAttribute ::= SEQUENCE { OtherKeyAttribute ::= SEQUENCE {
keyAttrId OBJECT IDENTIFIER, keyAttrId OBJECT IDENTIFIER,
keyAttr ANY DEFINED BY keyAttrId OPTIONAL } keyAttr ANY DEFINED BY keyAttrId OPTIONAL }
-- Attributes MessageAuthenticationCodeAlgorithm ::= AlgorithmIdentifier
-- CMS Attributes
MessageDigest ::= OCTET STRING MessageDigest ::= OCTET STRING
SigningTime ::= Time SigningTime ::= Time
Time ::= CHOICE { Time ::= CHOICE {
utcTime UTCTime, utcTime UTCTime,
generalTime GeneralizedTime } generalTime GeneralizedTime }
Countersignature ::= SignerInfo Countersignature ::= SignerInfo
skipping to change at page 28, line 4 skipping to change at page 30, line 20
us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 } us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 }
id-envelopedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) id-envelopedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
us(840) rsadsi(113549) pkcs(1) pkcs7(7) 3 } us(840) rsadsi(113549) pkcs(1) pkcs7(7) 3 }
id-digestedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) id-digestedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
us(840) rsadsi(113549) pkcs(1) pkcs7(7) 5 } us(840) rsadsi(113549) pkcs(1) pkcs7(7) 5 }
id-encryptedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) id-encryptedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
us(840) rsadsi(113549) pkcs(1) pkcs7(7) 6 } us(840) rsadsi(113549) pkcs(1) pkcs7(7) 6 }
id-ct-authData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16)
ct(1) 2 }
id-contentType OBJECT IDENTIFIER ::= { iso(1) member-body(2) id-contentType OBJECT IDENTIFIER ::= { iso(1) member-body(2)
us(840) rsadsi(113549) pkcs(1) pkcs9(9) 3 } us(840) rsadsi(113549) pkcs(1) pkcs9(9) 3 }
id-messageDigest OBJECT IDENTIFIER ::= { iso(1) member-body(2) id-messageDigest OBJECT IDENTIFIER ::= { iso(1) member-body(2)
us(840) rsadsi(113549) pkcs(1) pkcs9(9) 4 } us(840) rsadsi(113549) pkcs(1) pkcs9(9) 4 }
id-signingTime OBJECT IDENTIFIER ::= { iso(1) member-body(2) id-signingTime OBJECT IDENTIFIER ::= { iso(1) member-body(2)
us(840) rsadsi(113549) pkcs(1) pkcs9(9) 5 } us(840) rsadsi(113549) pkcs(1) pkcs9(9) 5 }
id-countersignature OBJECT IDENTIFIER ::= { iso(1) member-body(2) id-countersignature OBJECT IDENTIFIER ::= { iso(1) member-body(2)
skipping to change at page 29, line 13 skipping to change at page 32, line 13
END -- of CryptographicMessageSyntax END -- of CryptographicMessageSyntax
References References
PKCS #6 RSA Laboratories. PKCS #6: Extended-Certificate Syntax PKCS #6 RSA Laboratories. PKCS #6: Extended-Certificate Syntax
Standard. Version 1.5, November 1993. Standard. Version 1.5, November 1993.
PKCS #7 RSA Laboratories. PKCS #7: Cryptographic Message Syntax PKCS #7 RSA Laboratories. PKCS #7: Cryptographic Message Syntax
Standard. Version 1.5, November 1993. Standard. Version 1.5, November 1993.
PKCS #7: Cryptographic Message Syntax, Internet Draft
draft-hoffman-pkcs-crypt-msg-xx.
PKCS #9 RSA Laboratories. PKCS #9: Selected Attribute Types. PKCS #9 RSA Laboratories. PKCS #9: Selected Attribute Types.
Version 1.1, November 1993. Version 1.1, November 1993.
X.208 CCITT. Recommendation X.208: Specification of Abstract X.208 CCITT. Recommendation X.208: Specification of Abstract
Syntax Notation One (ASN.1). 1988. Syntax Notation One (ASN.1). 1988.
X.209 CCITT. Recommendation X.209: Specification of Basic Encoding X.209 CCITT. Recommendation X.209: Specification of Basic Encoding
Rules for Abstract Syntax Notation One (ASN.1). 1988. Rules for Abstract Syntax Notation One (ASN.1). 1988.
X.501 CCITT. Recommendation X.501: The Directory - Models. 1988. X.501 CCITT. Recommendation X.501: The Directory - Models. 1988.
X.509 CCITT. Recommendation X.509: The Directory - Authentication X.509 CCITT. Recommendation X.509: The Directory - Authentication
Framework. 1988. Framework. 1988.
Security Considerations Security Considerations
The Cryptographic Message Syntax provides a method for digitally The Cryptographic Message Syntax provides a method for digitally
signing data, digesting data, and encrypting data. signing data, digesting data, encrypting data, and authenticating
data.
Implementations must protect the signer's private key. Compromise of Implementations must protect the signer's private key. Compromise of
the signer's private key permits masquerade. the signer's private key permits masquerade.
Implementations must protect the key management private key and the Implementations must protect the key management private key and the
content-encryption key. Compromise of the key management private key content-encryption key. Compromise of the key management private key
may result in the disclosure of all messages protected with that key. may result in the disclosure of all messages protected with that key.
Similarly, compromise of the content-encryption key may result in Similarly, compromise of the content-encryption key may result in
disclosure of the encrypted content. disclosure of the encrypted content.
 End of changes. 

This html diff was produced by rfcdiff 1.23, available from http://www.levkowetz.com/ietf/tools/rfcdiff/