home *** CD-ROM | disk | FTP | other *** search
/ Internet Core Protocols / Oreilly-InternetCoreProtocols.iso / RFCs / rfc2630.txt < prev    next >
Encoding:
Text File  |  1999-10-14  |  128.9 KB  |  3,364 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                        R. Housley
  8. Request for Comments: 2630                                       SPYRUS
  9. Category: Standards Track                                     June 1999
  10.  
  11.  
  12.                       Cryptographic Message Syntax
  13.  
  14. Status of this Memo
  15.  
  16.    This document specifies an Internet standards track protocol for the
  17.    Internet community, and requests discussion and suggestions for
  18.    improvements.  Please refer to the current edition of the "Internet
  19.    Official Protocol Standards" (STD 1) for the standardization state
  20.    and status of this protocol.  Distribution of this memo is unlimited.
  21.  
  22. Copyright Notice
  23.  
  24.    Copyright (C) The Internet Society (1999).  All Rights Reserved.
  25.  
  26. Abstract
  27.  
  28.    This document describes the Cryptographic Message Syntax.  This
  29.    syntax is used to digitally sign, digest, authenticate, or encrypt
  30.    arbitrary messages.
  31.  
  32.    The Cryptographic Message Syntax is derived from PKCS #7 version 1.5
  33.    as specified in RFC 2315 [PKCS#7].  Wherever possible, backward
  34.    compatibility is preserved; however, changes were necessary to
  35.    accommodate attribute certificate transfer and key agreement
  36.    techniques for key management.
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58. Housley                     Standards Track                     [Page 1]
  59.  
  60. RFC 2630              Cryptographic Message Syntax             June 1999
  61.  
  62.  
  63. Table of Contents
  64.  
  65.    1   Introduction .................................................  4
  66.    2   General Overview .............................................  4
  67.    3   General Syntax ...............................................  5
  68.    4   Data Content Type ............................................  5
  69.    5   Signed-data Content Type .....................................  6
  70.        5.1  SignedData Type .........................................  7
  71.        5.2  EncapsulatedContentInfo Type ............................  8
  72.        5.3  SignerInfo Type .........................................  9
  73.        5.4  Message Digest Calculation Process ...................... 11
  74.        5.5  Message Signature Generation Process .................... 12
  75.        5.6  Message Signature Verification Process .................. 12
  76.    6   Enveloped-data Content Type .................................. 12
  77.        6.1  EnvelopedData Type ...................................... 14
  78.        6.2  RecipientInfo Type ...................................... 15
  79.             6.2.1  KeyTransRecipientInfo Type ....................... 16
  80.             6.2.2  KeyAgreeRecipientInfo Type ....................... 17
  81.             6.2.3  KEKRecipientInfo Type ............................ 19
  82.        6.3  Content-encryption Process .............................. 20
  83.        6.4  Key-encryption Process .................................. 20
  84.    7   Digested-data Content Type ................................... 21
  85.    8   Encrypted-data Content Type .................................. 22
  86.    9   Authenticated-data Content Type .............................. 23
  87.        9.1  AuthenticatedData Type .................................. 23
  88.        9.2  MAC Generation .......................................... 25
  89.        9.3  MAC Verification ........................................ 26
  90.    10  Useful Types ................................................. 27
  91.        10.1  Algorithm Identifier Types ............................. 27
  92.              10.1.1  DigestAlgorithmIdentifier ...................... 27
  93.              10.1.2  SignatureAlgorithmIdentifier ................... 27
  94.              10.1.3  KeyEncryptionAlgorithmIdentifier ............... 28
  95.              10.1.4  ContentEncryptionAlgorithmIdentifier ........... 28
  96.              10.1.5  MessageAuthenticationCodeAlgorithm ............. 28
  97.        10.2  Other Useful Types ..................................... 28
  98.              10.2.1  CertificateRevocationLists ..................... 28
  99.              10.2.2  CertificateChoices ............................. 29
  100.              10.2.3  CertificateSet ................................. 29
  101.              10.2.4  IssuerAndSerialNumber .......................... 30
  102.              10.2.5  CMSVersion ..................................... 30
  103.              10.2.6  UserKeyingMaterial ............................. 30
  104.              10.2.7  OtherKeyAttribute .............................. 30
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114. Housley                     Standards Track                     [Page 2]
  115.  
  116. RFC 2630              Cryptographic Message Syntax             June 1999
  117.  
  118.  
  119.    11  Useful Attributes ............................................ 31
  120.        11.1  Content Type ........................................... 31
  121.        11.2  Message Digest ......................................... 32
  122.        11.3  Signing Time ........................................... 32
  123.        11.4  Countersignature ....................................... 34
  124.    12  Supported Algorithms ......................................... 35
  125.        12.1  Digest Algorithms ...................................... 35
  126.              12.1.1  SHA-1 .......................................... 35
  127.              12.1.2  MD5 ............................................ 35
  128.        12.2  Signature Algorithms ................................... 36
  129.              12.2.1  DSA ............................................ 36
  130.              12.2.2  RSA ............................................ 36
  131.        12.3  Key Management Algorithms .............................. 36
  132.              12.3.1  Key Agreement Algorithms ....................... 36
  133.                      12.3.1.1  X9.42 Ephemeral-Static Diffie-Hellman. 37
  134.              12.3.2  Key Transport Algorithms ....................... 38
  135.                      12.3.2.1  RSA .................................. 39
  136.              12.3.3  Symmetric Key-Encryption Key Algorithms ........ 39
  137.                      12.3.3.1  Triple-DES Key Wrap .................. 40
  138.                      12.3.3.2  RC2 Key Wrap ......................... 41
  139.       12.4  Content Encryption Algorithms ........................... 41
  140.             12.4.1  Triple-DES CBC .................................. 42
  141.             12.4.2  RC2 CBC ......................................... 42
  142.       12.5  Message Authentication Code Algorithms .................. 42
  143.             12.5.1  HMAC with SHA-1 ................................. 43
  144.       12.6  Triple-DES and RC2 Key Wrap Algorithms .................. 43
  145.             12.6.1  Key Checksum .................................... 44
  146.             12.6.2  Triple-DES Key Wrap ............................. 44
  147.             12.6.3  Triple-DES Key Unwrap ........................... 44
  148.             12.6.4  RC2 Key Wrap .................................... 45
  149.             12.6.5  RC2 Key Unwrap .................................. 46
  150.    Appendix A:  ASN.1 Module ........................................ 47
  151.    References ....................................................... 55
  152.    Security Considerations .......................................... 56
  153.    Acknowledgments .................................................. 58
  154.    Author's Address ................................................. 59
  155.    Full Copyright Statement ......................................... 60
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170. Housley                     Standards Track                     [Page 3]
  171.  
  172. RFC 2630              Cryptographic Message Syntax             June 1999
  173.  
  174.  
  175. 1  Introduction
  176.  
  177.    This document describes the Cryptographic Message Syntax.  This
  178.    syntax is used to digitally sign, digest, authenticate, or encrypt
  179.    arbitrary messages.
  180.  
  181.    The Cryptographic Message Syntax describes an encapsulation syntax
  182.    for data protection.  It supports digital signatures, message
  183.    authentication codes, and encryption.  The syntax allows multiple
  184.    encapsulation, so one encapsulation envelope can be nested inside
  185.    another.  Likewise, one party can digitally sign some previously
  186.    encapsulated data.  It also allows arbitrary attributes, such as
  187.    signing time, to be signed along with the message content, and
  188.    provides for other attributes such as countersignatures to be
  189.    associated with a signature.
  190.  
  191.    The Cryptographic Message Syntax can support a variety of
  192.    architectures for certificate-based key management, such as the one
  193.    defined by the PKIX working group.
  194.  
  195.    The Cryptographic Message Syntax values are generated using ASN.1
  196.    [X.208-88], using BER-encoding [X.209-88].  Values are typically
  197.    represented as octet strings.  While many systems are capable of
  198.    transmitting arbitrary octet strings reliably, it is well known that
  199.    many electronic-mail systems are not.  This document does not address
  200.    mechanisms for encoding octet strings for reliable transmission in
  201.    such environments.
  202.  
  203. 2  General Overview
  204.  
  205.    The Cryptographic Message Syntax (CMS) is general enough to support
  206.    many different content types.  This document defines one protection
  207.    content, ContentInfo.  ContentInfo encapsulates a single identified
  208.    content type, and the identified type may provide further
  209.    encapsulation.  This document defines six content types: data,
  210.    signed-data, enveloped-data, digested-data, encrypted-data, and
  211.    authenticated-data.  Additional content types can be defined outside
  212.    this document.
  213.  
  214.    An implementation that conforms to this specification must implement
  215.    the protection content, ContentInfo, and must implement the data,
  216.    signed-data, and enveloped-data content types.  The other content
  217.    types may be implemented if desired.
  218.  
  219.    As a general design philosophy, each content type permits single pass
  220.    processing using indefinite-length Basic Encoding Rules (BER)
  221.    encoding.  Single-pass operation is especially helpful if content is
  222.    large, stored on tapes, or is "piped" from another process.  Single-
  223.  
  224.  
  225.  
  226. Housley                     Standards Track                     [Page 4]
  227.  
  228. RFC 2630              Cryptographic Message Syntax             June 1999
  229.  
  230.  
  231.    pass operation has one significant drawback: it is difficult to
  232.    perform encode operations using the Distinguished Encoding Rules
  233.    (DER) [X.509-88] encoding in a single pass since the lengths of the
  234.    various components may not be known in advance.  However, signed
  235.    attributes within the signed-data content type and authenticated
  236.    attributes within the authenticated-data content type require DER
  237.    encoding.  Signed attributes and authenticated attributes must be
  238.    transmitted in DER form to ensure that recipients can verify a
  239.    content that contains one or more unrecognized attributes.  Signed
  240.    attributes and authenticated attributes are the only CMS data types
  241.    that require DER encoding.
  242.  
  243. 3  General Syntax
  244.  
  245.    The Cryptographic Message Syntax (CMS) associates a content type
  246.    identifier with a content.  The syntax shall have ASN.1 type
  247.    ContentInfo:
  248.  
  249.       ContentInfo ::= SEQUENCE {
  250.         contentType ContentType,
  251.         content [0] EXPLICIT ANY DEFINED BY contentType }
  252.  
  253.       ContentType ::= OBJECT IDENTIFIER
  254.  
  255.    The fields of ContentInfo have the following meanings:
  256.  
  257.       contentType indicates the type of the associated content.  It is
  258.       an object identifier; it is a unique string of integers assigned
  259.       by an authority that defines the content type.
  260.  
  261.       content is the associated content.  The type of content can be
  262.       determined uniquely by contentType.  Content types for data,
  263.       signed-data, enveloped-data, digested-data, encrypted-data, and
  264.       authenticated-data are defined in this document.  If additional
  265.       content types are defined in other documents, the ASN.1 type
  266.       defined should not be a CHOICE type.
  267.  
  268. 4  Data Content Type
  269.  
  270.    The following object identifier identifies the data content type:
  271.  
  272.       id-data OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  273.           us(840) rsadsi(113549) pkcs(1) pkcs7(7) 1 }
  274.  
  275.    The data content type is intended to refer to arbitrary octet
  276.    strings, such as ASCII text files; the interpretation is left to the
  277.    application.  Such strings need not have any internal structure
  278.  
  279.  
  280.  
  281.  
  282. Housley                     Standards Track                     [Page 5]
  283.  
  284. RFC 2630              Cryptographic Message Syntax             June 1999
  285.  
  286.  
  287.    (although they could have their own ASN.1 definition or other
  288.    structure).
  289.  
  290.    The data content type is generally encapsulated in the signed-data,
  291.    enveloped-data, digested-data, encrypted-data, or authenticated-data
  292.    content type.
  293.  
  294. 5  Signed-data Content Type
  295.  
  296.    The signed-data content type consists of a content of any type and
  297.    zero or more signature values.  Any number of signers in parallel can
  298.    sign any type of content.
  299.  
  300.    The typical application of the signed-data content type represents
  301.    one signer's digital signature on content of the data content type.
  302.    Another typical application disseminates certificates and certificate
  303.    revocation lists (CRLs).
  304.  
  305.    The process by which signed-data is constructed involves the
  306.    following steps:
  307.  
  308.       1.  For each signer, a message digest, or hash value, is computed
  309.       on the content with a signer-specific message-digest algorithm.
  310.       If the signer is signing any information other than the content,
  311.       the message digest of the content and the other information are
  312.       digested with the signer's message digest algorithm (see Section
  313.       5.4), and the result becomes the "message digest."
  314.  
  315.       2.  For each signer, the message digest is digitally signed using
  316.       the signer's private key.
  317.  
  318.       3.  For each signer, the signature value and other signer-specific
  319.       information are collected into a SignerInfo value, as defined in
  320.       Section 5.3.  Certificates and CRLs for each signer, and those not
  321.       corresponding to any signer, are collected in this step.
  322.  
  323.       4.  The message digest algorithms for all the signers and the
  324.       SignerInfo values for all the signers are collected together with
  325.       the content into a SignedData value, as defined in Section 5.1.
  326.  
  327.    A recipient independently computes the message digest.  This message
  328.    digest and the signer's public key are used to verify the signature
  329.    value.  The signer's public key is referenced either by an issuer
  330.    distinguished name along with an issuer-specific serial number or by
  331.    a subject key identifier that uniquely identifies the certificate
  332.    containing the public key.  The signer's certificate may be included
  333.    in the SignedData certificates field.
  334.  
  335.  
  336.  
  337.  
  338. Housley                     Standards Track                     [Page 6]
  339.  
  340. RFC 2630              Cryptographic Message Syntax             June 1999
  341.  
  342.  
  343.    This section is divided into six parts.  The first part describes the
  344.    top-level type SignedData, the second part describes
  345.    EncapsulatedContentInfo, the third part describes the per-signer
  346.    information type SignerInfo, and the fourth, fifth, and sixth parts
  347.    describe the message digest calculation, signature generation, and
  348.    signature verification processes, respectively.
  349.  
  350. 5.1  SignedData Type
  351.  
  352.    The following object identifier identifies the signed-data content
  353.    type:
  354.  
  355.       id-signedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  356.           us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 }
  357.  
  358.    The signed-data content type shall have ASN.1 type SignedData:
  359.  
  360.       SignedData ::= SEQUENCE {
  361.         version CMSVersion,
  362.         digestAlgorithms DigestAlgorithmIdentifiers,
  363.         encapContentInfo EncapsulatedContentInfo,
  364.         certificates [0] IMPLICIT CertificateSet OPTIONAL,
  365.         crls [1] IMPLICIT CertificateRevocationLists OPTIONAL,
  366.         signerInfos SignerInfos }
  367.  
  368.       DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier
  369.  
  370.       SignerInfos ::= SET OF SignerInfo
  371.  
  372.    The fields of type SignedData have the following meanings:
  373.  
  374.       version is the syntax version number.  If no attribute
  375.       certificates are present in the certificates field, the
  376.       encapsulated content type is id-data, and all of the elements of
  377.       SignerInfos are version 1, then the value of version shall be 1.
  378.       Alternatively, if attribute certificates are present, the
  379.       encapsulated content type is other than id-data, or any of the
  380.       elements of SignerInfos are version 3, then the value of version
  381.       shall be 3.
  382.  
  383.       digestAlgorithms is a collection of message digest algorithm
  384.       identifiers.  There may be any number of elements in the
  385.       collection, including zero.  Each element identifies the message
  386.       digest algorithm, along with any associated parameters, used by
  387.       one or more signer.  The collection is intended to list the
  388.       message digest algorithms employed by all of the signers, in any
  389.       order, to facilitate one-pass signature verification.  The message
  390.       digesting process is described in Section 5.4.
  391.  
  392.  
  393.  
  394. Housley                     Standards Track                     [Page 7]
  395.  
  396. RFC 2630              Cryptographic Message Syntax             June 1999
  397.  
  398.  
  399.       encapContentInfo is the signed content, consisting of a content
  400.       type identifier and the content itself.  Details of the
  401.       EncapsulatedContentInfo type are discussed in section 5.2.
  402.  
  403.       certificates is a collection of certificates.  It is intended that
  404.       the set of certificates be sufficient to contain chains from a
  405.       recognized "root" or "top-level certification authority" to all of
  406.       the signers in the signerInfos field.  There may be more
  407.       certificates than necessary, and there may be certificates
  408.       sufficient to contain chains from two or more independent top-
  409.       level certification authorities.  There may also be fewer
  410.       certificates than necessary, if it is expected that recipients
  411.       have an alternate means of obtaining necessary certificates (e.g.,
  412.       from a previous set of certificates).  As discussed above, if
  413.       attribute certificates are present, then the value of version
  414.       shall be 3.
  415.  
  416.       crls is a collection of certificate revocation lists (CRLs).  It
  417.       is intended that the set contain information sufficient to
  418.       determine whether or not the certificates in the certificates
  419.       field are valid, but such correspondence is not necessary.  There
  420.       may be more CRLs than necessary, and there may also be fewer CRLs
  421.       than necessary.
  422.  
  423.       signerInfos is a collection of per-signer information.  There may
  424.       be any number of elements in the collection, including zero.  The
  425.       details of the SignerInfo type are discussed in section 5.3.
  426.  
  427. 5.2  EncapsulatedContentInfo Type
  428.  
  429.    The content is represented in the type EncapsulatedContentInfo:
  430.  
  431.       EncapsulatedContentInfo ::= SEQUENCE {
  432.         eContentType ContentType,
  433.         eContent [0] EXPLICIT OCTET STRING OPTIONAL }
  434.  
  435.       ContentType ::= OBJECT IDENTIFIER
  436.  
  437.    The fields of type EncapsulatedContentInfo have the following
  438.    meanings:
  439.  
  440.       eContentType is an object identifier that uniquely specifies the
  441.       content type.
  442.  
  443.       eContent is the content itself, carried as an octet string.  The
  444.       eContent need not be DER encoded.
  445.  
  446.  
  447.  
  448.  
  449.  
  450. Housley                     Standards Track                     [Page 8]
  451.  
  452. RFC 2630              Cryptographic Message Syntax             June 1999
  453.  
  454.  
  455.    The optional omission of the eContent within the
  456.    EncapsulatedContentInfo field makes it possible to construct
  457.    "external signatures."  In the case of external signatures, the
  458.    content being signed is absent from the EncapsulatedContentInfo value
  459.    included in the signed-data content type.  If the eContent value
  460.    within EncapsulatedContentInfo is absent, then the signatureValue is
  461.    calculated and the eContentType is assigned as though the eContent
  462.    value was present.
  463.  
  464.    In the degenerate case where there are no signers, the
  465.    EncapsulatedContentInfo value being "signed" is irrelevant.  In this
  466.    case, the content type within the EncapsulatedContentInfo value being
  467.    "signed" should be id-data (as defined in section 4), and the content
  468.    field of the EncapsulatedContentInfo value should be omitted.
  469.  
  470. 5.3  SignerInfo Type
  471.  
  472.    Per-signer information is represented in the type SignerInfo:
  473.  
  474.       SignerInfo ::= SEQUENCE {
  475.         version CMSVersion,
  476.         sid SignerIdentifier,
  477.         digestAlgorithm DigestAlgorithmIdentifier,
  478.         signedAttrs [0] IMPLICIT SignedAttributes OPTIONAL,
  479.         signatureAlgorithm SignatureAlgorithmIdentifier,
  480.         signature SignatureValue,
  481.         unsignedAttrs [1] IMPLICIT UnsignedAttributes OPTIONAL }
  482.  
  483.       SignerIdentifier ::= CHOICE {
  484.         issuerAndSerialNumber IssuerAndSerialNumber,
  485.         subjectKeyIdentifier [0] SubjectKeyIdentifier }
  486.  
  487.       SignedAttributes ::= SET SIZE (1..MAX) OF Attribute
  488.  
  489.       UnsignedAttributes ::= SET SIZE (1..MAX) OF Attribute
  490.  
  491.       Attribute ::= SEQUENCE {
  492.         attrType OBJECT IDENTIFIER,
  493.         attrValues SET OF AttributeValue }
  494.  
  495.       AttributeValue ::= ANY
  496.  
  497.       SignatureValue ::= OCTET STRING
  498.  
  499.    The fields of type SignerInfo have the following meanings:
  500.  
  501.       version is the syntax version number.  If the SignerIdentifier is
  502.       the CHOICE issuerAndSerialNumber, then the version shall be 1.  If
  503.  
  504.  
  505.  
  506. Housley                     Standards Track                     [Page 9]
  507.  
  508. RFC 2630              Cryptographic Message Syntax             June 1999
  509.  
  510.  
  511.       the SignerIdentifier is subjectKeyIdentifier, then the version
  512.       shall be 3.
  513.  
  514.       sid specifies the signer's certificate (and thereby the signer's
  515.       public key).  The signer's public key is needed by the recipient
  516.       to verify the signature.  SignerIdentifier provides two
  517.       alternatives for specifying the signer's public key.  The
  518.       issuerAndSerialNumber alternative identifies the signer's
  519.       certificate by the issuer's distinguished name and the certificate
  520.       serial number; the subjectKeyIdentifier identifies the signer's
  521.       certificate by the X.509 subjectKeyIdentifier extension value.
  522.  
  523.       digestAlgorithm identifies the message digest algorithm, and any
  524.       associated parameters, used by the signer.  The message digest is
  525.       computed on either the content being signed or the content
  526.       together with the signed attributes using the process described in
  527.       section 5.4.  The message digest algorithm should be among those
  528.       listed in the digestAlgorithms field of the associated SignerData.
  529.  
  530.       signedAttributes is a collection of attributes that are signed.
  531.       The field is optional, but it must be present if the content type
  532.       of the EncapsulatedContentInfo value being signed is not id-data.
  533.       Each SignedAttribute in the SET must be DER encoded.  Useful
  534.       attribute types, such as signing time, are defined in Section 11.
  535.       If the field is present, it must contain, at a minimum, the
  536.       following two attributes:
  537.  
  538.          A content-type attribute having as its value the content type
  539.          of the EncapsulatedContentInfo value being signed.  Section
  540.          11.1 defines the content-type attribute.  The content-type
  541.          attribute is not required when used as part of a
  542.          countersignature unsigned attribute as defined in section 11.4.
  543.  
  544.          A message-digest attribute, having as its value the message
  545.          digest of the content.  Section 11.2 defines the message-digest
  546.          attribute.
  547.  
  548.       signatureAlgorithm identifies the signature algorithm, and any
  549.       associated parameters, used by the signer to generate the digital
  550.       signature.
  551.  
  552.       signature is the result of digital signature generation, using the
  553.       message digest and the signer's private key.
  554.  
  555.       unsignedAttributes is a collection of attributes that are not
  556.       signed.  The field is optional.  Useful attribute types, such as
  557.       countersignatures, are defined in Section 11.
  558.  
  559.  
  560.  
  561.  
  562. Housley                     Standards Track                    [Page 10]
  563.  
  564. RFC 2630              Cryptographic Message Syntax             June 1999
  565.  
  566.  
  567.    The fields of type SignedAttribute and UnsignedAttribute have the
  568.    following meanings:
  569.  
  570.       attrType indicates the type of attribute.  It is an object
  571.       identifier.
  572.  
  573.       attrValues is a set of values that comprise the attribute.  The
  574.       type of each value in the set can be determined uniquely by
  575.       attrType.
  576.  
  577. 5.4  Message Digest Calculation Process
  578.  
  579.    The message digest calculation process computes a message digest on
  580.    either the content being signed or the content together with the
  581.    signed attributes.  In either case, the initial input to the message
  582.    digest calculation process is the "value" of the encapsulated content
  583.    being signed.  Specifically, the initial input is the
  584.    encapContentInfo eContent OCTET STRING to which the signing process
  585.    is applied.  Only the octets comprising the value of the eContent
  586.    OCTET STRING are input to the message digest algorithm, not the tag
  587.    or the length octets.
  588.  
  589.    The result of the message digest calculation process depends on
  590.    whether the signedAttributes field is present.  When the field is
  591.    absent, the result is just the message digest of the content as
  592.    described above.  When the field is present, however, the result is
  593.    the message digest of the complete DER encoding of the
  594.    SignedAttributes value contained in the signedAttributes field.
  595.    Since the SignedAttributes value, when present, must contain the
  596.    content type and the content message digest attributes, those values
  597.    are indirectly included in the result.  The content type attribute is
  598.    not required when used as part of a countersignature unsigned
  599.    attribute as defined in section 11.4.  A separate encoding of the
  600.    signedAttributes field is performed for message digest calculation.
  601.    The IMPLICIT [0] tag in the signedAttributes field is not used for
  602.    the DER encoding, rather an EXPLICIT SET OF tag is used.  That is,
  603.    the DER encoding of the SET OF tag, rather than of the IMPLICIT [0]
  604.    tag, is to be included in the message digest calculation along with
  605.    the length and content octets of the SignedAttributes value.
  606.  
  607.    When the signedAttributes field is absent, then only the octets
  608.    comprising the value of the signedData encapContentInfo eContent
  609.    OCTET STRING (e.g., the contents of a file) are input to the message
  610.    digest calculation.  This has the advantage that the length of the
  611.    content being signed need not be known in advance of the signature
  612.    generation process.
  613.  
  614.  
  615.  
  616.  
  617.  
  618. Housley                     Standards Track                    [Page 11]
  619.  
  620. RFC 2630              Cryptographic Message Syntax             June 1999
  621.  
  622.  
  623.    Although the encapContentInfo eContent OCTET STRING tag and length
  624.    octets are not included in the message digest calculation, they are
  625.    still protected by other means.  The length octets are protected by
  626.    the nature of the message digest algorithm since it is
  627.    computationally infeasible to find any two distinct messages of any
  628.    length that have the same message digest.
  629.  
  630. 5.5  Message Signature Generation Process
  631.  
  632.    The input to the signature generation process includes the result of
  633.    the message digest calculation process and the signer's private key.
  634.    The details of the signature generation depend on the signature
  635.    algorithm employed.  The object identifier, along with any
  636.    parameters, that specifies the signature algorithm employed by the
  637.    signer is carried in the signatureAlgorithm field.  The signature
  638.    value generated by the signer is encoded as an OCTET STRING and
  639.    carried in the signature field.
  640.  
  641. 5.6  Message Signature Verification Process
  642.  
  643.    The input to the signature verification process includes the result
  644.    of the message digest calculation process and the signer's public
  645.    key.  The recipient may obtain the correct public key for the signer
  646.    by any means, but the preferred method is from a certificate obtained
  647.    from the SignedData certificates field.  The selection and validation
  648.    of the signer's public key may be based on certification path
  649.    validation (see [PROFILE]) as well as other external context, but is
  650.    beyond the scope of this document.  The details of the signature
  651.    verification depend on the signature algorithm employed.
  652.  
  653.    The recipient may not rely on any message digest values computed by
  654.    the originator.  If the signedData signerInfo includes
  655.    signedAttributes, then the content message digest must be calculated
  656.    as described in section 5.4.  For the signature to be valid, the
  657.    message digest value calculated by the recipient must be the same as
  658.    the value of the messageDigest attribute included in the
  659.    signedAttributes of the signedData signerInfo.
  660.  
  661. 6  Enveloped-data Content Type
  662.  
  663.    The enveloped-data content type consists of an encrypted content of
  664.    any type and encrypted content-encryption keys for one or more
  665.    recipients.  The combination of the encrypted content and one
  666.    encrypted content-encryption key for a recipient is a "digital
  667.    envelope" for that recipient.  Any type of content can be enveloped
  668.    for an arbitrary number of recipients using any of the three key
  669.    management techniques for each recipient.
  670.  
  671.  
  672.  
  673.  
  674. Housley                     Standards Track                    [Page 12]
  675.  
  676. RFC 2630              Cryptographic Message Syntax             June 1999
  677.  
  678.  
  679.    The typical application of the enveloped-data content type will
  680.    represent one or more recipients' digital envelopes on content of the
  681.    data or signed-data content types.
  682.  
  683.    Enveloped-data is constructed by the following steps:
  684.  
  685.       1.  A content-encryption key for a particular content-encryption
  686.       algorithm is generated at random.
  687.  
  688.       2.  The content-encryption key is encrypted for each recipient.
  689.       The details of this encryption depend on the key management
  690.       algorithm used, but three general techniques are supported:
  691.  
  692.          key transport:  the content-encryption key is encrypted in the
  693.          recipient's public key;
  694.  
  695.          key agreement:  the recipient's public key and the sender's
  696.          private key are used to generate a pairwise symmetric key, then
  697.          the content-encryption key is encrypted in the pairwise
  698.          symmetric key; and
  699.  
  700.          symmetric key-encryption keys:  the content-encryption key is
  701.          encrypted in a previously distributed symmetric key-encryption
  702.          key.
  703.  
  704.       3.  For each recipient, the encrypted content-encryption key and
  705.       other recipient-specific information are collected into a
  706.       RecipientInfo value, defined in Section 6.2.
  707.  
  708.       4.  The content is encrypted with the content-encryption key.
  709.       Content encryption may require that the content be padded to a
  710.       multiple of some block size; see Section 6.3.
  711.  
  712.       5.  The RecipientInfo values for all the recipients are collected
  713.       together with the encrypted content to form an EnvelopedData value
  714.       as defined in Section 6.1.
  715.  
  716.    A recipient opens the digital envelope by decrypting one of the
  717.    encrypted content-encryption keys and then decrypting the encrypted
  718.    content with the recovered content-encryption key.
  719.  
  720.    This section is divided into four parts.  The first part describes
  721.    the top-level type EnvelopedData, the second part describes the per-
  722.    recipient information type RecipientInfo, and the third and fourth
  723.    parts describe the content-encryption and key-encryption processes.
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730. Housley                     Standards Track                    [Page 13]
  731.  
  732. RFC 2630              Cryptographic Message Syntax             June 1999
  733.  
  734.  
  735. 6.1  EnvelopedData Type
  736.  
  737.    The following object identifier identifies the enveloped-data content
  738.    type:
  739.  
  740.       id-envelopedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  741.           us(840) rsadsi(113549) pkcs(1) pkcs7(7) 3 }
  742.  
  743.    The enveloped-data content type shall have ASN.1 type EnvelopedData:
  744.  
  745.       EnvelopedData ::= SEQUENCE {
  746.         version CMSVersion,
  747.         originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
  748.         recipientInfos RecipientInfos,
  749.         encryptedContentInfo EncryptedContentInfo,
  750.         unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }
  751.  
  752.       OriginatorInfo ::= SEQUENCE {
  753.         certs [0] IMPLICIT CertificateSet OPTIONAL,
  754.         crls [1] IMPLICIT CertificateRevocationLists OPTIONAL }
  755.  
  756.       RecipientInfos ::= SET OF RecipientInfo
  757.  
  758.       EncryptedContentInfo ::= SEQUENCE {
  759.         contentType ContentType,
  760.         contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
  761.         encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL }
  762.  
  763.       EncryptedContent ::= OCTET STRING
  764.  
  765.       UnprotectedAttributes ::= SET SIZE (1..MAX) OF Attribute
  766.  
  767.    The fields of type EnvelopedData have the following meanings:
  768.  
  769.       version is the syntax version number.  If originatorInfo is
  770.       present, then version shall be 2.  If any of the RecipientInfo
  771.       structures included have a version other than 0, then the version
  772.       shall be 2.  If unprotectedAttrs is present, then version shall be
  773.       2.  If originatorInfo is absent, all of the RecipientInfo
  774.       structures are version 0, and unprotectedAttrs is absent, then
  775.       version shall be 0.
  776.  
  777.       originatorInfo optionally provides information about the
  778.       originator.  It is present only if required by the key management
  779.       algorithm.  It may contain certificates and CRLs:
  780.  
  781.          certs is a collection of certificates.  certs may contain
  782.          originator certificates associated with several different key
  783.  
  784.  
  785.  
  786. Housley                     Standards Track                    [Page 14]
  787.  
  788. RFC 2630              Cryptographic Message Syntax             June 1999
  789.  
  790.  
  791.          management algorithms.  certs may also contain attribute
  792.          certificates associated with the originator.  The certificates
  793.          contained in certs are intended to be sufficient to make chains
  794.          from a recognized "root" or "top-level certification authority"
  795.          to all recipients.  However, certs may contain more
  796.          certificates than necessary, and there may be certificates
  797.          sufficient to make chains from two or more independent top-
  798.          level certification authorities.  Alternatively, certs may
  799.          contain fewer certificates than necessary, if it is expected
  800.          that recipients have an alternate means of obtaining necessary
  801.          certificates (e.g., from a previous set of certificates).
  802.  
  803.          crls is a collection of CRLs.  It is intended that the set
  804.          contain information sufficient to determine whether or not the
  805.          certificates in the certs field are valid, but such
  806.          correspondence is not necessary.  There may be more CRLs than
  807.          necessary, and there may also be fewer CRLs than necessary.
  808.  
  809.       recipientInfos is a collection of per-recipient information.
  810.       There must be at least one element in the collection.
  811.  
  812.       encryptedContentInfo is the encrypted content information.
  813.  
  814.       unprotectedAttrs is a collection of attributes that are not
  815.       encrypted.  The field is optional.  Useful attribute types are
  816.       defined in Section 11.
  817.  
  818.    The fields of type EncryptedContentInfo have the following meanings:
  819.  
  820.       contentType indicates the type of content.
  821.  
  822.       contentEncryptionAlgorithm identifies the content-encryption
  823.       algorithm, and any associated parameters, used to encrypt the
  824.       content.  The content-encryption process is described in Section
  825.       6.3.  The same content-encryption algorithm and content-encryption
  826.       key is used for all recipients.
  827.  
  828.       encryptedContent is the result of encrypting the content.  The
  829.       field is optional, and if the field is not present, its intended
  830.       value must be supplied by other means.
  831.  
  832.    The recipientInfos field comes before the encryptedContentInfo field
  833.    so that an EnvelopedData value may be processed in a single pass.
  834.  
  835. 6.2  RecipientInfo Type
  836.  
  837.    Per-recipient information is represented in the type RecipientInfo.
  838.    RecipientInfo has a different format for the three key management
  839.  
  840.  
  841.  
  842. Housley                     Standards Track                    [Page 15]
  843.  
  844. RFC 2630              Cryptographic Message Syntax             June 1999
  845.  
  846.  
  847.    techniques that are supported: key transport, key agreement, and
  848.    previously distributed symmetric key-encryption keys.  Any of the
  849.    three key management techniques can be used for each recipient of the
  850.    same encrypted content.  In all cases, the content-encryption key is
  851.    transferred to one or more recipient in encrypted form.
  852.  
  853.       RecipientInfo ::= CHOICE {
  854.         ktri KeyTransRecipientInfo,
  855.         kari [1] KeyAgreeRecipientInfo,
  856.         kekri [2] KEKRecipientInfo }
  857.  
  858.       EncryptedKey ::= OCTET STRING
  859.  
  860. 6.2.1  KeyTransRecipientInfo Type
  861.  
  862.    Per-recipient information using key transport is represented in the
  863.    type KeyTransRecipientInfo.  Each instance of KeyTransRecipientInfo
  864.    transfers the content-encryption key to one recipient.
  865.  
  866.       KeyTransRecipientInfo ::= SEQUENCE {
  867.         version CMSVersion,  -- always set to 0 or 2
  868.         rid RecipientIdentifier,
  869.         keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
  870.         encryptedKey EncryptedKey }
  871.  
  872.       RecipientIdentifier ::= CHOICE {
  873.         issuerAndSerialNumber IssuerAndSerialNumber,
  874.         subjectKeyIdentifier [0] SubjectKeyIdentifier }
  875.  
  876.    The fields of type KeyTransRecipientInfo have the following meanings:
  877.  
  878.       version is the syntax version number.  If the RecipientIdentifier
  879.       is the CHOICE issuerAndSerialNumber, then the version shall be 0.
  880.       If the RecipientIdentifier is subjectKeyIdentifier, then the
  881.       version shall be 2.
  882.  
  883.       rid specifies the recipient's certificate or key that was used by
  884.       the sender to protect the content-encryption key.  The
  885.       RecipientIdentifier provides two alternatives for specifying the
  886.       recipient's certificate, and thereby the recipient's public key.
  887.       The recipient's certificate must contain a key transport public
  888.       key.  The content-encryption key is encrypted with the recipient's
  889.       public key.  The issuerAndSerialNumber alternative identifies the
  890.       recipient's certificate by the issuer's distinguished name and the
  891.       certificate serial number; the subjectKeyIdentifier identifies the
  892.       recipient's certificate by the X.509 subjectKeyIdentifier
  893.       extension value.
  894.  
  895.  
  896.  
  897.  
  898. Housley                     Standards Track                    [Page 16]
  899.  
  900. RFC 2630              Cryptographic Message Syntax             June 1999
  901.  
  902.  
  903.       keyEncryptionAlgorithm identifies the key-encryption algorithm,
  904.       and any associated parameters, used to encrypt the content-
  905.       encryption key for the recipient.  The key-encryption process is
  906.       described in Section 6.4.
  907.  
  908.       encryptedKey is the result of encrypting the content-encryption
  909.       key for the recipient.
  910.  
  911. 6.2.2  KeyAgreeRecipientInfo Type
  912.  
  913.    Recipient information using key agreement is represented in the type
  914.    KeyAgreeRecipientInfo.  Each instance of KeyAgreeRecipientInfo will
  915.    transfer the content-encryption key to one or more recipient that
  916.    uses the same key agreement algorithm and domain parameters for that
  917.    algorithm.
  918.  
  919.       KeyAgreeRecipientInfo ::= SEQUENCE {
  920.         version CMSVersion,  -- always set to 3
  921.         originator [0] EXPLICIT OriginatorIdentifierOrKey,
  922.         ukm [1] EXPLICIT UserKeyingMaterial OPTIONAL,
  923.         keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
  924.         recipientEncryptedKeys RecipientEncryptedKeys }
  925.  
  926.       OriginatorIdentifierOrKey ::= CHOICE {
  927.         issuerAndSerialNumber IssuerAndSerialNumber,
  928.         subjectKeyIdentifier [0] SubjectKeyIdentifier,
  929.         originatorKey [1] OriginatorPublicKey }
  930.  
  931.       OriginatorPublicKey ::= SEQUENCE {
  932.         algorithm AlgorithmIdentifier,
  933.         publicKey BIT STRING }
  934.  
  935.       RecipientEncryptedKeys ::= SEQUENCE OF RecipientEncryptedKey
  936.  
  937.       RecipientEncryptedKey ::= SEQUENCE {
  938.         rid KeyAgreeRecipientIdentifier,
  939.         encryptedKey EncryptedKey }
  940.  
  941.       KeyAgreeRecipientIdentifier ::= CHOICE {
  942.         issuerAndSerialNumber IssuerAndSerialNumber,
  943.         rKeyId [0] IMPLICIT RecipientKeyIdentifier }
  944.  
  945.       RecipientKeyIdentifier ::= SEQUENCE {
  946.         subjectKeyIdentifier SubjectKeyIdentifier,
  947.         date GeneralizedTime OPTIONAL,
  948.         other OtherKeyAttribute OPTIONAL }
  949.  
  950.       SubjectKeyIdentifier ::= OCTET STRING
  951.  
  952.  
  953.  
  954. Housley                     Standards Track                    [Page 17]
  955.  
  956. RFC 2630              Cryptographic Message Syntax             June 1999
  957.  
  958.  
  959.    The fields of type KeyAgreeRecipientInfo have the following meanings:
  960.  
  961.       version is the syntax version number.  It shall always be 3.
  962.  
  963.       originator is a CHOICE with three alternatives specifying the
  964.       sender's key agreement public key.  The sender uses the
  965.       corresponding private key and the recipient's public key to
  966.       generate a pairwise key.  The content-encryption key is encrypted
  967.       in the pairwise key.  The issuerAndSerialNumber alternative
  968.       identifies the sender's certificate, and thereby the sender's
  969.       public key, by the issuer's distinguished name and the certificate
  970.       serial number.  The subjectKeyIdentifier alternative identifies
  971.       the sender's certificate, and thereby the sender's public key, by
  972.       the X.509 subjectKeyIdentifier extension value.  The originatorKey
  973.       alternative includes the algorithm identifier and sender's key
  974.       agreement public key. Permitting originator anonymity since the
  975.       public key is not certified.
  976.  
  977.       ukm is optional.  With some key agreement algorithms, the sender
  978.       provides a User Keying Material (UKM) to ensure that a different
  979.       key is generated each time the same two parties generate a
  980.       pairwise key.
  981.  
  982.       keyEncryptionAlgorithm identifies the key-encryption algorithm,
  983.       and any associated parameters, used to encrypt the content-
  984.       encryption key in the key-encryption key.  The key-encryption
  985.       process is described in Section 6.4.
  986.  
  987.       recipientEncryptedKeys includes a recipient identifier and
  988.       encrypted key for one or more recipients.  The
  989.       KeyAgreeRecipientIdentifier is a CHOICE with two alternatives
  990.       specifying the recipient's certificate, and thereby the
  991.       recipient's public key, that was used by the sender to generate a
  992.       pairwise key-encryption key.  The recipient's certificate must
  993.       contain a key agreement public key.  The content-encryption key is
  994.       encrypted in the pairwise key-encryption key.  The
  995.       issuerAndSerialNumber alternative identifies the recipient's
  996.       certificate by the issuer's distinguished name and the certificate
  997.       serial number; the RecipientKeyIdentifier is described below.  The
  998.       encryptedKey is the result of encrypting the content-encryption
  999.       key in the pairwise key-encryption key generated using the key
  1000.       agreement algorithm.
  1001.  
  1002.    The fields of type RecipientKeyIdentifier have the following
  1003.    meanings:
  1004.  
  1005.       subjectKeyIdentifier identifies the recipient's certificate by the
  1006.       X.509 subjectKeyIdentifier extension value.
  1007.  
  1008.  
  1009.  
  1010. Housley                     Standards Track                    [Page 18]
  1011.  
  1012. RFC 2630              Cryptographic Message Syntax             June 1999
  1013.  
  1014.  
  1015.       date is optional.  When present, the date specifies which of the
  1016.       recipient's previously distributed UKMs was used by the sender.
  1017.  
  1018.       other is optional.  When present, this field contains additional
  1019.       information used by the recipient to locate the public keying
  1020.       material used by the sender.
  1021.  
  1022. 6.2.3  KEKRecipientInfo Type
  1023.  
  1024.    Recipient information using previously distributed symmetric keys is
  1025.    represented in the type KEKRecipientInfo.  Each instance of
  1026.    KEKRecipientInfo will transfer the content-encryption key to one or
  1027.    more recipients who have the previously distributed key-encryption
  1028.    key.
  1029.  
  1030.       KEKRecipientInfo ::= SEQUENCE {
  1031.         version CMSVersion,  -- always set to 4
  1032.         kekid KEKIdentifier,
  1033.         keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
  1034.         encryptedKey EncryptedKey }
  1035.  
  1036.       KEKIdentifier ::= SEQUENCE {
  1037.         keyIdentifier OCTET STRING,
  1038.         date GeneralizedTime OPTIONAL,
  1039.         other OtherKeyAttribute OPTIONAL }
  1040.  
  1041.    The fields of type KEKRecipientInfo have the following meanings:
  1042.  
  1043.       version is the syntax version number.  It shall always be 4.
  1044.  
  1045.       kekid specifies a symmetric key-encryption key that was previously
  1046.       distributed to the sender and one or more recipients.
  1047.  
  1048.       keyEncryptionAlgorithm identifies the key-encryption algorithm,
  1049.       and any associated parameters, used to encrypt the content-
  1050.       encryption key with the key-encryption key.  The key-encryption
  1051.       process is described in Section 6.4.
  1052.  
  1053.       encryptedKey is the result of encrypting the content-encryption
  1054.       key in the key-encryption key.
  1055.  
  1056.    The fields of type KEKIdentifier have the following meanings:
  1057.  
  1058.       keyIdentifier identifies the key-encryption key that was
  1059.       previously distributed to the sender and one or more recipients.
  1060.  
  1061.       date is optional.  When present, the date specifies a single key-
  1062.       encryption key from a set that was previously distributed.
  1063.  
  1064.  
  1065.  
  1066. Housley                     Standards Track                    [Page 19]
  1067.  
  1068. RFC 2630              Cryptographic Message Syntax             June 1999
  1069.  
  1070.  
  1071.       other is optional.  When present, this field contains additional
  1072.       information used by the recipient to determine the key-encryption
  1073.       key used by the sender.
  1074.  
  1075. 6.3  Content-encryption Process
  1076.  
  1077.    The content-encryption key for the desired content-encryption
  1078.    algorithm is randomly generated.  The data to be protected is padded
  1079.    as described below, then the padded data is encrypted using the
  1080.    content-encryption key.  The encryption operation maps an arbitrary
  1081.    string of octets (the data) to another string of octets (the
  1082.    ciphertext) under control of a content-encryption key.  The encrypted
  1083.    data is included in the envelopedData encryptedContentInfo
  1084.    encryptedContent OCTET STRING.
  1085.  
  1086.    The input to the content-encryption process is the "value" of the
  1087.    content being enveloped.  Only the value octets of the envelopedData
  1088.    encryptedContentInfo encryptedContent OCTET STRING are encrypted; the
  1089.    OCTET STRING tag and length octets are not encrypted.
  1090.  
  1091.    Some content-encryption algorithms assume the input length is a
  1092.    multiple of k octets, where k is greater than one.  For such
  1093.    algorithms, the input shall be padded at the trailing end with
  1094.    k-(lth mod k) octets all having value k-(lth mod k), where lth is
  1095.    the length of the input.  In other words, the input is padded at
  1096.    the trailing end with one of the following strings:
  1097.  
  1098.                      01 -- if lth mod k = k-1
  1099.                   02 02 -- if lth mod k = k-2
  1100.                       .
  1101.                       .
  1102.                       .
  1103.             k k ... k k -- if lth mod k = 0
  1104.  
  1105.    The padding can be removed unambiguously since all input is padded,
  1106.    including input values that are already a multiple of the block size,
  1107.    and no padding string is a suffix of another.  This padding method is
  1108.    well defined if and only if k is less than 256.
  1109.  
  1110. 6.4  Key-encryption Process
  1111.  
  1112.    The input to the key-encryption process -- the value supplied to the
  1113.    recipient's key-encryption algorithm -- is just the "value" of the
  1114.    content-encryption key.
  1115.  
  1116.    Any of the three key management techniques can be used for each
  1117.    recipient of the same encrypted content.
  1118.  
  1119.  
  1120.  
  1121.  
  1122. Housley                     Standards Track                    [Page 20]
  1123.  
  1124. RFC 2630              Cryptographic Message Syntax             June 1999
  1125.  
  1126.  
  1127. 7  Digested-data Content Type
  1128.  
  1129.    The digested-data content type consists of content of any type and a
  1130.    message digest of the content.
  1131.  
  1132.    Typically, the digested-data content type is used to provide content
  1133.    integrity, and the result generally becomes an input to the
  1134.    enveloped-data content type.
  1135.  
  1136.    The following steps construct digested-data:
  1137.  
  1138.       1.  A message digest is computed on the content with a message-
  1139.       digest algorithm.
  1140.  
  1141.       2.  The message-digest algorithm and the message digest are
  1142.       collected together with the content into a DigestedData value.
  1143.  
  1144.    A recipient verifies the message digest by comparing the message
  1145.    digest to an independently computed message digest.
  1146.  
  1147.    The following object identifier identifies the digested-data content
  1148.    type:
  1149.  
  1150.       id-digestedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  1151.           us(840) rsadsi(113549) pkcs(1) pkcs7(7) 5 }
  1152.  
  1153.    The digested-data content type shall have ASN.1 type DigestedData:
  1154.  
  1155.       DigestedData ::= SEQUENCE {
  1156.         version CMSVersion,
  1157.         digestAlgorithm DigestAlgorithmIdentifier,
  1158.         encapContentInfo EncapsulatedContentInfo,
  1159.         digest Digest }
  1160.  
  1161.       Digest ::= OCTET STRING
  1162.  
  1163.    The fields of type DigestedData have the following meanings:
  1164.  
  1165.       version is the syntax version number.  If the encapsulated content
  1166.       type is id-data, then the value of version shall be 0; however, if
  1167.       the encapsulated content type is other than id-data, then the
  1168.       value of version shall be 2.
  1169.  
  1170.       digestAlgorithm identifies the message digest algorithm, and any
  1171.       associated parameters, under which the content is digested.  The
  1172.       message-digesting process is the same as in Section 5.4 in the
  1173.       case when there are no signed attributes.
  1174.  
  1175.  
  1176.  
  1177.  
  1178. Housley                     Standards Track                    [Page 21]
  1179.  
  1180. RFC 2630              Cryptographic Message Syntax             June 1999
  1181.  
  1182.  
  1183.       encapContentInfo is the content that is digested, as defined in
  1184.       section 5.2.
  1185.  
  1186.       digest is the result of the message-digesting process.
  1187.  
  1188.    The ordering of the digestAlgorithm field, the encapContentInfo
  1189.    field, and the digest field makes it possible to process a
  1190.    DigestedData value in a single pass.
  1191.  
  1192. 8  Encrypted-data Content Type
  1193.  
  1194.    The encrypted-data content type consists of encrypted content of any
  1195.    type.  Unlike the enveloped-data content type, the encrypted-data
  1196.    content type has neither recipients nor encrypted content-encryption
  1197.    keys.  Keys must be managed by other means.
  1198.  
  1199.    The typical application of the encrypted-data content type will be to
  1200.    encrypt the content of the data content type for local storage,
  1201.    perhaps where the encryption key is a password.
  1202.  
  1203.    The following object identifier identifies the encrypted-data content
  1204.    type:
  1205.  
  1206.       id-encryptedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  1207.           us(840) rsadsi(113549) pkcs(1) pkcs7(7) 6 }
  1208.  
  1209.    The encrypted-data content type shall have ASN.1 type EncryptedData:
  1210.  
  1211.       EncryptedData ::= SEQUENCE {
  1212.         version CMSVersion,
  1213.         encryptedContentInfo EncryptedContentInfo,
  1214.         unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }
  1215.  
  1216.    The fields of type EncryptedData have the following meanings:
  1217.  
  1218.       version is the syntax version number.  If unprotectedAttrs is
  1219.       present, then version shall be 2.  If unprotectedAttrs is absent,
  1220.       then version shall be 0.
  1221.  
  1222.       encryptedContentInfo is the encrypted content information, as
  1223.       defined in Section 6.1.
  1224.  
  1225.       unprotectedAttrs is a collection of attributes that are not
  1226.       encrypted.  The field is optional.  Useful attribute types are
  1227.       defined in Section 11.
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234. Housley                     Standards Track                    [Page 22]
  1235.  
  1236. RFC 2630              Cryptographic Message Syntax             June 1999
  1237.  
  1238.  
  1239. 9  Authenticated-data Content Type
  1240.  
  1241.    The authenticated-data content type consists of content of any type,
  1242.    a message authentication code (MAC), and encrypted authentication
  1243.    keys for one or more recipients.  The combination of the MAC and one
  1244.    encrypted authentication key for a recipient is necessary for that
  1245.    recipient to verify the integrity of the content.  Any type of
  1246.    content can be integrity protected for an arbitrary number of
  1247.    recipients.
  1248.  
  1249.    The process by which authenticated-data is constructed involves the
  1250.    following steps:
  1251.  
  1252.       1.  A message-authentication key for a particular message-
  1253.       authentication algorithm is generated at random.
  1254.  
  1255.       2.  The message-authentication key is encrypted for each
  1256.       recipient.  The details of this encryption depend on the key
  1257.       management algorithm used.
  1258.  
  1259.       3.  For each recipient, the encrypted message-authentication key
  1260.       and other recipient-specific information are collected into a
  1261.       RecipientInfo value, defined in Section 6.2.
  1262.  
  1263.       4.  Using the message-authentication key, the originator computes
  1264.       a MAC value on the content.  If the originator is authenticating
  1265.       any information in addition to the content (see Section 9.2), a
  1266.       message digest is calculated on the content, the message digest of
  1267.       the content and the other information are authenticated using the
  1268.       message-authentication key, and the result becomes the "MAC
  1269.       value."
  1270.  
  1271. 9.1  AuthenticatedData Type
  1272.  
  1273.    The following object identifier identifies the authenticated-data
  1274.    content type:
  1275.  
  1276.       id-ct-authData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  1277.           us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16)
  1278.           ct(1) 2 }
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290. Housley                     Standards Track                    [Page 23]
  1291.  
  1292. RFC 2630              Cryptographic Message Syntax             June 1999
  1293.  
  1294.  
  1295.    The authenticated-data content type shall have ASN.1 type
  1296.    AuthenticatedData:
  1297.  
  1298.       AuthenticatedData ::= SEQUENCE {
  1299.         version CMSVersion,
  1300.         originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
  1301.         recipientInfos RecipientInfos,
  1302.         macAlgorithm MessageAuthenticationCodeAlgorithm,
  1303.         digestAlgorithm [1] DigestAlgorithmIdentifier OPTIONAL,
  1304.         encapContentInfo EncapsulatedContentInfo,
  1305.         authenticatedAttributes [2] IMPLICIT AuthAttributes OPTIONAL,
  1306.         mac MessageAuthenticationCode,
  1307.         unauthenticatedAttributes [3] IMPLICIT UnauthAttributes OPTIONAL }
  1308.  
  1309.       AuthAttributes ::= SET SIZE (1..MAX) OF Attribute
  1310.  
  1311.       UnauthAttributes ::= SET SIZE (1..MAX) OF Attribute
  1312.  
  1313.       MessageAuthenticationCode ::= OCTET STRING
  1314.  
  1315.    The fields of type AuthenticatedData have the following meanings:
  1316.  
  1317.       version is the syntax version number.  It shall be 0.
  1318.  
  1319.       originatorInfo optionally provides information about the
  1320.       originator.  It is present only if required by the key management
  1321.       algorithm.  It may contain certificates, attribute certificates,
  1322.       and CRLs, as defined in Section 6.1.
  1323.  
  1324.       recipientInfos is a collection of per-recipient information, as
  1325.       defined in Section 6.1.  There must be at least one element in the
  1326.       collection.
  1327.  
  1328.       macAlgorithm is a message authentication code (MAC) algorithm
  1329.       identifier.  It identifies the MAC algorithm, along with any
  1330.       associated parameters, used by the originator.  Placement of the
  1331.       macAlgorithm field facilitates one-pass processing by the
  1332.       recipient.
  1333.  
  1334.       digestAlgorithm identifies the message digest algorithm, and any
  1335.       associated parameters, used to compute a message digest on the
  1336.       encapsulated content if authenticated attributes are present.  The
  1337.       message digesting process is described in Section 9.2.  Placement
  1338.       of the digestAlgorithm field facilitates one-pass processing by
  1339.       the recipient.  If the digestAlgorithm field is present, then the
  1340.       authenticatedAttributes field must also be present.
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346. Housley                     Standards Track                    [Page 24]
  1347.  
  1348. RFC 2630              Cryptographic Message Syntax             June 1999
  1349.  
  1350.  
  1351.       encapContentInfo is the content that is authenticated, as defined
  1352.       in section 5.2.
  1353.  
  1354.       authenticatedAttributes is a collection of authenticated
  1355.       attributes.  The authenticatedAttributes structure is optional,
  1356.       but it must be present if the content type of the
  1357.       EncapsulatedContentInfo value being authenticated is not id-data.
  1358.       If the authenticatedAttributes field is present, then the
  1359.       digestAlgorithm field must also be present.  Each
  1360.       AuthenticatedAttribute in the SET must be DER encoded.  Useful
  1361.       attribute types are defined in Section 11.  If the
  1362.       authenticatedAttributes field is present, it must contain, at a
  1363.       minimum, the following two attributes:
  1364.  
  1365.          A content-type attribute having as its value the content type
  1366.          of the EncapsulatedContentInfo value being authenticated.
  1367.          Section 11.1 defines the content-type attribute.
  1368.  
  1369.          A message-digest attribute, having as its value the message
  1370.          digest of the content.  Section 11.2 defines the message-digest
  1371.          attribute.
  1372.  
  1373.       mac is the message authentication code.
  1374.  
  1375.       unauthenticatedAttributes is a collection of attributes that are
  1376.       not authenticated.  The field is optional.  To date, no attributes
  1377.       have been defined for use as unauthenticated attributes, but other
  1378.       useful attribute types are defined in Section 11.
  1379.  
  1380. 9.2  MAC Generation
  1381.  
  1382.    The MAC calculation process computes a message authentication code
  1383.    (MAC) on either the message being authenticated or a message digest
  1384.    of message being authenticated together with the originator's
  1385.    authenticated attributes.
  1386.  
  1387.    If authenticatedAttributes field is absent, the input to the MAC
  1388.    calculation process is the value of the encapContentInfo eContent
  1389.    OCTET STRING.  Only the octets comprising the value of the eContent
  1390.    OCTET STRING are input to the MAC algorithm; the tag and the length
  1391.    octets are omitted.  This has the advantage that the length of the
  1392.    content being authenticated need not be known in advance of the MAC
  1393.    generation process.
  1394.  
  1395.    If authenticatedAttributes field is present, the content-type
  1396.    attribute (as described in Section 11.1) and the message-digest
  1397.    attribute (as described in section 11.2) must be included, and the
  1398.    input to the MAC calculation process is the DER encoding of
  1399.  
  1400.  
  1401.  
  1402. Housley                     Standards Track                    [Page 25]
  1403.  
  1404. RFC 2630              Cryptographic Message Syntax             June 1999
  1405.  
  1406.  
  1407.    authenticatedAttributes.  A separate encoding of the
  1408.    authenticatedAttributes field is performed for message digest
  1409.    calculation.  The IMPLICIT [2] tag in the authenticatedAttributes
  1410.    field is not used for the DER encoding, rather an EXPLICIT SET OF tag
  1411.    is used.  That is, the DER encoding of the SET OF tag, rather than of
  1412.    the IMPLICIT [2] tag, is to be included in the message digest
  1413.    calculation along with the length and content octets of the
  1414.    authenticatedAttributes value.
  1415.  
  1416.    The message digest calculation process computes a message digest on
  1417.    the content being authenticated.  The initial input to the message
  1418.    digest calculation process is the "value" of the encapsulated content
  1419.    being authenticated.  Specifically, the input is the encapContentInfo
  1420.    eContent OCTET STRING to which the authentication process is applied.
  1421.    Only the octets comprising the value of the encapContentInfo eContent
  1422.    OCTET STRING are input to the message digest algorithm, not the tag
  1423.    or the length octets.  This has the advantage that the length of the
  1424.    content being authenticated need not be known in advance.  Although
  1425.    the encapContentInfo eContent OCTET STRING tag and length octets are
  1426.    not included in the message digest calculation, they are still
  1427.    protected by other means.  The length octets are protected by the
  1428.    nature of the message digest algorithm since it is computationally
  1429.    infeasible to find any two distinct messages of any length that have
  1430.    the same message digest.
  1431.  
  1432.    The input to the MAC calculation process includes the MAC input data,
  1433.    defined above, and an authentication key conveyed in a recipientInfo
  1434.    structure.  The details of MAC calculation depend on the MAC
  1435.    algorithm employed (e.g., HMAC).  The object identifier, along with
  1436.    any parameters, that specifies the MAC algorithm employed by the
  1437.    originator is carried in the macAlgorithm field.  The MAC value
  1438.    generated by the originator is encoded as an OCTET STRING and carried
  1439.    in the mac field.
  1440.  
  1441. 9.3  MAC Verification
  1442.  
  1443.    The input to the MAC verification process includes the input data
  1444.    (determined based on the presence or absence of the
  1445.    authenticatedAttributes field, as defined in 9.2), and the
  1446.    authentication key conveyed in recipientInfo.  The details of the MAC
  1447.    verification process depend on the MAC algorithm employed.
  1448.  
  1449.    The recipient may not rely on any MAC values or message digest values
  1450.    computed by the originator.  The content is authenticated as
  1451.    described in section 9.2.  If the originator includes authenticated
  1452.    attributes, then the content of the authenticatedAttributes is
  1453.    authenticated as described in section 9.2.  For authentication to
  1454.    succeed, the message MAC value calculated by the recipient must be
  1455.  
  1456.  
  1457.  
  1458. Housley                     Standards Track                    [Page 26]
  1459.  
  1460. RFC 2630              Cryptographic Message Syntax             June 1999
  1461.  
  1462.  
  1463.    the same as the value of the mac field.  Similarly, for
  1464.    authentication to succeed when the authenticatedAttributes field is
  1465.    present, the content message digest value calculated by the recipient
  1466.    must be the same as the message digest value included in the
  1467.    authenticatedAttributes message-digest attribute.
  1468.  
  1469. 10  Useful Types
  1470.  
  1471.    This section is divided into two parts.  The first part defines
  1472.    algorithm identifiers, and the second part defines other useful
  1473.    types.
  1474.  
  1475. 10.1  Algorithm Identifier Types
  1476.  
  1477.    All of the algorithm identifiers have the same type:
  1478.    AlgorithmIdentifier.  The definition of AlgorithmIdentifier is
  1479.    imported from X.509 [X.509-88].
  1480.  
  1481.    There are many alternatives for each type of algorithm listed.  For
  1482.    each of these five types, Section 12 lists the algorithms that must
  1483.    be included in a CMS implementation.
  1484.  
  1485. 10.1.1  DigestAlgorithmIdentifier
  1486.  
  1487.    The DigestAlgorithmIdentifier type identifies a message-digest
  1488.    algorithm.  Examples include SHA-1, MD2, and MD5.  A message-digest
  1489.    algorithm maps an octet string (the message) to another octet string
  1490.    (the message digest).
  1491.  
  1492.       DigestAlgorithmIdentifier ::= AlgorithmIdentifier
  1493.  
  1494. 10.1.2  SignatureAlgorithmIdentifier
  1495.  
  1496.    The SignatureAlgorithmIdentifier type identifies a signature
  1497.    algorithm.  Examples include DSS and RSA.  A signature algorithm
  1498.    supports signature generation and verification operations.  The
  1499.    signature generation operation uses the message digest and the
  1500.    signer's private key to generate a signature value.  The signature
  1501.    verification operation uses the message digest and the signer's
  1502.    public key to determine whether or not a signature value is valid.
  1503.    Context determines which operation is intended.
  1504.  
  1505.       SignatureAlgorithmIdentifier ::= AlgorithmIdentifier
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514. Housley                     Standards Track                    [Page 27]
  1515.  
  1516. RFC 2630              Cryptographic Message Syntax             June 1999
  1517.  
  1518.  
  1519. 10.1.3  KeyEncryptionAlgorithmIdentifier
  1520.  
  1521.    The KeyEncryptionAlgorithmIdentifier type identifies a key-encryption
  1522.    algorithm used to encrypt a content-encryption key.  The encryption
  1523.    operation maps an octet string (the key) to another octet string (the
  1524.    encrypted key) under control of a key-encryption key.  The decryption
  1525.    operation is the inverse of the encryption operation.  Context
  1526.    determines which operation is intended.
  1527.  
  1528.    The details of encryption and decryption depend on the key management
  1529.    algorithm used.  Key transport, key agreement, and previously
  1530.    distributed symmetric key-encrypting keys are supported.
  1531.  
  1532.       KeyEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
  1533.  
  1534. 10.1.4  ContentEncryptionAlgorithmIdentifier
  1535.  
  1536.    The ContentEncryptionAlgorithmIdentifier type identifies a content-
  1537.    encryption algorithm.  Examples include Triple-DES and RC2.  A
  1538.    content-encryption algorithm supports encryption and decryption
  1539.    operations.  The encryption operation maps an octet string (the
  1540.    message) to another octet string (the ciphertext) under control of a
  1541.    content-encryption key.  The decryption operation is the inverse of
  1542.    the encryption operation.  Context determines which operation is
  1543.    intended.
  1544.  
  1545.       ContentEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
  1546.  
  1547. 10.1.5  MessageAuthenticationCodeAlgorithm
  1548.  
  1549.    The MessageAuthenticationCodeAlgorithm type identifies a message
  1550.    authentication code (MAC) algorithm.  Examples include DES-MAC and
  1551.    HMAC.  A MAC algorithm supports generation and verification
  1552.    operations.  The MAC generation and verification operations use the
  1553.    same symmetric key.  Context determines which operation is intended.
  1554.  
  1555.       MessageAuthenticationCodeAlgorithm ::= AlgorithmIdentifier
  1556.  
  1557. 10.2  Other Useful Types
  1558.  
  1559.    This section defines types that are used other places in the
  1560.    document.  The types are not listed in any particular order.
  1561.  
  1562. 10.2.1  CertificateRevocationLists
  1563.  
  1564.    The CertificateRevocationLists type gives a set of certificate
  1565.    revocation lists (CRLs). It is intended that the set contain
  1566.    information sufficient to determine whether the certificates and
  1567.  
  1568.  
  1569.  
  1570. Housley                     Standards Track                    [Page 28]
  1571.  
  1572. RFC 2630              Cryptographic Message Syntax             June 1999
  1573.  
  1574.  
  1575.    attribute certificates with which the set is associated are revoked
  1576.    or not.  However, there may be more CRLs than necessary or there may
  1577.    be fewer CRLs than necessary.
  1578.  
  1579.    The CertificateList may contain a CRL, an Authority Revocation List
  1580.    (ARL), a Delta Revocation List, or an Attribute Certificate
  1581.    Revocation List.  All of these lists share a common syntax.
  1582.  
  1583.    CRLs are specified in X.509 [X.509-97], and they are profiled for use
  1584.    in the Internet in RFC 2459 [PROFILE].
  1585.  
  1586.    The definition of CertificateList is imported from X.509.
  1587.  
  1588.       CertificateRevocationLists ::= SET OF CertificateList
  1589.  
  1590. 10.2.2  CertificateChoices
  1591.  
  1592.    The CertificateChoices type gives either a PKCS #6 extended
  1593.    certificate [PKCS#6], an X.509 certificate, or an X.509 attribute
  1594.    certificate [X.509-97].  The PKCS #6 extended certificate is
  1595.    obsolete.  PKCS #6 certificates are included for backward
  1596.    compatibility, and their use should be avoided.  The Internet profile
  1597.    of X.509 certificates is specified in the "Internet X.509 Public Key
  1598.    Infrastructure: Certificate and CRL Profile" [PROFILE].
  1599.  
  1600.    The definitions of Certificate and AttributeCertificate are imported
  1601.    from X.509.
  1602.  
  1603.       CertificateChoices ::= CHOICE {
  1604.          certificate Certificate,                 -- See X.509
  1605.          extendedCertificate [0] IMPLICIT ExtendedCertificate,
  1606.                                                   -- Obsolete
  1607.          attrCert [1] IMPLICIT AttributeCertificate }
  1608.                                                   -- See X.509 and X9.57
  1609.  
  1610. 10.2.3  CertificateSet
  1611.  
  1612.    The CertificateSet type provides a set of certificates.  It is
  1613.    intended that the set be sufficient to contain chains from a
  1614.    recognized "root" or "top-level certification authority" to all of
  1615.    the sender certificates with which the set is associated.  However,
  1616.    there may be more certificates than necessary, or there may be fewer
  1617.    than necessary.
  1618.  
  1619.    The precise meaning of a "chain" is outside the scope of this
  1620.    document.  Some applications may impose upper limits on the length of
  1621.    a chain; others may enforce certain relationships between the
  1622.    subjects and issuers of certificates within a chain.
  1623.  
  1624.  
  1625.  
  1626. Housley                     Standards Track                    [Page 29]
  1627.  
  1628. RFC 2630              Cryptographic Message Syntax             June 1999
  1629.  
  1630.  
  1631.       CertificateSet ::= SET OF CertificateChoices
  1632.  
  1633. 10.2.4  IssuerAndSerialNumber
  1634.  
  1635.    The IssuerAndSerialNumber type identifies a certificate, and thereby
  1636.    an entity and a public key, by the distinguished name of the
  1637.    certificate issuer and an issuer-specific certificate serial number.
  1638.  
  1639.    The definition of Name is imported from X.501 [X.501-88], and the
  1640.    definition of CertificateSerialNumber is imported from X.509
  1641.    [X.509-97].
  1642.  
  1643.       IssuerAndSerialNumber ::= SEQUENCE {
  1644.         issuer Name,
  1645.         serialNumber CertificateSerialNumber }
  1646.  
  1647.       CertificateSerialNumber ::= INTEGER
  1648.  
  1649. 10.2.5  CMSVersion
  1650.  
  1651.    The Version type gives a syntax version number, for compatibility
  1652.    with future revisions of this document.
  1653.  
  1654.       CMSVersion ::= INTEGER  { v0(0), v1(1), v2(2), v3(3), v4(4) }
  1655.  
  1656. 10.2.6  UserKeyingMaterial
  1657.  
  1658.    The UserKeyingMaterial type gives a syntax for user keying material
  1659.    (UKM).  Some key agreement algorithms require UKMs to ensure that a
  1660.    different key is generated each time the same two parties generate a
  1661.    pairwise key.  The sender provides a UKM for use with a specific key
  1662.    agreement algorithm.
  1663.  
  1664.       UserKeyingMaterial ::= OCTET STRING
  1665.  
  1666. 10.2.7  OtherKeyAttribute
  1667.  
  1668.    The OtherKeyAttribute type gives a syntax for the inclusion of other
  1669.    key attributes that permit the recipient to select the key used by
  1670.    the sender.  The attribute object identifier must be registered along
  1671.    with the syntax of the attribute itself.  Use of this structure
  1672.    should be avoided since it may impede interoperability.
  1673.  
  1674.       OtherKeyAttribute ::= SEQUENCE {
  1675.         keyAttrId OBJECT IDENTIFIER,
  1676.         keyAttr ANY DEFINED BY keyAttrId OPTIONAL }
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682. Housley                     Standards Track                    [Page 30]
  1683.  
  1684. RFC 2630              Cryptographic Message Syntax             June 1999
  1685.  
  1686.  
  1687. 11  Useful Attributes
  1688.  
  1689.    This section defines attributes that may be used with signed-data,
  1690.    enveloped-data, encrypted-data, or authenticated-data.  The syntax of
  1691.    Attribute is compatible with X.501 [X.501-88] and RFC 2459 [PROFILE].
  1692.    Some of the attributes defined in this section were originally
  1693.    defined in PKCS #9 [PKCS#9], others were not previously defined.  The
  1694.    attributes are not listed in any particular order.
  1695.  
  1696.    Additional attributes are defined in many places, notably the S/MIME
  1697.    Version 3 Message Specification [MSG] and the Enhanced Security
  1698.    Services for S/MIME [ESS], which also include recommendations on the
  1699.    placement of these attributes.
  1700.  
  1701. 11.1  Content Type
  1702.  
  1703.    The content-type attribute type specifies the content type of the
  1704.    ContentInfo value being signed in signed-data.  The content-type
  1705.    attribute type is required if there are any authenticated attributes
  1706.    present.
  1707.  
  1708.    The content-type attribute must be a signed attribute or an
  1709.    authenticated attribute; it cannot be an unsigned attribute, an
  1710.    unauthenticated attribute, or an unprotectedAttribute.
  1711.  
  1712.    The following object identifier identifies the content-type
  1713.    attribute:
  1714.  
  1715.       id-contentType OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  1716.           us(840) rsadsi(113549) pkcs(1) pkcs9(9) 3 }
  1717.  
  1718.    Content-type attribute values have ASN.1 type ContentType:
  1719.  
  1720.       ContentType ::= OBJECT IDENTIFIER
  1721.  
  1722.    A content-type attribute must have a single attribute value, even
  1723.    though the syntax is defined as a SET OF AttributeValue.  There must
  1724.    not be zero or multiple instances of AttributeValue present.
  1725.  
  1726.    The SignedAttributes and AuthAttributes syntaxes are each defined as
  1727.    a SET OF Attributes.  The SignedAttributes in a signerInfo must not
  1728.    include multiple instances of the content-type attribute.  Similarly,
  1729.    the AuthAttributes in an AuthenticatedData must not include multiple
  1730.    instances of the content-type attribute.
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738. Housley                     Standards Track                    [Page 31]
  1739.  
  1740. RFC 2630              Cryptographic Message Syntax             June 1999
  1741.  
  1742.  
  1743. 11.2  Message Digest
  1744.  
  1745.    The message-digest attribute type specifies the message digest of the
  1746.    encapContentInfo eContent OCTET STRING being signed in signed-data
  1747.    (see section 5.4) or authenticated in authenticated-data (see section
  1748.    9.2).  For signed-data, the message digest is computed using the
  1749.    signer's message digest algorithm.  For authenticated-data, the
  1750.    message digest is computed using the originator's message digest
  1751.    algorithm.
  1752.  
  1753.    Within signed-data, the message-digest signed attribute type is
  1754.    required if there are any attributes present.  Within authenticated-
  1755.    data, the message-digest authenticated attribute type is required if
  1756.    there are any attributes present.
  1757.  
  1758.    The message-digest attribute must be a signed attribute or an
  1759.    authenticated attribute; it cannot be an unsigned attribute or an
  1760.    unauthenticated attribute.
  1761.  
  1762.    The following object identifier identifies the message-digest
  1763.    attribute:
  1764.  
  1765.       id-messageDigest OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  1766.           us(840) rsadsi(113549) pkcs(1) pkcs9(9) 4 }
  1767.  
  1768.    Message-digest attribute values have ASN.1 type MessageDigest:
  1769.  
  1770.       MessageDigest ::= OCTET STRING
  1771.  
  1772.    A message-digest attribute must have a single attribute value, even
  1773.    though the syntax is defined as a SET OF AttributeValue.  There must
  1774.    not be zero or multiple instances of AttributeValue present.
  1775.  
  1776.    The SignedAttributes syntax is defined as a SET OF Attributes.  The
  1777.    SignedAttributes in a signerInfo must not include multiple instances
  1778.    of the message-digest attribute.
  1779.  
  1780. 11.3  Signing Time
  1781.  
  1782.    The signing-time attribute type specifies the time at which the
  1783.    signer (purportedly) performed the signing process.  The signing-time
  1784.    attribute type is intended for use in signed-data.
  1785.  
  1786.    The signing-time attribute may be a signed attribute; it cannot be an
  1787.    unsigned attribute, an authenticated attribute, or an unauthenticated
  1788.    attribute.
  1789.  
  1790.  
  1791.  
  1792.  
  1793.  
  1794. Housley                     Standards Track                    [Page 32]
  1795.  
  1796. RFC 2630              Cryptographic Message Syntax             June 1999
  1797.  
  1798.  
  1799.    The following object identifier identifies the signing-time
  1800.    attribute:
  1801.  
  1802.       id-signingTime OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  1803.           us(840) rsadsi(113549) pkcs(1) pkcs9(9) 5 }
  1804.  
  1805.    Signing-time attribute values have ASN.1 type SigningTime:
  1806.  
  1807.       SigningTime ::= Time
  1808.  
  1809.       Time ::= CHOICE {
  1810.         utcTime          UTCTime,
  1811.         generalizedTime  GeneralizedTime }
  1812.  
  1813.    Note: The definition of Time matches the one specified in the 1997
  1814.    version of X.509 [X.509-97].
  1815.  
  1816.    Dates between 1 January 1950 and 31 December 2049 (inclusive) must be
  1817.    encoded as UTCTime.  Any dates with year values before 1950 or after
  1818.    2049 must be encoded as GeneralizedTime.
  1819.  
  1820.    UTCTime values must be expressed in Greenwich Mean Time (Zulu) and
  1821.    must include seconds (i.e., times are YYMMDDHHMMSSZ), even where the
  1822.    number of seconds is zero.  Midnight (GMT) must be represented as
  1823.    "YYMMDD000000Z".  Century information is implicit, and the century
  1824.    must be determined as follows:
  1825.  
  1826.       Where YY is greater than or equal to 50, the year shall be
  1827.       interpreted as 19YY; and
  1828.  
  1829.       Where YY is less than 50, the year shall be interpreted as 20YY.
  1830.  
  1831.    GeneralizedTime values shall be expressed in Greenwich Mean Time
  1832.    (Zulu) and must include seconds (i.e., times are YYYYMMDDHHMMSSZ),
  1833.    even where the number of seconds is zero.  GeneralizedTime values
  1834.    must not include fractional seconds.
  1835.  
  1836.    A signing-time attribute must have a single attribute value, even
  1837.    though the syntax is defined as a SET OF AttributeValue.  There must
  1838.    not be zero or multiple instances of AttributeValue present.
  1839.  
  1840.    The SignedAttributes syntax is defined as a SET OF Attributes.  The
  1841.    SignedAttributes in a signerInfo must not include multiple instances
  1842.    of the signing-time attribute.
  1843.  
  1844.    No requirement is imposed concerning the correctness of the signing
  1845.    time, and acceptance of a purported signing time is a matter of a
  1846.    recipient's discretion.  It is expected, however, that some signers,
  1847.  
  1848.  
  1849.  
  1850. Housley                     Standards Track                    [Page 33]
  1851.  
  1852. RFC 2630              Cryptographic Message Syntax             June 1999
  1853.  
  1854.  
  1855.    such as time-stamp servers, will be trusted implicitly.
  1856.  
  1857. 11.4  Countersignature
  1858.  
  1859.    The countersignature attribute type specifies one or more signatures
  1860.    on the contents octets of the DER encoding of the signatureValue
  1861.    field of a SignerInfo value in signed-data.  Thus, the
  1862.    countersignature attribute type countersigns (signs in serial)
  1863.    another signature.
  1864.  
  1865.    The countersignature attribute must be an unsigned attribute; it
  1866.    cannot be a signed attribute, an authenticated attribute, or an
  1867.    unauthenticated attribute.
  1868.  
  1869.    The following object identifier identifies the countersignature
  1870.    attribute:
  1871.  
  1872.       id-countersignature OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  1873.           us(840) rsadsi(113549) pkcs(1) pkcs9(9) 6 }
  1874.  
  1875.    Countersignature attribute values have ASN.1 type Countersignature:
  1876.  
  1877.       Countersignature ::= SignerInfo
  1878.  
  1879.    Countersignature values have the same meaning as SignerInfo values
  1880.    for ordinary signatures, except that:
  1881.  
  1882.       1.  The signedAttributes field must contain a message-digest
  1883.       attribute if it contains any other attributes, but need not
  1884.       contain a content-type attribute, as there is no content type for
  1885.       countersignatures.
  1886.  
  1887.       2.  The input to the message-digesting process is the contents
  1888.       octets of the DER encoding of the signatureValue field of the
  1889.       SignerInfo value with which the attribute is associated.
  1890.  
  1891.    A countersignature attribute can have multiple attribute values.  The
  1892.    syntax is defined as a SET OF AttributeValue, and there must be one
  1893.    or more instances of AttributeValue present.
  1894.  
  1895.    The UnsignedAttributes syntax is defined as a SET OF Attributes.  The
  1896.    UnsignedAttributes in a signerInfo may include multiple instances of
  1897.    the countersignature attribute.
  1898.  
  1899.    A countersignature, since it has type SignerInfo, can itself contain
  1900.    a countersignature attribute.  Thus it is possible to construct
  1901.    arbitrarily long series of countersignatures.
  1902.  
  1903.  
  1904.  
  1905.  
  1906. Housley                     Standards Track                    [Page 34]
  1907.  
  1908. RFC 2630              Cryptographic Message Syntax             June 1999
  1909.  
  1910.  
  1911. 12  Supported Algorithms
  1912.  
  1913.    This section lists the algorithms that must be implemented.
  1914.    Additional algorithms that should be implemented are also included.
  1915.  
  1916. 12.1  Digest Algorithms
  1917.  
  1918.    CMS implementations must include SHA-1.  CMS implementations should
  1919.    include MD5.
  1920.  
  1921.    Digest algorithm identifiers are located in the SignedData
  1922.    digestAlgorithms field, the SignerInfo digestAlgorithm field, the
  1923.    DigestedData digestAlgorithm field, and the AuthenticatedData
  1924.    digestAlgorithm field.
  1925.  
  1926.    Digest values are located in the DigestedData digest field, and
  1927.    digest values are located in the Message Digest authenticated
  1928.    attribute.  In addition, digest values are input to signature
  1929.    algorithms.
  1930.  
  1931. 12.1.1  SHA-1
  1932.  
  1933.    The SHA-1 digest algorithm is defined in FIPS Pub 180-1 [SHA1]. The
  1934.    algorithm identifier for SHA-1 is:
  1935.  
  1936.       sha-1 OBJECT IDENTIFIER ::= { iso(1) identified-organization(3)
  1937.           oiw(14) secsig(3) algorithm(2) 26 }
  1938.  
  1939.    The AlgorithmIdentifier parameters field is optional.  If present,
  1940.    the parameters field must contain an ASN.1 NULL.  Implementations
  1941.    should accept SHA-1 AlgorithmIdentifiers with absent parameters as
  1942.    well as NULL parameters.  Implementations should generate SHA-1
  1943.    AlgorithmIdentifiers with NULL parameters.
  1944.  
  1945. 12.1.2  MD5
  1946.  
  1947.    The MD5 digest algorithm is defined in RFC 1321 [MD5].  The algorithm
  1948.    identifier for MD5 is:
  1949.  
  1950.       md5 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840)
  1951.           rsadsi(113549) digestAlgorithm(2) 5 }
  1952.  
  1953.    The AlgorithmIdentifier parameters field must be present, and the
  1954.    parameters field must contain NULL.  Implementations may accept the
  1955.    MD5 AlgorithmIdentifiers with absent parameters as well as NULL
  1956.    parameters.
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962. Housley                     Standards Track                    [Page 35]
  1963.  
  1964. RFC 2630              Cryptographic Message Syntax             June 1999
  1965.  
  1966.  
  1967. 12.2  Signature Algorithms
  1968.  
  1969.    CMS implementations must include DSA.  CMS implementations may
  1970.    include RSA.
  1971.  
  1972.    Signature algorithm identifiers are located in the SignerInfo
  1973.    signatureAlgorithm field.  Also, signature algorithm identifiers are
  1974.    located in the SignerInfo signatureAlgorithm field of
  1975.    countersignature attributes.
  1976.  
  1977.    Signature values are located in the SignerInfo signature field.
  1978.    Also, signature values are located in the SignerInfo signature field
  1979.    of countersignature attributes.
  1980.  
  1981. 12.2.1  DSA
  1982.  
  1983.    The DSA signature algorithm is defined in FIPS Pub 186 [DSS].  DSA is
  1984.    always used with the SHA-1 message digest algorithm.  The algorithm
  1985.    identifier for DSA is:
  1986.  
  1987.       id-dsa-with-sha1 OBJECT IDENTIFIER ::=  { iso(1) member-body(2)
  1988.           us(840) x9-57 (10040) x9cm(4) 3 }
  1989.  
  1990.    The AlgorithmIdentifier parameters field must not be present.
  1991.  
  1992. 12.2.2  RSA
  1993.  
  1994.    The RSA signature algorithm is defined in RFC 2347 [NEWPKCS#1]. RFC
  1995.    2347 specifies the use of the RSA signature algorithm with the SHA-1
  1996.    and MD5 message digest algorithms.  The algorithm identifier for RSA
  1997.    is:
  1998.  
  1999.       rsaEncryption OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2000.           us(840) rsadsi(113549) pkcs(1) pkcs-1(1) 1 }
  2001.  
  2002. 12.3  Key Management Algorithms
  2003.  
  2004.    CMS accommodates three general key management techniques: key
  2005.    agreement, key transport, and previously distributed symmetric key-
  2006.    encryption keys.
  2007.  
  2008. 12.3.1  Key Agreement Algorithms
  2009.  
  2010.    CMS implementations must include key agreement using X9.42
  2011.    Ephemeral-Static Diffie-Hellman.
  2012.  
  2013.    Any symmetric encryption algorithm that a CMS implementation includes
  2014.    as a content-encryption algorithm must also be included as a key-
  2015.  
  2016.  
  2017.  
  2018. Housley                     Standards Track                    [Page 36]
  2019.  
  2020. RFC 2630              Cryptographic Message Syntax             June 1999
  2021.  
  2022.  
  2023.    encryption algorithm.  CMS implementations must include key agreement
  2024.    of Triple-DES pairwise key-encryption keys and Triple-DES wrapping of
  2025.    Triple-DES content-encryption keys.  CMS implementations should
  2026.    include key agreement of RC2 pairwise key-encryption keys and RC2
  2027.    wrapping of RC2 content-encryption keys.  The key wrap algorithm for
  2028.    Triple-DES and RC2 is described in section 12.3.3.
  2029.  
  2030.    A CMS implementation may support mixed key-encryption and content-
  2031.    encryption algorithms.  For example, a 128-bit RC2 content-encryption
  2032.    key may be wrapped with 168-bit Triple-DES key-encryption key.
  2033.    Similarly, a 40-bit RC2 content-encryption key may be wrapped with
  2034.    128-bit RC2 key-encryption key.
  2035.  
  2036.    For key agreement of RC2 key-encryption keys, 128 bits must be
  2037.    generated as input to the key expansion process used to compute the
  2038.    RC2 effective key [RC2].
  2039.  
  2040.    Key agreement algorithm identifiers are located in the EnvelopedData
  2041.    RecipientInfos KeyAgreeRecipientInfo keyEncryptionAlgorithm and
  2042.    AuthenticatedData RecipientInfos KeyAgreeRecipientInfo
  2043.    keyEncryptionAlgorithm fields.
  2044.  
  2045.    Key wrap algorithm identifiers are located in the KeyWrapAlgorithm
  2046.    parameters within the EnvelopedData RecipientInfos
  2047.    KeyAgreeRecipientInfo keyEncryptionAlgorithm and AuthenticatedData
  2048.    RecipientInfos KeyAgreeRecipientInfo keyEncryptionAlgorithm fields.
  2049.  
  2050.    Wrapped content-encryption keys are located in the EnvelopedData
  2051.    RecipientInfos KeyAgreeRecipientInfo RecipientEncryptedKeys
  2052.    encryptedKey field.  Wrapped message-authentication keys are located
  2053.    in the AuthenticatedData RecipientInfos KeyAgreeRecipientInfo
  2054.    RecipientEncryptedKeys encryptedKey field.
  2055.  
  2056. 12.3.1.1  X9.42 Ephemeral-Static Diffie-Hellman
  2057.  
  2058.    Ephemeral-Static Diffie-Hellman key agreement is defined in RFC 2631
  2059.    [DH-X9.42].  When using Ephemeral-Static Diffie-Hellman, the
  2060.    EnvelopedData RecipientInfos KeyAgreeRecipientInfo and
  2061.    AuthenticatedData RecipientInfos KeyAgreeRecipientInfo fields are
  2062.    used as follows:
  2063.  
  2064.       version must be 3.
  2065.  
  2066.       originator must be the originatorKey alternative.  The
  2067.       originatorKey algorithm fields must contain the dh-public-number
  2068.       object identifier with absent parameters.  The originatorKey
  2069.       publicKey field must contain the sender's ephemeral public key.
  2070.       The dh-public-number object identifier is:
  2071.  
  2072.  
  2073.  
  2074. Housley                     Standards Track                    [Page 37]
  2075.  
  2076. RFC 2630              Cryptographic Message Syntax             June 1999
  2077.  
  2078.  
  2079.          dh-public-number OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2080.              us(840) ansi-x942(10046) number-type(2) 1 }
  2081.  
  2082.       ukm may be absent.  When present, the ukm is used to ensure that a
  2083.       different key-encryption key is generated when the ephemeral
  2084.       private key might be used more than once.
  2085.  
  2086.       keyEncryptionAlgorithm must be the id-alg-ESDH algorithm
  2087.       identifier.  The algorithm identifier parameter field for id-alg-
  2088.       ESDH is KeyWrapAlgorihtm, and this parameter must be present.  The
  2089.       KeyWrapAlgorithm denotes the symmetric encryption algorithm used
  2090.       to encrypt the content-encryption key with the pairwise key-
  2091.       encryption key generated using the Ephemeral-Static Diffie-Hellman
  2092.       key agreement algorithm.  Triple-DES and RC2 key wrap algorithms
  2093.       are discussed in section 12.3.3.  The id-alg-ESDH algorithm
  2094.       identifier and parameter syntax is:
  2095.  
  2096.        id-alg-ESDH OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840)
  2097.            rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) alg(3) 5 }
  2098.  
  2099.        KeyWrapAlgorithm ::= AlgorithmIdentifier
  2100.  
  2101.       recipientEncryptedKeys contains an identifier and an encrypted key
  2102.       for each recipient.  The RecipientEncryptedKey
  2103.       KeyAgreeRecipientIdentifier must contain either the
  2104.       issuerAndSerialNumber identifying the recipient's certificate or
  2105.       the RecipientKeyIdentifier containing the subject key identifier
  2106.       from the recipient's certificate.  In both cases, the recipient's
  2107.       certificate contains the recipient's static public key.
  2108.       RecipientEncryptedKey EncryptedKey must contain the content-
  2109.       encryption key encrypted with the Ephemeral-Static Diffie-Hellman
  2110.       generated pairwise key-encryption key using the algorithm
  2111.       specified by the KeyWrapAlgortihm.
  2112.  
  2113. 12.3.2  Key Transport Algorithms
  2114.  
  2115.    CMS implementations should include key transport using RSA.  RSA
  2116.    implementations must include key transport of Triple-DES content-
  2117.    encryption keys.  RSA implementations should include key transport of
  2118.    RC2 content-encryption keys.
  2119.  
  2120.    Key transport algorithm identifiers are located in the EnvelopedData
  2121.    RecipientInfos KeyTransRecipientInfo keyEncryptionAlgorithm and
  2122.    AuthenticatedData RecipientInfos KeyTransRecipientInfo
  2123.    keyEncryptionAlgorithm fields.
  2124.  
  2125.    Key transport encrypted content-encryption keys are located in the
  2126.    EnvelopedData RecipientInfos KeyTransRecipientInfo encryptedKey
  2127.  
  2128.  
  2129.  
  2130. Housley                     Standards Track                    [Page 38]
  2131.  
  2132. RFC 2630              Cryptographic Message Syntax             June 1999
  2133.  
  2134.  
  2135.    field.  Key transport encrypted message-authentication keys are
  2136.    located in the AuthenticatedData RecipientInfos KeyTransRecipientInfo
  2137.    encryptedKey field.
  2138.  
  2139. 12.3.2.1  RSA
  2140.  
  2141.    The RSA key transport algorithm is the RSA encryption scheme defined
  2142.    in RFC 2313 [PKCS#1], block type is 02, where the message to be
  2143.    encrypted is the content-encryption key.  The algorithm identifier
  2144.    for RSA is:
  2145.  
  2146.       rsaEncryption OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2147.           us(840) rsadsi(113549) pkcs(1) pkcs-1(1) 1 }
  2148.  
  2149.    The AlgorithmIdentifier parameters field must be present, and the
  2150.    parameters field must contain NULL.
  2151.  
  2152.    When using a Triple-DES content-encryption key, adjust the parity
  2153.    bits for each DES key comprising the Triple-DES key prior to RSA
  2154.    encryption.
  2155.  
  2156.    The use of RSA encryption, as defined in RFC 2313 [PKCS#1], to
  2157.    provide confidentiality has a known vulnerability concerns.  The
  2158.    vulnerability is primarily relevant to usage in interactive
  2159.    applications rather than to store-and-forward environments.  Further
  2160.    information and proposed countermeasures are discussed in the
  2161.    Security Considerations section of this document.
  2162.  
  2163.    Note that the same encryption scheme is also defined in RFC 2437
  2164.    [NEWPKCS#1].  Within RFC 2437, this scheme is called
  2165.    RSAES-PKCS1-v1_5.
  2166.  
  2167. 12.3.3  Symmetric Key-Encryption Key Algorithms
  2168.  
  2169.    CMS implementations may include symmetric key-encryption key
  2170.    management.  Such CMS implementations must include Triple-DES key-
  2171.    encryption keys wrapping Triple-DES content-encryption keys, and such
  2172.    CMS implementations should include RC2 key-encryption keys wrapping
  2173.    RC2 content-encryption keys.  Only 128-bit RC2 keys may be used as
  2174.    key-encryption keys, and they must be used with the
  2175.    RC2ParameterVersion parameter set to 58.  A CMS implementation may
  2176.    support mixed key-encryption and content-encryption algorithms.  For
  2177.    example, a 40-bit RC2 content-encryption key may be wrapped with
  2178.    168-bit Triple-DES key-encryption key or with a 128-bit RC2 key-
  2179.    encryption key.
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  
  2186. Housley                     Standards Track                    [Page 39]
  2187.  
  2188. RFC 2630              Cryptographic Message Syntax             June 1999
  2189.  
  2190.  
  2191.    Key wrap algorithm identifiers are located in the EnvelopedData
  2192.    RecipientInfos KEKRecipientInfo keyEncryptionAlgorithm and
  2193.    AuthenticatedData RecipientInfos KEKRecipientInfo
  2194.    keyEncryptionAlgorithm fields.
  2195.  
  2196.    Wrapped content-encryption keys are located in the EnvelopedData
  2197.    RecipientInfos KEKRecipientInfo encryptedKey field.  Wrapped
  2198.    message-authentication keys are located in the AuthenticatedData
  2199.    RecipientInfos KEKRecipientInfo encryptedKey field.
  2200.  
  2201.    The output of a key agreement algorithm is a key-encryption key, and
  2202.    this key-encryption key is used to encrypt the content-encryption
  2203.    key.  In conjunction with key agreement algorithms, CMS
  2204.    implementations must include encryption of content-encryption keys
  2205.    with the pairwise key-encryption key generated using a key agreement
  2206.    algorithm.  To support key agreement, key wrap algorithm identifiers
  2207.    are located in the KeyWrapAlgorithm parameter of the EnvelopedData
  2208.    RecipientInfos KeyAgreeRecipientInfo keyEncryptionAlgorithm and
  2209.    AuthenticatedData RecipientInfos KeyAgreeRecipientInfo
  2210.    keyEncryptionAlgorithm fields.  Wrapped content-encryption keys are
  2211.    located in the EnvelopedData RecipientInfos KeyAgreeRecipientInfo
  2212.    RecipientEncryptedKeys encryptedKey field, wrapped message-
  2213.    authentication keys are located in the AuthenticatedData
  2214.    RecipientInfos KeyAgreeRecipientInfo RecipientEncryptedKeys
  2215.    encryptedKey field.
  2216.  
  2217. 12.3.3.1  Triple-DES Key Wrap
  2218.  
  2219.    Triple-DES key encryption has the algorithm identifier:
  2220.  
  2221.       id-alg-CMS3DESwrap OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2222.           us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) alg(3) 6 }
  2223.  
  2224.    The AlgorithmIdentifier parameter field must be NULL.
  2225.  
  2226.    The key wrap algorithm used to encrypt a Triple-DES content-
  2227.    encryption key with a Triple-DES key-encryption key is specified in
  2228.    section 12.6.
  2229.  
  2230.    Out-of-band distribution of the Triple-DES key-encryption key used to
  2231.    encrypt the Triple-DES content-encryption key is beyond of the scope
  2232.    of this document.
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242. Housley                     Standards Track                    [Page 40]
  2243.  
  2244. RFC 2630              Cryptographic Message Syntax             June 1999
  2245.  
  2246.  
  2247. 12.3.3.2  RC2 Key Wrap
  2248.  
  2249.    RC2 key encryption has the algorithm identifier:
  2250.  
  2251.       id-alg-CMSRC2wrap OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2252.           us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) alg(3) 7 }
  2253.  
  2254.    The AlgorithmIdentifier parameter field must be RC2wrapParameter:
  2255.  
  2256.       RC2wrapParameter ::= RC2ParameterVersion
  2257.  
  2258.       RC2ParameterVersion ::= INTEGER
  2259.  
  2260.    The RC2 effective-key-bits (key size) greater than 32 and less than
  2261.    256 is encoded in the RC2ParameterVersion.  For the effective-key-
  2262.    bits of 40, 64, and 128, the rc2ParameterVersion values are 160, 120,
  2263.    and 58 respectively.  These values are not simply the RC2 key length.
  2264.    Note that the value 160 must be encoded as two octets (00 A0),
  2265.    because the one octet (A0) encoding represents a negative number.
  2266.  
  2267.    Only 128-bit RC2 keys may be used as key-encryption keys, and they
  2268.    must be used with the RC2ParameterVersion parameter set to 58.
  2269.  
  2270.    The key wrap algorithm used to encrypt a RC2 content-encryption key
  2271.    with a RC2 key-encryption key is specified in section 12.6.
  2272.  
  2273.    Out-of-band distribution of the RC2 key-encryption key used to
  2274.    encrypt the RC2 content-encryption key is beyond of the scope of this
  2275.    document.
  2276.  
  2277. 12.4  Content Encryption Algorithms
  2278.  
  2279.    CMS implementations must include Triple-DES in CBC mode.  CMS
  2280.    implementations should include RC2 in CBC mode.
  2281.  
  2282.    Content encryption algorithms identifiers are located in the
  2283.    EnvelopedData EncryptedContentInfo contentEncryptionAlgorithm and the
  2284.    EncryptedData EncryptedContentInfo contentEncryptionAlgorithm fields.
  2285.  
  2286.    Content encryption algorithms are used to encipher the content
  2287.    located in the EnvelopedData EncryptedContentInfo encryptedContent
  2288.    field and the EncryptedData EncryptedContentInfo encryptedContent
  2289.    field.
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298. Housley                     Standards Track                    [Page 41]
  2299.  
  2300. RFC 2630              Cryptographic Message Syntax             June 1999
  2301.  
  2302.  
  2303. 12.4.1  Triple-DES CBC
  2304.  
  2305.    The Triple-DES algorithm is described in ANSI X9.52 [3DES].  The
  2306.    Triple-DES is composed from three sequential DES [DES] operations:
  2307.    encrypt, decrypt, and encrypt.  Three-Key Triple-DES uses a different
  2308.    key for each DES operation.  Two-Key Triple-DES uses one key for the
  2309.    two encrypt operations and different key for the decrypt operation.
  2310.    The same algorithm identifiers are used for Three-Key Triple-DES and
  2311.    Two-Key Triple-DES.  The algorithm identifier for Triple-DES in
  2312.    Cipher Block Chaining (CBC) mode is:
  2313.  
  2314.       des-ede3-cbc OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2315.           us(840) rsadsi(113549) encryptionAlgorithm(3) 7 }
  2316.  
  2317.    The AlgorithmIdentifier parameters field must be present, and the
  2318.    parameters field must contain a CBCParameter:
  2319.  
  2320.       CBCParameter ::= IV
  2321.  
  2322.       IV ::= OCTET STRING  -- exactly 8 octets
  2323.  
  2324. 12.4.2  RC2 CBC
  2325.  
  2326.    The RC2 algorithm is described in RFC 2268 [RC2].  The algorithm
  2327.    identifier for RC2 in CBC mode is:
  2328.  
  2329.       rc2-cbc OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840)
  2330.           rsadsi(113549) encryptionAlgorithm(3) 2 }
  2331.  
  2332.    The AlgorithmIdentifier parameters field must be present, and the
  2333.    parameters field must contain a RC2CBCParameter:
  2334.  
  2335.       RC2CBCParameter ::= SEQUENCE {
  2336.         rc2ParameterVersion INTEGER,
  2337.         iv OCTET STRING  }  -- exactly 8 octets
  2338.  
  2339.    The RC2 effective-key-bits (key size) greater than 32 and less than
  2340.    256 is encoded in the rc2ParameterVersion.  For the effective-key-
  2341.    bits of 40, 64, and 128, the rc2ParameterVersion values are 160, 120,
  2342.    and 58 respectively.  These values are not simply the RC2 key length.
  2343.    Note that the value 160 must be encoded as two octets (00 A0), since
  2344.    the one octet (A0) encoding represents a negative number.
  2345.  
  2346. 12.5  Message Authentication Code Algorithms
  2347.  
  2348.    CMS implementations that support authenticatedData must include HMAC
  2349.    with SHA-1.
  2350.  
  2351.  
  2352.  
  2353.  
  2354. Housley                     Standards Track                    [Page 42]
  2355.  
  2356. RFC 2630              Cryptographic Message Syntax             June 1999
  2357.  
  2358.  
  2359.    MAC algorithm identifiers are located in the AuthenticatedData
  2360.    macAlgorithm field.
  2361.  
  2362.    MAC values are located in the AuthenticatedData mac field.
  2363.  
  2364. 12.5.1  HMAC with SHA-1
  2365.  
  2366.    The HMAC with SHA-1 algorithm is described in RFC 2104 [HMAC].  The
  2367.    algorithm identifier for HMAC with SHA-1 is:
  2368.  
  2369.       hMAC-SHA1 OBJECT IDENTIFIER ::= { iso(1) identified-organization(3)
  2370.           dod(6) internet(1) security(5) mechanisms(5) 8 1 2 }
  2371.  
  2372.    The AlgorithmIdentifier parameters field must be absent.
  2373.  
  2374. 12.6  Triple-DES and RC2 Key Wrap Algorithms
  2375.  
  2376.    CMS implementations must include encryption of a Triple-DES content-
  2377.    encryption key with a Triple-DES key-encryption key using the
  2378.    algorithm specified in Sections 12.6.2 and 12.6.3.  CMS
  2379.    implementations should include encryption of a RC2 content-encryption
  2380.    key with a RC2 key-encryption key using the algorithm specified in
  2381.    Sections 12.6.4 and 12.6.5.  Triple-DES and RC2 content-encryption
  2382.    keys are encrypted in Cipher Block Chaining (CBC) mode [MODES].
  2383.  
  2384.    Key Transport algorithms allow for the content-encryption key to be
  2385.    directly encrypted; however, key agreement and symmetric key-
  2386.    encryption key algorithms encrypt the content-encryption key with a
  2387.    second symmetric encryption algorithm.  This section describes how
  2388.    the Triple-DES or RC2 content-encryption key is formatted and
  2389.    encrypted.
  2390.  
  2391.    Key agreement algorithms generate a pairwise key-encryption key, and
  2392.    a key wrap algorithm is used to encrypt the content-encryption key
  2393.    with the pairwise key-encryption key.  Similarly, a key wrap
  2394.    algorithm is used to encrypt the content-encryption key in a
  2395.    previously distributed key-encryption key.
  2396.  
  2397.    The key-encryption key is generated by the key agreement algorithm or
  2398.    distributed out of band.  For key agreement of RC2 key-encryption
  2399.    keys, 128 bits must be generated as input to the key expansion
  2400.    process used to compute the RC2 effective key [RC2].
  2401.  
  2402.    The same algorithm identifier is used for both 2-key and 3-key
  2403.    Triple-DES.  When the length of the content-encryption key to be
  2404.    wrapped is a 2-key Triple-DES key, a third key with the same value as
  2405.    the first key is created.  Thus, all Triple-DES content-encryption
  2406.    keys are wrapped like 3-key Triple-DES keys.
  2407.  
  2408.  
  2409.  
  2410. Housley                     Standards Track                    [Page 43]
  2411.  
  2412. RFC 2630              Cryptographic Message Syntax             June 1999
  2413.  
  2414.  
  2415. 12.6.1  Key Checksum
  2416.  
  2417.    The CMS Checksum Algorithm is used to provide a content-encryption
  2418.    key integrity check value.  The algorithm is:
  2419.  
  2420.    1.  Compute a 20 octet SHA-1 [SHA1] message digest on the
  2421.        content-encryption key.
  2422.    2.  Use the most significant (first) eight octets of the message
  2423.        digest value as the checksum value.
  2424.  
  2425. 12.6.2  Triple-DES Key Wrap
  2426.  
  2427.    The Triple-DES key wrap algorithm encrypts a Triple-DES content-
  2428.    encryption key with a Triple-DES key-encryption key.  The Triple-DES
  2429.    key wrap algorithm is:
  2430.  
  2431.    1.  Set odd parity for each of the DES key octets comprising
  2432.        the content-encryption key, call the result CEK.
  2433.    2.  Compute an 8 octet key checksum value on CEK as described above
  2434.        in Section 12.6.1, call the result ICV.
  2435.    3.  Let CEKICV = CEK || ICV.
  2436.    4.  Generate 8 octets at random, call the result IV.
  2437.    5.  Encrypt CEKICV in CBC mode using the key-encryption key.  Use
  2438.        the random value generated in the previous step as the
  2439.        initialization vector (IV).  Call the ciphertext TEMP1.
  2440.    6.  Let TEMP2 = IV || TEMP1.
  2441.    7.  Reverse the order of the octets in TEMP2.  That is, the most
  2442.        significant (first) octet is swapped with the least significant
  2443.        (last) octet, and so on.  Call the result TEMP3.
  2444.    8.  Encrypt TEMP3 in CBC mode using the key-encryption key.  Use
  2445.        an initialization vector (IV) of 0x4adda22c79e82105.
  2446.        The ciphertext is 40 octets long.
  2447.  
  2448.    Note:  When the same content-encryption key is wrapped in different
  2449.    key-encryption keys, a fresh initialization vector (IV) must be
  2450.    generated for each invocation of the key wrap algorithm.
  2451.  
  2452. 12.6.3  Triple-DES Key Unwrap
  2453.  
  2454.    The Triple-DES key unwrap algorithm decrypts a Triple-DES content-
  2455.    encryption key using a Triple-DES key-encryption key.  The Triple-DES
  2456.    key unwrap algorithm is:
  2457.  
  2458.    1.  If the wrapped content-encryption key is not 40 octets, then
  2459.        error.
  2460.    2.  Decrypt the wrapped content-encryption key in CBC mode using
  2461.        the key-encryption key.  Use an initialization vector (IV)
  2462.        of 0x4adda22c79e82105.  Call the output TEMP3.
  2463.  
  2464.  
  2465.  
  2466. Housley                     Standards Track                    [Page 44]
  2467.  
  2468. RFC 2630              Cryptographic Message Syntax             June 1999
  2469.  
  2470.  
  2471.    3.  Reverse the order of the octets in TEMP3.  That is, the most
  2472.        significant (first) octet is swapped with the least significant
  2473.        (last) octet, and so on.  Call the result TEMP2.
  2474.    4.  Decompose the TEMP2 into IV and TEMP1.  IV is the most
  2475.        significant (first) 8 octets, and TEMP1 is the least significant
  2476.        (last) 32 octets.
  2477.    5.  Decrypt TEMP1 in CBC mode using the key-encryption key.  Use
  2478.        the IV value from the previous step as the initialization vector.
  2479.        Call the ciphertext CEKICV.
  2480.    6.  Decompose the CEKICV into CEK and ICV. CEK is the most significant
  2481.        (first) 24 octets, and ICV is the least significant (last) 8 octets.
  2482.    7.  Compute an 8 octet key checksum value on CEK as described above
  2483.        in Section 12.6.1.  If the computed key checksum value does not
  2484.        match the decrypted key checksum value, ICV, then error.
  2485.    8.  Check for odd parity each of the DES key octets comprising CEK.
  2486.        If parity is incorrect, then there is an error.
  2487.    9.  Use CEK as the content-encryption key.
  2488.  
  2489. 12.6.4  RC2 Key Wrap
  2490.  
  2491.    The RC2 key wrap algorithm encrypts a RC2 content-encryption key with
  2492.    a RC2 key-encryption key.  The RC2 key wrap algorithm is:
  2493.  
  2494.    1.  Let the content-encryption key be called CEK, and let the length
  2495.        of the content-encryption key in octets be called LENGTH.  LENGTH
  2496.        is a single octet.
  2497.    2.  Let LCEK = LENGTH || CEK.
  2498.    3.  Let LCEKPAD = LCEK || PAD.  If the length of LCEK is a multiple
  2499.        of 8, the PAD has a length of zero.  If the length of LCEK is
  2500.        not a multiple of 8, then PAD contains the fewest number of
  2501.        random octets to make the length of LCEKPAD a multiple of 8.
  2502.    4.  Compute an 8 octet key checksum value on LCEKPAD as described
  2503.        above in Section 12.6.1, call the result ICV.
  2504.    5.  Let LCEKPADICV = LCEKPAD || ICV.
  2505.    6.  Generate 8 octets at random, call the result IV.
  2506.    7.  Encrypt LCEKPADICV in CBC mode using the key-encryption key.
  2507.        Use the random value generated in the previous step as the
  2508.        initialization vector (IV).  Call the ciphertext TEMP1.
  2509.    8.  Let TEMP2 = IV || TEMP1.
  2510.    9.  Reverse the order of the octets in TEMP2.  That is, the most
  2511.        significant (first) octet is swapped with the least significant
  2512.        (last) octet, and so on.  Call the result TEMP3.
  2513.    10. Encrypt TEMP3 in CBC mode using the key-encryption key.  Use
  2514.        an initialization vector (IV) of 0x4adda22c79e82105.
  2515.  
  2516.    Note:  When the same content-encryption key is wrapped in different
  2517.    key-encryption keys, a fresh initialization vector (IV) must be
  2518.    generated for each invocation of the key wrap algorithm.
  2519.  
  2520.  
  2521.  
  2522. Housley                     Standards Track                    [Page 45]
  2523.  
  2524. RFC 2630              Cryptographic Message Syntax             June 1999
  2525.  
  2526.  
  2527. 12.6.5  RC2 Key Unwrap
  2528.  
  2529.    The RC2 key unwrap algorithm decrypts a RC2 content-encryption key
  2530.    using a RC2 key-encryption key.  The RC2 key unwrap algorithm is:
  2531.  
  2532.    1.  If the wrapped content-encryption key is not a multiple of 8
  2533.        octets, then error.
  2534.    2.  Decrypt the wrapped content-encryption key in CBC mode using
  2535.        the key-encryption key.  Use an initialization vector (IV)
  2536.        of 0x4adda22c79e82105.  Call the output TEMP3.
  2537.    3.  Reverse the order of the octets in TEMP3.  That is, the most
  2538.        significant (first) octet is swapped with the least significant
  2539.        (last) octet, and so on.  Call the result TEMP2.
  2540.    4.  Decompose the TEMP2 into IV and TEMP1.  IV is the most
  2541.        significant (first) 8 octets, and TEMP1 is the remaining octets.
  2542.  
  2543.    5.  Decrypt TEMP1 in CBC mode using the key-encryption key.  Use
  2544.        the IV value from the previous step as the initialization vector.
  2545.        Call the plaintext LCEKPADICV.
  2546.    6.  Decompose the LCEKPADICV into LCEKPAD, and ICV.  ICV is the
  2547.        least significant (last) octet 8 octets.  LCEKPAD is the
  2548.        remaining octets.
  2549.    7.  Compute an 8 octet key checksum value on LCEKPAD as described
  2550.        above in Section 12.6.1.  If the computed key checksum value
  2551.        does not match the decrypted key checksum value, ICV, then error.
  2552.    8.  Decompose the LCEKPAD into LENGTH, CEK, and PAD.  LENGTH is the
  2553.        most significant (first) octet.  CEK is the following LENGTH
  2554.        octets.  PAD is the remaining octets, if any.
  2555.    9.  If the length of PAD is more than 7 octets, then error.
  2556.    10. Use CEK as the content-encryption key.
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578. Housley                     Standards Track                    [Page 46]
  2579.  
  2580. RFC 2630              Cryptographic Message Syntax             June 1999
  2581.  
  2582.  
  2583. Appendix A:  ASN.1 Module
  2584.  
  2585. CryptographicMessageSyntax
  2586.     { iso(1) member-body(2) us(840) rsadsi(113549)
  2587.       pkcs(1) pkcs-9(9) smime(16) modules(0) cms(1) }
  2588.  
  2589. DEFINITIONS IMPLICIT TAGS ::=
  2590. BEGIN
  2591.  
  2592. -- EXPORTS All
  2593. -- The types and values defined in this module are exported for use in
  2594. -- the other ASN.1 modules.  Other applications may use them for their
  2595. -- own purposes.
  2596.  
  2597. IMPORTS
  2598.  
  2599.   -- Directory Information Framework (X.501)
  2600.         Name
  2601.            FROM InformationFramework { joint-iso-itu-t ds(5) modules(1)
  2602.                 informationFramework(1) 3 }
  2603.  
  2604.   -- Directory Authentication Framework (X.509)
  2605.         AlgorithmIdentifier, AttributeCertificate, Certificate,
  2606.         CertificateList, CertificateSerialNumber
  2607.            FROM AuthenticationFramework { joint-iso-itu-t ds(5)
  2608.                 module(1) authenticationFramework(7) 3 } ;
  2609.  
  2610.  
  2611. -- Cryptographic Message Syntax
  2612.  
  2613. ContentInfo ::= SEQUENCE {
  2614.   contentType ContentType,
  2615.   content [0] EXPLICIT ANY DEFINED BY contentType }
  2616.  
  2617. ContentType ::= OBJECT IDENTIFIER
  2618.  
  2619. SignedData ::= SEQUENCE {
  2620.   version CMSVersion,
  2621.   digestAlgorithms DigestAlgorithmIdentifiers,
  2622.   encapContentInfo EncapsulatedContentInfo,
  2623.   certificates [0] IMPLICIT CertificateSet OPTIONAL,
  2624.   crls [1] IMPLICIT CertificateRevocationLists OPTIONAL,
  2625.   signerInfos SignerInfos }
  2626.  
  2627. DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier
  2628.  
  2629. SignerInfos ::= SET OF SignerInfo
  2630.  
  2631.  
  2632.  
  2633.  
  2634. Housley                     Standards Track                    [Page 47]
  2635.  
  2636. RFC 2630              Cryptographic Message Syntax             June 1999
  2637.  
  2638.  
  2639. EncapsulatedContentInfo ::= SEQUENCE {
  2640.   eContentType ContentType,
  2641.   eContent [0] EXPLICIT OCTET STRING OPTIONAL }
  2642.  
  2643. SignerInfo ::= SEQUENCE {
  2644.   version CMSVersion,
  2645.   sid SignerIdentifier,
  2646.   digestAlgorithm DigestAlgorithmIdentifier,
  2647.   signedAttrs [0] IMPLICIT SignedAttributes OPTIONAL,
  2648.   signatureAlgorithm SignatureAlgorithmIdentifier,
  2649.   signature SignatureValue,
  2650.   unsignedAttrs [1] IMPLICIT UnsignedAttributes OPTIONAL }
  2651.  
  2652. SignerIdentifier ::= CHOICE {
  2653.   issuerAndSerialNumber IssuerAndSerialNumber,
  2654.   subjectKeyIdentifier [0] SubjectKeyIdentifier }
  2655.  
  2656. SignedAttributes ::= SET SIZE (1..MAX) OF Attribute
  2657.  
  2658. UnsignedAttributes ::= SET SIZE (1..MAX) OF Attribute
  2659.  
  2660. Attribute ::= SEQUENCE {
  2661.   attrType OBJECT IDENTIFIER,
  2662.   attrValues SET OF AttributeValue }
  2663.  
  2664. AttributeValue ::= ANY
  2665.  
  2666. SignatureValue ::= OCTET STRING
  2667.  
  2668. EnvelopedData ::= SEQUENCE {
  2669.   version CMSVersion,
  2670.   originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
  2671.   recipientInfos RecipientInfos,
  2672.   encryptedContentInfo EncryptedContentInfo,
  2673.   unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }
  2674.  
  2675. OriginatorInfo ::= SEQUENCE {
  2676.   certs [0] IMPLICIT CertificateSet OPTIONAL,
  2677.   crls [1] IMPLICIT CertificateRevocationLists OPTIONAL }
  2678.  
  2679. RecipientInfos ::= SET OF RecipientInfo
  2680.  
  2681. EncryptedContentInfo ::= SEQUENCE {
  2682.   contentType ContentType,
  2683.   contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
  2684.   encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL }
  2685.  
  2686. EncryptedContent ::= OCTET STRING
  2687.  
  2688.  
  2689.  
  2690. Housley                     Standards Track                    [Page 48]
  2691.  
  2692. RFC 2630              Cryptographic Message Syntax             June 1999
  2693.  
  2694.  
  2695. UnprotectedAttributes ::= SET SIZE (1..MAX) OF Attribute
  2696.  
  2697. RecipientInfo ::= CHOICE {
  2698.   ktri KeyTransRecipientInfo,
  2699.   kari [1] KeyAgreeRecipientInfo,
  2700.   kekri [2] KEKRecipientInfo }
  2701.  
  2702. EncryptedKey ::= OCTET STRING
  2703.  
  2704. KeyTransRecipientInfo ::= SEQUENCE {
  2705.   version CMSVersion,  -- always set to 0 or 2
  2706.   rid RecipientIdentifier,
  2707.   keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
  2708.   encryptedKey EncryptedKey }
  2709.  
  2710. RecipientIdentifier ::= CHOICE {
  2711.   issuerAndSerialNumber IssuerAndSerialNumber,
  2712.   subjectKeyIdentifier [0] SubjectKeyIdentifier }
  2713.  
  2714. KeyAgreeRecipientInfo ::= SEQUENCE {
  2715.   version CMSVersion,  -- always set to 3
  2716.   originator [0] EXPLICIT OriginatorIdentifierOrKey,
  2717.   ukm [1] EXPLICIT UserKeyingMaterial OPTIONAL,
  2718.   keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
  2719.   recipientEncryptedKeys RecipientEncryptedKeys }
  2720.  
  2721. OriginatorIdentifierOrKey ::= CHOICE {
  2722.   issuerAndSerialNumber IssuerAndSerialNumber,
  2723.   subjectKeyIdentifier [0] SubjectKeyIdentifier,
  2724.   originatorKey [1] OriginatorPublicKey }
  2725.  
  2726. OriginatorPublicKey ::= SEQUENCE {
  2727.   algorithm AlgorithmIdentifier,
  2728.   publicKey BIT STRING }
  2729.  
  2730. RecipientEncryptedKeys ::= SEQUENCE OF RecipientEncryptedKey
  2731.  
  2732. RecipientEncryptedKey ::= SEQUENCE {
  2733.   rid KeyAgreeRecipientIdentifier,
  2734.   encryptedKey EncryptedKey }
  2735.  
  2736. KeyAgreeRecipientIdentifier ::= CHOICE {
  2737.   issuerAndSerialNumber IssuerAndSerialNumber,
  2738.   rKeyId [0] IMPLICIT RecipientKeyIdentifier }
  2739.  
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746. Housley                     Standards Track                    [Page 49]
  2747.  
  2748. RFC 2630              Cryptographic Message Syntax             June 1999
  2749.  
  2750.  
  2751. RecipientKeyIdentifier ::= SEQUENCE {
  2752.   subjectKeyIdentifier SubjectKeyIdentifier,
  2753.   date GeneralizedTime OPTIONAL,
  2754.   other OtherKeyAttribute OPTIONAL }
  2755.  
  2756. SubjectKeyIdentifier ::= OCTET STRING
  2757.  
  2758. KEKRecipientInfo ::= SEQUENCE {
  2759.   version CMSVersion,  -- always set to 4
  2760.   kekid KEKIdentifier,
  2761.   keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
  2762.   encryptedKey EncryptedKey }
  2763.  
  2764. KEKIdentifier ::= SEQUENCE {
  2765.   keyIdentifier OCTET STRING,
  2766.   date GeneralizedTime OPTIONAL,
  2767.   other OtherKeyAttribute OPTIONAL }
  2768.  
  2769. DigestedData ::= SEQUENCE {
  2770.   version CMSVersion,
  2771.   digestAlgorithm DigestAlgorithmIdentifier,
  2772.   encapContentInfo EncapsulatedContentInfo,
  2773.   digest Digest }
  2774.  
  2775. Digest ::= OCTET STRING
  2776.  
  2777. EncryptedData ::= SEQUENCE {
  2778.   version CMSVersion,
  2779.   encryptedContentInfo EncryptedContentInfo,
  2780.   unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }
  2781.  
  2782. AuthenticatedData ::= SEQUENCE {
  2783.   version CMSVersion,
  2784.   originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
  2785.   recipientInfos RecipientInfos,
  2786.   macAlgorithm MessageAuthenticationCodeAlgorithm,
  2787.   digestAlgorithm [1] DigestAlgorithmIdentifier OPTIONAL,
  2788.   encapContentInfo EncapsulatedContentInfo,
  2789.   authenticatedAttributes [2] IMPLICIT AuthAttributes OPTIONAL,
  2790.   mac MessageAuthenticationCode,
  2791.   unauthenticatedAttributes [3] IMPLICIT UnauthAttributes OPTIONAL }
  2792.  
  2793. AuthAttributes ::= SET SIZE (1..MAX) OF Attribute
  2794.  
  2795. UnauthAttributes ::= SET SIZE (1..MAX) OF Attribute
  2796.  
  2797. MessageAuthenticationCode ::= OCTET STRING
  2798.  
  2799.  
  2800.  
  2801.  
  2802. Housley                     Standards Track                    [Page 50]
  2803.  
  2804. RFC 2630              Cryptographic Message Syntax             June 1999
  2805.  
  2806.  
  2807. DigestAlgorithmIdentifier ::= AlgorithmIdentifier
  2808.  
  2809. SignatureAlgorithmIdentifier ::= AlgorithmIdentifier
  2810.  
  2811. KeyEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
  2812.  
  2813. ContentEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
  2814.  
  2815. MessageAuthenticationCodeAlgorithm ::= AlgorithmIdentifier
  2816.  
  2817. CertificateRevocationLists ::= SET OF CertificateList
  2818.  
  2819. CertificateChoices ::= CHOICE {
  2820.   certificate Certificate,  -- See X.509
  2821.   extendedCertificate [0] IMPLICIT ExtendedCertificate,  -- Obsolete
  2822.   attrCert [1] IMPLICIT AttributeCertificate }  -- See X.509 & X9.57
  2823.  
  2824. CertificateSet ::= SET OF CertificateChoices
  2825.  
  2826. IssuerAndSerialNumber ::= SEQUENCE {
  2827.   issuer Name,
  2828.   serialNumber CertificateSerialNumber }
  2829.  
  2830. CMSVersion ::= INTEGER  { v0(0), v1(1), v2(2), v3(3), v4(4) }
  2831.  
  2832. UserKeyingMaterial ::= OCTET STRING
  2833.  
  2834. OtherKeyAttribute ::= SEQUENCE {
  2835.   keyAttrId OBJECT IDENTIFIER,
  2836.   keyAttr ANY DEFINED BY keyAttrId OPTIONAL }
  2837.  
  2838.  
  2839. -- CMS Attributes
  2840.  
  2841. MessageDigest ::= OCTET STRING
  2842.  
  2843. SigningTime  ::= Time
  2844.  
  2845. Time ::= CHOICE {
  2846.   utcTime UTCTime,
  2847.   generalTime GeneralizedTime }
  2848.  
  2849. Countersignature ::= SignerInfo
  2850.  
  2851.  
  2852.  
  2853.  
  2854.  
  2855.  
  2856.  
  2857.  
  2858. Housley                     Standards Track                    [Page 51]
  2859.  
  2860. RFC 2630              Cryptographic Message Syntax             June 1999
  2861.  
  2862.  
  2863. -- Algorithm Identifiers
  2864.  
  2865. sha-1 OBJECT IDENTIFIER ::= { iso(1) identified-organization(3)
  2866.     oiw(14) secsig(3) algorithm(2) 26 }
  2867.  
  2868. md5 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840)
  2869.     rsadsi(113549) digestAlgorithm(2) 5 }
  2870.  
  2871. id-dsa-with-sha1 OBJECT IDENTIFIER ::=  { iso(1) member-body(2)
  2872.     us(840) x9-57 (10040) x9cm(4) 3 }
  2873.  
  2874. rsaEncryption OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2875.     us(840) rsadsi(113549) pkcs(1) pkcs-1(1) 1 }
  2876.  
  2877. dh-public-number OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2878.     us(840) ansi-x942(10046) number-type(2) 1 }
  2879.  
  2880. id-alg-ESDH OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840)
  2881.     rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) alg(3) 5 }
  2882.  
  2883. id-alg-CMS3DESwrap OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2884.     us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) alg(3) 6 }
  2885.  
  2886. id-alg-CMSRC2wrap OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2887.     us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) alg(3) 7 }
  2888.  
  2889. des-ede3-cbc OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2890.     us(840) rsadsi(113549) encryptionAlgorithm(3) 7 }
  2891.  
  2892. rc2-cbc OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840)
  2893.     rsadsi(113549) encryptionAlgorithm(3) 2 }
  2894.  
  2895. hMAC-SHA1 OBJECT IDENTIFIER ::= { iso(1) identified-organization(3)
  2896.     dod(6) internet(1) security(5) mechanisms(5) 8 1 2 }
  2897.  
  2898.  
  2899. -- Algorithm Parameters
  2900.  
  2901. KeyWrapAlgorithm ::= AlgorithmIdentifier
  2902.  
  2903. RC2wrapParameter ::= RC2ParameterVersion
  2904.  
  2905. RC2ParameterVersion ::= INTEGER
  2906.  
  2907. CBCParameter ::= IV
  2908.  
  2909. IV ::= OCTET STRING  -- exactly 8 octets
  2910.  
  2911.  
  2912.  
  2913.  
  2914. Housley                     Standards Track                    [Page 52]
  2915.  
  2916. RFC 2630              Cryptographic Message Syntax             June 1999
  2917.  
  2918.  
  2919. RC2CBCParameter ::= SEQUENCE {
  2920.   rc2ParameterVersion INTEGER,
  2921.   iv OCTET STRING  }  -- exactly 8 octets
  2922.  
  2923.  
  2924. -- Content Type Object Identifiers
  2925.  
  2926. id-ct-contentInfo OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2927.     us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16)
  2928.     ct(1) 6 }
  2929.  
  2930. id-data OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2931.     us(840) rsadsi(113549) pkcs(1) pkcs7(7) 1 }
  2932.  
  2933. id-signedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2934.     us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 }
  2935.  
  2936. id-envelopedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2937.     us(840) rsadsi(113549) pkcs(1) pkcs7(7) 3 }
  2938.  
  2939. id-digestedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2940.     us(840) rsadsi(113549) pkcs(1) pkcs7(7) 5 }
  2941.  
  2942. id-encryptedData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2943.     us(840) rsadsi(113549) pkcs(1) pkcs7(7) 6 }
  2944.  
  2945. id-ct-authData OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2946.     us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16)
  2947.     ct(1) 2 }
  2948.  
  2949.  
  2950. -- Attribute Object Identifiers
  2951.  
  2952. id-contentType OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2953.     us(840) rsadsi(113549) pkcs(1) pkcs9(9) 3 }
  2954.  
  2955. id-messageDigest OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2956.     us(840) rsadsi(113549) pkcs(1) pkcs9(9) 4 }
  2957.  
  2958. id-signingTime OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2959.     us(840) rsadsi(113549) pkcs(1) pkcs9(9) 5 }
  2960.  
  2961. id-countersignature OBJECT IDENTIFIER ::= { iso(1) member-body(2)
  2962.     us(840) rsadsi(113549) pkcs(1) pkcs9(9) 6 }
  2963.  
  2964.  
  2965.  
  2966.  
  2967.  
  2968.  
  2969.  
  2970. Housley                     Standards Track                    [Page 53]
  2971.  
  2972. RFC 2630              Cryptographic Message Syntax             June 1999
  2973.  
  2974.  
  2975. -- Obsolete Extended Certificate syntax from PKCS#6
  2976.  
  2977. ExtendedCertificate ::= SEQUENCE {
  2978.   extendedCertificateInfo ExtendedCertificateInfo,
  2979.   signatureAlgorithm SignatureAlgorithmIdentifier,
  2980.   signature Signature }
  2981.  
  2982. ExtendedCertificateInfo ::= SEQUENCE {
  2983.   version CMSVersion,
  2984.   certificate Certificate,
  2985.   attributes UnauthAttributes }
  2986.  
  2987. Signature ::= BIT STRING
  2988.  
  2989.  
  2990. END -- of CryptographicMessageSyntax
  2991.  
  2992.  
  2993.  
  2994.  
  2995.  
  2996.  
  2997.  
  2998.  
  2999.  
  3000.  
  3001.  
  3002.  
  3003.  
  3004.  
  3005.  
  3006.  
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026. Housley                     Standards Track                    [Page 54]
  3027.  
  3028. RFC 2630              Cryptographic Message Syntax             June 1999
  3029.  
  3030.  
  3031. References
  3032.  
  3033.    3DES       American National Standards Institute.  ANSI X9.52-1998,
  3034.               Triple Data Encryption Algorithm Modes of Operation. 1998.
  3035.  
  3036.    DES        American National Standards Institute.  ANSI X3.106,
  3037.               "American National Standard for Information Systems - Data
  3038.               Link Encryption".  1983.
  3039.  
  3040.    DH-X9.42   Rescorla, E., "Diffie-Hellman Key Agreement Method",
  3041.               RFC 2631, June 1999.
  3042.  
  3043.    DSS        National Institute of Standards and Technology.
  3044.               FIPS Pub 186: Digital Signature Standard.  19 May 1994.
  3045.  
  3046.    ESS        Hoffman, P., Editor, "Enhanced Security Services for
  3047.               S/MIME", RFC 2634, June 1999.
  3048.  
  3049.    HMAC       Krawczyk, H., "HMAC: Keyed-Hashing for Message
  3050.               Authentication", RFC 2104, February 1997.
  3051.  
  3052.    MD5        Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321,
  3053.               April 1992.
  3054.  
  3055.    MODES      National Institute of Standards and Technology.
  3056.               FIPS Pub 81: DES Modes of Operation.  2 December 1980.
  3057.  
  3058.    MSG        Ramsdell, B., Editor, "S/MIME Version 3 Message
  3059.               Specification", RFC 2633, June 1999.
  3060.  
  3061.    NEWPKCS#1  Kaliski, B., "PKCS #1: RSA Encryption, Version 2.0",
  3062.               RFC 2347, October 1998.
  3063.  
  3064.    PROFILE    Housley, R., Ford, W., Polk, W. and D. Solo, "Internet
  3065.               X.509 Public Key Infrastructure: Certificate and CRL
  3066.               Profile", RFC 2459, January 1999.
  3067.  
  3068.    PKCS#1     Kaliski, B., "PKCS #1: RSA Encryption, Version 1.5.",
  3069.               RFC 2313, March 1998.
  3070.  
  3071.    PKCS#6     RSA Laboratories.  PKCS #6: Extended-Certificate Syntax
  3072.               Standard, Version 1.5.  November 1993.
  3073.  
  3074.    PKCS#7     Kaliski, B., "PKCS #7: Cryptographic Message Syntax,
  3075.               Version 1.5.", RFC 2315, March 1998.
  3076.  
  3077.    PKCS#9     RSA Laboratories.  PKCS #9: Selected Attribute Types,
  3078.               Version 1.1.  November 1993.
  3079.  
  3080.  
  3081.  
  3082. Housley                     Standards Track                    [Page 55]
  3083.  
  3084. RFC 2630              Cryptographic Message Syntax             June 1999
  3085.  
  3086.  
  3087.    RANDOM     Eastlake, D., Crocker, S. and J. Schiller, "Randomness
  3088.               Recommendations for Security", RFC 1750, December 1994.
  3089.  
  3090.    RC2        Rivest, R., "A Description of the RC2 (r) Encryption
  3091.               Algorithm", RFC 2268, March 1998.
  3092.  
  3093.    SHA1       National Institute of Standards and Technology.
  3094.               FIPS Pub 180-1: Secure Hash Standard.  17 April 1995.
  3095.  
  3096.    X.208-88   CCITT.  Recommendation X.208: Specification of Abstract
  3097.               Syntax Notation One (ASN.1).  1988.
  3098.  
  3099.    X.209-88   CCITT.  Recommendation X.209: Specification of Basic
  3100.               Encoding Rules for Abstract Syntax Notation One (ASN.1).
  3101.               1988.
  3102.  
  3103.    X.501-88   CCITT.  Recommendation X.501: The Directory - Models.
  3104.               1988.
  3105.  
  3106.    X.509-88   CCITT.  Recommendation X.509: The Directory -
  3107.               Authentication Framework.  1988.
  3108.  
  3109.    X.509-97   ITU-T.  Recommendation X.509: The Directory -
  3110.               Authentication Framework.  1997.
  3111.  
  3112. Security Considerations
  3113.  
  3114.    The Cryptographic Message Syntax provides a method for digitally
  3115.    signing data, digesting data, encrypting data, and authenticating
  3116.    data.
  3117.  
  3118.    Implementations must protect the signer's private key.  Compromise of
  3119.    the signer's private key permits masquerade.
  3120.  
  3121.    Implementations must protect the key management private key, the
  3122.    key-encryption key, and the content-encryption key.  Compromise of
  3123.    the key management private key or the key-encryption key may result
  3124.    in the disclosure of all messages protected with that key.
  3125.    Similarly, compromise of the content-encryption key may result in
  3126.    disclosure of the associated encrypted content.
  3127.  
  3128.    Implementations must protect the key management private key and the
  3129.    message-authentication key.  Compromise of the key management private
  3130.    key permits masquerade of authenticated data.  Similarly, compromise
  3131.    of the message-authentication key may result in undetectable
  3132.    modification of the authenticated content.
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138. Housley                     Standards Track                    [Page 56]
  3139.  
  3140. RFC 2630              Cryptographic Message Syntax             June 1999
  3141.  
  3142.  
  3143.    Implementations must randomly generate content-encryption keys,
  3144.    message-authentication keys, initialization vectors (IVs), and
  3145.    padding.  Also, the generation of public/private key pairs relies on
  3146.    a random numbers.  The use of inadequate pseudo-random number
  3147.    generators (PRNGs) to generate cryptographic keys can result in
  3148.    little or no security.  An attacker may find it much easier to
  3149.    reproduce the PRNG environment that produced the keys, searching the
  3150.    resulting small set of possibilities, rather than brute force
  3151.    searching the whole key space.  The generation of quality random
  3152.    numbers is difficult.  RFC 1750 [RANDOM] offers important guidance in
  3153.    this area, and Appendix 3 of FIPS Pub 186 [DSS] provides one quality
  3154.    PRNG technique.
  3155.  
  3156.    When using key agreement algorithms or previously distributed
  3157.    symmetric key-encryption keys, a key-encryption key is used to
  3158.    encrypt the content-encryption key.  If the key-encryption and
  3159.    content-encryption algorithms are different, the effective security
  3160.    is determined by the weaker of the two algorithms.  If, for example,
  3161.    a message content is encrypted with 168-bit Triple-DES and the
  3162.    Triple-DES content-encryption key is wrapped with a 40-bit RC2 key,
  3163.    then at most 40 bits of protection is provided.  A trivial search to
  3164.    determine the value of the 40-bit RC2 key can recover Triple-DES key,
  3165.    and then the Triple-DES key can be used to decrypt the content.
  3166.    Therefore, implementers must ensure that key-encryption algorithms
  3167.    are as strong or stronger than content-encryption algorithms.
  3168.  
  3169.    Section 12.6 specifies key wrap algorithms used to encrypt a Triple-
  3170.    DES [3DES] content-encryption key with a Triple-DES key-encryption
  3171.    key or to encrypt a RC2 [RC2] content-encryption key with a RC2 key-
  3172.    encryption key.  The key wrap algorithms make use of CBC mode
  3173.    [MODES].  These key wrap algorithms have been reviewed for use with
  3174.    Triple and RC2.  They have not been reviewed for use with other
  3175.    cryptographic modes or other encryption algorithms.  Therefore, if a
  3176.    CMS implementation wishes to support ciphers in addition to Triple-
  3177.    DES or RC2, then additional key wrap algorithms need to be defined to
  3178.    support the additional ciphers.
  3179.  
  3180.    Implementers should be aware that cryptographic algorithms become
  3181.    weaker with time.  As new cryptoanalysis techniques are developed and
  3182.    computing performance improves, the work factor to break a particular
  3183.    cryptographic algorithm will reduce.  Therefore, cryptographic
  3184.    algorithm implementations should be modular allowing new algorithms
  3185.    to be readily inserted.  That is, implementers should be prepared for
  3186.    the set of mandatory to implement algorithms to change over time.
  3187.  
  3188.    The countersignature unauthenticated attribute includes a digital
  3189.    signature that is computed on the content signature value, thus the
  3190.    countersigning process need not know the original signed content.
  3191.  
  3192.  
  3193.  
  3194. Housley                     Standards Track                    [Page 57]
  3195.  
  3196. RFC 2630              Cryptographic Message Syntax             June 1999
  3197.  
  3198.  
  3199.    This structure permits implementation efficiency advantages; however,
  3200.    this structure may also permit the countersigning of an inappropriate
  3201.    signature value.  Therefore, implementations that perform
  3202.    countersignatures should either verify the original signature value
  3203.    prior to countersigning it (this verification requires processing of
  3204.    the original content), or implementations should perform
  3205.    countersigning in a context that ensures that only appropriate
  3206.    signature values are countersigned.
  3207.  
  3208.    Users of CMS, particularly those employing CMS to support interactive
  3209.    applications, should be aware that PKCS #1 Version 1.5 as specified
  3210.    in RFC 2313 [PKCS#1] is vulnerable to adaptive chosen ciphertext
  3211.    attacks when applied for encryption purposes.  Exploitation of this
  3212.    identified vulnerability, revealing the result of a particular RSA
  3213.    decryption, requires access to an oracle which will respond to a
  3214.    large number of ciphertexts (based on currently available results,
  3215.    hundreds of thousands or more), which are constructed adaptively in
  3216.    response to previously-received replies providing information on the
  3217.    successes or failures of attempted decryption operations.  As a
  3218.    result, the attack appears significantly less feasible to perpetrate
  3219.    for store-and-forward S/MIME environments than for directly
  3220.    interactive protocols.  Where CMS constructs are applied as an
  3221.    intermediate encryption layer within an interactive request-response
  3222.    communications environment, exploitation could be more feasible.
  3223.  
  3224.    An updated version of PKCS #1 has been published, PKCS #1 Version 2.0
  3225.    [NEWPKCS#1].  This new document will supersede RFC 2313.  PKCS #1
  3226.    Version 2.0 preserves support for the encryption padding format
  3227.    defined in PKCS #1 Version 1.5 [PKCS#1], and it also defines a new
  3228.    alternative.  To resolve the adaptive chosen ciphertext
  3229.    vulnerability, the PKCS #1 Version 2.0 specifies and recommends use
  3230.    of Optimal Asymmetric Encryption Padding (OAEP) when RSA encryption
  3231.    is used to provide confidentiality.  Designers of protocols and
  3232.    systems employing CMS for interactive environments should either
  3233.    consider usage of OAEP, or should ensure that information which could
  3234.    reveal the success or failure of attempted PKCS #1 Version 1.5
  3235.    decryption operations is not provided.  Support for OAEP will likely
  3236.    be added to a future version of the CMS specification.
  3237.  
  3238. Acknowledgments
  3239.  
  3240.    This document is the result of contributions from many professionals.
  3241.    I appreciate the hard work of all members of the IETF S/MIME Working
  3242.    Group.  I extend a special thanks to Rich Ankney, Tim Dean, Steve
  3243.    Dusse, Carl Ellison, Peter Gutmann, Bob Jueneman, Stephen Henson,
  3244.    Paul Hoffman, Scott Hollenbeck, Don Johnson, Burt Kaliski, John Linn,
  3245.    John Pawling, Blake Ramsdell, Francois Rousseau, Jim Schaad, and Dave
  3246.    Solo for their efforts and support.
  3247.  
  3248.  
  3249.  
  3250. Housley                     Standards Track                    [Page 58]
  3251.  
  3252. RFC 2630              Cryptographic Message Syntax             June 1999
  3253.  
  3254.  
  3255. Author's Address
  3256.  
  3257.    Russell Housley
  3258.    SPYRUS
  3259.    381 Elden Street
  3260.    Suite 1120
  3261.    Herndon, VA 20170
  3262.    USA
  3263.  
  3264.    EMail: housley@spyrus.com
  3265.  
  3266.  
  3267.  
  3268.  
  3269.  
  3270.  
  3271.  
  3272.  
  3273.  
  3274.  
  3275.  
  3276.  
  3277.  
  3278.  
  3279.  
  3280.  
  3281.  
  3282.  
  3283.  
  3284.  
  3285.  
  3286.  
  3287.  
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  
  3306. Housley                     Standards Track                    [Page 59]
  3307.  
  3308. RFC 2630              Cryptographic Message Syntax             June 1999
  3309.  
  3310.  
  3311. Full Copyright Statement
  3312.  
  3313.    Copyright (C) The Internet Society (1999).  All Rights Reserved.
  3314.  
  3315.    This document and translations of it may be copied and furnished to
  3316.    others, and derivative works that comment on or otherwise explain it
  3317.    or assist in its implementation may be prepared, copied, published
  3318.    and distributed, in whole or in part, without restriction of any
  3319.    kind, provided that the above copyright notice and this paragraph are
  3320.    included on all such copies and derivative works.  However, this
  3321.    document itself may not be modified in any way, such as by removing
  3322.    the copyright notice or references to the Internet Society or other
  3323.    Internet organizations, except as needed for the purpose of
  3324.    developing Internet standards in which case the procedures for
  3325.    copyrights defined in the Internet Standards process must be
  3326.    followed, or as required to translate it into languages other than
  3327.    English.
  3328.  
  3329.    The limited permissions granted above are perpetual and will not be
  3330.    revoked by the Internet Society or its successors or assigns.
  3331.  
  3332.    This document and the information contained herein is provided on an
  3333.    "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
  3334.    TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
  3335.    BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
  3336.    HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
  3337.    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  3338.  
  3339. Acknowledgement
  3340.  
  3341.    Funding for the RFC Editor function is currently provided by the
  3342.    Internet Society.
  3343.  
  3344.  
  3345.  
  3346.  
  3347.  
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362. Housley                     Standards Track                    [Page 60]
  3363.  
  3364.