From: <Saved by Blink>
Snapshot-Content-Location: https://www.rfc-editor.org/rfc/rfc5652
Subject: RFC 5652: Cryptographic Message Syntax (CMS)
Date: Wed, 23 Oct 2024 19:05:33 +0200
MIME-Version: 1.0
Content-Type: multipart/related;
	type="text/html";
	boundary="----MultipartBoundary--yENwd9FbLx5269kbRuMLh3486PXEW5c4SJwxhoR6YW----"


------MultipartBoundary--yENwd9FbLx5269kbRuMLh3486PXEW5c4SJwxhoR6YW----
Content-Type: text/html
Content-ID: <frame-5EE897CACE5FF9FFA40EA2E1B2010E96@mhtml.blink>
Content-Transfer-Encoding: quoted-printable
Content-Location: https://www.rfc-editor.org/rfc/rfc5652

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.=
w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns=3D"http://www.w3.=
org/1999/xhtml" xml:lang=3D"en" lang=3D"en"><head><meta http-equiv=3D"Conte=
nt-Type" content=3D"text/html; charset=3DUTF-8"><link rel=3D"stylesheet" ty=
pe=3D"text/css" href=3D"cid:css-b383ba12-effe-4d7c-b93d-9c02ee80a45f@mhtml.=
blink" /><link rel=3D"stylesheet" type=3D"text/css" href=3D"cid:css-c536faa=
b-0feb-40b9-abb0-a0bad96d4310@mhtml.blink" /><link rel=3D"stylesheet" type=
=3D"text/css" href=3D"cid:css-35d7e172-a26f-4f96-b476-aabef94556ec@mhtml.bl=
ink" /><link rel=3D"stylesheet" type=3D"text/css" href=3D"cid:css-4d5d9e0a-=
5f67-4467-ae1e-63dee7a17edb@mhtml.blink" />
   =20
    <meta name=3D"robots" content=3D"index,follow">
    <meta name=3D"creator" content=3D"rfchandler version 0.2">
      <meta name=3D"citation_author" content=3D"R. Housley">
      <meta name=3D"citation_publication_date" content=3D"September, 2009">
      <meta name=3D"citation_title" content=3D"Cryptographic Message Syntax=
 (CMS)">
      <meta name=3D"citation_doi" content=3D"10.17487/RFC5652">
      <meta name=3D"citation_issn" content=3D"2070-1721">
      <meta name=3D"citation_technical_report_number" content=3D"rfc5652">
      <meta name=3D"citation_pdf_url" content=3D"https://www.rfc-editor.org=
/rfc/pdfrfc/rfc5652.txt.pdf">
<title>RFC 5652: Cryptographic Message Syntax (CMS)</title>   =20
       =20

       =20
    <!--[if IE]>
    <style>
    body {
       font-size: 13px;
       margin: 10px 10px;
    }
    </style>
    <![endif]-->    </head>
<body>
<span class=3D"pre noprint docinfo">[<a href=3D"https://www.rfc-editor.org/=
" title=3D"RFC Editor">RFC Home</a>] [<a href=3D"https://www.rfc-editor.org=
/rfc/rfc5652.txt">TEXT</a>|<a href=3D"https://www.rfc-editor.org/rfc/pdfrfc=
/rfc5652.txt.pdf">PDF</a>|<a href=3D"https://www.rfc-editor.org/rfc/rfc5652=
.html">HTML</a>] [<a href=3D"https://datatracker.ietf.org/doc/rfc5652" titl=
e=3D"IETF Datatracker information for this document">Tracker</a>] [<a href=
=3D"https://datatracker.ietf.org/ipr/search/?rfc=3D5652&amp;submit=3Drfc" t=
itle=3D"IPR disclosures related to this document">IPR</a>] [<a class=3D"bol=
dtext" href=3D"https://www.rfc-editor.org/errata/rfc5652" target=3D"_blank"=
>Errata</a>] [<a href=3D"https://www.rfc-editor.org/info/rfc5652" title=3D"=
Info page">Info page</a>]         </span><br><span class=3D"pre noprint doc=
info">                                                                     =
   </span><br><span class=3D"pre noprint docinfo">                         =
                              INTERNET STANDARD</span><br><span class=3D"pr=
e noprint docinfo">Updated by: <a href=3D"https://www.rfc-editor.org/rfc/rf=
c8933" target=3D"_blank">8933</a>, <a href=3D"https://www.rfc-editor.org/rf=
c/rfc9629" target=3D"_blank">9629</a>                                      =
<span style=3D"color: #C00;">Errata Exist</span></span><pre>Network Working=
 Group                                         R. Housley
Request for Comments: 5652                                Vigil Security
Obsoletes: <a href=3D"https://www.rfc-editor.org/rfc/rfc3852">3852</a>     =
                                      September 2009
Category: Standards Track


                   <span class=3D"h1">Cryptographic Message Syntax (CMS)</s=
pan>

Abstract

   This document describes the Cryptographic Message Syntax (CMS).  This
   syntax is used to digitally sign, digest, authenticate, or encrypt
   arbitrary message content.

Status of This Memo

   This document specifies an Internet standards track protocol for the
   Internet community, and requests discussion and suggestions for
   improvements.  Please refer to the current edition of the "Internet
   Official Protocol Standards" (STD 1) for the standardization state
   and status of this protocol.  Distribution of this memo is unlimited.

Copyright and License Notice

   Copyright (c) 2009 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to <a href=3D"https://www.rfc-editor.org/bcp/bc=
p78">BCP 78</a> and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (<a href=3D"http://trustee.ietf.org/license-info">http://trustee.ietf.or=
g/license-info</a>) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the BSD License.

   This document may contain material from IETF Documents or IETF
   Contributions published or made publicly available before November
   10, 2008.  The person(s) controlling the copyright in some of this
   material may not have granted the IETF Trust the right to allow
   modifications of such material outside the IETF Standards Process.
   Without obtaining an adequate license from the person(s) controlling
   the copyright in such materials, this document may not be modified
   outside the IETF Standards Process, and derivative works of it may
   not be created outside the IETF Standards Process, except to format
   it for publication as an RFC or to translate it into languages other
   than English.



<span class=3D"grey">Housley                     Standards Track           =
          [Page 1]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-2"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


Table of Contents

   <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-1">1</a>. Intr=
oduction ....................................................<a href=3D"htt=
ps://www.rfc-editor.org/rfc/rfc5652#page-3">3</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-1.1">1.1</a=
>. Evolution of the CMS .......................................<a href=3D"h=
ttps://www.rfc-editor.org/rfc/rfc5652#page-4">4</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-1.1.1"=
>1.1.1</a>. Changes Since PKCS #7 Version 1.5 ...................<a href=3D=
"https://www.rfc-editor.org/rfc/rfc5652#page-4">4</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-1.1.2"=
>1.1.2</a>. Changes Since <a href=3D"https://www.rfc-editor.org/rfc/rfc2630=
">RFC 2630</a> ..............................<a href=3D"https://www.rfc-edi=
tor.org/rfc/rfc5652#page-4">4</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-1.1.3"=
>1.1.3</a>. Changes Since <a href=3D"https://www.rfc-editor.org/rfc/rfc3369=
">RFC 3369</a> ..............................<a href=3D"https://www.rfc-edi=
tor.org/rfc/rfc5652#page-5">5</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-1.1.4"=
>1.1.4</a>. Changes Since <a href=3D"https://www.rfc-editor.org/rfc/rfc3852=
">RFC 3852</a> ..............................<a href=3D"https://www.rfc-edi=
tor.org/rfc/rfc5652#page-5">5</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-1.2">1.2</a=
>. Terminology ................................................<a href=3D"h=
ttps://www.rfc-editor.org/rfc/rfc5652#page-5">5</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-1.3">1.3</a=
>. Version Numbers ............................................<a href=3D"h=
ttps://www.rfc-editor.org/rfc/rfc5652#page-6">6</a>
   <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-2">2</a>. Gene=
ral Overview ................................................<a href=3D"htt=
ps://www.rfc-editor.org/rfc/rfc5652#page-6">6</a>
   <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-3">3</a>. Gene=
ral Syntax ..................................................<a href=3D"htt=
ps://www.rfc-editor.org/rfc/rfc5652#page-7">7</a>
   <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-4">4</a>. Data=
 Content Type ...............................................<a href=3D"htt=
ps://www.rfc-editor.org/rfc/rfc5652#page-7">7</a>
   <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-5">5</a>. Sign=
ed-data Content Type ........................................<a href=3D"htt=
ps://www.rfc-editor.org/rfc/rfc5652#page-8">8</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-5.1">5.1</a=
>. SignedData Type ............................................<a href=3D"h=
ttps://www.rfc-editor.org/rfc/rfc5652#page-9">9</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-5.2">5.2</a=
>. EncapsulatedContentInfo Type ..............................<a href=3D"ht=
tps://www.rfc-editor.org/rfc/rfc5652#page-11">11</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-5.2.1"=
>5.2.1</a>. Compatibility with PKCS #7 .........................<a href=3D"=
https://www.rfc-editor.org/rfc/rfc5652#page-12">12</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-5.3">5.3</a=
>. SignerInfo Type ...........................................<a href=3D"ht=
tps://www.rfc-editor.org/rfc/rfc5652#page-13">13</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-5.4">5.4</a=
>. Message Digest Calculation Process ........................<a href=3D"ht=
tps://www.rfc-editor.org/rfc/rfc5652#page-16">16</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-5.5">5.5</a=
>. Signature Generation Process ..............................<a href=3D"ht=
tps://www.rfc-editor.org/rfc/rfc5652#page-16">16</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-5.6">5.6</a=
>. Signature Verification Process ............................<a href=3D"ht=
tps://www.rfc-editor.org/rfc/rfc5652#page-17">17</a>
   <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-6">6</a>. Enve=
loped-Data Content Type ....................................<a href=3D"http=
s://www.rfc-editor.org/rfc/rfc5652#page-17">17</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-6.1">6.1</a=
>. EnvelopedData Type ........................................<a href=3D"ht=
tps://www.rfc-editor.org/rfc/rfc5652#page-18">18</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-6.2">6.2</a=
>. RecipientInfo Type ........................................<a href=3D"ht=
tps://www.rfc-editor.org/rfc/rfc5652#page-21">21</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-6.2.1"=
>6.2.1</a>. KeyTransRecipientInfo Type .........................<a href=3D"=
https://www.rfc-editor.org/rfc/rfc5652#page-22">22</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-6.2.2"=
>6.2.2</a>. KeyAgreeRecipientInfo Type .........................<a href=3D"=
https://www.rfc-editor.org/rfc/rfc5652#page-23">23</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-6.2.3"=
>6.2.3</a>. KEKRecipientInfo Type ..............................<a href=3D"=
https://www.rfc-editor.org/rfc/rfc5652#page-25">25</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-6.2.4"=
>6.2.4</a>. PasswordRecipientInfo Type .........................<a href=3D"=
https://www.rfc-editor.org/rfc/rfc5652#page-26">26</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-6.2.5"=
>6.2.5</a>. OtherRecipientInfo Type ............................<a href=3D"=
https://www.rfc-editor.org/rfc/rfc5652#page-27">27</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-6.3">6.3</a=
>. Content-encryption Process ................................<a href=3D"ht=
tps://www.rfc-editor.org/rfc/rfc5652#page-27">27</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-6.4">6.4</a=
>. Key-Encryption Process ....................................<a href=3D"ht=
tps://www.rfc-editor.org/rfc/rfc5652#page-28">28</a>
   <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-7">7</a>. Dige=
sted-Data Content Type .....................................<a href=3D"http=
s://www.rfc-editor.org/rfc/rfc5652#page-28">28</a>
   <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-8">8</a>. Encr=
ypted-Data Content Type ....................................<a href=3D"http=
s://www.rfc-editor.org/rfc/rfc5652#page-29">29</a>
   <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-9">9</a>. Auth=
enticated-Data Content Type ................................<a href=3D"http=
s://www.rfc-editor.org/rfc/rfc5652#page-30">30</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-9.1">9.1</a=
>. AuthenticatedData Type ....................................<a href=3D"ht=
tps://www.rfc-editor.org/rfc/rfc5652#page-31">31</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-9.2">9.2</a=
>. MAC Generation ............................................<a href=3D"ht=
tps://www.rfc-editor.org/rfc/rfc5652#page-33">33</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-9.3">9.3</a=
>. MAC Verification ..........................................<a href=3D"ht=
tps://www.rfc-editor.org/rfc/rfc5652#page-34">34</a>
   <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-10">10</a>. Us=
eful Types ..................................................<a href=3D"htt=
ps://www.rfc-editor.org/rfc/rfc5652#page-34">34</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-10.1">10.1<=
/a>. Algorithm Identifier Types ...............................<a href=3D"h=
ttps://www.rfc-editor.org/rfc/rfc5652#page-35">35</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-10.1.1=
">10.1.1</a>. DigestAlgorithmIdentifier .........................<a href=3D=
"https://www.rfc-editor.org/rfc/rfc5652#page-35">35</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-10.1.2=
">10.1.2</a>. SignatureAlgorithmIdentifier ......................<a href=3D=
"https://www.rfc-editor.org/rfc/rfc5652#page-35">35</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-10.1.3=
">10.1.3</a>. KeyEncryptionAlgorithmIdentifier ..................<a href=3D=
"https://www.rfc-editor.org/rfc/rfc5652#page-35">35</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-10.1.4=
">10.1.4</a>. ContentEncryptionAlgorithmIdentifier ..............<a href=3D=
"https://www.rfc-editor.org/rfc/rfc5652#page-36">36</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-10.1.5=
">10.1.5</a>. MessageAuthenticationCodeAlgorithm ................<a href=3D=
"https://www.rfc-editor.org/rfc/rfc5652#page-36">36</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-10.1.6=
">10.1.6</a>. KeyDerivationAlgorithmIdentifier ..................<a href=3D=
"https://www.rfc-editor.org/rfc/rfc5652#page-36">36</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-10.2">10.2<=
/a>. Other Useful Types .......................................<a href=3D"h=
ttps://www.rfc-editor.org/rfc/rfc5652#page-36">36</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-10.2.1=
">10.2.1</a>. RevocationInfoChoices .............................<a href=3D=
"https://www.rfc-editor.org/rfc/rfc5652#page-36">36</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-10.2.2=
">10.2.2</a>. CertificateChoices ................................<a href=3D=
"https://www.rfc-editor.org/rfc/rfc5652#page-37">37</a>



<span class=3D"grey">Housley                     Standards Track           =
          [Page 2]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-3"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-10.2.3=
">10.2.3</a>. CertificateSet ....................................<a href=3D=
"https://www.rfc-editor.org/rfc/rfc5652#page-38">38</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-10.2.4=
">10.2.4</a>. IssuerAndSerialNumber .............................<a href=3D=
"https://www.rfc-editor.org/rfc/rfc5652#page-38">38</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-10.2.5=
">10.2.5</a>. CMSVersion ........................................<a href=3D=
"https://www.rfc-editor.org/rfc/rfc5652#page-39">39</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-10.2.6=
">10.2.6</a>. UserKeyingMaterial ................................<a href=3D=
"https://www.rfc-editor.org/rfc/rfc5652#page-39">39</a>
           <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-10.2.7=
">10.2.7</a>. OtherKeyAttribute .................................<a href=3D=
"https://www.rfc-editor.org/rfc/rfc5652#page-39">39</a>
   <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-11">11</a>. Us=
eful Attributes .............................................<a href=3D"htt=
ps://www.rfc-editor.org/rfc/rfc5652#page-39">39</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-11.1">11.1<=
/a>. Content Type .............................................<a href=3D"h=
ttps://www.rfc-editor.org/rfc/rfc5652#page-40">40</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-11.2">11.2<=
/a>. Message Digest ...........................................<a href=3D"h=
ttps://www.rfc-editor.org/rfc/rfc5652#page-40">40</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-11.3">11.3<=
/a>. Signing Time .............................................<a href=3D"h=
ttps://www.rfc-editor.org/rfc/rfc5652#page-41">41</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-11.4">11.4<=
/a>. Countersignature .........................................<a href=3D"h=
ttps://www.rfc-editor.org/rfc/rfc5652#page-42">42</a>
   <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-12">12</a>. AS=
N.1 Modules .................................................<a href=3D"htt=
ps://www.rfc-editor.org/rfc/rfc5652#page-43">43</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-12.1">12.1<=
/a>. CMS ASN.1 Module .........................................<a href=3D"h=
ttps://www.rfc-editor.org/rfc/rfc5652#page-44">44</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-12.2">12.2<=
/a>. Version 1 Attribute Certificate ASN.1 Module .............<a href=3D"h=
ttps://www.rfc-editor.org/rfc/rfc5652#page-51">51</a>
   <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-13">13</a>. Re=
ferences ....................................................<a href=3D"htt=
ps://www.rfc-editor.org/rfc/rfc5652#page-52">52</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-13.1">13.1<=
/a>. Normative References .....................................<a href=3D"h=
ttps://www.rfc-editor.org/rfc/rfc5652#page-52">52</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-13.2">13.2<=
/a>. Informative References ...................................<a href=3D"h=
ttps://www.rfc-editor.org/rfc/rfc5652#page-53">53</a>
   <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-14">14</a>. Se=
curity Considerations .......................................<a href=3D"htt=
ps://www.rfc-editor.org/rfc/rfc5652#page-54">54</a>
   <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-15">15</a>. Ac=
knowledgments ...............................................<a href=3D"htt=
ps://www.rfc-editor.org/rfc/rfc5652#page-56">56</a>

<span class=3D"h2"><a class=3D"selflink" id=3D"section-1" href=3D"https://w=
ww.rfc-editor.org/rfc/rfc5652#section-1">1</a>.  Introduction</span>

   This document describes the Cryptographic Message Syntax (CMS).  This
   syntax is used to digitally sign, digest, authenticate, or encrypt
   arbitrary message content.

   The CMS describes an encapsulation syntax for data protection.  It
   supports digital signatures and encryption.  The syntax allows
   multiple encapsulations; one encapsulation envelope can be nested
   inside another.  Likewise, one party can digitally sign some
   previously encapsulated data.  It also allows arbitrary attributes,
   such as signing time, to be signed along with the message content,
   and it provides for other attributes such as countersignatures to be
   associated with a signature.

   The CMS can support a variety of architectures for certificate-based
   key management, such as the one defined by the PKIX (Public Key
   Infrastructure using X.509) working group [<a href=3D"https://www.rfc-ed=
itor.org/rfc/rfc5652#ref-PROFILE" title=3D"&quot;Internet X.509 Public Key =
Infrastructure Certificate and Certificate Revocation List (CRL) Profile&qu=
ot;">PROFILE</a>].

   The CMS values are generated using ASN.1 [<a href=3D"https://www.rfc-edi=
tor.org/rfc/rfc5652#ref-X.208-88">X.208-88</a>], using BER-
   encoding (Basic Encoding Rules) [<a href=3D"https://www.rfc-editor.org/r=
fc/rfc5652#ref-X.209-88">X.209-88</a>].  Values are typically
   represented as octet strings.  While many systems are capable of
   transmitting arbitrary octet strings reliably, it is well known that
   many electronic mail systems are not.  This document does not address
   mechanisms for encoding octet strings for reliable transmission in
   such environments.






<span class=3D"grey">Housley                     Standards Track           =
          [Page 3]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-4"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


<span class=3D"h3"><a class=3D"selflink" id=3D"section-1.1" href=3D"https:/=
/www.rfc-editor.org/rfc/rfc5652#section-1.1">1.1</a>.  Evolution of the CMS=
</span>

   The CMS is derived from PKCS #7 version 1.5, which is documented in
   <a href=3D"https://www.rfc-editor.org/rfc/rfc2315">RFC 2315</a> [PKCS#7]=
.  PKCS #7 version 1.5 was developed outside of the
   IETF; it was originally published as an RSA Laboratories Technical
   Note in November 1993.  Since that time, the IETF has taken
   responsibility for the development and maintenance of the CMS.
   Today, several important IETF Standards-Track protocols make use of
   the CMS.

   This section describes that changes that the IETF has made to the CMS
   in each of the published versions.

<span class=3D"h4"><a class=3D"selflink" id=3D"section-1.1.1" href=3D"https=
://www.rfc-editor.org/rfc/rfc5652#section-1.1.1">1.1.1</a>.  Changes Since =
PKCS #7 Version 1.5</span>

   <a href=3D"https://www.rfc-editor.org/rfc/rfc2630">RFC 2630</a> [<a href=
=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-CMS1" title=3D"&quot;Cryptog=
raphic Message Syntax&quot;">CMS1</a>] was the first version of the CMS on =
the IETF
   Standards Track.  Wherever possible, backward compatibility with PKCS
   #7 version 1.5 is preserved; however, changes were made to
   accommodate version 1 attribute certificate transfer and to support
   algorithm-independent key management.  PKCS #7 version 1.5 included
   support only for key transport.  <a href=3D"https://www.rfc-editor.org/r=
fc/rfc2630">RFC 2630</a> adds support for key
   agreement and previously distributed symmetric key-encryption key
   techniques.

<span class=3D"h4"><a class=3D"selflink" id=3D"section-1.1.2" href=3D"https=
://www.rfc-editor.org/rfc/rfc5652#section-1.1.2">1.1.2</a>.  Changes Since =
<a href=3D"https://www.rfc-editor.org/rfc/rfc2630">RFC 2630</a></span>

   <a href=3D"https://www.rfc-editor.org/rfc/rfc3369">RFC 3369</a> [<a href=
=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-CMS2" title=3D"&quot;Cryptog=
raphic Message Syntax (CMS)&quot;">CMS2</a>] obsoletes <a href=3D"https://w=
ww.rfc-editor.org/rfc/rfc2630">RFC 2630</a> [<a href=3D"https://www.rfc-edi=
tor.org/rfc/rfc5652#ref-CMS1" title=3D"&quot;Cryptographic Message Syntax&q=
uot;">CMS1</a>] and <a href=3D"https://www.rfc-editor.org/rfc/rfc3211">RFC =
3211</a> [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-PWRI" title=
=3D"&quot;Password-based Encryption for CMS&quot;">PWRI</a>].
   Password-based key management is included in the CMS specification,
   and an extension mechanism to support new key management schemes
   without further changes to the CMS is specified.  Backward
   compatibility with <a href=3D"https://www.rfc-editor.org/rfc/rfc2630">RF=
C 2630</a> and <a href=3D"https://www.rfc-editor.org/rfc/rfc3211">RFC 3211<=
/a> is preserved; however,
   version 2 attribute certificate transfer is added, and the use of
   version 1 attribute certificates is deprecated.

   Secure/Multipurpose Internet Mail Extensions (S/MIME) v2 signatures
   [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-MSG2" title=3D"&q=
uot;S/MIME Version 2 Message Specification&quot;">MSG2</a>], which are base=
d on PKCS #7 version 1.5, are compatible with
   S/MIME v3 signatures [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#=
ref-MSG3" title=3D"&quot;S/MIME Version 3 Message Specification&quot;">MSG3=
</a>]and S/MIME v3.1 signatures [<a href=3D"https://www.rfc-editor.org/rfc/=
rfc5652#ref-MSG3.1" title=3D"&quot;Secure/Multipurpose Internet Mail Extens=
ions (S/MIME) Version 3.1 Message Specification&quot;">MSG3.1</a>].
   However, there are some subtle compatibility issues with signatures
   based on PKCS #7 version 1.5.  These issues are discussed in <a href=3D"=
https://www.rfc-editor.org/rfc/rfc5652#section-5.2.1">Section</a>
   <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-5.2.1">5.2.1</=
a>.  These issues remain with the current version of the CMS.

   Specific cryptographic algorithms are not discussed in this document,
   but they were discussed in <a href=3D"https://www.rfc-editor.org/rfc/rfc=
2630">RFC 2630</a>.  The discussion of specific
   cryptographic algorithms has been moved to a separate document
   [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-CMSALG" title=3D"=
&quot;Cryptographic Message Syntax (CMS) Algorithms&quot;">CMSALG</a>].  Se=
paration of the protocol and algorithm specifications
   allows the IETF to update each document independently.  This
   specification does not require the implementation of any particular




<span class=3D"grey">Housley                     Standards Track           =
          [Page 4]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-5"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   algorithms.  Rather, protocols that rely on the CMS are expected to
   choose appropriate algorithms for their environment.  The algorithms
   may be selected from [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#=
ref-CMSALG" title=3D"&quot;Cryptographic Message Syntax (CMS) Algorithms&qu=
ot;">CMSALG</a>] or elsewhere.

<span class=3D"h4"><a class=3D"selflink" id=3D"section-1.1.3" href=3D"https=
://www.rfc-editor.org/rfc/rfc5652#section-1.1.3">1.1.3</a>.  Changes Since =
<a href=3D"https://www.rfc-editor.org/rfc/rfc3369">RFC 3369</a></span>

   <a href=3D"https://www.rfc-editor.org/rfc/rfc3852">RFC 3852</a> [<a href=
=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-CMS3" title=3D"&quot;Cryptog=
raphic Message Syntax (CMS)&quot;">CMS3</a>] obsoletes <a href=3D"https://w=
ww.rfc-editor.org/rfc/rfc3369">RFC 3369</a> [<a href=3D"https://www.rfc-edi=
tor.org/rfc/rfc5652#ref-CMS2" title=3D"&quot;Cryptographic Message Syntax (=
CMS)&quot;">CMS2</a>].  As discussed in the
   previous section, <a href=3D"https://www.rfc-editor.org/rfc/rfc3369">RFC=
 3369</a> introduced an extension mechanism to
   support new key management schemes without further changes to the
   CMS.  <a href=3D"https://www.rfc-editor.org/rfc/rfc3852">RFC 3852</a> in=
troduces a similar extension mechanism to support
   additional certificate formats and revocation status information
   formats without further changes to the CMS.  These extensions are
   primarily documented in Sections <a href=3D"https://www.rfc-editor.org/r=
fc/rfc5652#section-10.2.1">10.2.1</a> and <a href=3D"https://www.rfc-editor=
.org/rfc/rfc5652#section-10.2.2">10.2.2</a>.  Backward
   compatibility with earlier versions of the CMS is preserved.

   The use of version numbers is described in <a href=3D"https://www.rfc-ed=
itor.org/rfc/rfc5652#section-1.3">Section 1.3</a>.

   Since the publication of <a href=3D"https://www.rfc-editor.org/rfc/rfc33=
69">RFC 3369</a>, a few errata have been noted.
   These errata are posted on the RFC Editor web site.  These errors
   have been corrected in this document.

   The text in <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-11=
.4">Section 11.4</a> that describes the counter signature
   unsigned attribute is clarified.  Hopefully, the revised text is
   clearer about the portion of the SignerInfo signature that is covered
   by a countersignature.

<span class=3D"h4"><a class=3D"selflink" id=3D"section-1.1.4" href=3D"https=
://www.rfc-editor.org/rfc/rfc5652#section-1.1.4">1.1.4</a>.  Changes Since =
<a href=3D"https://www.rfc-editor.org/rfc/rfc3852">RFC 3852</a></span>

   This document obsoletes <a href=3D"https://www.rfc-editor.org/rfc/rfc385=
2">RFC 3852</a> [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-CMS3=
" title=3D"&quot;Cryptographic Message Syntax (CMS)&quot;">CMS3</a>].  The =
primary reason for the
   publication of this document is to advance the CMS along the
   standards maturity ladder.

   This document includes the clarifications that were originally
   published in <a href=3D"https://www.rfc-editor.org/rfc/rfc4853">RFC 4853=
</a> [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-CMSMSIG" title=
=3D"&quot;Cryptographic Message Syntax (CMS) Multiple Signer Clarification&=
quot;">CMSMSIG</a>] regarding the proper handling of the
   SignedData protected content type when more than one digital
   signature is present.

   Since the publication of <a href=3D"https://www.rfc-editor.org/rfc/rfc38=
52">RFC 3852</a>, a few errata have been noted.
   These errata are posted on the RFC Editor web site.  These errors
   have been corrected in this document.

<span class=3D"h3"><a class=3D"selflink" id=3D"section-1.2" href=3D"https:/=
/www.rfc-editor.org/rfc/rfc5652#section-1.2">1.2</a>.  Terminology</span>

   In this document, the key words MUST, MUST NOT, REQUIRED, SHOULD,
   SHOULD NOT, RECOMMENDED, MAY, and OPTIONAL are to be interpreted as
   described in [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-STDW=
ORDS" title=3D"&quot;Key words for use in RFCs to Indicate Requirement Leve=
ls&quot;">STDWORDS</a>].





<span class=3D"grey">Housley                     Standards Track           =
          [Page 5]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-6"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


<span class=3D"h3"><a class=3D"selflink" id=3D"section-1.3" href=3D"https:/=
/www.rfc-editor.org/rfc/rfc5652#section-1.3">1.3</a>.  Version Numbers</spa=
n>

   Each of the major data structures includes a version number as the
   first item in the data structure.  The version numbers are intended
   to avoid ASN.1 decode errors.  Some implementations do not check the
   version number prior to attempting a decode, and if a decode error
   occurs, then the version number is checked as part of the error
   handling routine.  This is a reasonable approach; it places error
   processing outside of the fast path.  This approach is also forgiving
   when an incorrect version number is used by the sender.

   Most of the initial version numbers were assigned in PKCS #7 version
   1.5.  Others were assigned when the structure was initially created.
   Whenever a structure is updated, a higher version number is assigned.
   However, to ensure maximum interoperability, the higher version
   number is only used when the new syntax feature is employed.  That
   is, the lowest version number that supports the generated syntax is
   used.

<span class=3D"h2"><a class=3D"selflink" id=3D"section-2" href=3D"https://w=
ww.rfc-editor.org/rfc/rfc5652#section-2">2</a>.  General Overview</span>

   The CMS is general enough to support many different content types.
   This document defines one protection content, ContentInfo.
   ContentInfo encapsulates a single identified content type, and the
   identified type may provide further encapsulation.  This document
   defines six content types: data, signed-data, enveloped-data,
   digested-data, encrypted-data, and authenticated-data.  Additional
   content types can be defined outside this document.

   An implementation that conforms to this specification MUST implement
   the protection content, ContentInfo, and MUST implement the data,
   signed-data, and enveloped-data content types.  The other content
   types MAY be implemented.

   As a general design philosophy, each content type permits single pass
   processing using indefinite-length Basic Encoding Rules (BER)
   encoding.  Single-pass operation is especially helpful if content is
   large, stored on tapes, or is "piped" from another process.  Single-
   pass operation has one significant drawback: it is difficult to
   perform encode operations using the Distinguished Encoding Rules
   (DER) [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-X.509-88">X=
.509-88</a>] encoding in a single pass since the lengths of the
   various components may not be known in advance.  However, signed
   attributes within the signed-data content type and authenticated
   attributes within the authenticated-data content type need to be
   transmitted in DER form to ensure that recipients can verify a
   content that contains one or more unrecognized attributes.  Signed
   attributes and authenticated attributes are the only data types used
   in the CMS that require DER encoding.



<span class=3D"grey">Housley                     Standards Track           =
          [Page 6]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-7"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


<span class=3D"h2"><a class=3D"selflink" id=3D"section-3" href=3D"https://w=
ww.rfc-editor.org/rfc/rfc5652#section-3">3</a>.  General Syntax</span>

   The following object identifier identifies the content information
   type:

      id-ct-contentInfo OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
         us(840) rsadsi(113549) pkcs(1) pkcs9(9) smime(16) ct(1) 6 }

   The CMS associates a content type identifier with a content.  The
   syntax MUST have ASN.1 type ContentInfo:

      ContentInfo ::=3D SEQUENCE {
        contentType ContentType,
        content [0] EXPLICIT ANY DEFINED BY contentType }

      ContentType ::=3D OBJECT IDENTIFIER

   The fields of ContentInfo have the following meanings:

      contentType indicates the type of the associated content.  It is
      an object identifier; it is a unique string of integers assigned
      by an authority that defines the content type.

      content is the associated content.  The type of content can be
      determined uniquely by contentType.  Content types for data,
      signed-data, enveloped-data, digested-data, encrypted-data, and
      authenticated-data are defined in this document.  If additional
      content types are defined in other documents, the ASN.1 type
      defined SHOULD NOT be a CHOICE type.

<span class=3D"h2"><a class=3D"selflink" id=3D"section-4" href=3D"https://w=
ww.rfc-editor.org/rfc/rfc5652#section-4">4</a>.  Data Content Type</span>

   The following object identifier identifies the data content type:

      id-data OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
         us(840) rsadsi(113549) pkcs(1) pkcs7(7) 1 }

   The data content type is intended to refer to arbitrary octet
   strings, such as ASCII text files; the interpretation is left to the
   application.  Such strings need not have any internal structure
   (although they could have their own ASN.1 definition or other
   structure).

   S/MIME uses id-data to identify MIME-encoded content.  The use of
   this content identifier is specified in <a href=3D"https://www.rfc-edito=
r.org/rfc/rfc2311">RFC 2311</a> for S/MIME v2
   [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-MSG2" title=3D"&q=
uot;S/MIME Version 2 Message Specification&quot;">MSG2</a>], <a href=3D"htt=
ps://www.rfc-editor.org/rfc/rfc2633">RFC 2633</a> for S/MIME v3 [<a href=3D=
"https://www.rfc-editor.org/rfc/rfc5652#ref-MSG3" title=3D"&quot;S/MIME Ver=
sion 3 Message Specification&quot;">MSG3</a>], and <a href=3D"https://www.r=
fc-editor.org/rfc/rfc3851">RFC 3851</a> for S/MIME v3.1
   [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-MSG3.1" title=3D"=
&quot;Secure/Multipurpose Internet Mail Extensions (S/MIME) Version 3.1 Mes=
sage Specification&quot;">MSG3.1</a>].




<span class=3D"grey">Housley                     Standards Track           =
          [Page 7]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-8"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   The data content type is generally encapsulated in the signed-data,
   enveloped-data, digested-data, encrypted-data, or authenticated-data
   content type.

<span class=3D"h2"><a class=3D"selflink" id=3D"section-5" href=3D"https://w=
ww.rfc-editor.org/rfc/rfc5652#section-5">5</a>.  Signed-data Content Type</=
span>

   The signed-data content type consists of a content of any type and
   zero or more signature values.  Any number of signers in parallel can
   sign any type of content.

   The typical application of the signed-data content type represents
   one signer's digital signature on content of the data content type.
   Another typical application disseminates certificates and certificate
   revocation lists (CRLs).

   The process by which signed-data is constructed involves the
   following steps:

   1.  For each signer, a message digest, or hash value, is computed on
       the content with a signer-specific message-digest algorithm.  If
       the signer is signing any information other than the content, the
       message digest of the content and the other information are
       digested with the signer's message digest algorithm (see <a href=3D"=
https://www.rfc-editor.org/rfc/rfc5652#section-5.4">Section</a>
       <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-5.4">5.4</=
a>), and the result becomes the "message digest."

   2.  For each signer, the message digest is digitally signed using the
       signer's private key.

   3.  For each signer, the signature value and other signer-specific
       information are collected into a SignerInfo value, as defined in
       <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-5.3">Secti=
on 5.3</a>.  Certificates and CRLs for each signer, and those
       not corresponding to any signer, are collected in this step.

   4.  The message digest algorithms for all the signers and the
       SignerInfo values for all the signers are collected together with
       the content into a SignedData value, as defined in <a href=3D"https:=
//www.rfc-editor.org/rfc/rfc5652#section-5.1">Section 5.1</a>.

   A recipient independently computes the message digest.  This message
   digest and the signer's public key are used to verify the signature
   value.  The signer's public key is referenced in one of two ways.  It
   can be referenced by an issuer distinguished name along with an
   issuer-specific serial number to uniquely identify the certificate
   that contains the public key.  Alternatively, it can be referenced by
   a subject key identifier, which accommodates both certified and
   uncertified public keys.  While not required, the signer's
   certificate can be included in the SignedData certificates field.





<span class=3D"grey">Housley                     Standards Track           =
          [Page 8]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-9"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   When more than one signature is present, the successful validation of
   one signature associated with a given signer is usually treated as a
   successful signature by that signer.  However, there are some
   application environments where other rules are needed.  An
   application that employs a rule other than one valid signature for
   each signer must specify those rules.  Also, where simple matching of
   the signer identifier is not sufficient to determine whether the
   signatures were generated by the same signer, the application
   specification must describe how to determine which signatures were
   generated by the same signer.  Support of different communities of
   recipients is the primary reason that signers choose to include more
   than one signature.  For example, the signed-data content type might
   include signatures generated with the RSA signature algorithm and
   with the Elliptic Curve Digital Signature Algorithm (ECDSA) signature
   algorithm.  This allows recipients to verify the signature associated
   with one algorithm or the other.

   This section is divided into six parts.  The first part describes the
   top-level type SignedData, the second part describes
   EncapsulatedContentInfo, the third part describes the per-signer
   information type SignerInfo, and the fourth, fifth, and sixth parts
   describe the message digest calculation, signature generation, and
   signature verification processes, respectively.

<span class=3D"h3"><a class=3D"selflink" id=3D"section-5.1" href=3D"https:/=
/www.rfc-editor.org/rfc/rfc5652#section-5.1">5.1</a>.  SignedData Type</spa=
n>

   The following object identifier identifies the signed-data content
   type:

      id-signedData OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
         us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 }

   The signed-data content type shall have ASN.1 type SignedData:

      SignedData ::=3D SEQUENCE {
        version CMSVersion,
        digestAlgorithms DigestAlgorithmIdentifiers,
        encapContentInfo EncapsulatedContentInfo,
        certificates [0] IMPLICIT CertificateSet OPTIONAL,
        crls [1] IMPLICIT RevocationInfoChoices OPTIONAL,
        signerInfos SignerInfos }

      DigestAlgorithmIdentifiers ::=3D SET OF DigestAlgorithmIdentifier

      SignerInfos ::=3D SET OF SignerInfo






<span class=3D"grey">Housley                     Standards Track           =
          [Page 9]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-10"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   The fields of type SignedData have the following meanings:

      version is the syntax version number.  The appropriate value
      depends on certificates, eContentType, and SignerInfo.  The
      version MUST be assigned as follows:

         IF ((certificates is present) AND
            (any certificates with a type of other are present)) OR
            ((crls is present) AND
            (any crls with a type of other are present))
         THEN version MUST be 5
         ELSE
            IF (certificates is present) AND
               (any version 2 attribute certificates are present)
            THEN version MUST be 4
            ELSE
               IF ((certificates is present) AND
                  (any version 1 attribute certificates are present)) OR
                  (any SignerInfo structures are version 3) OR
                  (encapContentInfo eContentType is other than id-data)
               THEN version MUST be 3
               ELSE version MUST be 1

      digestAlgorithms is a collection of message digest algorithm
      identifiers.  There MAY be any number of elements in the
      collection, including zero.  Each element identifies the message
      digest algorithm, along with any associated parameters, used by
      one or more signer.  The collection is intended to list the
      message digest algorithms employed by all of the signers, in any
      order, to facilitate one-pass signature verification.
      Implementations MAY fail to validate signatures that use a digest
      algorithm that is not included in this set.  The message digesting
      process is described in <a href=3D"https://www.rfc-editor.org/rfc/rfc=
5652#section-5.4">Section 5.4</a>.

      encapContentInfo is the signed content, consisting of a content
      type identifier and the content itself.  Details of the
      EncapsulatedContentInfo type are discussed in <a href=3D"https://www.=
rfc-editor.org/rfc/rfc5652#section-5.2">Section 5.2</a>.

      certificates is a collection of certificates.  It is intended that
      the set of certificates be sufficient to contain certification
      paths from a recognized "root" or "top-level certification
      authority" to all of the signers in the signerInfos field.  There
      may be more certificates than necessary, and there may be
      certificates sufficient to contain certification paths from two or
      more independent top-level certification authorities.  There may
      also be fewer certificates than necessary, if it is expected that
      recipients have an alternate means of obtaining necessary




<span class=3D"grey">Housley                     Standards Track           =
         [Page 10]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-11"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


      certificates (e.g., from a previous set of certificates).  The
      signer's certificate MAY be included.  The use of version 1
      attribute certificates is strongly discouraged.

      crls is a collection of revocation status information.  It is
      intended that the collection contain information sufficient to
      determine whether the certificates in the certificates field are
      valid, but such correspondence is not necessary.  Certificate
      revocation lists (CRLs) are the primary source of revocation
      status information.  There MAY be more CRLs than necessary, and
      there MAY also be fewer CRLs than necessary.

      signerInfos is a collection of per-signer information.  There MAY
      be any number of elements in the collection, including zero.  When
      the collection represents more than one signature, the successful
      validation of one of signature from a given signer ought to be
      treated as a successful signature by that signer.  However, there
      are some application environments where other rules are needed.
      The details of the SignerInfo type are discussed in <a href=3D"https:=
//www.rfc-editor.org/rfc/rfc5652#section-5.3">Section 5.3</a>.
      Since each signer can employ a different digital signature
      technique, and future specifications could update the syntax, all
      implementations MUST gracefully handle unimplemented versions of
      SignerInfo.  Further, since all implementations will not support
      every possible signature algorithm, all implementations MUST
      gracefully handle unimplemented signature algorithms when they are
      encountered.

<span class=3D"h3"><a class=3D"selflink" id=3D"section-5.2" href=3D"https:/=
/www.rfc-editor.org/rfc/rfc5652#section-5.2">5.2</a>.  EncapsulatedContentI=
nfo Type</span>

   The content is represented in the type EncapsulatedContentInfo:

      EncapsulatedContentInfo ::=3D SEQUENCE {
        eContentType ContentType,
        eContent [0] EXPLICIT OCTET STRING OPTIONAL }

      ContentType ::=3D OBJECT IDENTIFIER

   The fields of type EncapsulatedContentInfo have the following
   meanings:

      eContentType is an object identifier.  The object identifier
      uniquely specifies the content type.

      eContent is the content itself, carried as an octet string.  The
      eContent need not be DER encoded.






<span class=3D"grey">Housley                     Standards Track           =
         [Page 11]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-12"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   The optional omission of the eContent within the
   EncapsulatedContentInfo field makes it possible to construct
   "external signatures".  In the case of external signatures, the
   content being signed is absent from the EncapsulatedContentInfo value
   included in the signed-data content type.  If the eContent value
   within EncapsulatedContentInfo is absent, then the signatureValue is
   calculated and the eContentType is assigned as though the eContent
   value was present.

   In the degenerate case where there are no signers, the
   EncapsulatedContentInfo value being "signed" is irrelevant.  In this
   case, the content type within the EncapsulatedContentInfo value being
   "signed" MUST be id-data (as defined in <a href=3D"https://www.rfc-edito=
r.org/rfc/rfc5652#section-4">Section 4</a>), and the content
   field of the EncapsulatedContentInfo value MUST be omitted.

<span class=3D"h4"><a class=3D"selflink" id=3D"section-5.2.1" href=3D"https=
://www.rfc-editor.org/rfc/rfc5652#section-5.2.1">5.2.1</a>.  Compatibility =
with PKCS #7</span>

   This section contains a word of warning to implementers that wish to
   support both the CMS and PKCS #7 [PKCS#7] SignedData content types.
   Both the CMS and PKCS #7 identify the type of the encapsulated
   content with an object identifier, but the ASN.1 type of the content
   itself is variable in PKCS #7 SignedData content type.

   PKCS #7 defines content as:

      content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL

   The CMS defines eContent as:

      eContent [0] EXPLICIT OCTET STRING OPTIONAL

   The CMS definition is much easier to use in most applications, and it
   is compatible with both S/MIME v2 and S/MIME v3.  S/MIME signed
   messages using the CMS and PKCS #7 are compatible because identical
   signed message formats are specified in <a href=3D"https://www.rfc-edito=
r.org/rfc/rfc2311">RFC 2311</a> for S/MIME v2
   [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-MSG2" title=3D"&q=
uot;S/MIME Version 2 Message Specification&quot;">MSG2</a>], <a href=3D"htt=
ps://www.rfc-editor.org/rfc/rfc2633">RFC 2633</a> for S/MIME v3 [<a href=3D=
"https://www.rfc-editor.org/rfc/rfc5652#ref-MSG3" title=3D"&quot;S/MIME Ver=
sion 3 Message Specification&quot;">MSG3</a>], and <a href=3D"https://www.r=
fc-editor.org/rfc/rfc3851">RFC 3851</a> for S/MIME v3.1
   [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-MSG3.1" title=3D"=
&quot;Secure/Multipurpose Internet Mail Extensions (S/MIME) Version 3.1 Mes=
sage Specification&quot;">MSG3.1</a>].  S/MIME v2 encapsulates the MIME con=
tent in a Data type
   (that is, an OCTET STRING) carried in the SignedData contentInfo
   content ANY field, and S/MIME v3 carries the MIME content in the
   SignedData encapContentInfo eContent OCTET STRING.  Therefore, in
   S/MIME v2, S/MIME v3, and S/MIME v3.1, the MIME content is placed in
   an OCTET STRING and the message digest is computed over the identical
   portions of the content.  That is, the message digest is computed
   over the octets comprising the value of the OCTET STRING, neither the
   tag nor length octets are included.






<span class=3D"grey">Housley                     Standards Track           =
         [Page 12]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-13"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   There are incompatibilities between the CMS and PKCS #7 SignedData
   types when the encapsulated content is not formatted using the Data
   type.  For example, when an <a href=3D"https://www.rfc-editor.org/rfc/rf=
c2634">RFC 2634</a> signed receipt [<a href=3D"https://www.rfc-editor.org/r=
fc/rfc5652#ref-ESS" title=3D"&quot;Enhanced Security Services for S/MIME&qu=
ot;">ESS</a>] is
   encapsulated in the CMS SignedData type, then the Receipt SEQUENCE is
   encoded in the SignedData encapContentInfo eContent OCTET STRING and
   the message digest is computed using the entire Receipt SEQUENCE
   encoding (including tag, length and value octets).  However, if an
   <a href=3D"https://www.rfc-editor.org/rfc/rfc2634">RFC 2634</a> signed r=
eceipt is encapsulated in the PKCS #7 SignedData
   type, then the Receipt SEQUENCE is DER encoded [<a href=3D"https://www.r=
fc-editor.org/rfc/rfc5652#ref-X.509-88">X.509-88</a>] in the
   SignedData contentInfo content ANY field (a SEQUENCE, not an OCTET
   STRING).  Therefore, the message digest is computed using only the
   value octets of the Receipt SEQUENCE encoding.

   The following strategy can be used to achieve backward compatibility
   with PKCS #7 when processing SignedData content types.  If the
   implementation is unable to ASN.1 decode the SignedData type using
   the CMS SignedData encapContentInfo eContent OCTET STRING syntax,
   then the implementation MAY attempt to decode the SignedData type
   using the PKCS #7 SignedData contentInfo content ANY syntax and
   compute the message digest accordingly.

   The following strategy can be used to achieve backward compatibility
   with PKCS #7 when creating a SignedData content type in which the
   encapsulated content is not formatted using the Data type.
   Implementations MAY examine the value of the eContentType, and then
   adjust the expected DER encoding of eContent based on the object
   identifier value.  For example, to support Microsoft Authenticode
   [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-MSAC" title=3D"&q=
uot;Authenticode&quot;">MSAC</a>], the following information MAY be include=
d:

      eContentType Object Identifier is set to { 1 3 6 1 4 1 311 2 1 4 }

      eContent contains DER-encoded Authenticode signing information

<span class=3D"h3"><a class=3D"selflink" id=3D"section-5.3" href=3D"https:/=
/www.rfc-editor.org/rfc/rfc5652#section-5.3">5.3</a>.  SignerInfo Type</spa=
n>

   Per-signer information is represented in the type SignerInfo:

      SignerInfo ::=3D SEQUENCE {
        version CMSVersion,
        sid SignerIdentifier,
        digestAlgorithm DigestAlgorithmIdentifier,
        signedAttrs [0] IMPLICIT SignedAttributes OPTIONAL,
        signatureAlgorithm SignatureAlgorithmIdentifier,
        signature SignatureValue,
        unsignedAttrs [1] IMPLICIT UnsignedAttributes OPTIONAL }






<span class=3D"grey">Housley                     Standards Track           =
         [Page 13]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-14"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


      SignerIdentifier ::=3D CHOICE {
        issuerAndSerialNumber IssuerAndSerialNumber,
        subjectKeyIdentifier [0] SubjectKeyIdentifier }

      SignedAttributes ::=3D SET SIZE (1..MAX) OF Attribute

      UnsignedAttributes ::=3D SET SIZE (1..MAX) OF Attribute

      Attribute ::=3D SEQUENCE {
        attrType OBJECT IDENTIFIER,
        attrValues SET OF AttributeValue }

      AttributeValue ::=3D ANY

      SignatureValue ::=3D OCTET STRING

   The fields of type SignerInfo have the following meanings:

      version is the syntax version number.  If the SignerIdentifier is
      the CHOICE issuerAndSerialNumber, then the version MUST be 1.  If
      the SignerIdentifier is subjectKeyIdentifier, then the version
      MUST be 3.

      sid specifies the signer's certificate (and thereby the signer's
      public key).  The signer's public key is needed by the recipient
      to verify the signature.  SignerIdentifier provides two
      alternatives for specifying the signer's public key.  The
      issuerAndSerialNumber alternative identifies the signer's
      certificate by the issuer's distinguished name and the certificate
      serial number; the subjectKeyIdentifier identifies the signer's
      certificate by a key identifier.  When an X.509 certificate is
      referenced, the key identifier matches the X.509
      subjectKeyIdentifier extension value.  When other certificate
      formats are referenced, the documents that specify the certificate
      format and their use with the CMS must include details on matching
      the key identifier to the appropriate certificate field.
      Implementations MUST support the reception of the
      issuerAndSerialNumber and subjectKeyIdentifier forms of
      SignerIdentifier.  When generating a SignerIdentifier,
      implementations MAY support one of the forms (either
      issuerAndSerialNumber or subjectKeyIdentifier) and always use it,
      or implementations MAY arbitrarily mix the two forms.  However,
      subjectKeyIdentifier MUST be used to refer to a public key
      contained in a non-X.509 certificate.

      digestAlgorithm identifies the message digest algorithm, and any
      associated parameters, used by the signer.  The message digest is
      computed on either the content being signed or the content



<span class=3D"grey">Housley                     Standards Track           =
         [Page 14]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-15"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


      together with the signed attributes using the process described in
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-5.4">Sectio=
n 5.4</a>.  The message digest algorithm SHOULD be among those
      listed in the digestAlgorithms field of the associated SignerData.
      Implementations MAY fail to validate signatures that use a digest
      algorithm that is not included in the SignedData digestAlgorithms
      set.

      signedAttrs is a collection of attributes that are signed.  The
      field is optional, but it MUST be present if the content type of
      the EncapsulatedContentInfo value being signed is not id-data.
      SignedAttributes MUST be DER encoded, even if the rest of the
      structure is BER encoded.  Useful attribute types, such as signing
      time, are defined in <a href=3D"https://www.rfc-editor.org/rfc/rfc565=
2#section-11">Section 11</a>.  If the field is present, it MUST
      contain, at a minimum, the following two attributes:

         A content-type attribute having as its value the content type
         of the EncapsulatedContentInfo value being signed.  <a href=3D"htt=
ps://www.rfc-editor.org/rfc/rfc5652#section-11.1">Section</a>
         <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-11.1">11=
.1</a> defines the content-type attribute.  However, the
         content-type attribute MUST NOT be used as part of a
         countersignature unsigned attribute as defined in <a href=3D"https=
://www.rfc-editor.org/rfc/rfc5652#section-11.4">Section 11.4</a>.

         A message-digest attribute, having as its value the message
         digest of the content.  <a href=3D"https://www.rfc-editor.org/rfc/=
rfc5652#section-11.2">Section 11.2</a> defines the message-digest
         attribute.

      signatureAlgorithm identifies the signature algorithm, and any
      associated parameters, used by the signer to generate the digital
      signature.

      signature is the result of digital signature generation, using the
      message digest and the signer's private key.  The details of the
      signature depend on the signature algorithm employed.

      unsignedAttrs is a collection of attributes that are not signed.
      The field is optional.  Useful attribute types, such as
      countersignatures, are defined in <a href=3D"https://www.rfc-editor.o=
rg/rfc/rfc5652#section-11">Section 11</a>.

   The fields of type SignedAttribute and UnsignedAttribute have the
   following meanings:

      attrType indicates the type of attribute.  It is an object
      identifier.

      attrValues is a set of values that comprise the attribute.  The
      type of each value in the set can be determined uniquely by
      attrType.  The attrType can impose restrictions on the number of
      items in the set.




<span class=3D"grey">Housley                     Standards Track           =
         [Page 15]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-16"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


<span class=3D"h3"><a class=3D"selflink" id=3D"section-5.4" href=3D"https:/=
/www.rfc-editor.org/rfc/rfc5652#section-5.4">5.4</a>.  Message Digest Calcu=
lation Process</span>

   The message digest calculation process computes a message digest on
   either the content being signed or the content together with the
   signed attributes.  In either case, the initial input to the message
   digest calculation process is the "value" of the encapsulated content
   being signed.  Specifically, the initial input is the
   encapContentInfo eContent OCTET STRING to which the signing process
   is applied.  Only the octets comprising the value of the eContent
   OCTET STRING are input to the message digest algorithm, not the tag
   or the length octets.

   The result of the message digest calculation process depends on
   whether the signedAttrs field is present.  When the field is absent,
   the result is just the message digest of the content as described
   above.  When the field is present, however, the result is the message
   digest of the complete DER encoding of the SignedAttrs value
   contained in the signedAttrs field.  Since the SignedAttrs value,
   when present, must contain the content-type and the message-digest
   attributes, those values are indirectly included in the result.  The
   content-type attribute MUST NOT be included in a countersignature
   unsigned attribute as defined in <a href=3D"https://www.rfc-editor.org/r=
fc/rfc5652#section-11.4">Section 11.4</a>.  A separate encoding
   of the signedAttrs field is performed for message digest calculation.
   The IMPLICIT [0] tag in the signedAttrs is not used for the DER
   encoding, rather an EXPLICIT SET OF tag is used.  That is, the DER
   encoding of the EXPLICIT SET OF tag, rather than of the IMPLICIT [0]
   tag, MUST be included in the message digest calculation along with
   the length and content octets of the SignedAttributes value.

   When the signedAttrs field is absent, only the octets comprising the
   value of the SignedData encapContentInfo eContent OCTET STRING (e.g.,
   the contents of a file) are input to the message digest calculation.
   This has the advantage that the length of the content being signed
   need not be known in advance of the signature generation process.

   Although the encapContentInfo eContent OCTET STRING tag and length
   octets are not included in the message digest calculation, they are
   protected by other means.  The length octets are protected by the
   nature of the message digest algorithm since it is computationally
   infeasible to find any two distinct message contents of any length
   that have the same message digest.

<span class=3D"h3"><a class=3D"selflink" id=3D"section-5.5" href=3D"https:/=
/www.rfc-editor.org/rfc/rfc5652#section-5.5">5.5</a>.  Signature Generation=
 Process</span>

   The input to the signature generation process includes the result of
   the message digest calculation process and the signer's private key.
   The details of the signature generation depend on the signature
   algorithm employed.  The object identifier, along with any



<span class=3D"grey">Housley                     Standards Track           =
         [Page 16]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-17"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   parameters, that specifies the signature algorithm employed by the
   signer is carried in the signatureAlgorithm field.  The signature
   value generated by the signer MUST be encoded as an OCTET STRING and
   carried in the signature field.

<span class=3D"h3"><a class=3D"selflink" id=3D"section-5.6" href=3D"https:/=
/www.rfc-editor.org/rfc/rfc5652#section-5.6">5.6</a>.  Signature Verificati=
on Process</span>

   The input to the signature verification process includes the result
   of the message digest calculation process and the signer's public
   key.  The recipient MAY obtain the correct public key for the signer
   by any means, but the preferred method is from a certificate obtained
   from the SignedData certificates field.  The selection and validation
   of the signer's public key MAY be based on certification path
   validation (see [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-P=
ROFILE" title=3D"&quot;Internet X.509 Public Key Infrastructure Certificate=
 and Certificate Revocation List (CRL) Profile&quot;">PROFILE</a>]) as well=
 as other external context, but is
   beyond the scope of this document.  The details of the signature
   verification depend on the signature algorithm employed.

   The recipient MUST NOT rely on any message digest values computed by
   the originator.  If the SignedData signerInfo includes
   signedAttributes, then the content message digest MUST be calculated
   as described in <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#sectio=
n-5.4">Section 5.4</a>.  For the signature to be valid, the
   message digest value calculated by the recipient MUST be the same as
   the value of the messageDigest attribute included in the
   signedAttributes of the SignedData signerInfo.

   If the SignedData signerInfo includes signedAttributes, then the
   content-type attribute value MUST match the SignedData
   encapContentInfo eContentType value.

<span class=3D"h2"><a class=3D"selflink" id=3D"section-6" href=3D"https://w=
ww.rfc-editor.org/rfc/rfc5652#section-6">6</a>.  Enveloped-data Content Typ=
e</span>

   The enveloped-data content type consists of an encrypted content of
   any type and encrypted content-encryption keys for one or more
   recipients.  The combination of the encrypted content and one
   encrypted content-encryption key for a recipient is a "digital
   envelope" for that recipient.  Any type of content can be enveloped
   for an arbitrary number of recipients using any of the supported key
   management techniques for each recipient.

   The typical application of the enveloped-data content type will
   represent one or more recipients' digital envelopes on content of the
   data or signed-data content types.

   Enveloped-data is constructed by the following steps:

   1.  A content-encryption key for a particular content-encryption
       algorithm is generated at random.




<span class=3D"grey">Housley                     Standards Track           =
         [Page 17]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-18"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   2.  The content-encryption key is encrypted for each recipient.  The
       details of this encryption depend on the key management algorithm
       used, but four general techniques are supported:

         key transport:  the content-encryption key is encrypted in the
         recipient's public key;

         key agreement:  the recipient's public key and the sender's
         private key are used to generate a pairwise symmetric key, then
         the content-encryption key is encrypted in the pairwise
         symmetric key;

         symmetric key-encryption keys:  the content-encryption key is
         encrypted in a previously distributed symmetric key-encryption
         key; and

         passwords: the content-encryption key is encrypted in a key-
         encryption key that is derived from a password or other shared
         secret value.

   3.  For each recipient, the encrypted content-encryption key and
       other recipient-specific information are collected into a
       RecipientInfo value, defined in <a href=3D"https://www.rfc-editor.or=
g/rfc/rfc5652#section-6.2">Section 6.2</a>.

   4.  The content is encrypted with the content-encryption key.
       Content encryption may require that the content be padded to a
       multiple of some block size; see <a href=3D"https://www.rfc-editor.o=
rg/rfc/rfc5652#section-6.3">Section 6.3</a>.

   5.  The RecipientInfo values for all the recipients are collected
       together with the encrypted content to form an EnvelopedData
       value as defined in <a href=3D"https://www.rfc-editor.org/rfc/rfc565=
2#section-6.1">Section 6.1</a>.

   A recipient opens the digital envelope by decrypting one of the
   encrypted content-encryption keys and then decrypting the encrypted
   content with the recovered content-encryption key.

   This section is divided into four parts.  The first part describes
   the top-level type EnvelopedData, the second part describes the per-
   recipient information type RecipientInfo, and the third and fourth
   parts describe the content-encryption and key-encryption processes.

<span class=3D"h3"><a class=3D"selflink" id=3D"section-6.1" href=3D"https:/=
/www.rfc-editor.org/rfc/rfc5652#section-6.1">6.1</a>.  EnvelopedData Type</=
span>

   The following object identifier identifies the enveloped-data content
   type:

      id-envelopedData OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
          us(840) rsadsi(113549) pkcs(1) pkcs7(7) 3 }



<span class=3D"grey">Housley                     Standards Track           =
         [Page 18]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-19"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   The enveloped-data content type shall have ASN.1 type EnvelopedData:

      EnvelopedData ::=3D SEQUENCE {
        version CMSVersion,
        originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
        recipientInfos RecipientInfos,
        encryptedContentInfo EncryptedContentInfo,
        unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }

      OriginatorInfo ::=3D SEQUENCE {
        certs [0] IMPLICIT CertificateSet OPTIONAL,
        crls [1] IMPLICIT RevocationInfoChoices OPTIONAL }

      RecipientInfos ::=3D SET SIZE (1..MAX) OF RecipientInfo

      EncryptedContentInfo ::=3D SEQUENCE {
        contentType ContentType,
        contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
        encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL }

      EncryptedContent ::=3D OCTET STRING

      UnprotectedAttributes ::=3D SET SIZE (1..MAX) OF Attribute

   The fields of type EnvelopedData have the following meanings:

      version is the syntax version number.  The appropriate value
      depends on originatorInfo, RecipientInfo, and unprotectedAttrs.
      The version MUST be assigned as follows:

         IF (originatorInfo is present) AND
            ((any certificates with a type of other are present) OR
            (any crls with a type of other are present))
         THEN version is 4
         ELSE
            IF ((originatorInfo is present) AND
               (any version 2 attribute certificates are present)) OR
               (any RecipientInfo structures include pwri) OR
               (any RecipientInfo structures include ori)
            THEN version is 3
            ELSE
               IF (originatorInfo is absent) AND
                  (unprotectedAttrs is absent) AND
                  (all RecipientInfo structures are version 0)
               THEN version is 0
               ELSE version is 2





<span class=3D"grey">Housley                     Standards Track           =
         [Page 19]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-20"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


      originatorInfo optionally provides information about the
      originator.  It is present only if required by the key management
      algorithm.  It may contain certificates and CRLs:

         certs is a collection of certificates.  certs may contain
         originator certificates associated with several different key
         management algorithms.  certs may also contain attribute
         certificates associated with the originator.  The certificates
         contained in certs are intended to be sufficient for all
         recipients to build certification paths from a recognized
         "root" or "top-level certification authority".  However, certs
         may contain more certificates than necessary, and there may be
         certificates sufficient to make certification paths from two or
         more independent top-level certification authorities.
         Alternatively, certs may contain fewer certificates than
         necessary, if it is expected that recipients have an alternate
         means of obtaining necessary certificates (e.g., from a
         previous set of certificates).

         crls is a collection of CRLs.  It is intended that the set
         contain information sufficient to determine whether or not the
         certificates in the certs field are valid, but such
         correspondence is not necessary.  There MAY be more CRLs than
         necessary, and there MAY also be fewer CRLs than necessary.

      recipientInfos is a collection of per-recipient information.
      There MUST be at least one element in the collection.

      encryptedContentInfo is the encrypted content information.

      unprotectedAttrs is a collection of attributes that are not
      encrypted.  The field is optional.  Useful attribute types are
      defined in <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-=
11">Section 11</a>.

   The fields of type EncryptedContentInfo have the following meanings:

      contentType indicates the type of content.

      contentEncryptionAlgorithm identifies the content-encryption
      algorithm, and any associated parameters, used to encrypt the
      content.  The content-encryption process is described in <a href=3D"h=
ttps://www.rfc-editor.org/rfc/rfc5652#section-6.3">Section</a>
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-6.3">6.3</a=
>.  The same content-encryption algorithm and content-encryption
      key are used for all recipients.

      encryptedContent is the result of encrypting the content.  The
      field is optional, and if the field is not present, its intended
      value must be supplied by other means.




<span class=3D"grey">Housley                     Standards Track           =
         [Page 20]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-21"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   The recipientInfos field comes before the encryptedContentInfo field
   so that an EnvelopedData value may be processed in a single pass.

<span class=3D"h3"><a class=3D"selflink" id=3D"section-6.2" href=3D"https:/=
/www.rfc-editor.org/rfc/rfc5652#section-6.2">6.2</a>.  RecipientInfo Type</=
span>

   Per-recipient information is represented in the type RecipientInfo.
   RecipientInfo has a different format for each of the supported key
   management techniques.  Any of the key management techniques can be
   used for each recipient of the same encrypted content.  In all cases,
   the encrypted content-encryption key is transferred to one or more
   recipients.

   Since all implementations will not support every possible key
   management algorithm, all implementations MUST gracefully handle
   unimplemented algorithms when they are encountered.  For example, if
   a recipient receives a content-encryption key encrypted in their RSA
   public key using RSA-OAEP (Optimal Asymmetric Encryption Padding) and
   the implementation only supports RSA PKCS #1 v1.5, then a graceful
   failure must be implemented.

   Implementations MUST support key transport, key agreement, and
   previously distributed symmetric key-encryption keys, as represented
   by ktri, kari, and kekri, respectively.  Implementations MAY support
   the password-based key management as represented by pwri.
   Implementations MAY support any other key management technique as
   represented by ori.  Since each recipient can employ a different key
   management technique and future specifications could define
   additional key management techniques, all implementations MUST
   gracefully handle unimplemented alternatives within the RecipientInfo
   CHOICE, all implementations MUST gracefully handle unimplemented
   versions of otherwise supported alternatives within the RecipientInfo
   CHOICE, and all implementations MUST gracefully handle unimplemented
   or unknown ori alternatives.

      RecipientInfo ::=3D CHOICE {
        ktri KeyTransRecipientInfo,
        kari [1] KeyAgreeRecipientInfo,
        kekri [2] KEKRecipientInfo,
        pwri [3] PasswordRecipientinfo,
        ori [4] OtherRecipientInfo }

      EncryptedKey ::=3D OCTET STRING









<span class=3D"grey">Housley                     Standards Track           =
         [Page 21]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-22"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


<span class=3D"h4"><a class=3D"selflink" id=3D"section-6.2.1" href=3D"https=
://www.rfc-editor.org/rfc/rfc5652#section-6.2.1">6.2.1</a>.  KeyTransRecipi=
entInfo Type</span>

   Per-recipient information using key transport is represented in the
   type KeyTransRecipientInfo.  Each instance of KeyTransRecipientInfo
   transfers the content-encryption key to one recipient.

      KeyTransRecipientInfo ::=3D SEQUENCE {
        version CMSVersion,  -- always set to 0 or 2
        rid RecipientIdentifier,
        keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
        encryptedKey EncryptedKey }

      RecipientIdentifier ::=3D CHOICE {
        issuerAndSerialNumber IssuerAndSerialNumber,
        subjectKeyIdentifier [0] SubjectKeyIdentifier }

   The fields of type KeyTransRecipientInfo have the following meanings:

      version is the syntax version number.  If the RecipientIdentifier
      is the CHOICE issuerAndSerialNumber, then the version MUST be 0.
      If the RecipientIdentifier is subjectKeyIdentifier, then the
      version MUST be 2.

      rid specifies the recipient's certificate or key that was used by
      the sender to protect the content-encryption key.  The content-
      encryption key is encrypted with the recipient's public key.  The
      RecipientIdentifier provides two alternatives for specifying the
      recipient's certificate, and thereby the recipient's public key.
      The recipient's certificate must contain a key transport public
      key.  Therefore, a recipient X.509 version 3 certificate that
      contains a key usage extension MUST assert the keyEncipherment
      bit.  The issuerAndSerialNumber alternative identifies the
      recipient's certificate by the issuer's distinguished name and the
      certificate serial number; the subjectKeyIdentifier identifies the
      recipient's certificate by a key identifier.  When an X.509
      certificate is referenced, the key identifier matches the X.509
      subjectKeyIdentifier extension value.  When other certificate
      formats are referenced, the documents that specify the certificate
      format and their use with the CMS must include details on matching
      the key identifier to the appropriate certificate field.  For
      recipient processing, implementations MUST support both of these
      alternatives for specifying the recipient's certificate.  For
      sender processing, implementations MUST support at least one of
      these alternatives.







<span class=3D"grey">Housley                     Standards Track           =
         [Page 22]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-23"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


      keyEncryptionAlgorithm identifies the key-encryption algorithm,
      and any associated parameters, used to encrypt the content-
      encryption key for the recipient.  The key-encryption process is
      described in <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#sectio=
n-6.4">Section 6.4</a>.

      encryptedKey is the result of encrypting the content-encryption
      key for the recipient.

<span class=3D"h4"><a class=3D"selflink" id=3D"section-6.2.2" href=3D"https=
://www.rfc-editor.org/rfc/rfc5652#section-6.2.2">6.2.2</a>.  KeyAgreeRecipi=
entInfo Type</span>

   Recipient information using key agreement is represented in the type
   KeyAgreeRecipientInfo.  Each instance of KeyAgreeRecipientInfo will
   transfer the content-encryption key to one or more recipients that
   use the same key agreement algorithm and domain parameters for that
   algorithm.

      KeyAgreeRecipientInfo ::=3D SEQUENCE {
        version CMSVersion,  -- always set to 3
        originator [0] EXPLICIT OriginatorIdentifierOrKey,
        ukm [1] EXPLICIT UserKeyingMaterial OPTIONAL,
        keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
        recipientEncryptedKeys RecipientEncryptedKeys }

      OriginatorIdentifierOrKey ::=3D CHOICE {
        issuerAndSerialNumber IssuerAndSerialNumber,
        subjectKeyIdentifier [0] SubjectKeyIdentifier,
        originatorKey [1] OriginatorPublicKey }

      OriginatorPublicKey ::=3D SEQUENCE {
        algorithm AlgorithmIdentifier,
        publicKey BIT STRING }

      RecipientEncryptedKeys ::=3D SEQUENCE OF RecipientEncryptedKey

      RecipientEncryptedKey ::=3D SEQUENCE {
        rid KeyAgreeRecipientIdentifier,
        encryptedKey EncryptedKey }

      KeyAgreeRecipientIdentifier ::=3D CHOICE {
        issuerAndSerialNumber IssuerAndSerialNumber,
        rKeyId [0] IMPLICIT RecipientKeyIdentifier }

      RecipientKeyIdentifier ::=3D SEQUENCE {
        subjectKeyIdentifier SubjectKeyIdentifier,
        date GeneralizedTime OPTIONAL,
        other OtherKeyAttribute OPTIONAL }

      SubjectKeyIdentifier ::=3D OCTET STRING



<span class=3D"grey">Housley                     Standards Track           =
         [Page 23]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-24"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   The fields of type KeyAgreeRecipientInfo have the following meanings:

      version is the syntax version number.  It MUST always be 3.

      originator is a CHOICE with three alternatives specifying the
      sender's key agreement public key.  The sender uses the
      corresponding private key and the recipient's public key to
      generate a pairwise key.  The content-encryption key is encrypted
      in the pairwise key.  The issuerAndSerialNumber alternative
      identifies the sender's certificate, and thereby the sender's
      public key, by the issuer's distinguished name and the certificate
      serial number.  The subjectKeyIdentifier alternative identifies
      the sender's certificate, and thereby the sender's public key, by
      a key identifier.  When an X.509 certificate is referenced, the
      key identifier matches the X.509 subjectKeyIdentifier extension
      value.  When other certificate formats are referenced, the
      documents that specify the certificate format and their use with
      the CMS must include details on matching the key identifier to the
      appropriate certificate field.  The originatorKey alternative
      includes the algorithm identifier and sender's key agreement
      public key.  This alternative permits originator anonymity since
      the public key is not certified.  Implementations MUST support all
      three alternatives for specifying the sender's public key.

      ukm is optional.  With some key agreement algorithms, the sender
      provides a User Keying Material (UKM) to ensure that a different
      key is generated each time the same two parties generate a
      pairwise key.  Implementations MUST accept a KeyAgreeRecipientInfo
      SEQUENCE that includes a ukm field.  Implementations that do not
      support key agreement algorithms that make use of UKMs MUST
      gracefully handle the presence of UKMs.

      keyEncryptionAlgorithm identifies the key-encryption algorithm,
      and any associated parameters, used to encrypt the content-
      encryption key with the key-encryption key.  The key-encryption
      process is described in <a href=3D"https://www.rfc-editor.org/rfc/rfc=
5652#section-6.4">Section 6.4</a>.

      recipientEncryptedKeys includes a recipient identifier and
      encrypted key for one or more recipients.  The
      KeyAgreeRecipientIdentifier is a CHOICE with two alternatives
      specifying the recipient's certificate, and thereby the
      recipient's public key, that was used by the sender to generate a
      pairwise key-encryption key.  The recipient's certificate must
      contain a key agreement public key.  Therefore, a recipient X.509
      version 3 certificate that contains a key usage extension MUST
      assert the keyAgreement bit.  The content-encryption key is
      encrypted in the pairwise key-encryption key.  The
      issuerAndSerialNumber alternative identifies the recipient's



<span class=3D"grey">Housley                     Standards Track           =
         [Page 24]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-25"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


      certificate by the issuer's distinguished name and the certificate
      serial number; the RecipientKeyIdentifier is described below.  The
      encryptedKey is the result of encrypting the content-encryption
      key in the pairwise key-encryption key generated using the key
      agreement algorithm.  Implementations MUST support both
      alternatives for specifying the recipient's certificate.

   The fields of type RecipientKeyIdentifier have the following
   meanings:

      subjectKeyIdentifier identifies the recipient's certificate by a
      key identifier.  When an X.509 certificate is referenced, the key
      identifier matches the X.509 subjectKeyIdentifier extension value.
      When other certificate formats are referenced, the documents that
      specify the certificate format and their use with the CMS must
      include details on matching the key identifier to the appropriate
      certificate field.

      date is optional.  When present, the date specifies which of the
      recipient's previously distributed UKMs was used by the sender.

      other is optional.  When present, this field contains additional
      information used by the recipient to locate the public keying
      material used by the sender.

<span class=3D"h4"><a class=3D"selflink" id=3D"section-6.2.3" href=3D"https=
://www.rfc-editor.org/rfc/rfc5652#section-6.2.3">6.2.3</a>.  KEKRecipientIn=
fo Type</span>

   Recipient information using previously distributed symmetric keys is
   represented in the type KEKRecipientInfo.  Each instance of
   KEKRecipientInfo will transfer the content-encryption key to one or
   more recipients who have the previously distributed key-encryption
   key.

      KEKRecipientInfo ::=3D SEQUENCE {
        version CMSVersion,  -- always set to 4
        kekid KEKIdentifier,
        keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
        encryptedKey EncryptedKey }

      KEKIdentifier ::=3D SEQUENCE {
        keyIdentifier OCTET STRING,
        date GeneralizedTime OPTIONAL,
        other OtherKeyAttribute OPTIONAL }








<span class=3D"grey">Housley                     Standards Track           =
         [Page 25]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-26"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   The fields of type KEKRecipientInfo have the following meanings:

      version is the syntax version number.  It MUST always be 4.

      kekid specifies a symmetric key-encryption key that was previously
      distributed to the sender and one or more recipients.

      keyEncryptionAlgorithm identifies the key-encryption algorithm,
      and any associated parameters, used to encrypt the content-
      encryption key with the key-encryption key.  The key-encryption
      process is described in <a href=3D"https://www.rfc-editor.org/rfc/rfc=
5652#section-6.4">Section 6.4</a>.

      encryptedKey is the result of encrypting the content-encryption
      key in the key-encryption key.

   The fields of type KEKIdentifier have the following meanings:

      keyIdentifier identifies the key-encryption key that was
      previously distributed to the sender and one or more recipients.

      date is optional.  When present, the date specifies a single key-
      encryption key from a set that was previously distributed.

      other is optional.  When present, this field contains additional
      information used by the recipient to determine the key-encryption
      key used by the sender.

<span class=3D"h4"><a class=3D"selflink" id=3D"section-6.2.4" href=3D"https=
://www.rfc-editor.org/rfc/rfc5652#section-6.2.4">6.2.4</a>.  PasswordRecipi=
entInfo Type</span>

   Recipient information using a password or shared secret value is
   represented in the type PasswordRecipientInfo.  Each instance of
   PasswordRecipientInfo will transfer the content-encryption key to one
   or more recipients who possess the password or shared secret value.

   The PasswordRecipientInfo Type is specified in <a href=3D"https://www.rf=
c-editor.org/rfc/rfc3211">RFC 3211</a> [<a href=3D"https://www.rfc-editor.o=
rg/rfc/rfc5652#ref-PWRI" title=3D"&quot;Password-based Encryption for CMS&q=
uot;">PWRI</a>].  The
   PasswordRecipientInfo structure is repeated here for completeness.

      PasswordRecipientInfo ::=3D SEQUENCE {
        version CMSVersion,   -- Always set to 0
        keyDerivationAlgorithm [0] KeyDerivationAlgorithmIdentifier
                                     OPTIONAL,
        keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
        encryptedKey EncryptedKey }








<span class=3D"grey">Housley                     Standards Track           =
         [Page 26]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-27"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   The fields of type PasswordRecipientInfo have the following meanings:

      version is the syntax version number.  It MUST always be 0.

      keyDerivationAlgorithm identifies the key-derivation algorithm,
      and any associated parameters, used to derive the key-encryption
      key from the password or shared secret value.  If this field is
      absent, the key-encryption key is supplied from an external
      source, for example a hardware crypto token such as a smart card.

      keyEncryptionAlgorithm identifies the encryption algorithm, and
      any associated parameters, used to encrypt the content-encryption
      key with the key-encryption key.

      encryptedKey is the result of encrypting the content-encryption
      key with the key-encryption key.

<span class=3D"h4"><a class=3D"selflink" id=3D"section-6.2.5" href=3D"https=
://www.rfc-editor.org/rfc/rfc5652#section-6.2.5">6.2.5</a>.  OtherRecipient=
Info Type</span>

   Recipient information for additional key management techniques are
   represented in the type OtherRecipientInfo.  The OtherRecipientInfo
   type allows key management techniques beyond key transport, key
   agreement, previously distributed symmetric key-encryption keys, and
   password-based key management to be specified in future documents.
   An object identifier uniquely identifies such key management
   techniques.

      OtherRecipientInfo ::=3D SEQUENCE {
        oriType OBJECT IDENTIFIER,
        oriValue ANY DEFINED BY oriType }

   The fields of type OtherRecipientInfo have the following meanings:

      oriType identifies the key management technique.

      oriValue contains the protocol data elements needed by a recipient
      using the identified key management technique.

<span class=3D"h3"><a class=3D"selflink" id=3D"section-6.3" href=3D"https:/=
/www.rfc-editor.org/rfc/rfc5652#section-6.3">6.3</a>.  Content-encryption P=
rocess</span>

   The content-encryption key for the desired content-encryption
   algorithm is randomly generated.  The data to be protected is padded
   as described below, then the padded data is encrypted using the
   content-encryption key.  The encryption operation maps an arbitrary
   string of octets (the data) to another string of octets (the
   ciphertext) under control of a content-encryption key.  The encrypted
   data is included in the EnvelopedData encryptedContentInfo
   encryptedContent OCTET STRING.



<span class=3D"grey">Housley                     Standards Track           =
         [Page 27]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-28"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   Some content-encryption algorithms assume the input length is a
   multiple of k octets, where k is greater than one.  For such
   algorithms, the input shall be padded at the trailing end with
   k-(lth mod k) octets all having value k-(lth mod k), where lth is
   the length of the input.  In other words, the input is padded at
   the trailing end with one of the following strings:

                     01 -- if lth mod k =3D k-1
                  02 02 -- if lth mod k =3D k-2
                      .
                      .
                      .
            k k ... k k -- if lth mod k =3D 0

   The padding can be removed unambiguously since all input is padded,
   including input values that are already a multiple of the block size,
   and no padding string is a suffix of another.  This padding method is
   well defined if and only if k is less than 256.

<span class=3D"h3"><a class=3D"selflink" id=3D"section-6.4" href=3D"https:/=
/www.rfc-editor.org/rfc/rfc5652#section-6.4">6.4</a>.  Key-encryption Proce=
ss</span>

   The input to the key-encryption process -- the value supplied to the
   recipient's key-encryption algorithm -- is just the "value" of the
   content-encryption key.

   Any of the aforementioned key management techniques can be used for
   each recipient of the same encrypted content.

<span class=3D"h2"><a class=3D"selflink" id=3D"section-7" href=3D"https://w=
ww.rfc-editor.org/rfc/rfc5652#section-7">7</a>.  Digested-data Content Type=
</span>

   The digested-data content type consists of content of any type and a
   message digest of the content.

   Typically, the digested-data content type is used to provide content
   integrity, and the result generally becomes an input to the
   enveloped-data content type.

   The following steps construct digested-data:

   1.  A message digest is computed on the content with a message-digest
       algorithm.

   2.  The message-digest algorithm and the message digest are collected
       together with the content into a DigestedData value.

   A recipient verifies the message digest by comparing the message
   digest to an independently computed message digest.




<span class=3D"grey">Housley                     Standards Track           =
         [Page 28]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-29"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   The following object identifier identifies the digested-data content
   type:

      id-digestedData OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
          us(840) rsadsi(113549) pkcs(1) pkcs7(7) 5 }

   The digested-data content type shall have ASN.1 type DigestedData:

      DigestedData ::=3D SEQUENCE {
        version CMSVersion,
        digestAlgorithm DigestAlgorithmIdentifier,
        encapContentInfo EncapsulatedContentInfo,
        digest Digest }

      Digest ::=3D OCTET STRING

   The fields of type DigestedData have the following meanings:

      version is the syntax version number.  If the encapsulated content
      type is id-data, then the value of version MUST be 0; however, if
      the encapsulated content type is other than id-data, then the
      value of version MUST be 2.

      digestAlgorithm identifies the message digest algorithm, and any
      associated parameters, under which the content is digested.  The
      message-digesting process is the same as in <a href=3D"https://www.rf=
c-editor.org/rfc/rfc5652#section-5.4">Section 5.4</a> in the
      case when there are no signed attributes.

      encapContentInfo is the content that is digested, as defined in
      <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-5.2">Sectio=
n 5.2</a>.

      digest is the result of the message-digesting process.

   The ordering of the digestAlgorithm field, the encapContentInfo
   field, and the digest field makes it possible to process a
   DigestedData value in a single pass.

<span class=3D"h2"><a class=3D"selflink" id=3D"section-8" href=3D"https://w=
ww.rfc-editor.org/rfc/rfc5652#section-8">8</a>.  Encrypted-data Content Typ=
e</span>

   The encrypted-data content type consists of encrypted content of any
   type.  Unlike the enveloped-data content type, the encrypted-data
   content type has neither recipients nor encrypted content-encryption
   keys.  Keys MUST be managed by other means.

   The typical application of the encrypted-data content type will be to
   encrypt the content of the data content type for local storage,
   perhaps where the encryption key is derived from a password.




<span class=3D"grey">Housley                     Standards Track           =
         [Page 29]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-30"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   The following object identifier identifies the encrypted-data content
   type:

      id-encryptedData OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
          us(840) rsadsi(113549) pkcs(1) pkcs7(7) 6 }

   The encrypted-data content type shall have ASN.1 type EncryptedData:

      EncryptedData ::=3D SEQUENCE {
        version CMSVersion,
        encryptedContentInfo EncryptedContentInfo,
        unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }

   The fields of type EncryptedData have the following meanings:

      version is the syntax version number.  If unprotectedAttrs is
      present, then the version MUST be 2.  If unprotectedAttrs is
      absent, then version MUST be 0.

      encryptedContentInfo is the encrypted content information, as
      defined in <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-=
6.1">Section 6.1</a>.

      unprotectedAttrs is a collection of attributes that are not
      encrypted.  The field is optional.  Useful attribute types are
      defined in <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-=
11">Section 11</a>.

<span class=3D"h2"><a class=3D"selflink" id=3D"section-9" href=3D"https://w=
ww.rfc-editor.org/rfc/rfc5652#section-9">9</a>.  Authenticated-data Content=
 Type</span>

   The authenticated-data content type consists of content of any type,
   a message authentication code (MAC), and encrypted authentication
   keys for one or more recipients.  The combination of the MAC and one
   encrypted authentication key for a recipient is necessary for that
   recipient to verify the integrity of the content.  Any type of
   content can be integrity protected for an arbitrary number of
   recipients.

   The process by which authenticated-data is constructed involves the
   following steps:

   1.  A message-authentication key for a particular message-
       authentication algorithm is generated at random.

   2.  The message-authentication key is encrypted for each recipient.
       The details of this encryption depend on the key management
       algorithm used.






<span class=3D"grey">Housley                     Standards Track           =
         [Page 30]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-31"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   3.  For each recipient, the encrypted message-authentication key and
       other recipient-specific information are collected into a
       RecipientInfo value, defined in <a href=3D"https://www.rfc-editor.or=
g/rfc/rfc5652#section-6.2">Section 6.2</a>.

   4.  Using the message-authentication key, the originator computes a
       MAC value on the content.  If the originator is authenticating
       any information in addition to the content (see <a href=3D"https://w=
ww.rfc-editor.org/rfc/rfc5652#section-9.2">Section 9.2</a>), a
       message digest is calculated on the content, the message digest
       of the content and the other information are authenticated using
       the message-authentication key, and the result becomes the "MAC
       value".

<span class=3D"h3"><a class=3D"selflink" id=3D"section-9.1" href=3D"https:/=
/www.rfc-editor.org/rfc/rfc5652#section-9.1">9.1</a>.  AuthenticatedData Ty=
pe</span>

   The following object identifier identifies the authenticated-data
   content type:

      id-ct-authData OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
         us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16)
         ct(1) 2 }

   The authenticated-data content type shall have ASN.1 type
   AuthenticatedData:

      AuthenticatedData ::=3D SEQUENCE {
        version CMSVersion,
        originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
        recipientInfos RecipientInfos,
        macAlgorithm MessageAuthenticationCodeAlgorithm,
        digestAlgorithm [1] DigestAlgorithmIdentifier OPTIONAL,
        encapContentInfo EncapsulatedContentInfo,
        authAttrs [2] IMPLICIT AuthAttributes OPTIONAL,
        mac MessageAuthenticationCode,
        unauthAttrs [3] IMPLICIT UnauthAttributes OPTIONAL }

      AuthAttributes ::=3D SET SIZE (1..MAX) OF Attribute

      UnauthAttributes ::=3D SET SIZE (1..MAX) OF Attribute

      MessageAuthenticationCode ::=3D OCTET STRING

   The fields of type AuthenticatedData have the following meanings:

      version is the syntax version number.  The version MUST be
      assigned as follows:






<span class=3D"grey">Housley                     Standards Track           =
         [Page 31]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-32"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


         IF (originatorInfo is present) AND
            ((any certificates with a type of other are present) OR
            (any crls with a type of other are present))
         THEN version is 3
         ELSE
            IF ((originatorInfo is present) AND
               (any version 2 attribute certificates are present))
            THEN version is 1
            ELSE version is 0

      originatorInfo optionally provides information about the
      originator.  It is present only if required by the key management
      algorithm.  It MAY contain certificates, attribute certificates,
      and CRLs, as defined in <a href=3D"https://www.rfc-editor.org/rfc/rfc=
5652#section-6.1">Section 6.1</a>.

      recipientInfos is a collection of per-recipient information, as
      defined in <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-=
6.1">Section 6.1</a>.  There MUST be at least one element in the
      collection.

      macAlgorithm is a message authentication code (MAC) algorithm
      identifier.  It identifies the MAC algorithm, along with any
      associated parameters, used by the originator.  Placement of the
      macAlgorithm field facilitates one-pass processing by the
      recipient.

      digestAlgorithm identifies the message digest algorithm, and any
      associated parameters, used to compute a message digest on the
      encapsulated content if authenticated attributes are present.  The
      message digesting process is described in <a href=3D"https://www.rfc-=
editor.org/rfc/rfc5652#section-9.2">Section 9.2</a>.  Placement
      of the digestAlgorithm field facilitates one-pass processing by
      the recipient.  If the digestAlgorithm field is present, then the
      authAttrs field MUST also be present.

      encapContentInfo is the content that is authenticated, as defined
      in <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-5.2">Sec=
tion 5.2</a>.

      authAttrs is a collection of authenticated attributes.  The
      authAttrs structure is optional, but it MUST be present if the
      content type of the EncapsulatedContentInfo value being
      authenticated is not id-data.  If the authAttrs field is present,
      then the digestAlgorithm field MUST also be present.  The
      AuthAttributes structure MUST be DER encoded, even if the rest of
      the structure is BER encoded.  Useful attribute types are defined
      in <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-11">Sect=
ion 11</a>.  If the authAttrs field is present, it MUST
      contain, at a minimum, the following two attributes:






<span class=3D"grey">Housley                     Standards Track           =
         [Page 32]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-33"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


         A content-type attribute having as its value the content type
         of the EncapsulatedContentInfo value being authenticated.
         <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-11.1">Se=
ction 11.1</a> defines the content-type attribute.

         A message-digest attribute, having as its value the message
         digest of the content.  <a href=3D"https://www.rfc-editor.org/rfc/=
rfc5652#section-11.2">Section 11.2</a> defines the message-digest
         attribute.

      mac is the message authentication code.

      unauthAttrs is a collection of attributes that are not
      authenticated.  The field is optional.  To date, no attributes
      have been defined for use as unauthenticated attributes, but other
      useful attribute types are defined in <a href=3D"https://www.rfc-edit=
or.org/rfc/rfc5652#section-11">Section 11</a>.

<span class=3D"h3"><a class=3D"selflink" id=3D"section-9.2" href=3D"https:/=
/www.rfc-editor.org/rfc/rfc5652#section-9.2">9.2</a>.  MAC Generation</span=
>

   The MAC calculation process computes a message authentication code
   (MAC) on either the content being authenticated or a message digest
   of content being authenticated together with the originator's
   authenticated attributes.

   If the authAttrs field is absent, the input to the MAC calculation
   process is the value of the encapContentInfo eContent OCTET STRING.
   Only the octets comprising the value of the eContent OCTET STRING are
   input to the MAC algorithm; the tag and the length octets are
   omitted.  This has the advantage that the length of the content being
   authenticated need not be known in advance of the MAC generation
   process.

   If the authAttrs field is present, the content-type attribute (as
   described in <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-1=
1.1">Section 11.1</a>) and the message-digest attribute (as
   described in <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-1=
1.2">Section 11.2</a>) MUST be included, and the input to the MAC
   calculation process is the DER encoding of authAttrs.  A separate
   encoding of the authAttrs field is performed for message digest
   calculation.  The IMPLICIT [2] tag in the authAttrs field is not used
   for the DER encoding, rather an EXPLICIT SET OF tag is used.  That
   is, the DER encoding of the SET OF tag, rather than of the IMPLICIT
   [2] tag, is to be included in the message digest calculation along
   with the length and content octets of the authAttrs value.

   The message digest calculation process computes a message digest on
   the content being authenticated.  The initial input to the message
   digest calculation process is the "value" of the encapsulated content
   being authenticated.  Specifically, the input is the encapContentInfo
   eContent OCTET STRING to which the authentication process is applied.
   Only the octets comprising the value of the encapContentInfo eContent
   OCTET STRING are input to the message digest algorithm, not the tag



<span class=3D"grey">Housley                     Standards Track           =
         [Page 33]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-34"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   or the length octets.  This has the advantage that the length of the
   content being authenticated need not be known in advance.  Although
   the encapContentInfo eContent OCTET STRING tag and length octets are
   not included in the message digest calculation, they are still
   protected by other means.  The length octets are protected by the
   nature of the message digest algorithm since it is computationally
   infeasible to find any two distinct contents of any length that have
   the same message digest.

   The input to the MAC calculation process includes the MAC input data,
   defined above, and an authentication key conveyed in a recipientInfo
   structure.  The details of MAC calculation depend on the MAC
   algorithm employed (e.g., Hashed Message Authentication Code (HMAC)).
   The object identifier, along with any parameters, that specifies the
   MAC algorithm employed by the originator is carried in the
   macAlgorithm field.  The MAC value generated by the originator is
   encoded as an OCTET STRING and carried in the mac field.

<span class=3D"h3"><a class=3D"selflink" id=3D"section-9.3" href=3D"https:/=
/www.rfc-editor.org/rfc/rfc5652#section-9.3">9.3</a>.  MAC Verification</sp=
an>

   The input to the MAC verification process includes the input data
   (determined based on the presence or absence of the authAttrs field,
   as defined in 9.2), and the authentication key conveyed in
   recipientInfo.  The details of the MAC verification process depend on
   the MAC algorithm employed.

   The recipient MUST NOT rely on any MAC values or message digest
   values computed by the originator.  The content is authenticated as
   described in <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-9=
.2">Section 9.2</a>.  If the originator includes authenticated
   attributes, then the content of the authAttrs is authenticated as
   described in <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-9=
.2">Section 9.2</a>.  For authentication to succeed, the MAC
   value calculated by the recipient MUST be the same as the value of
   the mac field.  Similarly, for authentication to succeed when the
   authAttrs field is present, the content message digest value
   calculated by the recipient MUST be the same as the message digest
   value included in the authAttrs message-digest attribute.

   If the AuthenticatedData includes authAttrs, then the content-type
   attribute value MUST match the AuthenticatedData encapContentInfo
   eContentType value.

<span class=3D"h2"><a class=3D"selflink" id=3D"section-10" href=3D"https://=
www.rfc-editor.org/rfc/rfc5652#section-10">10</a>.  Useful Types</span>

   This section is divided into two parts.  The first part defines
   algorithm identifiers, and the second part defines other useful
   types.





<span class=3D"grey">Housley                     Standards Track           =
         [Page 34]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-35"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


<span class=3D"h3"><a class=3D"selflink" id=3D"section-10.1" href=3D"https:=
//www.rfc-editor.org/rfc/rfc5652#section-10.1">10.1</a>.  Algorithm Identif=
ier Types</span>

   All of the algorithm identifiers have the same type:
   AlgorithmIdentifier.  The definition of AlgorithmIdentifier is taken
   from X.509 [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-X.509-=
88">X.509-88</a>].

   There are many alternatives for each algorithm type.

<span class=3D"h4"><a class=3D"selflink" id=3D"section-10.1.1" href=3D"http=
s://www.rfc-editor.org/rfc/rfc5652#section-10.1.1">10.1.1</a>.  DigestAlgor=
ithmIdentifier</span>

   The DigestAlgorithmIdentifier type identifies a message-digest
   algorithm.  Examples include SHA-1, MD2, and MD5.  A message-digest
   algorithm maps an octet string (the content) to another octet string
   (the message digest).

      DigestAlgorithmIdentifier ::=3D AlgorithmIdentifier

<span class=3D"h4"><a class=3D"selflink" id=3D"section-10.1.2" href=3D"http=
s://www.rfc-editor.org/rfc/rfc5652#section-10.1.2">10.1.2</a>.  SignatureAl=
gorithmIdentifier</span>

   The SignatureAlgorithmIdentifier type identifies a signature
   algorithm, and it can also identify a message digest algorithm.
   Examples include RSA, DSA, DSA with SHA-1, ECDSA, and ECDSA with
   SHA-256.  A signature algorithm supports signature generation and
   verification operations.  The signature generation operation uses the
   message digest and the signer's private key to generate a signature
   value.  The signature verification operation uses the message digest
   and the signer's public key to determine whether or not a signature
   value is valid.  Context determines which operation is intended.

      SignatureAlgorithmIdentifier ::=3D AlgorithmIdentifier

<span class=3D"h4"><a class=3D"selflink" id=3D"section-10.1.3" href=3D"http=
s://www.rfc-editor.org/rfc/rfc5652#section-10.1.3">10.1.3</a>.  KeyEncrypti=
onAlgorithmIdentifier</span>

   The KeyEncryptionAlgorithmIdentifier type identifies a key-encryption
   algorithm used to encrypt a content-encryption key.  The encryption
   operation maps an octet string (the key) to another octet string (the
   encrypted key) under control of a key-encryption key.  The decryption
   operation is the inverse of the encryption operation.  Context
   determines which operation is intended.

   The details of encryption and decryption depend on the key management
   algorithm used.  Key transport, key agreement, previously distributed
   symmetric key-encrypting keys, and symmetric key-encrypting keys
   derived from passwords are supported.

      KeyEncryptionAlgorithmIdentifier ::=3D AlgorithmIdentifier





<span class=3D"grey">Housley                     Standards Track           =
         [Page 35]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-36"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


<span class=3D"h4"><a class=3D"selflink" id=3D"section-10.1.4" href=3D"http=
s://www.rfc-editor.org/rfc/rfc5652#section-10.1.4">10.1.4</a>.  ContentEncr=
yptionAlgorithmIdentifier</span>

   The ContentEncryptionAlgorithmIdentifier type identifies a content-
   encryption algorithm.  Examples include Triple-DES and RC2.  A
   content-encryption algorithm supports encryption and decryption
   operations.  The encryption operation maps an octet string (the
   plaintext) to another octet string (the ciphertext) under control of
   a content-encryption key.  The decryption operation is the inverse of
   the encryption operation.  Context determines which operation is
   intended.

      ContentEncryptionAlgorithmIdentifier ::=3D AlgorithmIdentifier

<span class=3D"h4"><a class=3D"selflink" id=3D"section-10.1.5" href=3D"http=
s://www.rfc-editor.org/rfc/rfc5652#section-10.1.5">10.1.5</a>.  MessageAuth=
enticationCodeAlgorithm</span>

   The MessageAuthenticationCodeAlgorithm type identifies a message
   authentication code (MAC) algorithm.  Examples include DES-MAC and
   HMAC-SHA-1.  A MAC algorithm supports generation and verification
   operations.  The MAC generation and verification operations use the
   same symmetric key.  Context determines which operation is intended.

      MessageAuthenticationCodeAlgorithm ::=3D AlgorithmIdentifier

<span class=3D"h4"><a class=3D"selflink" id=3D"section-10.1.6" href=3D"http=
s://www.rfc-editor.org/rfc/rfc5652#section-10.1.6">10.1.6</a>.  KeyDerivati=
onAlgorithmIdentifier</span>

   The KeyDerivationAlgorithmIdentifier type is specified in <a href=3D"htt=
ps://www.rfc-editor.org/rfc/rfc3211">RFC 3211</a>
   [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-PWRI" title=3D"&q=
uot;Password-based Encryption for CMS&quot;">PWRI</a>].  The KeyDerivationA=
lgorithmIdentifier definition is repeated
   here for completeness.

   Key derivation algorithms convert a password or shared secret value
   into a key-encryption key.

      KeyDerivationAlgorithmIdentifier ::=3D AlgorithmIdentifier

<span class=3D"h3"><a class=3D"selflink" id=3D"section-10.2" href=3D"https:=
//www.rfc-editor.org/rfc/rfc5652#section-10.2">10.2</a>.  Other Useful Type=
s</span>

   This section defines types that are used other places in the
   document.  The types are not listed in any particular order.

<span class=3D"h4"><a class=3D"selflink" id=3D"section-10.2.1" href=3D"http=
s://www.rfc-editor.org/rfc/rfc5652#section-10.2.1">10.2.1</a>.  RevocationI=
nfoChoices</span>

   The RevocationInfoChoices type gives a set of revocation status
   information alternatives.  It is intended that the set contain
   information sufficient to determine whether the certificates and
   attribute certificates with which the set is associated are revoked.
   However, there MAY be more revocation status information than
   necessary or there MAY be less revocation status information than
   necessary.  X.509 Certificate revocation lists (CRLs) [<a href=3D"https:=
//www.rfc-editor.org/rfc/rfc5652#ref-X.509-97">X.509-97</a>] are



<span class=3D"grey">Housley                     Standards Track           =
         [Page 36]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-37"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   the primary source of revocation status information, but any other
   revocation information format can be supported.  The
   OtherRevocationInfoFormat alternative is provided to support any
   other revocation information format without further modifications to
   the CMS.  For example, Online Certificate Status Protocol (OCSP)
   Responses [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-OCSP" t=
itle=3D"&quot;X.509 Internet Public Key Infrastructure Online Certificate S=
tatus Protocol - OCSP&quot;">OCSP</a>] can be supported using the
   OtherRevocationInfoFormat.

   The CertificateList may contain a CRL, an Authority Revocation List
   (ARL), a Delta CRL, or an Attribute Certificate Revocation List.  All
   of these lists share a common syntax.

   The CertificateList type gives a certificate revocation list (CRL).
   CRLs are specified in X.509 [<a href=3D"https://www.rfc-editor.org/rfc/r=
fc5652#ref-X.509-97">X.509-97</a>], and they are profiled for use
   in the Internet in <a href=3D"https://www.rfc-editor.org/rfc/rfc5280">RF=
C 5280</a> [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-PROFILE" =
title=3D"&quot;Internet X.509 Public Key Infrastructure Certificate and Cer=
tificate Revocation List (CRL) Profile&quot;">PROFILE</a>].

   The definition of CertificateList is taken from X.509.

      RevocationInfoChoices ::=3D SET OF RevocationInfoChoice

      RevocationInfoChoice ::=3D CHOICE {
        crl CertificateList,
        other [1] IMPLICIT OtherRevocationInfoFormat }

      OtherRevocationInfoFormat ::=3D SEQUENCE {
        otherRevInfoFormat OBJECT IDENTIFIER,
        otherRevInfo ANY DEFINED BY otherRevInfoFormat }

<span class=3D"h4"><a class=3D"selflink" id=3D"section-10.2.2" href=3D"http=
s://www.rfc-editor.org/rfc/rfc5652#section-10.2.2">10.2.2</a>.  Certificate=
Choices</span>

   The CertificateChoices type gives either a PKCS #6 extended
   certificate [PKCS#6], an X.509 certificate, a version 1 X.509
   attribute certificate (ACv1) [<a href=3D"https://www.rfc-editor.org/rfc/=
rfc5652#ref-X.509-97">X.509-97</a>], a version 2 X.509 attribute
   certificate (ACv2) [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#re=
f-X.509-00">X.509-00</a>], or any other certificate format.  The
   PKCS #6 extended certificate is obsolete.  The PKCS #6 certificate is
   included for backward compatibility, and PKCS #6 certificates SHOULD
   NOT be used.  The ACv1 is also obsolete.  ACv1 is included for
   backward compatibility, and ACv1 SHOULD NOT be used.  The Internet
   profile of X.509 certificates is specified in the "Internet X.509
   Public Key Infrastructure: Certificate and CRL Profile" [<a href=3D"http=
s://www.rfc-editor.org/rfc/rfc5652#ref-PROFILE" title=3D"&quot;Internet X.5=
09 Public Key Infrastructure Certificate and Certificate Revocation List (C=
RL) Profile&quot;">PROFILE</a>].
   The Internet profile of ACv2 is specified in the "An Internet
   Attribute Certificate Profile for Authorization" [<a href=3D"https://www=
.rfc-editor.org/rfc/rfc5652#ref-ACPROFILE" title=3D"&quot;An Internet Attri=
bute Certificate Profile for Authorization&quot;">ACPROFILE</a>].  The
   OtherCertificateFormat alternative is provided to support any other
   certificate format without further modifications to the CMS.

   The definition of Certificate is taken from X.509.





<span class=3D"grey">Housley                     Standards Track           =
         [Page 37]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-38"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   The definitions of AttributeCertificate are taken from X.509-1997 and
   X.509-2000.  The definition from X.509-1997 is assigned to
   AttributeCertificateV1 (see <a href=3D"https://www.rfc-editor.org/rfc/rf=
c5652#section-12.2">Section 12.2</a>), and the definition from
   X.509-2000 is assigned to AttributeCertificateV2.

      CertificateChoices ::=3D CHOICE {
       certificate Certificate,
       extendedCertificate [0] IMPLICIT ExtendedCertificate, -- Obsolete
       v1AttrCert [1] IMPLICIT AttributeCertificateV1,       -- Obsolete
       v2AttrCert [2] IMPLICIT AttributeCertificateV2,
       other [3] IMPLICIT OtherCertificateFormat }

      OtherCertificateFormat ::=3D SEQUENCE {
        otherCertFormat OBJECT IDENTIFIER,
        otherCert ANY DEFINED BY otherCertFormat }

<span class=3D"h4"><a class=3D"selflink" id=3D"section-10.2.3" href=3D"http=
s://www.rfc-editor.org/rfc/rfc5652#section-10.2.3">10.2.3</a>.  Certificate=
Set</span>

   The CertificateSet type provides a set of certificates.  It is
   intended that the set be sufficient to contain certification paths
   from a recognized "root" or "top-level certification authority" to
   all of the sender certificates with which the set is associated.
   However, there may be more certificates than necessary, or there MAY
   be fewer than necessary.

   The precise meaning of a "certification path" is outside the scope of
   this document.  However, [<a href=3D"https://www.rfc-editor.org/rfc/rfc5=
652#ref-PROFILE" title=3D"&quot;Internet X.509 Public Key Infrastructure Ce=
rtificate and Certificate Revocation List (CRL) Profile&quot;">PROFILE</a>]=
 provides a definition for X.509
   certificates.  Some applications may impose upper limits on the
   length of a certification path; others may enforce certain
   relationships between the subjects and issuers of certificates within
   a certification path.

      CertificateSet ::=3D SET OF CertificateChoices

<span class=3D"h4"><a class=3D"selflink" id=3D"section-10.2.4" href=3D"http=
s://www.rfc-editor.org/rfc/rfc5652#section-10.2.4">10.2.4</a>.  IssuerAndSe=
rialNumber</span>

   The IssuerAndSerialNumber type identifies a certificate, and thereby
   an entity and a public key, by the distinguished name of the
   certificate issuer and an issuer-specific certificate serial number.

   The definition of Name is taken from X.501 [<a href=3D"https://www.rfc-e=
ditor.org/rfc/rfc5652#ref-X.501-88">X.501-88</a>], and the
   definition of CertificateSerialNumber is taken from X.509 [<a href=3D"ht=
tps://www.rfc-editor.org/rfc/rfc5652#ref-X.509-97">X.509-97</a>].

      IssuerAndSerialNumber ::=3D SEQUENCE {
        issuer Name,
        serialNumber CertificateSerialNumber }

      CertificateSerialNumber ::=3D INTEGER



<span class=3D"grey">Housley                     Standards Track           =
         [Page 38]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-39"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


<span class=3D"h4"><a class=3D"selflink" id=3D"section-10.2.5" href=3D"http=
s://www.rfc-editor.org/rfc/rfc5652#section-10.2.5">10.2.5</a>.  CMSVersion<=
/span>

   The CMSVersion type gives a syntax version number, for compatibility
   with future revisions of this specification.

      CMSVersion ::=3D INTEGER
                     { v0(0), v1(1), v2(2), v3(3), v4(4), v5(5) }

<span class=3D"h4"><a class=3D"selflink" id=3D"section-10.2.6" href=3D"http=
s://www.rfc-editor.org/rfc/rfc5652#section-10.2.6">10.2.6</a>.  UserKeyingM=
aterial</span>

   The UserKeyingMaterial type gives a syntax for user keying material
   (UKM).  Some key agreement algorithms require UKMs to ensure that a
   different key is generated each time the same two parties generate a
   pairwise key.  The sender provides a UKM for use with a specific key
   agreement algorithm.

      UserKeyingMaterial ::=3D OCTET STRING

<span class=3D"h4"><a class=3D"selflink" id=3D"section-10.2.7" href=3D"http=
s://www.rfc-editor.org/rfc/rfc5652#section-10.2.7">10.2.7</a>.  OtherKeyAtt=
ribute</span>

   The OtherKeyAttribute type gives a syntax for the inclusion of other
   key attributes that permit the recipient to select the key used by
   the sender.  The attribute object identifier must be registered along
   with the syntax of the attribute itself.  Use of this structure
   should be avoided since it might impede interoperability.

      OtherKeyAttribute ::=3D SEQUENCE {
        keyAttrId OBJECT IDENTIFIER,
        keyAttr ANY DEFINED BY keyAttrId OPTIONAL }

<span class=3D"h2"><a class=3D"selflink" id=3D"section-11" href=3D"https://=
www.rfc-editor.org/rfc/rfc5652#section-11">11</a>.  Useful Attributes</span=
>

   This section defines attributes that may be used with signed-data,
   enveloped-data, encrypted-data, or authenticated-data.  The syntax of
   Attribute is compatible with X.501 [<a href=3D"https://www.rfc-editor.or=
g/rfc/rfc5652#ref-X.501-88">X.501-88</a>] and <a href=3D"https://www.rfc-ed=
itor.org/rfc/rfc5280">RFC 5280</a> [<a href=3D"https://www.rfc-editor.org/r=
fc/rfc5652#ref-PROFILE" title=3D"&quot;Internet X.509 Public Key Infrastruc=
ture Certificate and Certificate Revocation List (CRL) Profile&quot;">PROFI=
LE</a>].
   Some of the attributes defined in this section were originally
   defined in PKCS #9 [PKCS#9]; others were originally defined in a
   previous version of this specification [<a href=3D"https://www.rfc-edito=
r.org/rfc/rfc5652#ref-CMS1" title=3D"&quot;Cryptographic Message Syntax&quo=
t;">CMS1</a>].  The attributes are
   not listed in any particular order.

   Additional attributes are defined in many places, notably the S/MIME
   Version 3.1 Message Specification [<a href=3D"https://www.rfc-editor.org=
/rfc/rfc5652#ref-MSG3.1" title=3D"&quot;Secure/Multipurpose Internet Mail E=
xtensions (S/MIME) Version 3.1 Message Specification&quot;">MSG3.1</a>] and=
 the Enhanced Security
   Services for S/MIME [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#r=
ef-ESS" title=3D"&quot;Enhanced Security Services for S/MIME&quot;">ESS</a>=
], which also include recommendations on the
   placement of these attributes.







<span class=3D"grey">Housley                     Standards Track           =
         [Page 39]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-40"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


<span class=3D"h3"><a class=3D"selflink" id=3D"section-11.1" href=3D"https:=
//www.rfc-editor.org/rfc/rfc5652#section-11.1">11.1</a>.  Content Type</spa=
n>

   The content-type attribute type specifies the content type of the
   ContentInfo within signed-data or authenticated-data.  The content-
   type attribute type MUST be present whenever signed attributes are
   present in signed-data or authenticated attributes present in
   authenticated-data.  The content-type attribute value MUST match the
   encapContentInfo eContentType value in the signed-data or
   authenticated-data.

   The content-type attribute MUST be a signed attribute or an
   authenticated attribute; it MUST NOT be an unsigned attribute,
   unauthenticated attribute, or unprotected attribute.

   The following object identifier identifies the content-type
   attribute:

      id-contentType OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
          us(840) rsadsi(113549) pkcs(1) pkcs9(9) 3 }

   Content-type attribute values have ASN.1 type ContentType:

      ContentType ::=3D OBJECT IDENTIFIER

   Even though the syntax is defined as a SET OF AttributeValue, a
   content-type attribute MUST have a single attribute value; zero or
   multiple instances of AttributeValue are not permitted.

   The SignedAttributes and AuthAttributes syntaxes are each defined as
   a SET OF Attributes.  The SignedAttributes in a signerInfo MUST NOT
   include multiple instances of the content-type attribute.  Similarly,
   the AuthAttributes in an AuthenticatedData MUST NOT include multiple
   instances of the content-type attribute.

<span class=3D"h3"><a class=3D"selflink" id=3D"section-11.2" href=3D"https:=
//www.rfc-editor.org/rfc/rfc5652#section-11.2">11.2</a>.  Message Digest</s=
pan>

   The message-digest attribute type specifies the message digest of the
   encapContentInfo eContent OCTET STRING being signed in signed-data
   (see <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-5.4">Sect=
ion 5.4</a>) or authenticated in authenticated-data (see <a href=3D"https:/=
/www.rfc-editor.org/rfc/rfc5652#section-9.2">Section</a>
   <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-9.2">9.2</a>).=
  For signed-data, the message digest is computed using the
   signer's message digest algorithm.  For authenticated-data, the
   message digest is computed using the originator's message digest
   algorithm.

   Within signed-data, the message-digest signed attribute type MUST be
   present when there are any signed attributes present.  Within
   authenticated-data, the message-digest authenticated attribute type
   MUST be present when there are any authenticated attributes present.



<span class=3D"grey">Housley                     Standards Track           =
         [Page 40]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-41"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   The message-digest attribute MUST be a signed attribute or an
   authenticated attribute; it MUST NOT be an unsigned attribute,
   unauthenticated attribute, or unprotected attribute.

   The following object identifier identifies the message-digest
   attribute:

      id-messageDigest OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
          us(840) rsadsi(113549) pkcs(1) pkcs9(9) 4 }

   Message-digest attribute values have ASN.1 type MessageDigest:

      MessageDigest ::=3D OCTET STRING

   A message-digest attribute MUST have a single attribute value, even
   though the syntax is defined as a SET OF AttributeValue.  There MUST
   NOT be zero or multiple instances of AttributeValue present.

   The SignedAttributes syntax and AuthAttributes syntax are each
   defined as a SET OF Attributes.  The SignedAttributes in a signerInfo
   MUST include only one instance of the message-digest attribute.
   Similarly, the AuthAttributes in an AuthenticatedData MUST include
   only one instance of the message-digest attribute.

<span class=3D"h3"><a class=3D"selflink" id=3D"section-11.3" href=3D"https:=
//www.rfc-editor.org/rfc/rfc5652#section-11.3">11.3</a>.  Signing Time</spa=
n>

   The signing-time attribute type specifies the time at which the
   signer (purportedly) performed the signing process.  The signing-time
   attribute type is intended for use in signed-data.

   The signing-time attribute MUST be a signed attribute or an
   authenticated attribute; it MUST NOT be an unsigned attribute,
   unauthenticated attribute, or unprotected attribute.

   The following object identifier identifies the signing-time
   attribute:

      id-signingTime OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
          us(840) rsadsi(113549) pkcs(1) pkcs9(9) 5 }

   Signing-time attribute values have ASN.1 type SigningTime:

      SigningTime ::=3D Time

      Time ::=3D CHOICE {
        utcTime UTCTime,
        generalizedTime GeneralizedTime }




<span class=3D"grey">Housley                     Standards Track           =
         [Page 41]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-42"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   Note: The definition of Time matches the one specified in the 1997
   version of X.509 [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-=
X.509-97">X.509-97</a>].

   Dates between 1 January 1950 and 31 December 2049 (inclusive) MUST be
   encoded as UTCTime.  Any dates with year values before 1950 or after
   2049 MUST be encoded as GeneralizedTime.

   UTCTime values MUST be expressed in Coordinated Universal Time
   (formerly known as Greenwich Mean Time (GMT) and Zulu clock time) and
   MUST include seconds (i.e., times are YYMMDDHHMMSSZ), even where the
   number of seconds is zero.  Midnight MUST be represented as
   "YYMMDD000000Z".  Century information is implicit, and the century
   MUST be determined as follows:

      Where YY is greater than or equal to 50, the year MUST be
      interpreted as 19YY; and

      Where YY is less than 50, the year MUST be interpreted as 20YY.

   GeneralizedTime values MUST be expressed in Coordinated Universal
   Time and MUST include seconds (i.e., times are YYYYMMDDHHMMSSZ), even
   where the number of seconds is zero.  GeneralizedTime values MUST NOT
   include fractional seconds.

   A signing-time attribute MUST have a single attribute value, even
   though the syntax is defined as a SET OF AttributeValue.  There MUST
   NOT be zero or multiple instances of AttributeValue present.

   The SignedAttributes syntax and the AuthAttributes syntax are each
   defined as a SET OF Attributes.  The SignedAttributes in a signerInfo
   MUST NOT include multiple instances of the signing-time attribute.
   Similarly, the AuthAttributes in an AuthenticatedData MUST NOT
   include multiple instances of the signing-time attribute.

   No requirement is imposed concerning the correctness of the signing
   time, and acceptance of a purported signing time is a matter of a
   recipient's discretion.  It is expected, however, that some signers,
   such as time-stamp servers, will be trusted implicitly.

<span class=3D"h3"><a class=3D"selflink" id=3D"section-11.4" href=3D"https:=
//www.rfc-editor.org/rfc/rfc5652#section-11.4">11.4</a>.  Countersignature<=
/span>

   The countersignature attribute type specifies one or more signatures
   on the contents octets of the signature OCTET STRING in a SignerInfo
   value of the signed-data.  That is, the message digest is computed
   over the octets comprising the value of the OCTET STRING, neither the
   tag nor length octets are included.  Thus, the countersignature
   attribute type countersigns (signs in serial) another signature.




<span class=3D"grey">Housley                     Standards Track           =
         [Page 42]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-43"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   The countersignature attribute MUST be an unsigned attribute; it MUST
   NOT be a signed attribute, an authenticated attribute, an
   unauthenticated attribute, or an unprotected attribute.

   The following object identifier identifies the countersignature
   attribute:

      id-countersignature OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
          us(840) rsadsi(113549) pkcs(1) pkcs9(9) 6 }

   Countersignature attribute values have ASN.1 type Countersignature:

      Countersignature ::=3D SignerInfo

   Countersignature values have the same meaning as SignerInfo values
   for ordinary signatures, except that:

   1.  The signedAttributes field MUST NOT contain a content-type
       attribute; there is no content type for countersignatures.

   2.  The signedAttributes field MUST contain a message-digest
       attribute if it contains any other attributes.

   3.  The input to the message-digesting process is the contents octets
       of the DER encoding of the signatureValue field of the SignerInfo
       value with which the attribute is associated.

   A countersignature attribute can have multiple attribute values.  The
   syntax is defined as a SET OF AttributeValue, and there MUST be one
   or more instances of AttributeValue present.

   The UnsignedAttributes syntax is defined as a SET OF Attributes.  The
   UnsignedAttributes in a signerInfo may include multiple instances of
   the countersignature attribute.

   A countersignature, since it has type SignerInfo, can itself contain
   a countersignature attribute.  Thus, it is possible to construct an
   arbitrarily long series of countersignatures.

<span class=3D"h2"><a class=3D"selflink" id=3D"section-12" href=3D"https://=
www.rfc-editor.org/rfc/rfc5652#section-12">12</a>.  ASN.1 Modules</span>

   <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#section-12.1">Section =
12.1</a> contains the ASN.1 module for the CMS, and <a href=3D"https://www.=
rfc-editor.org/rfc/rfc5652#section-12.2">Section 12.2</a>
   contains the ASN.1 module for the Version 1 Attribute Certificate.








<span class=3D"grey">Housley                     Standards Track           =
         [Page 43]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-44"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


<span class=3D"h3"><a class=3D"selflink" id=3D"section-12.1" href=3D"https:=
//www.rfc-editor.org/rfc/rfc5652#section-12.1">12.1</a>.  CMS ASN.1 Module<=
/span>

   CryptographicMessageSyntax2004
     { iso(1) member-body(2) us(840) rsadsi(113549)
       pkcs(1) pkcs-9(9) smime(16) modules(0) cms-2004(24) }

   DEFINITIONS IMPLICIT TAGS ::=3D
   BEGIN

   -- EXPORTS All
   -- The types and values defined in this module are exported for use
   -- in the other ASN.1 modules.  Other applications may use them for
   -- their own purposes.

   IMPORTS

     -- Imports from <a href=3D"https://www.rfc-editor.org/rfc/rfc5280">RFC=
 5280</a> [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-PROFILE" t=
itle=3D"&quot;Internet X.509 Public Key Infrastructure Certificate and Cert=
ificate Revocation List (CRL) Profile&quot;">PROFILE</a>], <a href=3D"https=
://www.rfc-editor.org/rfc/rfc5652#appendix-A.1">Appendix A.1</a>
           AlgorithmIdentifier, Certificate, CertificateList,
           CertificateSerialNumber, Name
              FROM PKIX1Explicit88
                   { iso(1) identified-organization(3) dod(6)
                     internet(1) security(5) mechanisms(5) pkix(7)
                     mod(0) pkix1-explicit(18) }

     -- Imports from <a href=3D"https://www.rfc-editor.org/rfc/rfc3281">RFC=
 3281</a> [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-ACPROFILE"=
 title=3D"&quot;An Internet Attribute Certificate Profile for Authorization=
&quot;">ACPROFILE</a>], <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#a=
ppendix-B">Appendix B</a>
           AttributeCertificate
              FROM PKIXAttributeCertificate
                   { iso(1) identified-organization(3) dod(6)
                     internet(1) security(5) mechanisms(5) pkix(7)
                     mod(0) attribute-cert(12) }

     -- Imports from <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#appe=
ndix-B">Appendix B</a> of this document
           AttributeCertificateV1
              FROM AttributeCertificateVersion1
                   { iso(1) member-body(2) us(840) rsadsi(113549)
                     pkcs(1) pkcs-9(9) smime(16) modules(0)
                     v1AttrCert(15) } ;

   -- Cryptographic Message Syntax

   ContentInfo ::=3D SEQUENCE {
     contentType ContentType,
     content [0] EXPLICIT ANY DEFINED BY contentType }

   ContentType ::=3D OBJECT IDENTIFIER






<span class=3D"grey">Housley                     Standards Track           =
         [Page 44]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-45"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   SignedData ::=3D SEQUENCE {
     version CMSVersion,
     digestAlgorithms DigestAlgorithmIdentifiers,
     encapContentInfo EncapsulatedContentInfo,
     certificates [0] IMPLICIT CertificateSet OPTIONAL,
     crls [1] IMPLICIT RevocationInfoChoices OPTIONAL,
     signerInfos SignerInfos }

   DigestAlgorithmIdentifiers ::=3D SET OF DigestAlgorithmIdentifier

   SignerInfos ::=3D SET OF SignerInfo

   EncapsulatedContentInfo ::=3D SEQUENCE {
     eContentType ContentType,
     eContent [0] EXPLICIT OCTET STRING OPTIONAL }

   SignerInfo ::=3D SEQUENCE {
     version CMSVersion,
     sid SignerIdentifier,
     digestAlgorithm DigestAlgorithmIdentifier,
     signedAttrs [0] IMPLICIT SignedAttributes OPTIONAL,
     signatureAlgorithm SignatureAlgorithmIdentifier,
     signature SignatureValue,
     unsignedAttrs [1] IMPLICIT UnsignedAttributes OPTIONAL }

   SignerIdentifier ::=3D CHOICE {
     issuerAndSerialNumber IssuerAndSerialNumber,
     subjectKeyIdentifier [0] SubjectKeyIdentifier }

   SignedAttributes ::=3D SET SIZE (1..MAX) OF Attribute

   UnsignedAttributes ::=3D SET SIZE (1..MAX) OF Attribute

   Attribute ::=3D SEQUENCE {
     attrType OBJECT IDENTIFIER,
     attrValues SET OF AttributeValue }

   AttributeValue ::=3D ANY

   SignatureValue ::=3D OCTET STRING

   EnvelopedData ::=3D SEQUENCE {
     version CMSVersion,
     originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
     recipientInfos RecipientInfos,
     encryptedContentInfo EncryptedContentInfo,
     unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }




<span class=3D"grey">Housley                     Standards Track           =
         [Page 45]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-46"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   OriginatorInfo ::=3D SEQUENCE {
     certs [0] IMPLICIT CertificateSet OPTIONAL,
     crls [1] IMPLICIT RevocationInfoChoices OPTIONAL }

   RecipientInfos ::=3D SET SIZE (1..MAX) OF RecipientInfo

   EncryptedContentInfo ::=3D SEQUENCE {
     contentType ContentType,
     contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
     encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL }

   EncryptedContent ::=3D OCTET STRING

   UnprotectedAttributes ::=3D SET SIZE (1..MAX) OF Attribute

   RecipientInfo ::=3D CHOICE {
     ktri KeyTransRecipientInfo,
     kari [1] KeyAgreeRecipientInfo,
     kekri [2] KEKRecipientInfo,
     pwri [3] PasswordRecipientInfo,
     ori [4] OtherRecipientInfo }

   EncryptedKey ::=3D OCTET STRING

   KeyTransRecipientInfo ::=3D SEQUENCE {
     version CMSVersion,  -- always set to 0 or 2
     rid RecipientIdentifier,
     keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
     encryptedKey EncryptedKey }

   RecipientIdentifier ::=3D CHOICE {
     issuerAndSerialNumber IssuerAndSerialNumber,
     subjectKeyIdentifier [0] SubjectKeyIdentifier }

   KeyAgreeRecipientInfo ::=3D SEQUENCE {
     version CMSVersion,  -- always set to 3
     originator [0] EXPLICIT OriginatorIdentifierOrKey,
     ukm [1] EXPLICIT UserKeyingMaterial OPTIONAL,
     keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
     recipientEncryptedKeys RecipientEncryptedKeys }

   OriginatorIdentifierOrKey ::=3D CHOICE {
     issuerAndSerialNumber IssuerAndSerialNumber,
     subjectKeyIdentifier [0] SubjectKeyIdentifier,
     originatorKey [1] OriginatorPublicKey }






<span class=3D"grey">Housley                     Standards Track           =
         [Page 46]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-47"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   OriginatorPublicKey ::=3D SEQUENCE {
     algorithm AlgorithmIdentifier,
     publicKey BIT STRING }

   RecipientEncryptedKeys ::=3D SEQUENCE OF RecipientEncryptedKey

   RecipientEncryptedKey ::=3D SEQUENCE {
     rid KeyAgreeRecipientIdentifier,
     encryptedKey EncryptedKey }

   KeyAgreeRecipientIdentifier ::=3D CHOICE {
     issuerAndSerialNumber IssuerAndSerialNumber,
     rKeyId [0] IMPLICIT RecipientKeyIdentifier }

   RecipientKeyIdentifier ::=3D SEQUENCE {
     subjectKeyIdentifier SubjectKeyIdentifier,
     date GeneralizedTime OPTIONAL,
     other OtherKeyAttribute OPTIONAL }

   SubjectKeyIdentifier ::=3D OCTET STRING

   KEKRecipientInfo ::=3D SEQUENCE {
     version CMSVersion,  -- always set to 4
     kekid KEKIdentifier,
     keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
     encryptedKey EncryptedKey }

   KEKIdentifier ::=3D SEQUENCE {
     keyIdentifier OCTET STRING,
     date GeneralizedTime OPTIONAL,
     other OtherKeyAttribute OPTIONAL }

   PasswordRecipientInfo ::=3D SEQUENCE {
     version CMSVersion,   -- always set to 0
     keyDerivationAlgorithm [0] KeyDerivationAlgorithmIdentifier
                                OPTIONAL,
     keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
     encryptedKey EncryptedKey }

   OtherRecipientInfo ::=3D SEQUENCE {
     oriType OBJECT IDENTIFIER,
     oriValue ANY DEFINED BY oriType }

   DigestedData ::=3D SEQUENCE {
     version CMSVersion,
     digestAlgorithm DigestAlgorithmIdentifier,
     encapContentInfo EncapsulatedContentInfo,
     digest Digest }



<span class=3D"grey">Housley                     Standards Track           =
         [Page 47]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-48"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   Digest ::=3D OCTET STRING

   EncryptedData ::=3D SEQUENCE {
     version CMSVersion,
     encryptedContentInfo EncryptedContentInfo,
     unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }

   AuthenticatedData ::=3D SEQUENCE {
     version CMSVersion,
     originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
     recipientInfos RecipientInfos,
     macAlgorithm MessageAuthenticationCodeAlgorithm,
     digestAlgorithm [1] DigestAlgorithmIdentifier OPTIONAL,
     encapContentInfo EncapsulatedContentInfo,
     authAttrs [2] IMPLICIT AuthAttributes OPTIONAL,
     mac MessageAuthenticationCode,
     unauthAttrs [3] IMPLICIT UnauthAttributes OPTIONAL }

   AuthAttributes ::=3D SET SIZE (1..MAX) OF Attribute

   UnauthAttributes ::=3D SET SIZE (1..MAX) OF Attribute

   MessageAuthenticationCode ::=3D OCTET STRING

   DigestAlgorithmIdentifier ::=3D AlgorithmIdentifier

   SignatureAlgorithmIdentifier ::=3D AlgorithmIdentifier

   KeyEncryptionAlgorithmIdentifier ::=3D AlgorithmIdentifier

   ContentEncryptionAlgorithmIdentifier ::=3D AlgorithmIdentifier

   MessageAuthenticationCodeAlgorithm ::=3D AlgorithmIdentifier

   KeyDerivationAlgorithmIdentifier ::=3D AlgorithmIdentifier

   RevocationInfoChoices ::=3D SET OF RevocationInfoChoice

   RevocationInfoChoice ::=3D CHOICE {
     crl CertificateList,
     other [1] IMPLICIT OtherRevocationInfoFormat }

   OtherRevocationInfoFormat ::=3D SEQUENCE {
     otherRevInfoFormat OBJECT IDENTIFIER,
     otherRevInfo ANY DEFINED BY otherRevInfoFormat }






<span class=3D"grey">Housley                     Standards Track           =
         [Page 48]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-49"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   CertificateChoices ::=3D CHOICE {
     certificate Certificate,
     extendedCertificate [0] IMPLICIT ExtendedCertificate,  -- Obsolete
     v1AttrCert [1] IMPLICIT AttributeCertificateV1,        -- Obsolete
     v2AttrCert [2] IMPLICIT AttributeCertificateV2,
     other [3] IMPLICIT OtherCertificateFormat }

   AttributeCertificateV2 ::=3D AttributeCertificate

   OtherCertificateFormat ::=3D SEQUENCE {
     otherCertFormat OBJECT IDENTIFIER,
     otherCert ANY DEFINED BY otherCertFormat }

   CertificateSet ::=3D SET OF CertificateChoices

   IssuerAndSerialNumber ::=3D SEQUENCE {
     issuer Name,
     serialNumber CertificateSerialNumber }

   CMSVersion ::=3D INTEGER  { v0(0), v1(1), v2(2), v3(3), v4(4), v5(5) }

   UserKeyingMaterial ::=3D OCTET STRING

   OtherKeyAttribute ::=3D SEQUENCE {
     keyAttrId OBJECT IDENTIFIER,
     keyAttr ANY DEFINED BY keyAttrId OPTIONAL }

   -- Content Type Object Identifiers

   id-ct-contentInfo OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
       us(840) rsadsi(113549) pkcs(1) pkcs9(9) smime(16) ct(1) 6 }

   id-data OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
       us(840) rsadsi(113549) pkcs(1) pkcs7(7) 1 }

   id-signedData OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
       us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 }

   id-envelopedData OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
       us(840) rsadsi(113549) pkcs(1) pkcs7(7) 3 }

   id-digestedData OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
       us(840) rsadsi(113549) pkcs(1) pkcs7(7) 5 }

   id-encryptedData OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
       us(840) rsadsi(113549) pkcs(1) pkcs7(7) 6 }





<span class=3D"grey">Housley                     Standards Track           =
         [Page 49]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-50"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   id-ct-authData OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
       us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) ct(1) 2 }

   -- The CMS Attributes

   MessageDigest ::=3D OCTET STRING

   SigningTime  ::=3D Time

   Time ::=3D CHOICE {
     utcTime UTCTime,
     generalTime GeneralizedTime }

   Countersignature ::=3D SignerInfo

   -- Attribute Object Identifiers

   id-contentType OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
       us(840) rsadsi(113549) pkcs(1) pkcs9(9) 3 }

   id-messageDigest OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
       us(840) rsadsi(113549) pkcs(1) pkcs9(9) 4 }

   id-signingTime OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
       us(840) rsadsi(113549) pkcs(1) pkcs9(9) 5 }

   id-countersignature OBJECT IDENTIFIER ::=3D { iso(1) member-body(2)
       us(840) rsadsi(113549) pkcs(1) pkcs9(9) 6 }

   -- Obsolete Extended Certificate syntax from PKCS #6

   ExtendedCertificateOrCertificate ::=3D CHOICE {
     certificate Certificate,
     extendedCertificate [0] IMPLICIT ExtendedCertificate }

   ExtendedCertificate ::=3D SEQUENCE {
     extendedCertificateInfo ExtendedCertificateInfo,
     signatureAlgorithm SignatureAlgorithmIdentifier,
     signature Signature }

   ExtendedCertificateInfo ::=3D SEQUENCE {
     version CMSVersion,
     certificate Certificate,
     attributes UnauthAttributes }

   Signature ::=3D BIT STRING

   END -- of CryptographicMessageSyntax2004



<span class=3D"grey">Housley                     Standards Track           =
         [Page 50]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-51"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


<span class=3D"h3"><a class=3D"selflink" id=3D"section-12.2" href=3D"https:=
//www.rfc-editor.org/rfc/rfc5652#section-12.2">12.2</a>.  Version 1 Attribu=
te Certificate ASN.1 Module</span>

   AttributeCertificateVersion1
       { iso(1) member-body(2) us(840) rsadsi(113549)
         pkcs(1) pkcs-9(9) smime(16) modules(0) v1AttrCert(15) }

   DEFINITIONS EXPLICIT TAGS ::=3D
   BEGIN

   -- EXPORTS All

   IMPORTS

     -- Imports from <a href=3D"https://www.rfc-editor.org/rfc/rfc5280">RFC=
 5280</a> [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-PROFILE" t=
itle=3D"&quot;Internet X.509 Public Key Infrastructure Certificate and Cert=
ificate Revocation List (CRL) Profile&quot;">PROFILE</a>], <a href=3D"https=
://www.rfc-editor.org/rfc/rfc5652#appendix-A.1">Appendix A.1</a>
           AlgorithmIdentifier, Attribute, CertificateSerialNumber,
           Extensions, UniqueIdentifier
              FROM PKIX1Explicit88
                   { iso(1) identified-organization(3) dod(6)
                     internet(1) security(5) mechanisms(5) pkix(7)
                     mod(0) pkix1-explicit(18) }

     -- Imports from <a href=3D"https://www.rfc-editor.org/rfc/rfc5280">RFC=
 5280</a> [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-PROFILE" t=
itle=3D"&quot;Internet X.509 Public Key Infrastructure Certificate and Cert=
ificate Revocation List (CRL) Profile&quot;">PROFILE</a>], <a href=3D"https=
://www.rfc-editor.org/rfc/rfc5652#appendix-A.2">Appendix A.2</a>
           GeneralNames
              FROM PKIX1Implicit88
                   { iso(1) identified-organization(3) dod(6)
                     internet(1) security(5) mechanisms(5) pkix(7)
                     mod(0) pkix1-implicit(19) }

     -- Imports from <a href=3D"https://www.rfc-editor.org/rfc/rfc3281">RFC=
 3281</a> [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-ACPROFILE"=
 title=3D"&quot;An Internet Attribute Certificate Profile for Authorization=
&quot;">ACPROFILE</a>], <a href=3D"https://www.rfc-editor.org/rfc/rfc5652#a=
ppendix-B">Appendix B</a>
           AttCertValidityPeriod, IssuerSerial
              FROM PKIXAttributeCertificate
                   { iso(1) identified-organization(3) dod(6)
                     internet(1) security(5) mechanisms(5) pkix(7)
                     mod(0) attribute-cert(12) } ;

   -- Definition extracted from X.509-1997 [<a href=3D"https://www.rfc-edit=
or.org/rfc/rfc5652#ref-X.509-97">X.509-97</a>], but
   -- different type names are used to avoid collisions.

   AttributeCertificateV1 ::=3D SEQUENCE {
     acInfo AttributeCertificateInfoV1,
     signatureAlgorithm AlgorithmIdentifier,
     signature BIT STRING }









<span class=3D"grey">Housley                     Standards Track           =
         [Page 51]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-52"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   AttributeCertificateInfoV1 ::=3D SEQUENCE {
     version AttCertVersionV1 DEFAULT v1,
     subject CHOICE {
       baseCertificateID [0] IssuerSerial,
         -- associated with a Public Key Certificate
       subjectName [1] GeneralNames },
         -- associated with a name
     issuer GeneralNames,
     signature AlgorithmIdentifier,
     serialNumber CertificateSerialNumber,
     attCertValidityPeriod AttCertValidityPeriod,
     attributes SEQUENCE OF Attribute,
     issuerUniqueID UniqueIdentifier OPTIONAL,
     extensions Extensions OPTIONAL }

   AttCertVersionV1 ::=3D INTEGER { v1(0) }

   END -- of AttributeCertificateVersion1

<span class=3D"h2"><a class=3D"selflink" id=3D"section-13" href=3D"https://=
www.rfc-editor.org/rfc/rfc5652#section-13">13</a>.  References</span>

<span class=3D"h3"><a class=3D"selflink" id=3D"section-13.1" href=3D"https:=
//www.rfc-editor.org/rfc/rfc5652#section-13.1">13.1</a>.  Normative Referen=
ces</span>

   [<a id=3D"ref-ACPROFILE">ACPROFILE</a>]   Farrell, S. and R. Housley, "A=
n Internet Attribute
                 Certificate Profile for Authorization", <a href=3D"https:/=
/www.rfc-editor.org/rfc/rfc3281">RFC 3281</a>, April
                 2002.

   [<a id=3D"ref-PROFILE">PROFILE</a>]     Cooper, D., Santesson, S., Farre=
ll, S., Boeyen, S.,
                 Housley, R., and W. Polk, "Internet X.509 Public Key
                 Infrastructure Certificate and Certificate Revocation
                 List (CRL) Profile", <a href=3D"https://www.rfc-editor.org=
/rfc/rfc5280">RFC 5280</a>, May 2008.

   [<a id=3D"ref-STDWORDS">STDWORDS</a>]    Bradner, S., "Key words for use=
 in RFCs to Indicate
                 Requirement Levels", <a href=3D"https://www.rfc-editor.org=
/bcp/bcp14">BCP 14</a>, <a href=3D"https://www.rfc-editor.org/rfc/rfc2119">=
RFC 2119</a>, March 1997.

   [<a id=3D"ref-X.208-88">X.208-88</a>]    CCITT.  Recommendation X.208: S=
pecification of Abstract
                 Syntax Notation One (ASN.1), 1988.

   [<a id=3D"ref-X.209-88">X.209-88</a>]    CCITT.  Recommendation X.209: S=
pecification of Basic
                 Encoding Rules for Abstract Syntax Notation One
                 (ASN.1), 1988.

   [<a id=3D"ref-X.501-88">X.501-88</a>]    CCITT.  Recommendation X.501: T=
he Directory - Models,
                 1988.

   [<a id=3D"ref-X.509-88">X.509-88</a>]    CCITT.  Recommendation X.509: T=
he Directory -
                 Authentication Framework, 1988.




<span class=3D"grey">Housley                     Standards Track           =
         [Page 52]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-53"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   [<a id=3D"ref-X.509-97">X.509-97</a>]    ITU-T.  Recommendation X.509: T=
he Directory -
                 Authentication Framework, 1997.

   [<a id=3D"ref-X.509-00">X.509-00</a>]    ITU-T.  Recommendation X.509: T=
he Directory -
                 Authentication Framework, 2000.

<span class=3D"h3"><a class=3D"selflink" id=3D"section-13.2" href=3D"https:=
//www.rfc-editor.org/rfc/rfc5652#section-13.2">13.2</a>.  Informative Refer=
ences</span>

   [<a id=3D"ref-CMS1">CMS1</a>]        Housley, R., "Cryptographic Message=
 Syntax", <a href=3D"https://www.rfc-editor.org/rfc/rfc2630">RFC 2630</a>,
                 June 1999.

   [<a id=3D"ref-CMS2">CMS2</a>]        Housley, R., "Cryptographic Message=
 Syntax (CMS)", <a href=3D"https://www.rfc-editor.org/rfc/rfc3369">RFC</a>
                 <a href=3D"https://www.rfc-editor.org/rfc/rfc3369">3369</a=
>, August 2002.

   [<a id=3D"ref-CMS3">CMS3</a>]        Housley, R., "Cryptographic Message=
 Syntax (CMS)", <a href=3D"https://www.rfc-editor.org/rfc/rfc3852">RFC</a>
                 <a href=3D"https://www.rfc-editor.org/rfc/rfc3852">3852</a=
>, July 2004.

   [<a id=3D"ref-CMSALG">CMSALG</a>]      Housley, R., "Cryptographic Messa=
ge Syntax (CMS)
                 Algorithms", <a href=3D"https://www.rfc-editor.org/rfc/rfc=
3370">RFC 3370</a>, August 2002.

   [<a id=3D"ref-CMSMSIG">CMSMSIG</a>]     Housley, R., "Cryptographic Mess=
age Syntax (CMS)
                 Multiple Signer Clarification", <a href=3D"https://www.rfc=
-editor.org/rfc/rfc4853">RFC 4853</a>, April 2007.

   [<a id=3D"ref-DH-X9.42">DH-X9.42</a>]    Rescorla, E., "Diffie-Hellman K=
ey Agreement Method",
                 <a href=3D"https://www.rfc-editor.org/rfc/rfc2631">RFC 263=
1</a>, June 1999.

   [<a id=3D"ref-ESS">ESS</a>]         Hoffman, P., Ed., "Enhanced Security=
 Services for
                 S/MIME", <a href=3D"https://www.rfc-editor.org/rfc/rfc2634=
">RFC 2634</a>, June 1999.

   [<a id=3D"ref-MSAC">MSAC</a>]        Microsoft Development Network (MSDN=
) Library,
                 "Authenticode", April 2004 Release.

   [<a id=3D"ref-MSG2">MSG2</a>]        Dusse, S., Hoffman, P., Ramsdell, B=
., Lundblade, L.,
                 and L. Repka, "S/MIME Version 2 Message Specification",
                 <a href=3D"https://www.rfc-editor.org/rfc/rfc2311">RFC 231=
1</a>, March 1998.

   [<a id=3D"ref-MSG3">MSG3</a>]        Ramsdell, B., Ed., "S/MIME Version =
3 Message
                 Specification", <a href=3D"https://www.rfc-editor.org/rfc/=
rfc2633">RFC 2633</a>, June 1999.

   [<a id=3D"ref-MSG3.1">MSG3.1</a>]      Ramsdell, B., Ed., "Secure/Multip=
urpose Internet Mail
                 Extensions (S/MIME) Version 3.1 Message Specification",
                 <a href=3D"https://www.rfc-editor.org/rfc/rfc3851">RFC 385=
1</a>, July 2004.

   [NEWPKCS#1]   Kaliski, B. and J. Staddon, "PKCS #1: RSA Cryptography
                 Specifications Version 2.0", <a href=3D"https://www.rfc-ed=
itor.org/rfc/rfc2437">RFC 2437</a>, October 1998.






<span class=3D"grey">Housley                     Standards Track           =
         [Page 53]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-54"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   [<a id=3D"ref-OCSP">OCSP</a>]        Myers, M., Ankney, R., Malpani, A.,=
 Galperin, S., and
                 C. Adams, "X.509 Internet Public Key Infrastructure
                 Online Certificate Status Protocol - OCSP", <a href=3D"htt=
ps://www.rfc-editor.org/rfc/rfc2560">RFC 2560</a>,
                 June 1999.

   [PKCS#1]      Kaliski, B., "PKCS #1: RSA Encryption Version 1.5", <a hre=
f=3D"https://www.rfc-editor.org/rfc/rfc2313">RFC</a>
                 <a href=3D"https://www.rfc-editor.org/rfc/rfc2313">2313</a=
>, March 1998.

   [PKCS#6]      RSA Laboratories.  PKCS #6: Extended-Certificate Syntax
                 Standard, Version 1.5.  November 1993.

   [PKCS#7]      Kaliski, B., "PKCS #7: Cryptographic Message Syntax
                 Version 1.5", <a href=3D"https://www.rfc-editor.org/rfc/rf=
c2315">RFC 2315</a>, March 1998.

   [PKCS#9]      RSA Laboratories.  PKCS #9: Selected Attribute Types,
                 Version 1.1.  November 1993.

   [<a id=3D"ref-PWRI">PWRI</a>]        Gutmann, P., "Password-based Encryp=
tion for CMS", <a href=3D"https://www.rfc-editor.org/rfc/rfc3211">RFC</a>
                 <a href=3D"https://www.rfc-editor.org/rfc/rfc3211">3211</a=
>, December 2001.

   [<a id=3D"ref-RANDOM">RANDOM</a>]      Eastlake, D., 3rd, Schiller, J., =
and S. Crocker,
                 "Randomness Requirements for Security", <a href=3D"https:/=
/www.rfc-editor.org/bcp/bcp106">BCP 106</a>, <a href=3D"https://www.rfc-edi=
tor.org/rfc/rfc4086">RFC</a>
                 <a href=3D"https://www.rfc-editor.org/rfc/rfc4086">4086</a=
>, June 2005.

<span class=3D"h2"><a class=3D"selflink" id=3D"section-14" href=3D"https://=
www.rfc-editor.org/rfc/rfc5652#section-14">14</a>.  Security Considerations=
</span>

   The Cryptographic Message Syntax provides a method for digitally
   signing data, digesting data, encrypting data, and authenticating
   data.

   Implementations must protect the signer's private key.  Compromise of
   the signer's private key permits masquerade.

   Implementations must protect the key management private key, the
   key-encryption key, and the content-encryption key.  Compromise of
   the key management private key or the key-encryption key may result
   in the disclosure of all contents protected with that key.
   Similarly, compromise of the content-encryption key may result in
   disclosure of the associated encrypted content.

   Implementations must protect the key management private key and the
   message-authentication key.  Compromise of the key management private
   key permits masquerade of authenticated data.  Similarly, compromise
   of the message-authentication key may result in undetectable
   modification of the authenticated content.






<span class=3D"grey">Housley                     Standards Track           =
         [Page 54]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-55"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   The key management technique employed to distribute message-
   authentication keys must itself provide data origin authentication;
   otherwise, the contents are delivered with integrity from an unknown
   source.  Neither RSA [PKCS#1] [NEWPKCS#1] nor Ephemeral-Static
   Diffie-Hellman [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-DH=
-X9.42" title=3D"&quot;Diffie-Hellman Key Agreement Method&quot;">DH-X9.42<=
/a>] provide the necessary data origin
   authentication.  Static-Static Diffie-Hellman [<a href=3D"https://www.rf=
c-editor.org/rfc/rfc5652#ref-DH-X9.42" title=3D"&quot;Diffie-Hellman Key Ag=
reement Method&quot;">DH-X9.42</a>] does provide
   the necessary data origin authentication when both the originator and
   recipient public keys are bound to appropriate identities in X.509
   certificates.

   When more than two parties share the same message-authentication key,
   data origin authentication is not provided.  Any party that knows the
   message-authentication key can compute a valid MAC; therefore, the
   contents could originate from any one of the parties.

   Implementations must randomly generate content-encryption keys,
   message-authentication keys, initialization vectors (IVs), and
   padding.  Also, the generation of public/private key pairs relies on
   random numbers.  The use of inadequate pseudo-random number
   generators (PRNGs) to generate cryptographic keys can result in
   little or no security.  An attacker may find it much easier to
   reproduce the PRNG environment that produced the keys, searching the
   resulting small set of possibilities, rather than brute force
   searching the whole key space.  The generation of quality random
   numbers is difficult.  <a href=3D"https://www.rfc-editor.org/rfc/rfc4086=
">RFC 4086</a> [<a href=3D"https://www.rfc-editor.org/rfc/rfc5652#ref-RANDO=
M" title=3D"&quot;Randomness Requirements for Security&quot;">RANDOM</a>] o=
ffers important guidance in
   this area.

   When using key-agreement algorithms or previously distributed
   symmetric key-encryption keys, a key-encryption key is used to
   encrypt the content-encryption key.  If the key-encryption and
   content-encryption algorithms are different, the effective security
   is determined by the weaker of the two algorithms.  If, for example,
   content is encrypted with Triple-DES using a 168-bit Triple-DES
   content-encryption key, and the content-encryption key is wrapped
   with RC2 using a 40-bit RC2 key-encryption key, then at most 40 bits
   of protection is provided.  A trivial search to determine the value
   of the 40-bit RC2 key can recover the Triple-DES key, and then the
   Triple-DES key can be used to decrypt the content.  Therefore,
   implementers must ensure that key-encryption algorithms are as strong
   or stronger than content-encryption algorithms.

   Implementers should be aware that cryptographic algorithms become
   weaker with time.  As new cryptoanalysis techniques are developed and
   computing performance improves, the work factor to break a particular
   cryptographic algorithm will be reduced.  Therefore, cryptographic
   algorithm implementations should be modular, allowing new algorithms
   to be readily inserted.  That is, implementers should be prepared for
   the set of algorithms that must be supported to change over time.



<span class=3D"grey">Housley                     Standards Track           =
         [Page 55]</span></pre>
<hr class=3D"noprint"><!--NewPage--><pre class=3D"newpage"><span id=3D"page=
-56"></span>
<span class=3D"grey"><a href=3D"https://www.rfc-editor.org/rfc/rfc5652">RFC=
 5652</a>              Cryptographic Message Syntax        September 2009</=
span>


   The countersignature unsigned attribute includes a digital signature
   that is computed on the content signature value; thus, the
   countersigning process need not know the original signed content.
   This structure permits implementation efficiency advantages; however,
   this structure may also permit the countersigning of an inappropriate
   signature value.  Therefore, implementations that perform
   countersignatures should either verify the original signature value
   prior to countersigning it (this verification requires processing of
   the original content), or implementations should perform
   countersigning in a context that ensures that only appropriate
   signature values are countersigned.

<span class=3D"h2"><a class=3D"selflink" id=3D"section-15" href=3D"https://=
www.rfc-editor.org/rfc/rfc5652#section-15">15</a>.  Acknowledgments</span>

   This document is the result of contributions from many professionals.
   I appreciate the hard work of all members of the IETF S/MIME Working
   Group.  I extend a special thanks to Rich Ankney, Simon Blake-Wilson,
   Tim Dean, Steve Dusse, Carl Ellison, Peter Gutmann, Bob Jueneman,
   Stephen Henson, Paul Hoffman, Scott Hollenbeck, Don Johnson, Burt
   Kaliski, John Linn, John Pawling, Blake Ramsdell, Francois Rousseau,
   Jim Schaad, Dave Solo, Paul Timmel, and Sean Turner for their efforts
   and support.

   I thank Tim Polk for his encouragement in advancing this
   specification along the standards maturity ladder.  In addition, I
   thank Jan Vilhuber for the careful reading that resulted in RFC
   Errata 1744.

Author's Address

   Russell Housley
   Vigil Security, LLC
   918 Spring Knoll Drive
   Herndon, VA 20170
   USA
   EMail: housley@vigilsec.com















Housley                     Standards Track                    [Page 56]
</pre>




</body></html>
------MultipartBoundary--yENwd9FbLx5269kbRuMLh3486PXEW5c4SJwxhoR6YW----
Content-Type: text/css
Content-Transfer-Encoding: quoted-printable
Content-Location: cid:css-b383ba12-effe-4d7c-b93d-9c02ee80a45f@mhtml.blink

@charset "utf-8";

@media only screen and (min-width: 992px) and (max-width: 1199px) {
  body { font-size: 14pt; }
  div.content { width: 96ex; margin: 0px auto; }
}

@media only screen and (min-width: 768px) and (max-width: 991px) {
  body { font-size: 14pt; }
  div.content { width: 96ex; margin: 0px auto; }
}

@media only screen and (min-width: 480px) and (max-width: 767px) {
  body { font-size: 11pt; }
  div.content { width: 96ex; margin: 0px auto; }
}

@media only screen and (max-width: 479px) {
  body { font-size: 8pt; }
  div.content { width: 96ex; margin: 0px auto; }
}

@media only screen and (min-device-width: 375px) and (max-device-width: 667=
px) {
  body { font-size: 9.5pt; }
  div.content { width: 96ex; margin: 0px; }
}

@media only screen and (min-device-width: 1200px) {
  body { font-size: 10pt; margin: 0px 4em; }
  div.content { width: 96ex; margin: 0px; }
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { display: inline; whi=
te-space: pre; font-family: monospace; font-size: 1em; font-weight: bold; }

pre { font-size: 1em; margin-top: 0px; margin-bottom: 0px; }

.pre { white-space: pre; font-family: monospace; }

.header { font-weight: bold; }

.newpage { break-before: page; }

.invisible { text-decoration: none; color: white; }

a.selflink { color: black; text-decoration: none; }

@media print {
  body { font-family: monospace; font-size: 10.5pt; }
  h1, h2, h3, h4, h5, h6 { font-size: 1em; }
  a:link, a:visited { color: inherit; text-decoration: none; }
  .noprint { display: none; }
}

@media screen {
  .grey, .grey a:link, .grey a:visited { color: rgb(119, 119, 119); }
  .docinfo { background-color: rgb(238, 238, 238); }
  .top { border-top: 7px solid rgb(238, 238, 238); }
  .bgwhite { background-color: white; }
  .bgred { background-color: rgb(255, 68, 68); }
  .bggrey { background-color: rgb(102, 102, 102); }
  .bgbrown { background-color: rgb(136, 68, 0); }
  .bgorange { background-color: rgb(255, 170, 0); }
  .bgyellow { background-color: rgb(238, 238, 0); }
  .bgmagenta { background-color: rgb(255, 68, 255); }
  .bgblue { background-color: rgb(102, 102, 255); }
  .bgcyan { background-color: rgb(68, 221, 221); }
  .bggreen { background-color: rgb(68, 255, 68); }
  .legend { font-size: 90%; }
  .cplate { font-size: 70%; border: 1px solid grey; }
}
------MultipartBoundary--yENwd9FbLx5269kbRuMLh3486PXEW5c4SJwxhoR6YW----
Content-Type: text/css
Content-Transfer-Encoding: quoted-printable
Content-Location: cid:css-c536faab-0feb-40b9-abb0-a0bad96d4310@mhtml.blink

@charset "utf-8";

body::-webkit-scrollbar { width: 21px; height: 21px; }
------MultipartBoundary--yENwd9FbLx5269kbRuMLh3486PXEW5c4SJwxhoR6YW----
Content-Type: text/css
Content-Transfer-Encoding: quoted-printable
Content-Location: cid:css-35d7e172-a26f-4f96-b476-aabef94556ec@mhtml.blink

@charset "utf-8";

.ad-area, .greyAd, .adResult, .video-ads, .ad-box:not(#ad-banner):not(:empt=
y), .ads-row, .ads_wrapper, .ad_body, #taboola-below-article-1, .ad_block, =
.ProductAd, .adcard, .inline-ad, [data-ad-name], #ad_link, #header_ad, #pag=
e_ad, .ad-source, .ad-notice, .is-sponsored, .ads-image, .ad_btn, .adv-bann=
er, .nativead, .adtable, #adContainer, .product-ad, .header-ad-row, [href^=
=3D"https://mypatriotsupply.com/"] > img, .ad-160-600, .ad_middle, #centera=
ds, [href^=3D"http://mypillow.com/"] > img, #adcontent, .ad-hero, #adbox, d=
iv[id^=3D"ezoic-pub-ad-"], .ad-section, .ad-bottom, .adsninja-ad-zone, ins.=
adsbygoogle[data-ad-slot], .advert_area, .ad-point, .ad-padding, .logo-ad, =
.textad, .module_ad, .ad-sidebar, .ad-wrap:not(#google_ads_iframe_checktag)=
, .sponsor_post, .adrow, .Adsense, .promoAd, .adscontainer, #ad_3, #topbann=
erad, .adbutton, .footer_ads, .videos-ad, .smallads, .cnx-player-wrapper, #=
ads-header, #adv-text, .ad-outside, #ad_2, .adsleft, .sidebar-ad, [href^=3D=
"https://zstacklife.com/"] img, #ad_top, .region-ad-top, div[data-ad-target=
ing], .ad_top, #adcontainer1, .fixed_ad, .advert-detail, .adActive, #adWrap=
per, .node-ad, .adthrive-video-player, .adrect, .block-ad, .nav_ad, .ad_cap=
tion, [href^=3D"http://www.mypillow.com/"] > img, .article-advert, .adverti=
sement-block, .ad-popup, .adcenter, .large-advert, #ad-rotator, .sidebar-ad=
s, .ad_box, #google-ads, .adsbottombox, .mntl-leaderboard-spacer, .containe=
r-ads, .adsBlock, .page_ad, #side-ad, .o-ad-container, [href^=3D"https://my=
store.com/"] > img, .ad-content, .ad-text, .article_ad, .bottom_ad_block, #=
topAd, [href^=3D"https://noqreport.com/"] > img, .ad_container, .sponsored-=
article, .custom-ad, .wps-player-wrap, .contentAds, .adshome, .bottom_ad, .=
mainAd, .banner-ad-container, .head_ad, .ads-inline, .small-ads, #stickyads=
, .ad-current, [href^=3D"https://www.mypatriotsupply.com/"] > img, div[id^=
=3D"ad_position_"], a[href^=3D"https://ndt5.net/"], div[aria-label=3D"Ads"]=
, a[href^=3D"https://click.dtiserv2.com/"], .has-fixed-bottom-ad, #ad_1, #r=
ight_ads, .reklama, .ads-title, #banner-ad, .advert_list, .footer-ad, .publ=
icidade, .adChoicesLogo, .advert2, .topAd, #rightad, .ads-loaded, .ad-label=
, .ads-header, .postad, div[id^=3D"div-gpt-"], [href^=3D"https://www.herban=
omic.com/"] > img, #ad_4, .sponsoredItem, .adHolder, .middlead, .adban, #ad=
-p3, .adslot, .sidebar_advert, .ac-widget-placeholder, #outbrain_widget_0, =
.ad-cover, .w-adsninja-video-player, .adverttext, .adsList, .body-top-ads, =
.ad-widget, .ad_global_header, .ad_bottom, .adwidget, .ads-banner, .ad-zone=
-container, #adsensewide, .ad_div, #ads-wrapper, a[href^=3D"https://natour.=
naughtyamerica.com/track/"], .side-ad, #sidebar-ad, #footer-ads, .ad_title,=
 .ad-enabled, #adtop, .content_ads, .ad-root, .display_ad, [href^=3D"https:=
//www.restoro.com/"], .advBox, .pbs__player, #ad-wrapper, .gallery-ad, #art=
icle_ad, #adbar, #leftad, #ad-carousel, .ad-click, .ads.widget, .ad336, .ad=
vert-container, .img_ad, #adsContainer, .ad-links, .display-ad, a[href^=3D"=
https://ad.doubleclick.net/"], .boxAds, .adLink, .has-ad, #ad-top, .ad728x9=
0, .ads_right, .adlink, .adText, .ads-core-placer, a[href^=3D"https://www.s=
heetmusicplus.com/"][href*=3D"?aff_id=3D"], .top-ad, .ad_spot, .ad_bg, .adv=
ertSlider, .vertical-ads, .adsense_wrapper, .adthrive-content, .box_ads, .a=
dvertorial, .ad_left, #ads-menu, .home-ad, div[id^=3D"dfp-ad-"], .ad-zone, =
.adMiddle, .product-ads, .adv-box, .header_ad, #mplayer-embed, #related_ads=
, .ads-left, .advertiser, .column-ad, .ad_frame, .adtitle, .c-ads, #ads-lef=
t, #advertise, .ad_main, #prerollAd, .ad-button, .adtag, .ad-center, .ad_it=
em, .small_ad, .ads-mobile, .topads, .adverts, .block-sponsor, #adcontainer=
, .ad-title, .ad_banner, .anyClipWrapper, ins.adsbygoogle[data-ad-client], =
.ad-icon, [href^=3D"https://mypillow.com/"] > img, [id^=3D"div-gpt-ad"], .a=
dImg, #headerAd, .advads-widget, a[onmousedown^=3D"this.href=3D'https://pai=
d.outbrain.com/network/redir?"][target=3D"_blank"], [href^=3D"https://www.m=
ypillow.com/"] > img, .ads1, .adwords, .after-post-ad { display: none !impo=
rtant; }
------MultipartBoundary--yENwd9FbLx5269kbRuMLh3486PXEW5c4SJwxhoR6YW----
Content-Type: text/css
Content-Transfer-Encoding: quoted-printable
Content-Location: cid:css-4d5d9e0a-5f67-4467-ae1e-63dee7a17edb@mhtml.blink

@charset "utf-8";

.ad-area, .greyAd, .adResult, .video-ads, .ad-box:not(#ad-banner):not(:empt=
y), .ads-row, .ads_wrapper, .ad_body, #taboola-below-article-1, .ad_block, =
.ProductAd, .adcard, .inline-ad, [data-ad-name], #ad_link, #header_ad, #pag=
e_ad, .ad-source, .ad-notice, .is-sponsored, .ads-image, .ad_btn, .adv-bann=
er, .nativead, .adtable, #adContainer, .product-ad, .header-ad-row, [href^=
=3D"https://mypatriotsupply.com/"] > img, .ad-160-600, .ad_middle, #centera=
ds, [href^=3D"http://mypillow.com/"] > img, #adcontent, .ad-hero, #adbox, d=
iv[id^=3D"ezoic-pub-ad-"], .ad-section, .ad-bottom, .adsninja-ad-zone, ins.=
adsbygoogle[data-ad-slot], .advert_area, .ad-point, .ad-padding, .logo-ad, =
.textad, .module_ad, .ad-sidebar, .ad-wrap:not(#google_ads_iframe_checktag)=
, .sponsor_post, .adrow, .Adsense, .promoAd, .adscontainer, #ad_3, #topbann=
erad, .adbutton, .footer_ads, .videos-ad, .smallads, .cnx-player-wrapper, #=
ads-header, #adv-text, .ad-outside, #ad_2, .adsleft, .sidebar-ad, [href^=3D=
"https://zstacklife.com/"] img, #ad_top, .region-ad-top, div[data-ad-target=
ing], .ad_top, #adcontainer1, .fixed_ad, .advert-detail, .adActive, #adWrap=
per, .node-ad, .adthrive-video-player, .adrect, .block-ad, .nav_ad, .ad_cap=
tion, [href^=3D"http://www.mypillow.com/"] > img, .article-advert, .adverti=
sement-block, .ad-popup, .adcenter, .large-advert, #ad-rotator, .sidebar-ad=
s, .ad_box, #google-ads, .adsbottombox, .mntl-leaderboard-spacer, .containe=
r-ads, .adsBlock, .page_ad, #side-ad, .o-ad-container, [href^=3D"https://my=
store.com/"] > img, .ad-content, .ad-text, .article_ad, .bottom_ad_block, #=
topAd, [href^=3D"https://noqreport.com/"] > img, .ad_container, .sponsored-=
article, .custom-ad, .wps-player-wrap, .contentAds, .adshome, .bottom_ad, .=
mainAd, .banner-ad-container, .head_ad, .ads-inline, .small-ads, #stickyads=
, .ad-current, [href^=3D"https://www.mypatriotsupply.com/"] > img, div[id^=
=3D"ad_position_"], a[href^=3D"https://ndt5.net/"], div[aria-label=3D"Ads"]=
, a[href^=3D"https://click.dtiserv2.com/"], .has-fixed-bottom-ad, #ad_1, #r=
ight_ads, .reklama, .ads-title, #banner-ad, .advert_list, .footer-ad, .publ=
icidade, .adChoicesLogo, .advert2, .topAd, #rightad, .ads-loaded, .ad-label=
, .ads-header, .postad, div[id^=3D"div-gpt-"], [href^=3D"https://www.herban=
omic.com/"] > img, #ad_4, .sponsoredItem, .adHolder, .middlead, .adban, #ad=
-p3, .adslot, .sidebar_advert, .ac-widget-placeholder, #outbrain_widget_0, =
.ad-cover, .w-adsninja-video-player, .adverttext, .adsList, .body-top-ads, =
.ad-widget, .ad_global_header, .ad_bottom, .adwidget, .ads-banner, .ad-zone=
-container, #adsensewide, .ad_div, #ads-wrapper, a[href^=3D"https://natour.=
naughtyamerica.com/track/"], .side-ad, #sidebar-ad, #footer-ads, .ad_title,=
 .ad-enabled, #adtop, .content_ads, .ad-root, .display_ad, [href^=3D"https:=
//www.restoro.com/"], .advBox, .pbs__player, #ad-wrapper, .gallery-ad, #art=
icle_ad, #adbar, #leftad, #ad-carousel, .ad-click, .ads.widget, .ad336, .ad=
vert-container, .img_ad, #adsContainer, .ad-links, .display-ad, a[href^=3D"=
https://ad.doubleclick.net/"], .boxAds, .adLink, .has-ad, #ad-top, .ad728x9=
0, .ads_right, .adlink, .adText, .ads-core-placer, a[href^=3D"https://www.s=
heetmusicplus.com/"][href*=3D"?aff_id=3D"], .top-ad, .ad_spot, .ad_bg, .adv=
ertSlider, .vertical-ads, .adsense_wrapper, .adthrive-content, .box_ads, .a=
dvertorial, .ad_left, #ads-menu, .home-ad, div[id^=3D"dfp-ad-"], .ad-zone, =
.adMiddle, .product-ads, .adv-box, .header_ad, #mplayer-embed, #related_ads=
, .ads-left, .advertiser, .column-ad, .ad_frame, .adtitle, .c-ads, #ads-lef=
t, #advertise, .ad_main, #prerollAd, .ad-button, .adtag, .ad-center, .ad_it=
em, .small_ad, .ads-mobile, .topads, .adverts, .block-sponsor, #adcontainer=
, .ad-title, .ad_banner, .anyClipWrapper, ins.adsbygoogle[data-ad-client], =
.ad-icon, [href^=3D"https://mypillow.com/"] > img, [id^=3D"div-gpt-ad"], .a=
dImg, #headerAd, .advads-widget, a[onmousedown^=3D"this.href=3D'https://pai=
d.outbrain.com/network/redir?"][target=3D"_blank"], [href^=3D"https://www.m=
ypillow.com/"] > img, .ads1, .adwords, .after-post-ad { display: none !impo=
rtant; }
------MultipartBoundary--yENwd9FbLx5269kbRuMLh3486PXEW5c4SJwxhoR6YW------
