<?xml version = '1.0' encoding='US-ASCII'?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
  <!ENTITY rfc1847 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.1847.xml">
  <!ENTITY rfc1866 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.1866.xml">
  <!ENTITY rfc2045 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2045.xml">
  <!ENTITY rfc2046 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2046.xml">
  <!ENTITY rfc2047 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2047.xml">
  <!ENTITY rfc2049 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2049.xml">
  <!ENTITY rfc2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
  <!ENTITY rfc2183 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2183.xml">
  <!ENTITY rfc2268 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2268.xml">
  <!ENTITY rfc2311 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2311.xml">
  <!ENTITY rfc2312 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2312.xml">
  <!ENTITY rfc2313 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2313.xml">
  <!ENTITY rfc2314 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2314.xml">
  <!ENTITY rfc2315 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2315.xml">
  <!ENTITY rfc2317 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2317.xml">
  <!ENTITY rfc2630 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2630.xml">
  <!ENTITY rfc2631 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2631.xml">
  <!ENTITY rfc2632 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2632.xml">
  <!ENTITY rfc2633 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2633.xml">
  <!ENTITY rfc2634 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2634.xml">
  <!ENTITY rfc2785 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2785.xml">
  <!ENTITY rfc3218 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3218.xml">
  <!ENTITY rfc3274 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3274.xml">
  <!ENTITY rfc3370 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3370.xml">
  <!ENTITY rfc3560 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3560.xml">
  <!ENTITY rfc3565 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3565.xml">
  <!ENTITY rfc3766 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3766.xml">
  <!ENTITY rfc3850 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3850.xml">
  <!ENTITY rfc3851 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3851.xml">
  <!ENTITY rfc3852 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3852.xml">
  <!ENTITY rfc4056 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4056.xml">
  <!ENTITY rfc4086 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4086.xml">
  <!ENTITY rfc4134 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4134.xml">
  <!ENTITY rfc4270 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4270.xml">
  <!ENTITY rfc6838 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6838.xml">
  <!ENTITY rfc4289 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4289.xml">
  <!ENTITY rfc4949 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4949.xml">
  <!ENTITY rfc5035 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5035.xml">
  <!ENTITY rfc5083 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5083.xml">
  <!ENTITY rfc5084 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5084.xml">
  <!ENTITY rfc5652 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5652.xml">
  <!ENTITY rfc5750 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5750.xml">
  <!ENTITY rfc5751 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5751.xml">
  <!ENTITY rfc5753 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5753.xml">
  <!ENTITY rfc5754 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5754.xml">
  <!ENTITY rfc6151 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6151.xml">
  <!ENTITY rfc6194 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6194.xml">
  <!ENTITY rfc6278 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6278.xml">
  <!ENTITY rfc7114 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7114.xml">
  <!ENTITY rfc7905 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7905.xml">
  <!ENTITY rfc8174 SYSTEM "http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml">
  <!ENTITY rfc8418 SYSTEM "http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8418.xml">
  <!ENTITY rfc8419 SYSTEM "http://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8419.xml">
]>

<?rfc toc='yes'?>
<?rfc symrefs='yes'?>
<?rfc sortrefs='yes' ?>
<?rfc compact='yes'?>
<?rfc subcompact='no' ?>
<?rfc text-list-symbols='-*o" ?>

<rfc ipr='pre5378Trust200902' number="8551" category='std' obsoletes="5751">
  <front>

    <title abbrev="S/MIME 4.0 Message Specification">Secure/Multipurpose Internet Mail Extensions (S/MIME) Version 4.0 Message Specification</title>

    <author fullname="Jim Schaad" initials="J." surname="Schaad">
      <organization>August Cellars</organization>
      <address>
        <email>ietf@augustcellars.com</email>
      </address>
    </author>

    <author fullname="Blake Ramsdell" initials="B." surname="Ramsdell">
      <organization>Brute Squad Labs, Inc.</organization>
      <address>
        <email>blaker@gmail.com</email>
      </address>
    </author>

    <author fullname="Sean Turner" initials="S." surname="Turner">
      <organization>sn3rd</organization>
      <address>
        <email>sean@sn3rd.com</email>
      </address>
    </author>

    <date month="January" year="2019"/>

    <keyword>S/MIME</keyword>

    <abstract>
      <t>
        This document defines Secure/Multipurpose Internet Mail Extensions
        (S/&wj;MIME) version 4.0.  S/&wj;MIME provides a consistent way to send and
        receive secure MIME data.  Digital signatures provide authentication,
        message integrity, and non-repudiation with proof of origin.
        Encryption provides data confidentiality.  Compression can be used to
        reduce data size.  This document obsoletes RFC 5751.
      </t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>
        S/&wj;MIME (Secure/Multipurpose Internet Mail Extensions) provides a
        consistent way to send and receive secure MIME data.  Based on the
        popular Internet MIME standard, S/&wj;MIME provides the following
        cryptographic security services for electronic messaging
        applications:  authentication, message integrity, and non-repudiation
        of origin (using digital signatures), and data confidentiality (using
        encryption).  As a supplementary service, S/&wj;MIME provides message
        compression.
      </t>

      <t>
        S/&wj;MIME can be used by traditional mail user agents (MUAs) to add
        cryptographic security services to mail that is sent, and to
        interpret cryptographic security services in mail that is received.
        However, S/&wj;MIME is not restricted to mail; it can be used with any
        transport mechanism that transports MIME data, such as HTTP or SIP.
        As such, S/&wj;MIME takes advantage of the object-based features of MIME
        and allows secure messages to be exchanged in mixed-transport
        systems.
      </t>
      
      <t>
        Further, S/&wj;MIME can be used in automated message transfer agents that
        use cryptographic security services that do not require any human
        intervention, such as the signing of software-generated documents and
        the encryption of FAX messages sent over the Internet.
      </t>

      <t>
        This document defines version 4.0 of the S/MIME Message Specification.
        As such, this document obsoletes version 3.2 of the S/MIME Message Specification <xref target="RFC5751"/>.
      </t>

      <t>
        This specification contains a number of references to documents that
        have been obsoleted or replaced.  This is intentional, as the
        updated documents often do not have the same information or protocol requirements in them.
      </t>
      
      <section title="Specification Overview" anchor="SpecOverview">

        <t>
          This document describes a protocol for adding cryptographic signature
          and encryption services to MIME data.  The MIME standard <xref target="MIME-SPEC"/>
          provides a general structure for the content of Internet messages and
          allows extensions for new applications based on content-type.
        </t>
        <t>
          This specification defines how to create a MIME body part that has
          been cryptographically enhanced according to the Cryptographic
          Message Syntax (CMS) <xref target="CMS"/>, which is derived from
          PKCS&nbsp;#7 <xref target="RFC2315"/>.  This specification also defines the application/&wj;pkcs7-mime
          media type, which can be used to transport those body parts.
        </t>
        <t>
          This document also discusses how to use the multipart/&wj;signed media
          type defined in <xref target="RFC1847"/> to transport S/&wj;MIME signed messages.
          multipart/&wj;signed is used in conjunction with the
          application/&wj;pkcs7-signature media type, which is used to transport a detached S/&wj;MIME
          signature.
        </t>
        <t>
          In order to create S/&wj;MIME messages, an S/&wj;MIME agent MUST follow the
          specifications in this document, as well as the specifications listed
          in <xref target="CMS"/>, <xref target="RFC3370"/>,
          <xref target="RFC4056"/>, <xref target="RFC3560"/>, and <xref target="RFC5754"/>.
        </t>
        <t>
          Throughout this specification, there are requirements and
          recommendations made for how receiving agents handle incoming
          messages.  There are separate requirements and recommendations for
          how sending agents create outgoing messages.  In general, the best
          strategy is to follow the Robustness Principle (be liberal in what
	  you receive and conservative in what you send). Most of the
          requirements are placed on the handling of incoming messages,
          while the recommendations are mostly on the creation of outgoing
          messages.
        </t>
        <t>
          The separation for requirements on receiving agents and sending
          agents also derives from the likelihood that there will be S/&wj;MIME
          systems that involve software other than traditional Internet mail
          clients.  S/&wj;MIME can be used with any system that transports MIME
          data.  An automated process that sends an encrypted message might not
          be able to receive an encrypted message at all, for example.  Thus,
          the requirements and recommendations for the two types of agents are
          listed separately when appropriate.
        </t>
      </section>
      
      <section title="Definitions" anchor="Definitions">

        <t>
          For the purposes of this specification, the following definitions
          apply.
        </t>

        <t>
          <list style="hanging">
            <t hangText="ASN.1:"><vspace/>
              Abstract Syntax Notation One, as defined in ITU-T Recommendations X.680, X.681, X.682, and X.683 <xref target="ASN.1"/>.
            </t>
          <t hangText="BER:"><vspace/>
               Basic Encoding Rules for ASN.1, as defined in ITU-T Recommendation X.690 <xref target="X.690"/>.
            </t>

          <t hangText="Certificate:"><vspace/>
       A type that binds an entity's name to a public key
          with a digital signature.
            </t>

          <t hangText="DER:"><vspace/>
         Distinguished Encoding Rules for ASN.1, as defined
          in ITU-T Recommendation X.690 <xref target="X.690"/>.
            </t>

          <t hangText="7-bit data:"><vspace/>
        Text data with lines less than 998 characters
          long, where none of the characters have the 8th
          bit set, and there are no NULL characters.  &lt;CR>
          and &lt;LF&gt; occur only as part of a &lt;CR&gt;&lt;LF&gt;
          end&nbhy;of&nbhy;line delimiter.
            </t>


          <t hangText="8-bit data:"><vspace/>
        Text data with lines less than 998 characters, and
          where none of the characters are NULL characters.
          &lt;CR&gt; and &lt;LF&gt; occur only as part of a
          &lt;CR&gt;&lt;LF&gt; end&nbhy;of&nbhy;line delimiter.
            </t>

          <t hangText="Binary data:"><vspace/>Arbitrary data.
            </t>

          <t hangText="Transfer encoding:"><vspace/>
        A reversible transformation made on data so 8-bit
          or binary data can be sent via a channel that only
          transmits 7-bit data.
            </t>

          <t hangText="Receiving agent:"><vspace/>
       Software that interprets and processes S/&wj;MIME CMS
          objects, MIME body parts that contain CMS content
          types, or both.
            </t>

          <t hangText="Sending agent:"><vspace/>
        Software that creates S/&wj;MIME CMS content types,
          MIME body parts that contain CMS content types, or
          both.
            </t>

          <t hangText="S/MIME agent:"><vspace/>
         User software that is a receiving agent, a sending
          agent, or both.
          </t>

          <t hangText="Data integrity service:"><vspace/>
            A security service that protects against unauthorized changes to
            data by ensuring that changes to the data are detectable <xref
            target="RFC4949"/>.
          </t>

          <t hangText="Data confidentiality:"><vspace/>
            The property that data is not disclosed to system entities unless they have been authorized to know the data <xref target="RFC4949"/>.
          </t>
          </list>
        </t>
      </section>
      <section title="Conventions Used in This Document" anchor="MUSTS">

        <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL",
        "SHALL&nbsp;NOT", "SHOULD", "SHOULD&nbsp;NOT", "RECOMMENDED",
        "NOT&nbsp;RECOMMENDED", "MAY", and "OPTIONAL" in this document
        are to be interpreted as described in BCP&nbsp;14
        <xref target="RFC2119"/> <xref target="RFC8174"/> when,
        and only when, they appear in all capitals, as shown here.</t>
        <!-- JLS - should BCP14  become a group reference since we are already doing this for other thing? -->

        <t>
          We define the additional requirement levels:

          <list style="hanging" hangIndent="10">
          <t hangText="SHOULD+">This term means the same as SHOULD.  However, the authors
          expect that a requirement marked as SHOULD+ will be
          promoted at some future time to be a MUST.
          </t>

          <t hangText="SHOULD-">This term means the same as SHOULD.  However, the authors
          expect that a requirement marked as SHOULD- will be demoted
          to a MAY in a future version of this document.
          </t>
          <t hangText="MUST-">This term means the same as MUST.  However, the authors
          expect that this requirement will no longer be a MUST in a
          future document.  Although its status will be determined at
          a later time, it is reasonable to expect that if a future
          revision of a document alters the status of a MUST-
          requirement, it will remain at least a SHOULD or a SHOULD-.
          </t>
          </list>
        </t>

     <t>The term "RSA" in this document almost always refers to the PKCS&nbsp;#1&nbsp;v1.5 RSA <xref target="RFC2313"/> signature or encryption algorithms even when not qualified as such.
     There are a couple of places where it refers to the general RSA cryptographic operation; these can be determined from the context where it is used.
   </t>
      </section>
      
      <section title="Compatibility with Prior Practice of S/MIME" anchor="Compatability">
        <t>
          S/&wj;MIME version 4.0 agents ought to attempt to have the greatest
          interoperability possible with agents for prior versions of
          S/&wj;MIME.</t>

<t><list style="symbols">
          <t>S/&wj;MIME version 2 is described in RFC 2311 through RFC 2315
          inclusive <xref target="SMIMEv2"/>.</t>

          <t>S/&wj;MIME version 3 is described in RFC 2630 through RFC 2634
          inclusive and RFC 5035 <xref target="SMIMEv3"/>.</t>

          <t>S/&wj;MIME version 3.1 is described in RFC 3850, RFC 3851, RFC
          3852, RFC 2634, and RFC 5035 <xref target="SMIMEv3.1"/>.</t>

          <t>S/&wj;MIME version 3.2 is described in RFC 2634, RFC 5750,
          RFC 5751, RFC 5652, and RFC 5035 <xref target="SMIMEv3.2"/>.</t>
          
          <t><xref target="RFC2311"/> also has historical information about
          the development of S/&wj;MIME.</t>
        </list></t>

      </section>

<!-- Pulled from RFC 5751, except for first sentence.
     Only changes are "Key ..."->"The key ..." and "were" in paragraph 2 -->
      <section title="Changes from S/MIME v3 to S/MIME v3.1">

        <t>
          This section describes the changes made between S/MIME v3 and
          S/MIME&nbsp;v3.1.  Note that the requirement levels indicated by the
  capitalized key words ("MUST", "SHOULD", etc.) may have changed in
  later versions of S/MIME.
        </t>

        <t><list style="symbols">
        <t>
          The RSA public key algorithm was changed to a MUST implement.
          The key wrap algorithm and the Diffie-Hellman (DH) algorithm <xref
          target="RFC2631"/> were changed to a SHOULD implement.
        </t>
        <t>
          The AES symmetric encryption algorithm has been included as a
          SHOULD implement.
        </t>
        <t>
          The RSA public key algorithm was changed to a MUST implement
          signature algorithm.
        </t>
        <t>
          Ambiguous language about the use of "empty" SignedData messages to
          transmit certificates was clarified to reflect that transmission of
          Certificate Revocation Lists is also allowed.
        </t>
        <t>
          The use of binary encoding for some MIME entities is now explicitly
          discussed.
        </t>
        <t>
          Header protection through the use of the message/rfc822 media type
          has been added.
        </t>
        <t>
          Use of the CompressedData CMS type is allowed, along with required
          media type and file extension additions.
        </t>
      </list></t>
      </section>

<!-- Pulled from RFC 5751.  Updated with author OK / AUTH state. -->
      <section title="Changes from S/MIME v3.1 to S/MIME v3.2">
        <t>
          This section describes the changes made between S/MIME v3.1 and
          S/MIME v3.2.  Note that the requirement levels indicated by the
  capitalized key words ("MUST", "SHOULD", etc.) may have changed in
  later versions of S/MIME.
          Note that the section numbers listed here (e.g., 3.4.3.2) are from
          <xref target="RFC5751"/>.
        </t>

        <t><list style="symbols">
        <t>
          Made editorial changes, e.g., replaced "MIME type" with "media
          type", "content-type" with "Content-Type".
        </t>
        <t>
          Moved "Conventions Used in This Document" to <xref target="MUSTS"/>.  Added
          definitions for SHOULD+, SHOULD-, and MUST-.
        </t>
        <t>
          <xref target="SpecOverview"/> and <xref target="ASN1Module"/>: Added
          references to RFCs for RSASSA&nbhy;PSS, RSAES-OAEP, and SHA2 CMS
          algorithms.  Added CMS Multiple Signers Clarification to CMS
          reference.
        </t>
        <t>
          <xref target="Definitions"/>: Updated references to ASN.1 to X.680,
          and BER and DER to X.690.
        </t>
        <t>
          <xref target="Compatability"/>: Added references to S/&wj;MIME v3.1
	  RFCs.
        </t>

        <t>
          <xref target="DigestAlgorithmIdentifier"/> (digest algorithm):
          SHA-256 added as MUST, SHA-1 and MD5 made SHOULD-.</t>
        <t>
          <xref target="SignatureAlgorithmIdentifier"/> (signature
          algorithms): RSA with SHA-256 added as MUST; DSA with SHA-256 added
          as SHOULD+; RSA with SHA&nbhy;1, DSA with SHA&nbhy;1, and RSA with
          MD5 changed to SHOULD-; and RSASSA-PSS with SHA-256 added as
          SHOULD+.  Also added note about what S/&wj;MIME v3.1 clients support.
        </t>
        <t>
          <xref target="KeyEncryptionAlgorithmIdentifier"/> (key encryption): DH changed to SHOULD-, and RSAES-OAEP
          added as SHOULD+.  Elaborated on requirements for key wrap algorithm.
        </t>
        <t>
          <xref target="SignTime"/>: Added requirement that receiving agents MUST support
          both GeneralizedTime and UTCTime.
        </t>
        <t>
          <xref target="SMIMECaps"/>: Replaced reference "sha1WithRSAEncryption" with
          "sha256WithRSAEncryption", replaced "DES-3EDE-CBC" with "AES-128
          CBC", and deleted the RC5 example.
        </t>
<!-- "2.5.2.1" is from RFC 5751 -->
        <t>
          Section 2.5.2.1: Deleted entire section (discussed deprecated&nbsp;RC2).
        </t>

<!-- Left the hard-coded "2.7.1" to match the original text -->
        <t>
          <xref target="ContentEncryptionAlgorithmIdentifier"/>, Section 2.7.1,
          and <xref target="ASN1Module"/>: References to RC2/40 removed.
        </t>
        <t>
          <xref target="ContentEncryptionAlgorithmIdentifier"/> (content encryption): AES-128 CBC added as MUST, AES-192
          and AES-256 CBC SHOULD+, and tripleDES now SHOULD-.
        </t>
        <t>
          <xref target="WhichEncAlg"/>: Updated pointers from
          2.7.2.1 through 2.7.2.4 to
          <xref target="KnownCaps" format="counter"/>
          and <xref target="UnknownCaps" format="counter"/>.
        </t>
        <t>
          <xref target="Canonicalization"/>: Removed text about MIME character sets.
        </t>
        <t>
          Sections <xref target="smime-type" format="counter"/> and 3.6: Replaced "encrypted" with
          "enveloped".  Updated OID example to use AES-128 CBC OID.
        </t>
        <t>
<!-- "3.4.3.2" is from RFC 5751 -->
          Section 3.4.3.2: Replaced "micalg" parameter for "SHA&nbhy;1" with "sha&nbhy;1".
        </t>
        <t>
          <xref target="CertProcessing"/>: Updated reference to CERT v3.2.
        </t>
        <t>
          <xref target="KeyPairs"/>: Updated RSA and DSA key size discussion.  Moved last
          four sentences to security considerations.  Updated reference to
          randomness requirements for security.
        </t>
        <t>
          <xref target="IANA"/>: Added IANA registration templates to update media type
          registry to point to this document as opposed to RFC 2311.
        </t>
        <t>
          <xref target="SecurityConsiderations"/>: Updated security considerations.
        </t>

<!-- Hard-coded "Section 7" because this is from RFC 5751 -->
        <t>
          Section 7: Moved references from <xref target="HistoricMail"/> to
          this section.  Updated references.  Added informative references
          to SMIMEv2, SMIMEv3, and SMIMEv3.1.
        </t>
        <t>
          <!--
              JLS:  This should be changed to a hard coded string if you are trying to save the old section number.  Otherwise V2Historic is correct
          -->
          <xref target="HistoricMail"/>: Added <xref target="HistoricMail"/>
          to move S/&wj;MIME v2 to Historic status.
        </t>
      </list></t>
      </section>

      <section title="Changes for S/MIME v4.0">
        <t>
          This section describes the changes made between S/MIME v3.2 and S/MIME v4.0.
        </t>
        <t>
          <list style="symbols">
            <t>
              Added the use of AuthEnvelopedData, including defining and
              registering an smime-type value (Sections&nbsp;<xref
              target="AuthEnvelopedData1" format="counter"/> and <xref
              target="AuthEnvelopedData2" format="counter"/>).
            </t>
            <t>
              Updated the content-encryption algorithms (Sections&nbsp;<xref
              target="ContentEncryptionAlgorithmIdentifier" format="counter"/> and <xref
              target="UnknownCaps" format="counter"/>): added AES-256 
              Galois/Counter Mode (GCM), added
              ChaCha20-Poly1305, removed mention of AES-192 Cipher Block
              Chaining (CBC), and marked
              tripleDES as historic.
            </t>
            <t>
              Updated the set of signature algorithms (<xref
              target="SignatureAlgorithmIdentifier"/>): added the Edwards-curve
              Digital Signature Algorithm (EdDSA), added the Elliptic Curve
              Digital Signature Algorithm (ECDSA), and marked DSA as historic.
            </t>
            <t>
              Updated the set of digest algorithms (<xref
              target="DigestAlgorithmIdentifier"/>): added SHA-512, and marked
              SHA-1 as historic.
            </t>
            <t>
              Updated the size of keys to be used for RSA encryption and RSA
              signing (<xref target="CertProcessing"/>).
            </t>
            <t>
              Created <xref target="HistoricMail"/>, which discusses
              considerations for dealing with historic email messages.
            </t>
          </list>
        </t>
      </section>
      
    </section>

    <section title="CMS Options">

      <t>
        CMS allows for a wide variety of options in content, attributes, and
        algorithm support.  This section puts forth a number of support
        requirements and recommendations in order to achieve a base level of
        interoperability among all S/&wj;MIME implementations.  <xref target="RFC3370"/> and
        <xref target="RFC5754"/> provide additional details regarding the use of the
        cryptographic algorithms.  <xref target="ESS"/> provides additional details
        regarding the use of additional attributes.
      </t>
      
      <section title="DigestAlgorithmIdentifier" anchor="DigestAlgorithmIdentifier">
        <t>
          The algorithms here are used for digesting the body of the message
          and are not the same as the digest algorithms used as part of the
          signature algorithms. The result of this is placed in the
          message&nbhy;digest attribute of the signed attributes. It is RECOMMENDED
          that the algorithm used for digesting the body of the message be of
          similar strength to, or greater strength than, the signature algorithm.
        </t>
        
        <t>
          Sending and receiving agents:
          <list style="symbols">
            <t>
              MUST support SHA-256.
            </t>
            <t>
              MUST support SHA-512.
            </t>
          </list>
        </t>

        <t>
          <xref target="RFC5754"/> provides the details for using these algorithms with S/&wj;MIME.
        </t>
            
      </section>
      
      <section title="SignatureAlgorithmIdentifier" anchor="SignatureAlgorithmIdentifier">
        <t>
          There are different sets of requirements placed on receiving and
          sending agents. By having the different requirements, the maximum
          amount of interoperability is achieved, as it allows for specialized
          protection of private key material but maximum signature validation.
        </t>
        
        <t>
          Receiving agents:
          <list style="symbols">
            <t>
              MUST support ECDSA with curve P-256 and SHA-256.
            </t>
            <t>
              MUST support EdDSA with curve25519 using PureEdDSA mode <xref
              target="RFC8419"/>.
            </t>
            <t>
              MUST- support RSA PKCS&nbsp;#1 v1.5 with SHA-256.
            </t>
            <t>
              SHOULD support the RSA Probabilistic Signature Scheme
              (RSASSA-PSS) with SHA-256.
            </t>
          </list>
        </t>

        <t>
          Sending agents:
          <list style="symbols">
            <t>
              MUST support at least one of the following algorithms: ECDSA
              with curve P-256 and SHA-256, or EdDSA with curve25519 using
              PureEdDSA mode.
            </t>
            
            <t>
              MUST- support RSA PKCS&nbsp;#1 v1.5 with SHA-256.
            </t>
            <t>
              SHOULD support RSASSA-PSS with SHA-256.
            </t>
          </list>
        </t>
        
        <t>
          See <xref target="KeyPairs"/> for information on key size and algorithm references.
        </t>
        
      </section>
      <section title="KeyEncryptionAlgorithmIdentifier" anchor="KeyEncryptionAlgorithmIdentifier">
        <t>
          Receiving and sending agents:
          <list style="symbols">
            <t>
              MUST support Elliptic Curve Diffie-Hellman (ECDH) ephemeral-static mode for P-256, as specified in <xref target="RFC5753"/>.
            </t>
            
            <t>
              MUST support ECDH ephemeral-static mode for X25519 using
              HKDF-256 ("HKDF" stands for "HMAC-based Key Derivation
              Function") for the KDF, as specified in <xref target="RFC8418"/>.
            </t>
            
            <t>
              MUST- support RSA encryption, as specified in <xref target="RFC3370"/>.
            </t>
            <t>
              SHOULD+ support RSA Encryption Scheme - Optimal Asymmetric
              Encryption Padding (RSAES-OAEP), as specified in <xref target="RFC3560"/>.
            </t>
            
          </list>
        </t>
        
        <t>
          When ECDH ephemeral-static is used, a key wrap algorithm is also
          specified in the KeyEncryptionAlgorithmIdentifier <xref
          target="RFC5652"/>.  The underlying encryption functions for the key
          wrap and content-encryption algorithms <xref target="RFC3370"/> <xref
          target="RFC3565"/> and the key sizes for the two algorithms MUST be
          the same (e.g., AES-128 key wrap algorithm with AES-128
          content-encryption algorithm). As both 128-bit and 256-bit AES modes are
          mandatory to implement as content-encryption algorithms (<xref
          target="ContentEncryptionAlgorithmIdentifier"/>), both the AES-128
          and AES-256 key wrap algorithms MUST be supported when ECDH
          ephemeral-static is used. Recipients MAY enforce this but MUST use
          the weaker of the two as part of any cryptographic strength
          computations they might do.
        </t>

        <t>
          <xref target="HistoricMail"/> provides information on algorithm support in older versions of S/MIME.
        </t>
        
      </section>
      <section title="General Syntax">
        <t>
          There are several CMS content types.  Of these, only the Data,
          SignedData, EnvelopedData, AuthEnvelopedData, and CompressedData content types are
          currently used for S/&wj;MIME.
        </t>
        <section title="Data Content Type">
          <t>
            Sending agents MUST use the id-data content type identifier to
            identify the "inner" MIME message content.  For example, when
            applying a digital signature to MIME data, the CMS SignedData
            encapContentInfo eContentType MUST include the id-data object
            identifier (OID), and the media type MUST be stored in the SignedData
            encapContentInfo eContent OCTET STRING (unless the sending agent is
            using multipart/&wj;signed, in which case the eContent is absent,
            per <xref target="SignMultipart"/> of this document).  As another
            example, when applying encryption to MIME data, the CMS
            EnvelopedData encryptedContentInfo contentType MUST include the
            id-data OID and the encrypted MIME content MUST be
            stored in the EnvelopedData encryptedContentInfo encryptedContent
            OCTET STRING.
          </t>
        </section>

        <section title="SignedData Content Type">
          <t>
            Sending agents MUST use the SignedData content type to apply a
            digital signature to a message or, in a degenerate case where there
            is no signature information, to convey certificates.  Applying a
            signature to a message provides authentication, message integrity,
            and non&nbhy;repudiation of origin.
          </t>
        </section>

        <section title="EnvelopedData Content Type">
          <t>
            This content type is used to apply data confidentiality to a message.
            In order to distribute the symmetric key, a sender needs to have access to a public key for each intended
            message recipient to use this service.
          </t>
        </section>

        <section title="AuthEnvelopedData Content Type" anchor="AuthEnvelopedData1">
          <t>
            This content type is used to apply data confidentiality and message integrity to a message.
            This content type does not provide authentication or non&nbhy;repudiation.
            In order to distribute the symmetric key, a sender needs to have access to a public key for each intended
            message recipient to use this service.
          </t>
        </section>

        <section title="CompressedData Content Type">
          <t>
            This content type is used to apply data compression to a message.
            This content type does not provide authentication, message integrity,
            non&nbhy;repudiation, or data confidentiality; it is only used to reduce
            the message's size.
          </t>
          <t>
            See <xref target="MultipleOperations"/> for further guidance on
            the use of this type in conjunction with other CMS types.
          </t>
        </section>
      </section>

      <section title="Attributes and the SignerInfo Type">
        <t>
          The SignerInfo type allows the inclusion of unsigned and signed
          attributes along with a signature.
          These attributes can be required for the processing of messages
          (e.g., message digest), information the signer supplied (e.g.,
          SMIME capabilities) that should be processed, or attributes that are
          not relevant to the current situation (e.g., mlExpansionHistory <xref
          target="RFC2634"/> for mail viewers).
        </t>
        <t>
          Receiving agents MUST be able to handle zero or one instance of each
          of the signed attributes listed here.  Sending agents SHOULD generate
          one instance of each of the following signed attributes in each
          S/&wj;MIME message:
          <list style="symbols">
            <t>
              Signing time (<xref target="SignTime"/> in this document)
            </t>
            <t>
              SMIME capabilities (<xref target="SMIMECaps"/> in this document)
            </t>
            <t>
              Encryption key Preference (<xref target="EncryptKeyPref"/> in this
              document)
            </t>
            <t>
              Message digest (Section 11.2 in <xref target="RFC5652"/>)
            </t>
            <t>
              Content type (Section 11.1 in <xref target="RFC5652"/>)
            </t>
          </list>
        </t>
        <t>
          Further, receiving agents SHOULD be able to handle zero or one
          instance of the signingCertificate and signingCertificateV2 signed
          attributes, as defined in Section&nbsp;5 of RFC&nbsp;2634 <xref
          target="ESS"/> and Section&nbsp;3 of RFC&nbsp;5035 <xref
          target="ESS"/>, respectively.
        </t>
        <t>
          Sending agents SHOULD generate one instance of the signingCertificate
          or signingCertificateV2 signed attribute in each SignerInfo
          structure.
        </t>
        <t>
          Additional attributes and values for these attributes might be
          defined in the future.  Receiving agents SHOULD handle attributes or
          values that they do not recognize in a graceful manner.
        </t>
        <t>
          Interactive sending agents that include signed attributes that are
          not listed here SHOULD display those attributes to the user, so that
          the user is aware of all of the data being signed.
        </t>

        <section title="Signing Time Attribute" anchor="SignTime">
          <t>
            The signingTime attribute is used to convey the time that a message
            was signed.  The time of signing will most likely be created by a
            signer and therefore is only as trustworthy as that signer.
          </t>

<!-- Reviewer:  "YY," "19YY," and "20YY" are OK; they represent years. -->
          <t>
            Sending agents MUST encode signing time through the year 2049 as
            UTCTime; signing times in 2050 or later MUST be encoded as
            GeneralizedTime.  When the UTCTime CHOICE is used, S/&wj;MIME agents MUST
            interpret the year field (YY) as follows:
            <list style="none">
              <t>
                If YY is greater than or equal to 50, the year is interpreted as
                19YY; if YY is less than 50, the year is interpreted as 20YY.
              </t>
            </list>
          </t>
          <t>
            Receiving agents MUST be able to process signingTime attributes that
            are encoded in either UTCTime or GeneralizedTime.
          </t>
        </section>
        <section title="SMIMECapabilities Attribute" anchor="SMIMECaps">
          <t>
            The SMIMECapabilities attribute includes signature algorithms (such
            as "sha256WithRSAEncryption"), symmetric algorithms (such as "AES-128
            CBC"), authenticated symmetric algorithms (such as "AES-128 GCM"), and key encipherment algorithms (such as "rsaEncryption").
            The presence of an SMIMECapability attribute containing an algorithm implies that the sender can deal with the algorithm as well as understand the ASN.1 structures associated with that algorithm.
            There are also several identifiers that indicate support for other
            optional features such as binary encoding and compression.  The
            SMIMECapabilities attribute was designed to be flexible and extensible so
            that, in the future, a means of identifying other capabilities and
            preferences such as certificates can be added in a way that will not
            cause current clients to break.
          </t>
          <t>
            If present, the SMIMECapabilities attribute MUST be a SignedAttribute.
            CMS defines SignedAttributes as a SET OF Attribute.
            The SignedAttributes in a signerInfo MUST include a single instance of the SMIMECapabilities attribute.
            CMS defines the ASN.1 syntax for Attribute to include attrValues SET OF AttributeValue.
            An SMIMECapabilities attribute MUST only include a single instance of AttributeValue.
            If a signature is detected as violating these requirements, the signature SHOULD be treated as failing.
          </t>
          <t>
            The semantics of the SMIMECapabilities attribute specify a partial
            list as to what the client announcing the SMIMECapabilities can
            support.  A client does not have to list every capability it
            supports, and it need not list all its capabilities so that the
            capabilities list doesn't get too long.  In an SMIMECapabilities
            attribute, the OIDs are listed in order of their
            preference but SHOULD be separated logically along the lines of
            their categories (signature algorithms, symmetric algorithms, key
            encipherment algorithms, etc.).
          </t>
          <t>
            The structure of the SMIMECapabilities attribute is to facilitate
            simple table lookups and binary comparisons in order to determine
            matches.
            For instance, the encoding for the SMIMECapability for sha256WithRSAEncryption includes rather than omits the NULL parameter.
            Because of the requirement for identical encoding,
            individuals documenting algorithms to be used in the
            SMIMECapabilities attribute SHOULD explicitly document the correct
            byte sequence for the common cases.
          </t>
          <t>
            For any capability, the associated parameters for the OID MUST
            specify all of the parameters necessary to differentiate between two
            instances of the same algorithm.
          </t>
          <t>
            The same OID that is used to identify an algorithm SHOULD also
            be used in the SMIMECapability for that algorithm.  There are
            cases where a single OID can correspond to multiple algorithms.
            In these cases, a single algorithm MUST be assigned to the
            SMIMECapability using that OID.  Additional OIDs from the
            smimeCapabilities OID tree are then allocated for the other
            algorithms usages.

<!-- [rfced] [AD]  Section 2.5.2:  Please review the updated text
(per author, during the AUTH state), and let us know if you approve.
(The update appears to be editorial, but we have to err on the side
of caution in case it could be considered technical.)

Original question:
We found this sentence difficult to
follow.  If the suggested text is not correct, please clarify
"The OIDs ... SHOULD use the same OID" and "ambiguous from."

Original:
 The OIDs that correspond to algorithms SHOULD use the same OID as the
 actual algorithm, except in the case where the algorithm usage is
 ambiguous from the OID.

Suggested:
 Each OID that corresponds to an algorithm SHOULD be the same OID as
 the OID for the actual algorithm, except in the case where such an
 OID renders the algorithm usage ambiguous.

Currently (per author input):
-->
<!-- JLS - updated the end of the sentence -->

  For instance, in an earlier specification,
            rsaEncryption was ambiguous because it could refer to either a
            signature algorithm or a key encipherment algorithm.  In the event
            that an OID is ambiguous, it needs to be arbitrated by the maintainer
            of the registered SMIMECapabilities list as to which type of
            algorithm will use the OID, and a new OID MUST be allocated under the
            smimeCapabilities OID to satisfy the other use of the OID.
          </t>
          <t>
            The registered SMIMECapabilities list specifies the parameters for
            OIDs that need them, most notably key lengths in the case of
            variable-length symmetric ciphers.  In the event that there are no
            differentiating parameters for a particular OID, the parameters MUST
            be omitted and MUST NOT be encoded as NULL.  Additional values for
            the SMIMECapabilities attribute might be defined in the future.
            Receiving agents MUST handle an SMIMECapabilities object that has
            values that it does not recognize in a graceful manner.
          </t>
          <t>
            <xref target="WhichEncAlg"/> explains a strategy for caching capabilities.
          </t>
        </section>
        <section title="Encryption Key Preference Attribute" anchor="EncryptKeyPref">
          <t>
            The encryption key preference attribute allows the signer to
            unambiguously describe which of the signer's certificates has the
            signer's preferred encryption key.  This attribute is designed to
            enhance behavior for interoperating with those clients that use
            separate keys for encryption and signing.  This attribute is used to
            convey to anyone viewing the attribute which of the listed
            certificates is appropriate for encrypting a session key for future
            encrypted messages.
          </t>
          <t>
            If present, the SMIMEEncryptionKeyPreference attribute MUST be a SignedAttribute.
            CMS defines SignedAttributes as a SET OF Attribute.
            The SignedAttributes in a signerInfo MUST include a single instance of the SMIMEEncryptionKeyPreference attribute.
            CMS defines the ASN.1 syntax for Attribute to include attrValues SET OF AttributeValue.
            An SMIMEEncryptionKeyPreference attribute MUST only include a single instance of AttributeValue.
            If a signature is detected as violating these requirements, the signature SHOULD be treated as failing.
          </t>
          <t>
            The sending agent SHOULD include the referenced certificate in the
            set of certificates included in the signed message if this attribute
            is used.  The certificate MAY be omitted if it has been previously
            made available to the receiving agent.  Sending agents SHOULD use
            this attribute if the commonly used or preferred encryption
            certificate is not the same as the certificate used to sign the
            message.
          </t>
          <t>
            Receiving agents SHOULD store the preference data if the signature on
            the message is valid and the signing time is greater than the
            currently stored value.  (As with the SMIMECapabilities, the clock
            skew SHOULD be checked and the data not used if the skew is too
            great.)  Receiving agents SHOULD respect the sender's encryption key
            preference attribute if possible.  This, however, represents only a
            preference, and the receiving agent can use any certificate in
            replying to the sender that is valid.
          </t>
          <t>
            <xref target="WhichEncAlg"/> explains a strategy for caching preference data.
          </t>
          
          <section title="Selection of Recipient Key Management Certificate">
            <t>
              In order to determine the key management certificate to be used when
              sending a future CMS EnvelopedData message for a particular
              recipient, the following steps SHOULD be followed:
              <list style="symbols">
                <t>
                  If an SMIMEEncryptionKeyPreference attribute is found in a
                  SignedData object received from the desired recipient, this
                  identifies the X.509 certificate that SHOULD be used as the X.509
                  key management certificate for the recipient.
                </t>
                <t>
                  If an SMIMEEncryptionKeyPreference attribute is not found in a
                  SignedData object received from the desired recipient, the set of
                  X.509 certificates SHOULD be searched for an X.509 certificate with
                  the same subject name as the signer of an X.509 certificate that can
                  be used for key management.
                </t>
                <t>
                  Or, use some other method of determining the user's key management
                  key.  If an X.509 key management certificate is not found, then
                  encryption cannot be done with the signer of the message.  If
                  multiple X.509 key management certificates are found, the S/&wj;MIME
                  agent can make an arbitrary choice between them.
                </t>
              </list>
            </t>
          </section>
        </section>
      </section>
        <section title="SignerIdentifier SignerInfo Type">
          <t>
            S/&wj;MIME v4.0 implementations MUST support both issuerAndSerialNumber
            and subjectKeyIdentifier.  Messages that use the subjectKeyIdentifier
            choice cannot be read by S/&wj;MIME v2 clients.
          </t>
          <t>
            It is important to understand that some certificates use a value for
            subjectKeyIdentifier that is not suitable for uniquely identifying a
            certificate.  Implementations MUST be prepared for multiple
            certificates for potentially different entities to have the same
            value for subjectKeyIdentifier and MUST be prepared to try each
            matching certificate during signature verification before indicating
            an error condition.
          </t>
        </section>
        
        <section title="ContentEncryptionAlgorithmIdentifier" anchor="ContentEncryptionAlgorithmIdentifier">
          <t>
            Sending and receiving agents:
            <list style="symbols">
              <t>
                MUST support encryption and decryption with AES-128 GCM and AES-256 GCM <xref target="RFC5084"/>.
              </t>

              <t>
                MUST- support encryption and decryption with AES-128 CBC <xref target="RFC3565"/>.
              </t>
              <t>
                SHOULD+ support encryption and decryption with ChaCha20-Poly1305 <xref target="RFC7905"/>.
              </t>
            </list>
          </t>
          
          <section title="Deciding Which Encryption Method to Use" anchor="WhichEncAlg">
            <t>
              When a sending agent creates an encrypted message, it has to decide
              which type of encryption to use.  The decision process involves using
              information garnered from the capabilities lists included in messages
              received from the recipient, as well as out-of-band information such
              as private agreements, user preferences, legal restrictions, and
              so&nbsp;on.
            </t>
            <t>
              <xref target="SMIMECaps"/> defines a method by which a sending agent can
              optionally announce, among other things, its decrypting capabilities
              in its order of preference.  The following method for processing and
              remembering the encryption capabilities attribute in incoming signed
              messages SHOULD be used.
              <list style="symbols">
                <t>
                  If the receiving agent has not yet created a list of
                  capabilities for the sender's public key, then, after verifying
                  the signature on the incoming message and checking the
                  timestamp, the receiving agent SHOULD create a new list
                  containing at least the signing time and the symmetric
                  capabilities.
                </t>
                <t>
                  If such a list already exists, the receiving agent SHOULD verify
                  that the signing time in the incoming message is greater than
                  the signing time stored in the list and that the signature is
                  valid.  If so, the receiving agent SHOULD update both the
                  signing time and capabilities in the list.  Values of the
                  signing time that lie far in the future (that is, a greater
                  discrepancy than any reasonable clock skew), or a capabilities
                  list in messages whose signature could not be verified, MUST NOT
                  be accepted.
                </t>
              </list>
            </t>
            <t>
              The list of capabilities SHOULD be stored for future use in creating
              messages.
            </t>
            <t>
              Before sending a message, the sending agent MUST decide whether it is
              willing to use weak encryption for the particular data in the
              message.  If the sending agent decides that weak encryption is
              unacceptable for this data, then the sending agent MUST NOT use a
              weak algorithm.  The decision to use or not use weak encryption
              overrides any other decision in this section about which encryption
              algorithm to use.
            </t>
            <t>
              Sections <xref target="KnownCaps" format="counter"/> and <xref
              target="UnknownCaps" format="counter"/> describe the decisions a sending
              agent SHOULD use when choosing which type of encryption will be applied
              to a message.  These rules are ordered, so the sending agent SHOULD
              make its decision in the order given.
            </t>
            
            <section title="Rule 1: Known Capabilities" anchor="KnownCaps">
              <t>
                If the sending agent has received a set of capabilities from the
                recipient for the message the agent is about to encrypt, then the
                sending agent SHOULD use that information by selecting the first
                capability in the list (that is, the capability most preferred by the
                intended recipient) that the sending agent knows how to encrypt.  The
                sending agent SHOULD use one of the capabilities in the list if the
                agent reasonably expects the recipient to be able to decrypt the
                message.
              </t>
            </section>
            
            <section title="Rule 2: Unknown Capabilities, Unknown Version of S/MIME" anchor="UnknownCaps">
              <t>
              If the following two conditions are met, the sending agent
              SHOULD use AES-256 GCM, as AES-256 GCM is a stronger algorithm
              and is required by S/MIME v4.0:
                <list style="symbols">
                  <t>
                    The sending agent has no knowledge of the encryption
                    capabilities of the recipient.
                  </t>
                  <t>
                    The sending agent has no knowledge of the version of
                    S/&wj;MIME used or supported by the recipient.
                  </t>
                </list>

                If the sending agent chooses not to use AES-256 GCM in this
                step, given the presumption is that a client implementing
                AES-GCM would do both AES-256 and AES-128, it SHOULD use
                AES-128 CBC.
              </t>
            </section>
          </section>
            <section title="Choosing Weak Encryption" anchor="WeakEncryption">
              <t>
                Algorithms such as RC2 are considered to be weak encryption algorithms.
                Algorithms such as TripleDES are not state of the art and are considered to be weaker algorithms than AES.
                A sending agent that is controlled by a human SHOULD
                allow a human sender to determine the risks of sending data using a
                weaker encryption algorithm before sending the data, and possibly allow
                the human to use a stronger encryption algorithm such as AES GCM or AES CBC even if there is a possibility that the recipient will not be able to process that algorithm.
              </t>
            </section>

            <section title="Multiple Recipients">
              <t>
                If a sending agent is composing an encrypted message to a group of
                recipients where the encryption capabilities of some of the
                recipients do not overlap, the sending agent is forced to send more
                than one message.  Please note that if the sending agent chooses to
                send a message encrypted with a strong algorithm and then send the
                same message encrypted with a weak algorithm, someone watching the
                communications channel could learn the contents of the strongly
                encrypted message simply by decrypting the weakly encrypted message.
              </t>
            </section>
          </section>
    </section>
        <section title="Creating S/MIME Messages">
          <t>
            This section describes the S/&wj;MIME message formats and how they are
            created.  S/&wj;MIME messages are a combination of MIME bodies and CMS
            content types.  Several media types as well as several CMS content
            types are used.  The data to be secured is always a canonical MIME
            entity.  The MIME entity and other data, such as certificates and
            algorithm identifiers, are given to CMS processing facilities that
            produce a CMS object.  Finally, the CMS object is wrapped in MIME.
            The "Enhanced Security Services for S/&wj;MIME" documents <xref target="ESS"/> provide
            descriptions of how nested, secured S/&wj;MIME messages are formatted.
            ESS provides a description of how a triple-wrapped S/&wj;MIME message is
            formatted using multipart/&wj;signed and application/&wj;pkcs7-mime for the
            signatures.
          </t>
          <t>
            S/&wj;MIME provides one format for enveloped-only data, several formats
            for signed-only data, and several formats for signed and enveloped
            data.  Several formats are required to accommodate several
            environments -- in particular, for signed messages.  The criteria for
            choosing among these formats are also described.
          </t>
          <t>

            Anyone reading this section is expected to understand MIME as
            described in <xref target="MIME-SPEC"/> and <xref target="RFC1847"/>.
          </t>

          <section title="Preparing the MIME Entity for Signing, Enveloping, or Compressing" anchor="MimePrep">
            <t>
              S/&wj;MIME is used to secure MIME entities.
              A MIME message is composed of a MIME header and a MIME body.
              A body can consist of a single MIME entity or a tree of
              MIME entities (rooted with a multipart).  S/MIME can be used
              to secure either a single MIME entity or a tree of
              MIME entities.  These entities can be in locations other than
              the root.  S/MIME can be applied multiple times to different
              entities in a single message.

<!-- [rfced] Section 3.1:  Authors, per this AUTH-state note from
Jim, please review the updated text in this paragraph, and let us
know if it is acceptable:

From Jim:
"S/MIME is used to secure MIME entities.  A MIME message is composed of a MIME
header and a MIME body.
A body can consist of a single mime entity or a tree of mime entities (rooted
with a multipart).  S/MIME can be used to secure either a single mime entity
or a tree of mime entities.  These entities can be in locations other than the
root.  S/MIIME can be applied multiple times to different entities in a single
message.   A MIME entity that is the whole message includes only ....

"I think this is probably a more accurate description of what I am trying to
say.  I am sure that it can still use some wordsmithing.  Please tag this with
a note that I need to be sure to run the new text pass everybody after it has
been finalized."

Our original question:  
Regarding this author note:  We are not sure
how best to update this sentence.  Would it help to somehow clarify
the concept of "sub-part" versus "part"?

Author note:
 RFC Editor - The following sentence as caused lots of arguments
 among the different reviewers.  Please make it look good.
 If you want to ask me about what I mean please feel free to do so.

Original:
 A MIME entity can be a sub-part, sub-parts of a
 MIME message, or the whole MIME message with all of its sub-parts.

Possibly:
 A MIME entity can be (1) one or more "sub-parts" of a MIME message
 or (2) the whole MIME message with all of its sub-parts.

Currently:
 S/MIME is used to secure MIME entities.  A MIME message is composed
 of a MIME header and a MIME body.  A body can consist of a single
 MIME entity or a tree of MIME entities (rooted with a multipart).
 S/MIME can be used to secure either a single MIME entity or a tree of
 MIME entities.  These entities can be in locations other than the
 root.  S/MIME can be applied multiple times to different entities in
 a single message. -->
              
              A MIME entity that is the whole message includes only the MIME message headers and MIME body and does not include the rfc822 header.
              Note that S/&wj;MIME can also be used to secure MIME entities used in applications other than Internet mail.
              For cases where protection of the rfc822 header is required, the
              use of the message/rfc822 media type is explained later in this section.
            </t>
            <t>
              The MIME entity that is secured and described in this section can be
              thought of as the "inside" MIME entity.  That is, it is the
              "innermost" object in what is possibly a larger MIME message.
              Processing "outside" MIME entities into CMS content types is
              described in <xref target="pkcs7-mime-media-type"/>, <xref
              target="Signed-Only"/>, and elsewhere.
              <!-- JLS M00TODO -->

<!-- [rfced] Section 3.1:  Per this AUTH-state note from Jim,
please let us know how best to update this text.

From Jim:
"It is intended to refer to other documents. Specifically if a new mime type
is defined it would be defined there. On the other hand I am not sure that I
understand what this is trying to say at this point in time.  I think that the
sentence should read

Creation of "outside" MIME entities that contain CMS content types is
described in ..."

Original question:
Will "elsewhere" be clear to readers
(i.e., does it refer to some other section in this document or to
other documents?)?

Original:
 That is, it is the
 "innermost" object in what is possibly a larger MIME message.
 Processing "outside" MIME entities into CMS content types is
 described in Section 3.2, Section 3.5, and elsewhere. -->

            </t>
            <t>
              The procedure for preparing a MIME entity is given in <xref target="MIME-SPEC"/>.
              The same procedure is used here with some additional restrictions
              when signing.  The description of the procedures from <xref target="MIME-SPEC"/> is
              repeated here, but it is suggested that the reader refer to those
              documents for the exact procedures.  This section also describes
              additional requirements.
            </t>
            <t>
              A single procedure is used for creating MIME entities that are to
              have any combination of signing, enveloping, and compressing applied.
              Some additional steps are recommended to defend against known
              corruptions that can occur during mail transport that are of
              particular importance for clear-signing using the multipart/&wj;signed
              format.  It is recommended that these additional steps be performed
              on enveloped messages, or signed and enveloped messages, so that the
              messages can be forwarded to any environment without modification.
            </t>
            <t>
              These steps are descriptive rather than prescriptive.  The
              implementer is free to use any procedure as long as the result
              is the&nbsp;same.
              <list style="format Step %d.">
                <t>  The MIME entity is prepared according to local
                conventions.
                </t>

              <t>  The leaf parts of the MIME entity are converted to
              canonical&nbsp;form.
              </t>
              <t>  Appropriate transfer encoding is applied to the leaves
              of&nbsp;the MIME entity.
              </t>
              </list>
            </t>
            <t>
              When an S/&wj;MIME message is received, the security services on the
              message are processed, and the result is the MIME entity.  That MIME
              entity is typically passed to a MIME-capable user agent where it is
              further decoded and presented to the user or receiving application.
            </t>
            <t>
              In order to protect outer, non-content-related message header
              fields (for instance, the "Subject", "To", "From", and "Cc"
              fields), the sending client MAY wrap a full MIME message in a
              message/rfc822 wrapper in order to apply S/&wj;MIME security
              services to these header fields.  It is up to the receiving
              client to decide how to present this "inner" header along with
              the unprotected "outer" header. Given the security difference
              between headers, it is RECOMMENDED that the receiving client
              provide a distinction between header fields, depending on where
              they are located.
            </t>
            <t>
              When an S/&wj;MIME message is received, if the top-level protected MIME
              entity has a Content-Type of message/rfc822, it can be assumed that
              the intent was to provide header protection.  This entity SHOULD be
              presented as the top-level message, taking into account
              header&nbhy;merging issues as previously discussed.
            </t>
            
            <section title="Canonicalization" anchor="Canonicalization">
              <t>
                Each MIME entity MUST be converted to a canonical form that is
                uniquely and unambiguously representable in the environment where the
                signature is created and the environment where the signature will be
                verified.  MIME entities MUST be canonicalized for enveloping and
                compressing as well as signing.
              </t>
              <t>
                The exact details of canonicalization depend on the actual media type
                and subtype of an entity and are not described here.  Instead, the
                standard for the particular media type SHOULD be consulted.  For
                example, canonicalization of type text/plain is different from
                canonicalization of audio/basic.  Other than text types, most types
                have only one representation, regardless of computing platform or
                environment, that can be considered their canonical representation.
                In general, canonicalization will be performed by the non&nbhy;security
                part of the sending agent rather than the S/&wj;MIME implementation.
              </t>
              <t>
                The most common and important canonicalization is for text, which is
                often represented differently in different environments.  MIME
                entities of major type "text" MUST have both their line endings and
                character set canonicalized.  The line ending MUST be the pair of
                characters &lt;CR&gt;&lt;LF&gt;, and the charset SHOULD be a registered charset
                <xref target="CHARSETS"/>.  The details of the canonicalization are specified in
                <xref target="MIME-SPEC"/>.
              </t>
              <t>
                Note that some charsets such as ISO-2022 have multiple
                representations for the same characters.  When preparing such text
                for signing, the canonical representation specified for the charset
                MUST be used.
              </t>
            </section>
            <section title="Transfer Encoding">
              <t>
                When generating any of the secured MIME entities below, except the signing using the multipart/&wj;signed format, no transfer encoding is required at all.
                S/&wj;MIME implementations MUST be able to deal with binary MIME objects.
                If no Content-Transfer-Encoding header field is present, the transfer encoding is presumed to be 7BIT.
              </t>
              <t>
                As a rule, S/&wj;MIME implementations SHOULD use transfer
                encoding as described in <xref target="Transfer-multipart"/> for all MIME entities they secure.
                The reason for securing only 7-bit MIME entities, even for enveloped data that is not exposed to the transport, is that it allows the MIME entity to be handled in any environment without changing it.
                For example, a trusted gateway might remove the envelope, but not the signature, of a message, and then forward the signed message on to the end recipient so that they can verify the signatures directly.
                If the transport internal to the site is not 8-bit clean, such as on a wide-area network with a single mail gateway, verifying the signature will not be possible unless the original MIME entity was only 7-bit data.
              </t>
              <t>
                In the case where S/&wj;MIME implementations can determine that all intended recipients are capable of handling inner (all but the outermost) binary MIME objects, implementations SHOULD use binary encoding as opposed to a 7-bit-safe transfer encoding for the inner entities.
                The use of a 7-bit-safe encoding (such as base64) unnecessarily expands the message size.
                Implementations MAY determine that recipient implementations
                are capable of handling&nbsp;inner binary MIME entities by
                (1)&nbsp;interpreting the id&nbhy;cap&nbhy;preferBinaryInside
                SMIMECapabilities attribute, (2)&nbsp;prior agreement, or
                (3)&nbsp;other means.
              </t>
              <t>
                If one or more intended recipients are unable to handle inner binary
                MIME objects or if this capability is unknown for any of the
                intended recipients, S/&wj;MIME implementations SHOULD use transfer
                encoding as described in <xref target="Transfer-multipart"/> for all MIME entities they
                secure.
              </t>
            </section>
            <section title="Transfer Encoding for Signing Using multipart/signed" anchor="Transfer-multipart">
              <t>
                If a multipart/&wj;signed entity is ever to be transmitted over the
                standard Internet SMTP infrastructure or other transport that is
                constrained to 7-bit text, it MUST have transfer encoding applied so
                that it is represented as 7-bit text.  MIME entities that are
                already 7-bit data need no transfer encoding.  Entities such as 8-bit text
                and binary data can be encoded with quoted-printable or base64
                transfer encoding.
              </t>
              <t>
                The primary reason for the 7-bit requirement is that the Internet
                mail transport infrastructure cannot guarantee transport of 8-bit or
                binary data.  Even though many segments of the transport
                infrastructure now handle 8-bit and even binary data, it is sometimes
                not possible to know whether the transport path is 8-bit clean.  If a
                mail message with 8-bit data were to encounter a message transfer
                agent that cannot transmit 8-bit or binary data, the agent has three
                options, none of which are acceptable for a clear-signed message:
                <list style="symbols">
                  <t>
                    The agent could change the transfer encoding; this would
                    invalidate the signature.
                  </t>
                  <t>
                    The agent could transmit the data anyway, which would most likely
                    result in the 8th bit being corrupted; this too would invalidate
                    the signature.
                  </t>
                  <t>
                    The agent could return the message to the sender.
                  </t>
                </list>
              </t>
              <t>

                <xref target="RFC1847"/> prohibits an agent from changing the transfer encoding
                of the first part of a multipart/&wj;signed message.  If a compliant
                agent that cannot transmit 8-bit or binary data encountered a
                multipart/&wj;signed message with 8-bit or binary data in the first part,
                it would have to return the message to the sender as undeliverable.
              </t>
            </section>
            <section title="Sample Canonical MIME Entity">
              <t>
                This example shows a multipart/&wj;mixed message with full transfer
                encoding.  This message contains a text part and an attachment.  The
                sample message text includes characters that are not ASCII and
                thus need to be transfer encoded.  Though not shown here, the end of
                each line is &lt;CR&gt;&lt;LF&gt;.  The line ending of the MIME headers, the
                text, and the transfer-encoded parts all MUST be &lt;CR&gt;&lt;LF&gt;.
              </t>
              <t>
                Note that this example is not an example of an S/&wj;MIME
                message.
              </t>
              <figure>
              <artwork>
Content-Type: multipart/mixed; boundary=bar

--bar
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

=A1Hola Michael!

How do you like the new S/MIME specification?

It's generally a good idea to encode lines that begin with
From=20because some mail transport agents will insert a
greater-than (&gt;) sign, thus invalidating the signature.

Also, in some cases it might be desirable to encode any =20
trailing whitespace that occurs on lines in order to ensure =20
that the message signature is not invalidated when passing =20
a gateway that modifies such whitespace (like BITNET). =20

--bar
Content-Type: image/jpeg
Content-Transfer-Encoding: base64

iQCVAwUBMJrRF2N9oWBghPDJAQE9UQQAtl7LuRVndBjrk4EqYBIb3h5QXIX/LC//
jJV5bNvkZIGPIcEmI5iFd9boEgvpirHtIREEqLQRkYNoBActFBZmh9GC3C041WGq
uMbrbxc+nIs1TIKlA08rVi9ig/2Yh7LFrK5Ein57U/W72vgSxLhe/zhdfolT9Brn
HOxEa44b+EI=

--bar--
              </artwork>
              </figure>
            </section>
          </section>
            <section title="The application/pkcs7-mime Media Type" anchor="pkcs7-mime-media-type">
              <t>
                The application/&wj;pkcs7-mime media type is used to carry CMS content
                types, including EnvelopedData, SignedData, and CompressedData.  The
                details of constructing these entities are described in subsequent
                sections.  This section describes the general characteristics of the
                application/&wj;pkcs7-mime media type.
              </t>
              <t>
                The carried CMS object always contains a MIME entity that is prepared
                as described in <xref target="MimePrep"/> if the eContentType is id-data.  Other
                contents MAY be carried when the eContentType contains different
                values.  See <xref target="ESS"/> for an example of this with signed receipts.
              </t>
              <t>
                Since CMS content types are binary data, in most cases base64
                transfer encoding is appropriate -- in particular, when used with SMTP
                transport.  The transfer encoding used depends on the transport
                through which the object is to be sent and is not a characteristic
                of the media type.
              </t>
              <t>
                Note that this discussion refers to the transfer encoding of the CMS
                object or "outside" MIME entity.  It is completely distinct from, and
                unrelated to, the transfer encoding of the MIME entity secured by the
                CMS object -- the "inside" object, which is described in <xref target="MimePrep"/>.
              </t>
              <t>
                Because there are several types of application/&wj;pkcs7-mime objects, a
                sending agent SHOULD do as much as possible to help a receiving agent
                know about the contents of the object without forcing the receiving
                agent to decode the ASN.1 for the object.  The Content-Type header
                field of all application/&wj;pkcs7-mime objects SHOULD include the
                optional "smime-type" parameter, as described in the following
                sections.
              </t>

              <section title="The name and filename Parameters">
                <t>
                  For application/&wj;pkcs7-mime, sending agents SHOULD emit the
                  optional&nbsp;"name" parameter to the Content-Type field for compatibility
                  with older systems.  Sending agents SHOULD also emit the optional
                  Content-Disposition field <xref target="RFC2183"/> with the "filename" parameter.
                  If a sending agent emits the above parameters, the value of the
                  parameters SHOULD be a filename with the appropriate extension:
                </t>
                
<figure><artwork><![CDATA[
                                                             File
Media Type                                                Extension
-------------------------------------------------------------------
application/pkcs7-mime (SignedData, EnvelopedData,           .p7m
   AuthEnvelopedData)
application/pkcs7-mime (degenerate SignedData certificate    .p7c
   management message)
application/pkcs7-mime (CompressedData)                      .p7z
application/pkcs7-signature (SignedData)                     .p7s
]]></artwork></figure>

                <t>
                  In addition, the filename SHOULD be limited to eight characters
                  followed by a three-letter extension.  The eight-character filename
                  base can be any distinct name; the use of the filename base "smime"
                  SHOULD be used to indicate that the MIME entity is associated with
                  S/&wj;MIME.
                </t>
                <t>

                  Including a filename serves two purposes.  It facilitates easier use
                  of S/&wj;MIME objects as files on disk.  It also can convey type
                  information across gateways.  When a MIME entity of type
                  application/&wj;pkcs7-mime (for example) arrives at a gateway that has no
                  special knowledge of S/&wj;MIME, it will default the entity's media type
                  to application/&wj;octet-stream and treat it as a generic attachment,
                  thus losing the type information.  However, the suggested filename
                  for an attachment is often carried across a gateway.  This often
                  allows the receiving systems to determine the appropriate application
                  to hand the attachment off to -- in this case, a standalone S/&wj;MIME
                  processing application.  Note that this mechanism is provided as a
                  convenience for implementations in certain environments.  A proper
                  S/&wj;MIME implementation MUST use the media types and MUST NOT rely on
                  the file extensions.
                </t>
              </section>
              <section title="The smime-type Parameter" anchor="smime-type">
                <t>
                  The application/&wj;pkcs7-mime content type defines the optional "smime&nbhy;type" parameter.  The intent of this parameter is to convey details
                  about the security applied (signed or enveloped) along with
                  information about the contained content.  This specification defines
                  the following smime-types.
                </t>

<figure><artwork><![CDATA[
    Name                   CMS Type              Inner Content
    ----------------------------------------------------------
    enveloped-data         EnvelopedData         id-data
    signed-data            SignedData            id-data
    certs-only             SignedData            id-data
    compressed-data        CompressedData        id-data
    authEnveloped-data     AuthEnvelopedData     id-data
]]></artwork></figure>

                <t>
                  In order for consistency to be obtained with future specifications,
                  the following guidelines SHOULD be followed when assigning a new
                  smime-type parameter.
                  <list style="numbers">
                    <t>
                      If both signing and encryption can be applied to the content,
                      then three values for smime-type SHOULD be assigned: "signed-*", "authEnv-*",
                      and "enveloped-*".  If one operation can be assigned,
 then this
                      can be omitted.  Thus, since "certs-only" can only be signed,
                      "signed-" is omitted.
                    </t>
                    <t>
                      A common string for a content OID SHOULD be assigned.  We use
                      "data" for the id-data content OID when MIME is the inner
                      content.
                    </t>
                    <t>
                      If no common string is assigned, then the common string of
                      "OID.&lt;oid&gt;" is recommended (for example,
                      "OID.2.16.840.1.101.3.4.1.2" would be AES-128 CBC).
                    </t>
                  </list>
                </t>
                <t>
                  It is explicitly intended that this field be a suitable hint for mail
                  client applications to indicate whether a message is "signed", "authEnveloped", or
                  "enveloped" without having to tunnel into the CMS payload.
                </t>

                <t>
                  A registry for additional smime-type parameter values has been defined in <xref target="RFC7114"/>.
                </t>
              </section>
            </section>
            <section title="Creating an Enveloped-Only Message">
              <t>
                This section describes the format for enveloping a MIME entity
                without signing it.  It is important to note that sending enveloped
                but not signed messages does not provide for data integrity.
                The "enveloped-only" structure does not support
                authenticated symmetric algorithms. Use the
                "authenticated enveloped" structure for these algorithms.
                Thus, it is possible to replace ciphertext in such a way that the processed message will still be valid, but the meaning can be altered.
              </t>
              <t>
              <list style="format Step %d.">
                <t>  The MIME entity to be enveloped is prepared according to
                <xref target="MimePrep"/>.
</t>
                <t>  The MIME entity and other required data are processed into a
                CMS object of type EnvelopedData.  In addition to encrypting
                a copy of the content-encryption key (CEK) for each recipient, a
                copy of the CEK SHOULD be encrypted for
                the originator and included in the EnvelopedData (see <xref
                target="RFC5652"/>, Section&nbsp;6).
</t>
                <t>  The EnvelopedData object is wrapped in a CMS ContentInfo
                object.
</t>
                <t>  The ContentInfo object is inserted into an
                application/&wj;pkcs7-mime MIME entity.
</t>
                </list>
              </t>
              <t>
                The smime-type parameter for enveloped-only messages is
                "enveloped&nbhy;data".  The file extension for this type of message is&nbsp;".p7m".
              </t>
              <t>

                A sample message would be:
              </t>
              <figure>
                <artwork>
Content-Type: application/pkcs7-mime; name=smime.p7m;
   smime-type=enveloped-data
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=smime.p7m

MIIBHgYJKoZIhvcNAQcDoIIBDzCCAQsCAQAxgcAwgb0CAQAwJjASMRAwDgYDVQQDEw
dDYXJsUlNBAhBGNGvHgABWvBHTbi7NXXHQMA0GCSqGSIb3DQEBAQUABIGAC3EN5nGI
iJi2lsGPcP2iJ97a4e8kbKQz36zg6Z2i0yx6zYC4mZ7mX7FBs3IWg+f6KgCLx3M1eC
bWx8+MDFbbpXadCDgO8/nUkUNYeNxJtuzubGgzoyEd8Ch4H/dd9gdzTd+taTEgS0ip
dSJuNnkVY4/M652jKKHRLFf02hosdR8wQwYJKoZIhvcNAQcBMBQGCCqGSIb3DQMHBA
gtaMXpRwZRNYAgDsiSf8Z9P43LrY4OxUk660cu1lXeCSFOSOpOJ7FuVyU=
              </artwork>
              </figure>
            </section>
            <section title="Creating an Authenticated Enveloped-Only Message" anchor="AuthEnvelopedData2">
              <t>
                This section describes the format for enveloping a MIME entity without signing it.
                Authenticated enveloped messages provide confidentiality and data integrity.
                It is important to note that sending authenticated enveloped  messages does not provide for proof of origination when using S/MIME.
                It is possible for a third party to replace ciphertext in such a way that the processed message will still be valid, but the meaning can be altered.
                However, this is substantially more difficult than it is for
                an enveloped-only message, as the algorithm does provide a
                level of authentication.
<!-- Noted "does provide" in ARO. -->
                Any recipient for whom the message is encrypted can replace it without detection.
              </t>
              <t>
              <list style="format Step %d.">
                  <t>
                    The MIME entity to be enveloped is prepared according to <xref target="MimePrep"/>.
                  </t>
                  
                  <t>
                    The MIME entity and other required data are processed into a CMS object of type AuthEnvelopedData.
                    In addition to encrypting a copy of the CEK for each recipient, a copy of the CEK SHOULD
                    be encrypted for the originator and included in the AuthEnvelopedData (see <xref target="RFC5083"/>).
                  </t>
                  
                  <t>
                    The AuthEnvelopedData object is wrapped in a CMS ContentInfo object.
                  </t>
                  
                  <t>
                    The ContentInfo object is inserted into an application/&wj;pkcs7-mime MIME entity.
                  </t>
                  
                </list>
              </t>
              
              <t>
                The smime-type parameter for authenticated enveloped-only messages is "authEnveloped-data".
                The file extension for this type of message is&nbsp;".p7m".
              </t>
              <t>

                A sample message would be:
              </t>
              <figure>
                <artwork>
Content-Type: application/pkcs7-mime; smime-type=authEnveloped-data;
   name=smime.p7m
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=smime.p7m

MIIDWQYLKoZIhvcNAQkQARegggNIMIIDRAIBADGBvjCBuwIBADAmMBIxEDAO
BgNVBAMTB0NhcmxSU0ECEEY0a8eAAFa8EdNuLs1dcdAwCwYJKoZIhvcNAQEB
BIGAgyZJo0ERTxA4xdTri5P5tVMyh0RARepTUCORZvlUbcUlaI8IpJZH3/J1
Fv6MxTRS4O/K+ZcTlQmYeWLQvwdltQdOIP3mhpqXzTnOYhTK1IDtF2zx75Lg
vE+ilpcLIzXfJB4RCBPtBWaHAof4Wb+VMQvLkk9OolX4mRSH1LPktgAwggJq
BgkqhkiG9w0BBwEwGwYJYIZIAWUDBAEGMA4EDGPizioC9OHSsnNx4oCCAj7Y
Cb8rOy8+55106newEJohC/aDgWbJhrMKzSOwa7JraXOV3HXD3NvKbl665dRx
vmDwSCNaLCRU5q8/AxQx2SvnAbM+JKcEfC/VFdd4SiHNiUECAApLku2rMi5B
WrhW/FXmx9d+cjum2BRwB3wj0q1wajdB0/kVRbQwg697dnlYyUog4vpJERjr
7KAkawZx1RMHaM18wgZjUNpCBXFS3chQi9mTBp2i2Hf5iZ8OOtTx+rCQUmI6
Jhy03vdcPCCARBjn3v0d3upZYDZddMA41CB9fKnnWFjadV1KpYwv80tqsEfx
Vo0lJQ5VtJ8MHJiBpLVKadRIZ4iH2ULC0JtN5mXE1SrFKh7cqbJ4+7nqSRL3
oBTud3rX41DGshOjpqcYHT4sqYlgZkc6dp0g1+hF1p3cGmjHdpysV2NVSUev
ghHbvSqhIsXFzRSWKiZOigmlkv3R5LnjpYyP4brM62Jl7y0qborvV4dNMz7m
D+5YxSlH0KAe8z6TT3LHuQdN7QCkFoiUSCaNhpAFaakkGIpqcqLhpOK4lXxt
kptCG93eUwNCcTxtx6bXufPR5TUHohvZvfeqMp42kL37FJC/A8ZHoOxXy8+X
X5QYxCQNuofWlvnIWv0Nr8w65x6lgVjPYmd/cHwzQKBTBMXN6pBud/PZL5zF
tw3QHlQkBR+UflMWZKeN9L0KdQ27mQlCo5gQS85aifxoiiA2v9+0hxZw91rP
IW4D+GS7oMMoKj8ZNyCJJsyf5smRZ+WxeBoolb3+TiGcBBCsRnfe6noLZiFO
6Zeu2ZwE
              </artwork>
              </figure>
            </section>
            <section title="Creating a Signed-Only Message" anchor="Signed-Only">
              <t>
              There are two formats for signed messages defined for S/&wj;MIME:
                <list style="symbols">
                  <t>
                    application/&wj;pkcs7-mime with SignedData.
                  </t>
                  <t>

                    multipart/signed.
                  </t>
                </list>
              </t>
              <t>
                In general, the multipart/signed form is preferred for sending, and
                receiving agents MUST be able to handle both.
              </t>
              <section title="Choosing a Format for Signed-Only Messages">
                <t>
                  There are no hard-and-fast rules as to when a particular signed-only
                  format is chosen.  It depends on the capabilities of all the
                  receivers and the relative importance of receivers with S/&wj;MIME
                  facilities being able to verify the signature versus the importance
                  of receivers without S/&wj;MIME software being able to view the message.
                </t>
                <t>
                  Messages signed using the multipart/&wj;signed format can always be
                  viewed by the receiver whether or not they have S/&wj;MIME software.
                  They can also be viewed whether they are using a MIME-native user
                  agent or they have messages translated by a gateway.  In this
                  context, "be viewed" means the ability to process the message
                  essentially as if it were not a signed message, including any other
                  MIME structure the message might have.
                </t>
                <t>

                  Messages signed using the SignedData format cannot be viewed by a
                  recipient unless they have S/&wj;MIME facilities.  However, the
                  SignedData format protects the message content from being changed by
                  benign intermediate agents.  Such agents might do line wrapping or
                  content-transfer encoding changes that would break the signature.
                </t>
              </section>
              <section title="Signing Using application/pkcs7-mime with SignedData">
                <t>
                  This signing format uses the application/&wj;pkcs7-mime media type.  The
                  steps to create this format are as follows:

                  <list style="format Step %d.">
                  <t>  The MIME entity is prepared according to <xref target="MimePrep"/>.
</t>
                  <t>  The MIME entity and other required data are processed into a
                  CMS object of type SignedData.
                  </t>
                  <t>  The SignedData object is wrapped in a CMS ContentInfo
                  object.
</t>
                  <t>  The ContentInfo object is inserted into an
                  application/&wj;pkcs7-mime MIME entity.
                  </t>
                  </list>
                </t>
                <t>
                  The smime-type parameter for messages using application/&wj;pkcs7-mime
                  with SignedData is "signed-data".  The file extension for this type
                  of message is ".p7m".
                </t>
                <t>
                  A sample message would be:
                </t>
                <figure>
                <artwork>
Content-Type: application/pkcs7-mime; smime-type=signed-data;
   name=smime.p7m
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=smime.p7m

MIIDmQYJKoZIhvcNAQcCoIIDijCCA4YCAQExCTAHBgUrDgMCGjAtBgkqhkiG9w0BBw
GgIAQeDQpUaGlzIGlzIHNvbWUgc2FtcGxlIGNvbnRlbnQuoIIC4DCCAtwwggKboAMC
AQICAgDIMAkGByqGSM44BAMwEjEQMA4GA1UEAxMHQ2FybERTUzAeFw05OTA4MTcwMT
EwNDlaFw0zOTEyMzEyMzU5NTlaMBMxETAPBgNVBAMTCEFsaWNlRFNTMIIBtjCCASsG
ByqGSM44BAEwggEeAoGBAIGNze2D6gqeOT7CSCij5EeT3Q7XqA7sU8WrhAhP/5Thc0
h+DNbzREjR/p+vpKGJL+HZMMg23j+bv7dM3F9piuR10DcMkQiVm96nXvn89J8v3UOo
i1TxP7AHCEdNXYjDw7Wz41UIddU5dhDEeL3/nbCElzfy5FEbteQJllzzflvbAhUA4k
emGkVmuBPG2o+4NyErYov3k80CgYAmONAUiTKqOfs+bdlLWWpMdiM5BAI1XPLLGjDD
HlBd3ZtZ4s2qBT1YwHuiNrhuB699ikIlp/R1z0oIXks+kPht6pzJIYo7dhTpzi5dow
fNI4W4LzABfG1JiRGJNkS9+MiVSlNWteL5c+waYTYfEX/Cve3RUP+YdMLRgUpgObo2
OQOBhAACgYBc47ladRSWC6l63eM/qeysXty9txMRNKYWiSgRI9k0hmd1dRMSPUNbb+
VRv/qJ8qIbPiR9PQeNW2PIu0WloErjhdbOBoA/6CN+GvIkq1MauCcNHu8Iv2YUgFxi
rGX6FYvxuzTU0pY39mFHssQyhPB+QUD9RqdjTjPypeL08oPluKOBgTB/MAwGA1UdEw
EB/wQCMAAwDgYDVR0PAQH/BAQDAgbAMB8GA1UdIwQYMBaAFHBEPoIub4feStN14z0g
vEMrk/EfMB0GA1UdDgQWBBS+bKGz48H37UNwpM4TAeL945f+zTAfBgNVHREEGDAWgR
RBbGljZURTU0BleGFtcGxlLmNvbTAJBgcqhkjOOAQDAzAAMC0CFFUMpBkfQiuJcSIz
jYNqtT1na79FAhUAn2FTUlQLXLLd2ud2HeIQUltDXr0xYzBhAgEBMBgwEjEQMA4GA1
UEAxMHQ2FybERTUwICAMgwBwYFKw4DAhowCQYHKoZIzjgEAwQuMCwCFD1cSW6LIUFz
eXle3YI5SKSBer/sAhQmCq7s/CTFHOEjgASeUjbMpx5g6A==
                </artwork>
                </figure>
              </section>
              
              <section title="Signing Using the multipart/signed Format" anchor="SignMultipart">
                <t>
                  This format is a clear-signing format.  Recipients without any S/&wj;MIME
                  or CMS processing facilities are able to view the message.  It makes
                  use of the multipart/&wj;signed media type described in <xref target="RFC1847"/>.
                  The multipart/&wj;signed media type has two parts.  The first part
                  contains the MIME entity that is signed; the second part contains the
                  "detached signature" CMS SignedData object in which the
                  encapContentInfo eContent field is absent.
                </t>
              




              <section title="The application/pkcs7-signature Media Type">
                <t>
                  This media type always contains a CMS ContentInfo containing a single
                  CMS object of type SignedData.  The SignedData encapContentInfo
                  eContent field MUST be absent.  The signerInfos field contains the
                  signatures for the MIME entity.
                </t>
                <t>
                  The file extension for signed-only messages using
                  application/&wj;pkcs7&nbhy;signature is ".p7s".
                </t>
              </section>
              
              <section title="Creating a multipart/signed Message" anchor="sec3.4.3.2">
                <t>
                  <list style="format Step %d.">
                  <t>  The MIME entity to be signed is prepared according to
                  <xref target="MimePrep"/>, taking special care for clear-signing.
</t>
                  <t>  The MIME entity is presented to CMS processing in order to
                  obtain an object of type SignedData in which the
                  encapContentInfo eContent field is absent.
</t>
                  <t>  The MIME entity is inserted into the first part of a
                  multipart/&wj;signed message with no processing other than that
                  described in <xref target="MimePrep"/>.
</t>
                  <t>  Transfer encoding is applied to the "detached signature" CMS
                  SignedData object, and it is inserted into a MIME entity of
                  type application/&wj;pkcs7-signature.
</t>
                  <t>  The MIME entity of the application/&wj;pkcs7-signature is
                  inserted into the second part of the multipart/&wj;signed
                  entity.
</t>
                  </list>
                </t>
                <t>
                  The multipart/&wj;signed Content-Type has two required parameters: the
                  protocol parameter and the micalg parameter.
                </t>
                <t>
                  The protocol parameter MUST be "application/&wj;pkcs7-signature".  Note
                  that quotation marks are required around the protocol parameter
                  because MIME requires that the "/" character in the parameter value
                  MUST be quoted.
                </t>
                <t>
                  The micalg parameter allows for one-pass processing when the
                  signature is being verified.  The value of the micalg parameter is
                  dependent on the message digest algorithm(s) used in the calculation
                  of the Message Integrity Check.  If multiple message digest
                  algorithms are used, they MUST be separated by commas per <xref target="RFC1847"/>.
                    The values to be placed in the micalg parameter SHOULD be
                  from the following:
                </t>

<figure><artwork><![CDATA[
     Algorithm      Value Used
     -----------------------------------------------------------
     MD5*           md5
     SHA-1*         sha-1
     SHA-224        sha-224
     SHA-256        sha-256
     SHA-384        sha-384
     SHA-512        sha-512
     Any other      (defined separately in the algorithm profile
                     or "unknown" if not defined)
]]></artwork></figure>

                <t>
                  *Note: MD5 and SHA-1 are historical and no longer considered secure.
                  See <xref target="HistoricMail"/> for details.
                </t>
                
                <t>
                  (Historical note: Some early implementations of S/MIME emitted and
                  expected "rsa-md5", "rsa-sha1", and "sha1" for the micalg parameter.)
                  Receiving agents SHOULD be able to recover gracefully from a micalg
                  parameter value that they do not recognize.
                  Future values for this parameter will be taken from the IANA "Hash Function Textual Names" registry.
                </t>
              </section>
              <section title="Sample multipart/signed Message">
                <figure>
                  <artwork>
Content-Type: multipart/signed;
    micalg=sha-256;
    boundary="----=_NextBoundary____Fri,_06_Sep_2002_00:25:21";
    protocol="application/pkcs7-signature"

This is a multipart message in MIME format.

------=_NextBoundary____Fri,_06_Sep_2002_00:25:21

This is some sample content.
------=_NextBoundary____Fri,_06_Sep_2002_00:25:21
Content-Type: application/pkcs7-signature; name=smime.p7s
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=smime.p7s

MIIBJgYJKoZIhvcNAQcCoIIBFzCCARMCAQExADALBgkqhkiG9w0BBwExgf4w
gfsCAQIwJjASMRAwDgYDVQQDEwdDYXJsUlNBAhBGNGvHgABWvBHTbi7EELOw
MAsGCWCGSAFlAwQCAaAxMC8GCSqGSIb3DQEJBDEiBCCxwpZGNZzTSsugsn+f
lEidzQK4mf/ozKqfmbxhcIkKqjALBgkqhkiG9w0BAQsEgYB0XJV7fjPa5Nuh
oth5msDfP8A5urYUMjhNpWgXG8ae3XpppqVrPi2nVO41onHnkByjkeD/wc31
A9WH8MzFQgSTsrJ65JvffTTXkOpRPxsSHn3wJFwP/atWHkh8YK/jR9bULhUl
Mv5jQEDiwVX5DRasxu6Ld8zv9u5/TsdBNiufGw==

------=_NextBoundary____Fri,_06_Sep_2002_00:25:21--
                </artwork>
                </figure>

                <t>
                  The content that is digested (the first part of the multipart/&wj;signed)
                  consists of the bytes:
                </t>
                <figure>
                  <artwork>
54 68 69 73 20 69 73 20 73 6f 6d 65 20 73 61 6d 70 6c 65 20 63 6f 6e
74 65 6e 74 2e 0d 0a
                  </artwork>
                </figure>
              </section>
            </section>
              </section>
            <section title="Creating a Compressed-Only Message"
 anchor="creatingcompressedonly">
              <t>
                This section describes the format for compressing a MIME entity.
                Please note that versions of S/&wj;MIME prior to version 3.1 did not
                specify any use of CompressedData and will not recognize it.  The
                use of a capability to indicate the ability to receive CompressedData
                is described in <xref target="RFC3274"/> and is the preferred method for
                compatibility.
              </t>
              <t>
                <list style="format Step %d.">
                <t>  The MIME entity to be compressed is prepared according to
                <xref target="MimePrep"/>.
</t>
                <t>  The MIME entity and other required data are processed into a
                CMS object of type CompressedData.
                </t>
                
                <t>  The CompressedData object is wrapped in a CMS ContentInfo
                object.
</t>
                <t>  The ContentInfo object is inserted into an
                application/&wj;pkcs7-mime MIME entity.
</t>
                </list>
              </t>
              <t>
                The smime-type parameter for compressed-only messages is
                "compressed&nbhy;data".  The file extension for this type of message is&nbsp;".p7z".
              </t>
              <t>
                A sample message would be:
              </t>
              <figure>
              <artwork>
Content-Type: application/pkcs7-mime; smime-type=compressed-data;
   name=smime.p7z
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=smime.p7z

eNoLycgsVgCi4vzcVIXixNyCnFSF5Py8ktS8Ej0AlCkKVA==
              </artwork>
              </figure>
            </section>
            <section title="Multiple Operations" anchor="MultipleOperations">
              <t>
                The signed-only, enveloped-only, and compressed-only MIME formats can
                be nested.  This works because these formats are all MIME entities
                that encapsulate other MIME entities.
              </t>
              <t>
                An S/&wj;MIME implementation MUST be able to receive and process
                arbitrarily nested S/&wj;MIME within reasonable resource limits of the
                recipient computer.
              </t>
              <t>
                It is possible to apply any of the signing, encrypting, and
                compressing operations in any order.  It is up to the implementer and
                the user to choose.  When signing first, the signatories are then
                securely obscured by the enveloping.  When enveloping first, the
                signatories are exposed, but it is possible to verify signatures
                without removing the enveloping.  This can be useful in an
                environment where automatic signature verification is desired, as no
                private key material is required to verify a signature.
              </t>
              <t>
                There are security ramifications related to choosing whether to sign first or
                encrypt first.  A recipient of a message that is encrypted and then
                signed can validate that the encrypted block was unaltered but
                cannot determine any relationship between the signer and the
                unencrypted contents of the message.  A recipient of a message that
                is signed and then encrypted can assume that the signed message itself
                has not been altered but that a careful attacker could have changed
                the unauthenticated portions of the encrypted message.
              </t>
              <t>
                When using compression, keep the following guidelines in mind:
                <list style="symbols">

<!--[rfced] Please review our update to the following text to ensure
we have captured your intent regarding our question from AUTH
state.

Original question:
17) Section 3.7:  In these sentences, do "binary encoded encrypted data" and
"Base64 encrypted data" mean "encoded encrypted data that is binary" and
"encrypted data that is base64,"
or do they mean "binary-encoded encrypted data" and "Base64-encrypted
data"?  (We see "binary encoding" used elsewhere in this document.)

Original:
-  Compression of binary encoded encrypted data is discouraged, since
   it will not yield significant compression.  Base64 encrypted data
   could very well benefit, however.

Author reply:
Jim: "In this situation, the terms "binary encoded" and "base64" refer
to content transfer encoding.  The term "binary encoding" also refers
to content transfer encoding.  It means encrypted data that is
transferred as binary data vs encrypted data that is transferred as
Base64 encoded."

Edited text:

Compression of encrypted data that is transferred as binary data is
discouraged, since it will not yield significant
compression.  Encrypted data that is transferred as base64-encoded data could very well
benefit, however. -->
                  <t>

                Compression of encrypted data that is transferred as binary data is
                    discouraged, since it will not yield significant
                    compression.  Encrypted data that is transferred as
		    base64-encoded data could benefit as well.
                  </t>
                  <t>
                    If a lossy compression algorithm is used with signing, you will
                    need to compress first, then sign.
                  </t>
                </list>
              </t>
            </section>
            <section title="Creating a Certificate Management Message">
              <t>
                The certificate management message or MIME entity is used to
                transport certificates and/or Certificate Revocation Lists
                (CRLs), such as in response to a registration request.
              </t>
              <t>
                <list style="format Step %d.">
                <t>  The certificates and/or CRLs are made available
                to the CMS generating process that creates a
                CMS object of type SignedData.  The SignedData
                encapContentInfo eContent field MUST be absent, and
                the signerInfos field MUST be empty.
                </t>
<t>  The SignedData object is wrapped in a CMS ContentInfo
                object.
</t>
<t>  The ContentInfo object is enclosed in an
                application/&wj;pkcs7-mime MIME entity.
</t>
                </list>
              </t>
              <t>
                The smime-type parameter for a certificate management message is
                "certs-only".  The file extension for this type of message is ".p7c".
              </t>
            </section>
            <section title="Registration Requests">
              <t>
                A sending agent that signs messages MUST have a certificate for the
                signature so that a receiving agent can verify the signature.  There
                are many ways of getting certificates, such as through an exchange
                with a certification authority, through a hardware token or diskette,
                and so on.
              </t>
              <t>
                S/&wj;MIME v2 <xref target="SMIMEv2"/> specified a method for "registering" public keys
                with certificate authorities using an application/&wj;pkcs10 body part.
                Since that time, the IETF PKIX Working Group has developed other
                methods for requesting certificates.  However, S/&wj;MIME v4.0 does not
                require a particular certificate request mechanism.
              </t>
            </section>
            <section title="Identifying an S/MIME Message">
              <t>
                Because S/&wj;MIME takes into account interoperation in non&nbhy;MIME
                environments, several different mechanisms are employed to carry the
                type information, and it becomes a bit difficult to identify S/&wj;MIME
                messages.  The following table lists criteria for determining whether
                or not a message is an S/&wj;MIME message.  A message is considered an
                S/&wj;MIME message if it matches any of the criteria listed below.
              </t>
              <t>
                The file suffix in the table below comes from the "name" parameter in
                the Content-Type header field or the "filename" parameter in the
                Content-Disposition header field.  The MIME parameters that
carry the
                file suffix are not listed below.
              </t>

<figure><artwork><![CDATA[
Media Type                 Parameters                     File Suffix
---------------------------------------------------------------------
application/pkcs7-mime     N/A                            N/A

multipart/signed           protocol=                      N/A
                           "application/pkcs7-signature"

application/octet-stream   N/A                            p7m, p7s,
                                                          p7c, p7z
]]></artwork></figure>

            </section>
          </section>
          <section title="Certificate Processing" anchor="CertProcessing">
            <t>
              A receiving agent MUST provide some certificate retrieval mechanism
              in order to gain access to certificates for recipients of digital
              envelopes.  This specification does not cover how S/&wj;MIME agents
              handle certificates -- only what they do after a certificate has been
              validated or rejected.  S/&wj;MIME certificate issues are covered in
              <xref target="RFC5750"/>.
            </t>
            <t>
              At a minimum, for initial S/&wj;MIME deployment, a user agent could
              automatically generate a message to an intended recipient requesting
              that recipient's certificate in a signed return message.  Receiving
              and sending agents SHOULD also provide a mechanism to allow a user to
              "store and protect" certificates for correspondents in such a
              way as to guarantee their later retrieval.

            </t>
            
            <section title="Key Pair Generation" anchor="KeyPairs">
              <t>
                All key pairs MUST be generated from a good source of non&nbhy;deterministic random input <xref target="RFC4086"/>, and the private key MUST be
                protected in a secure fashion.
              </t>
              
              <t>
                An S/&wj;MIME user agent MUST NOT generate asymmetric keys less than 2048&nbsp;bits for use with an RSA signature algorithm.
              </t>

              <t>
                For 2048-bit through 4096-bit RSA with SHA-256, see <xref target="RFC5754"/> and <xref target="FIPS186-4"/>.
                The first reference provides the signature algorithm's OID, and the second provides the signature algorithm's definition.
              </t>
              
              <t>
                For RSASSA-PSS with SHA-256, see <xref target="RFC4056"/>.
                For RSAES-OAEP, see <xref target="RFC3560"/>.
              </t>
            </section>
            
            <section title="Signature Generation">
              <t>
                The following are the requirements for an S/&wj;MIME agent
                when generating RSA and RSASSA-PSS signatures:
              </t>
              <figure>
              <artwork>
        key size &lt;= 2047 : SHOULD NOT (Note 2)
2048 &lt;= key size &lt;= 4096 : SHOULD     (Note 1)
4096 &lt;  key size         : MAY        (Note 1)

Note 1: See Security Considerations in Section 6.
Note 2: See Historical Mail Considerations in Appendix B.
              </artwork>
              </figure>

              <t>
                Key sizes for ECDSA and EdDSA are fixed by the curve.
              </t>
              
            </section>
            
            <section title="Signature Verification">
              <t>
                The following are the requirements for S/&wj;MIME receiving agents during
                verification of RSA and RSASSA-PSS signatures:
              </t>
              <figure>
              <artwork>
        key size &lt;= 2047 : SHOULD NOT (Note 2)
2048 &lt;= key size &lt;= 4096 : MUST       (Note 1)
4096 &lt;  key size         : MAY        (Note 1)

Note 1: See Security Considerations in Section 6.
Note 2: See Historical Mail Considerations in Appendix B.
              </artwork>
              </figure>

              <t>
                Key sizes for ECDSA and EdDSA are fixed by the curve.
              </t>
            </section>
            
            <section title="Encryption">
              <t>
                The following are the requirements for an S/&wj;MIME agent when establishing keys for content encryption using the RSA and RSA-OAEP algorithms:
              </t>
              <figure>
              <artwork>
        key size &lt;= 2047 : SHOULD NOT (Note 2)
2048 &lt;= key size &lt;= 4096 : SHOULD     (Note 1)
4096 &lt;  key size         : MAY        (Note 1)

Note 1: See Security Considerations in Section 6.
Note 2: See Historical Mail Considerations in Appendix B.
              </artwork>
              </figure>
              
              <t>
                Key sizes for ECDH are fixed by the curve.
              </t>
            </section>
            
            <section title="Decryption">
              <t>
                The following are the requirements for an S/&wj;MIME agent when
                establishing keys for content decryption using the RSA and RSAES-OAEP algorithms:
              </t>
              <figure>
              <artwork>
        key size &lt;= 2047 : MAY        (Note 2)
2048 &lt;= key size &lt;= 4096 : MUST       (Note 1)
4096 &lt;  key size         : MAY        (Note 1)

Note 1: See Security Considerations in Section 6.
Note 2: See Historical Mail Considerations in Appendix B.
              </artwork>
              </figure>

              <t>
                Key sizes for ECDH are fixed by the curve.
              </t>
              
            </section>
          </section>
          
          <section title="IANA Considerations" anchor="IANA">
            <t>
              The following information updates the media type registration for
              application/&wj;pkcs7-mime and application/&wj;pkcs7-signature to refer to
              this document as opposed to RFC 5751.
            </t>
            <t>
              Add authEnveloped-data to the list of values for smime-type.
            </t>
            <t>
              Update references from RFC 5751 to this document in general.
            </t>
            <t>
              Note that other documents can define additional media types for
              S/&wj;MIME.
            </t>

            <section title="Media Type for application/pkcs7-mime">

              <figure>
                <artwork><![CDATA[
Type name: application

Subtype Name: pkcs7-mime

Required Parameters: NONE

Optional Parameters: smime-type
                     name

Encoding Considerations: See Section 3 of this document

Security Considerations: See Section 6 of this document

Interoperability Considerations: See Sections 1-6 of this document

Published Specification: RFC 2311, RFC 2633, RFC 5751,
                         and this document

Applications that use this media type: Security applications

Fragment identifier considerations: N/A                         

Additional information:
    Deprecated alias names for this type: N/A
    Magic number(s): N/A
    File extensions(s): See Section 3.2.1 of this document
    Macintosh file type code(s): N/A

Person & email address to contact for further information:
   The IESG <iesg@ietf.org>

Intended usage: COMMON

Restrictions on usage: NONE

Author: Sean Turner

Change Controller: LAMPS working group delegated from the IESG
]]></artwork></figure>

            </section>

            <section title="Media Type for application/pkcs7-signature">
              <figure>
                <artwork><![CDATA[
Type name: application

Subtype Name: pkcs7-signature

Required Parameters: N/A

Optional Parameters: N/A

Encoding Considerations: See Section 3 of this document

Security Considerations: See Section 6 of this document

Interoperability Considerations: See Sections 1-6 of this document

Published Specification: RFC 2311, RFC 2633, RFC 5751,
                         and this document

Applications that use this media type: Security applications

Fragment identifier considerations: N/A

Additional information:
    Deprecated alias names for this type: N/A
    Magic number(s): N/A
    File extensions(s): See Section 3.2.1 of this document
    Macintosh file type code(s): N/A

Person & email address to contact for further information:
   The IESG <iesg@ietf.org>

Intended usage: COMMON

Restrictions on usage: N/A

Author: Sean Turner

Change Controller: LAMPS working group delegated from the IESG
]]></artwork></figure>

            </section>

<!--[rfced] Section 5 "IANA Considerations" describes what will follow
in Sections 5.1 and 5.2.  Perhaps a preview of Section 5.3 would
be helpful to include here as well.  If you agree, please provide
the text to add.

Current:

   The following information updates the media type registration for
   application/pkcs7-mime and application/pkcs7-signature to refer to
   this document as opposed to RFC 5751.

   Note that other documents can define additional media types for
   S/MIME. -->
            <section title="authEnveloped-data smime-type">
              <t>
                IANA has registered the following value in the "Parameter Values for the smime-type Parameter" registry.
               
                <list style="none">
                  <t>smime-type value: authEnveloped-data</t>
                  <t>Reference: RFC 8551, <xref target="smime-type"/></t>
                </list>
              </t>
            </section>

            <section title="Reference Updates">
              <t>
                IANA is to update all references to RFC 5751 to this document.
                Known registries to be updated are "CoAP Content-Formats"
                and "media-types".
              </t>

<!--[rfced] The following actions sent to the RPC by IANA do not have
corresponding text in the IANA section of this
document.  Please consider what text should be added
to address these updates.

ACTION 4:

We've replaced references to RFC5751 with references to this document
for the following early allocations in the CoAP Content-Formats
registry:

application/pkcs7-mime; smime-type=server-generated-key (TEMPORARY - registered 2018-08-09, expires 2019-08-09)
ID: 280 
Reference: [RFC-ietf-lamps-rfc5751-bis-12][RFC7030][draft-ietf-ace-coap-est]

application/pkcs7-mime; smime-type=certs-only (TEMPORARY - registered 2018-08-09, expires 2019-08-09)
ID: 281
Reference: [RFC-ietf-lamps-rfc5751-bis-12][draft-ietf-ace-coap-est]

application/pkcs7-mime; smime-type=CMC-Request (TEMPORARY - registered 2018-08-09, expires 2019-08-09)
ID: 282 
Reference: [RFC-ietf-lamps-rfc5751-bis-12][RFC5273][draft-ietf-ace-coap-est]

application/pkcs7-mime; smime-type=CMC-Response (TEMPORARY - registered 2018-08-09, expires 2019-08-09)
ID: 283
Reference: [RFC-ietf-lamps-rfc5751-bis-12][RFC5273][draft-ietf-ace-coap-est]

application/pkcs8 (TEMPORARY - registered 2018-08-09, expires 2019-08-09) 
ID: 284 
Reference: [RFC-ietf-lamps-rfc5751-bis-12][RFC5958][draft-ietf-ace-coap-est]

application/pkcs10 (TEMPORARY - registered 2018-08-09, expires 2019-08-09) 
ID: 286
Reference: [RFC-ietf-lamps-rfc5751-bis-12][RFC5967][draft-ietf-ace-coap-est]

ACTION 5:

We've replaced informational references to RFC 5751 with references to
this document in the registration templates for the following media
types:

text/parameters [RFC7826]
application/dicom+json [DICOM Standards Committee]

Please see
https://www.iana.org/assignments/media-types
https://www.iana.org/assignments/media-types/text/parameters
https://www.iana.org/assignments/media-types/application/dicom+json

-->
            </section>
          </section>
          <section title="Security Considerations" anchor="SecurityConsiderations">
            <t>
              Cryptographic algorithms will be broken or weakened over time.
              Implementers and users need to check that the cryptographic
              algorithms listed in this document continue to provide the expected
              level of security.  The IETF from time to time may issue documents
              dealing with the current state of the art.  For example:
              <list style="symbols">
                <t>
                  The Million Message Attack described in RFC 3218 <xref target="RFC3218"/>.
                </t>
                <t>
                  The Diffie-Hellman "small-subgroup" attacks described in RFC
                  2785 <xref target="RFC2785"/>.
                </t>
                <t>
                  The attacks against hash algorithms described in RFC 4270 <xref target="RFC4270"/>.
                </t>
              </list>
            </t>
            <t>
              This specification uses Public-Key Cryptography technologies.  It is
              assumed that the private key is protected to ensure that it is not
              accessed or altered by unauthorized parties.
            </t>
            <t>
              It is impossible for most people or software to estimate the value of
              a message's content.  Further, it is impossible for most people or
              software to estimate the actual cost of recovering an encrypted
              message's content that is encrypted with a key of a particular size.
              Further, it is quite difficult to determine the cost of a failed
              decryption if a recipient cannot process a message's content.  Thus,
              choosing between different key sizes (or choosing whether to just use
              plaintext) is also impossible for most people or software.  However,
              decisions based on these criteria are made all the time, and
              therefore this specification gives a framework for using those
              estimates in choosing algorithms.
            </t>
            <t>
              The choice of 2048 bits as an RSA asymmetric key size in this
              specification is based on the desire to provide at least 100 bits of
              security.  The key sizes that must be supported to conform to this
              specification seem appropriate for the Internet, based on <xref target="RFC3766"/>.
              Of course, there are environments, such as financial and medical
              systems, that may select different key sizes.  For this reason, an
              implementation MAY support key sizes beyond those recommended in this
              specification.
            </t>
            <t>
              Receiving agents that validate signatures and sending agents that
              encrypt messages need to be cautious of cryptographic processing
              usage when validating signatures and encrypting messages using keys
              larger than those mandated in this specification.  An attacker could
              send certificates with keys that would result in excessive
              cryptographic processing -- for example, keys larger than those
              mandated in this specification, as such keys could swamp the processing
              element.  Agents that use such keys without first validating the
              certificate to a trust anchor are advised to have some sort of
              cryptographic resource management system to prevent such attacks.
            </t>
            <t>
              Some cryptographic algorithms such as RC2 offer little actual security over sending plaintext.
              Other algorithms such as TripleDES provide security but are no longer considered to be state of the art.
              S/MIME requires the use of current state-of-the-art algorithms such as AES and provides the ability to announce cryptographic capabilities to parties with whom you communicate.
              This allows the sender to create messages that can use the strongest common encryption algorithm.
              Using algorithms such as RC2 is never recommended unless the only alternative is no cryptography.
            </t>
            <t>
              RSA and DSA keys of less than 2048 bits are now considered by many
              experts to be cryptographically insecure (due to advances in
              computing power) and should no longer be used to protect messages.
              Such keys were previously considered secure, so processing previously
              received signed and encrypted mail will often result in the use of
              weak keys.  Implementations that wish to support previous versions of
              S/&wj;MIME or process old messages need to consider the security risks
              that result from smaller key sizes (e.g., spoofed messages) versus
              the costs of denial of service.  If an implementation supports
              verification of digital signatures generated with RSA and DSA keys of
              less than 1024 bits, it MUST warn the user.  Implementers should
              consider providing different warnings for newly received messages and
              previously stored messages.  Server implementations (e.g., secure
              mail list servers) where user warnings are not appropriate SHOULD
              reject messages with weak signatures.
            </t>
            <t>
              Implementers SHOULD be aware that multiple active key pairs can be
              associated with a single individual.  For example, one key pair can
              be used to support confidentiality, while a different key pair can be
              used for digital signatures.
            </t>
            <t>
              If a sending agent is sending the same message using different
              strengths of cryptography, an attacker watching the communications
              channel might be able to determine the contents of the strongly
              encrypted message by decrypting the weakly encrypted version.  In
              other words, a sender SHOULD NOT send a copy of a message using
              weaker cryptography than they would use for the original of the
              message.
            </t>
            <t>
              Modification of the ciphertext in EnvelopedData can go undetected if authentication is
              not also used, which is the case when sending EnvelopedData without
              wrapping it in SignedData or enclosing SignedData within it.
              This is one of the reasons for moving from EnvelopedData to AuthEnvelopedData, as the authenticated encryption algorithms provide the authentication without needing the SignedData layer.
            </t>
            <t>
              If an implementation is concerned about compliance with National
              Institute of Standards and Technology (NIST) key size
              recommendations, then see <xref target="SP800-57"/>.
            </t>
            <t>
              If messaging environments make use of the fact that a message is
              signed to change the behavior of message processing (examples would
              be running rules or UI display hints), without first verifying that
              the message is actually signed and knowing the state of the
              signature, this can lead to incorrect handling of the message.
              Visual indicators on messages may need to have the signature
              validation code checked periodically if the indicator is supposed to
              give information on the current status of a message.
            </t>
            <t>
              Many people assume that the use of an authenticated encryption algorithm is all that is needed for  the sender of the message to be authenticated.
              In almost all cases, this is not a correct statement.
              There are a number of preconditions that need to hold for an authenticated encryption algorithm to provide this service:
              <list style="symbols">
                <t>
                  The starting key must be bound to a single entity.
                  The use of a group key only would allow for the statement that a message was sent by one of the entities that held the key but will not identify a specific entity.
                </t>
                <t>
                  The message must have exactly one sender and one recipient.
                  Having more than one recipient would allow for the second recipient to create a message that the first recipient would believe is from the sender by stripping the second recipient from the message.
                </t>
                <t>
                  A direct path needs to exist from the starting key to the key used as the CEK.  That path needs to guarantee that no third party could have seen the resulting CEK.
                  This means that one needs to be using an algorithm that is called a "Direct Encryption" or a "Direct Key Agreement" algorithm in other contexts.
                  This means that the starting key is (1)&nbsp;used directly
                  as the CEK or (2)&nbsp;used to create a secret
                  that is then transformed into the CEK via a KDF&nbsp;step.
                </t>
              </list>
              S/MIME implementations almost universally use ephemeral-static rather than static-static key agreement and do not use a shared secret for encryption. This means that the first precondition is not met.
              <xref target="RFC6278"/> defines how to use static-static key agreement with CMS, so the first precondition can be met.
              Currently, all S/MIME key agreement methods derive a
              key-encryption key (KEK) and wrap a CEK.
              This violates the third precondition above.
              New key agreement algorithms that directly created the CEK without creating an intervening KEK would need to be defined.
            </t>
            <t>
              Even when all of the preconditions are met and origination of a message is established by the use of an authenticated encryption algorithm, users need to be aware that there is no way to prove this to a third party.
              This is because either of the parties can successfully create the message (or just alter the content) based on the fact that the CEK is going to be known to both parties.
              Thus, the origination is always built on a presumption that "I did not send this message to myself."
            </t>
            <t>
              All of the authenticated encryption algorithms in this document use counter mode for the encryption portion of the algorithm.
              This means that the length of the plaintext will always be
              known, as the ciphertext length and the plaintext length are
              always the same.  This information can enable passive observers to infer information based solely on the length of the message.
              Applications for which this is a concern need to provide some type of padding so that the length of the message does not provide this information.
            </t>
            <t>
              When compression is used with encryption, it has the potential
              to provide an additional layer of security. However, care needs
              to be taken when designing a protocol that relies on
              using compression, so as not to create a compression oracle.
              Compression oracle attacks require
              an adaptive input to the process and attack the unknown content
              of a message based on the length of the compressed output. This
              means that no attack on the encryption key is necessarily
              required.
            </t>
            <t>
              A recent paper on S/MIME and OpenPGP email security <xref target="Efail"/> has pointed out a number of problems with the current S/MIME specifications and how people have implemented mail clients.
              Due to the nature of how CBC mode operates, the modes allow for malleability of plaintexts.
              This malleability allows for attackers to make changes in the
              ciphertext and, if parts of the plaintext are known, create
              arbitrary blocks of plaintext.
              These changes can be made without the weak integrity check in CBC mode being triggered.
              This type of attack can be prevented by the use of an
              Authenticated Encryption with Associated Data (AEAD) algorithm with a more robust integrity check on the decryption process.
              It is therefore recommended that mail systems migrate to using AES-GCM as quickly as possible and that the decrypted content not be acted on prior to finishing the integrity check.
            </t>

            <t>
              The other attack that is highlighted in <xref target="Efail"/> is due to an error in how mail clients deal with HTML and multipart/mixed messages.
              Clients MUST require that a text/html content type be a complete
              HTML document (per <xref target="RFC1866"/>).
              Clients SHOULD treat each of the different pieces of the multipart/mixed construct as being of different origins.
              Clients MUST treat each encrypted or signed piece of a MIME message as being of different origins both from unprotected content and from each other.
            </t>
          </section>
  </middle>
  <back>

<!--[rfced] In talking with the RSE regarding the reference groupings
that appear in this document, we suggest the following path
forward in order to meet the requirements of RFC 7322:

a) Updating the "grouped" reference entries to include the references
of each document group like the following (modeled after the way
STDs/BCPs with more than one RFC are referenced:

[SMIMEv3]   Housley, R., "Cryptographic Message Syntax", RFC 2630, DOI 10.17487/RFC2630, June 1999,
            <https://www.rfc-editor.org/info/rfc2630>.

            Rescorla, E., "Diffie-Hellman Key Agreement Method", RFC 2631, DOI 10.17487/RFC2631,
            June 1999, <https://www.rfc-editor.org/info/rfc2631>.


            Ramsdell, B., Ed., "S/MIME Version 3 Certificate Handling", RFC 2632, DOI 10.17487/RFC2632,
            June 1999, <https://www.rfc-editor.org/info/rfc2632>.


            Ramsdell, B., Ed., "S/MIME Version 3 Message Specification", RFC 2633, DOI 10.17487/RFC2633,
            June 1999, <https://www.rfc-editor.org/info/rfc2633>.


            Hoffman, P., Ed., "Enhanced Security Services for S/MIME", RFC 2634, DOI 10.17487/RFC2634,
            June 1999, <https://www.rfc-editor.org/info/rfc2634>.

            Schaad, J., "Enhanced Security Services (ESS) Update: Adding CertID Algorithm Agility",
            RFC 5035, DOI 10.17487/RFC5035, August 2007, 
            <https://www.rfc-editor.org/info/rfc5035>.

b) Removing the existing reference entries pointing to the individual
RFCs that are in these reference groups.

c) Updating the in-text citations to point to the specific
RFC/document inside the group in running text, for example:

Original:
Key wrap algorithm and the Diffie-Hellman (DH) algorithm [RFC2631]
changed to a SHOULD implement.

perhaps:
Key wrap algorithm and the Diffie-Hellman (DH) algorithm (RFC 2631 [SMIMEv3])
changed to a SHOULD implement.

Our goals are to achieve a 1:1 mapping between reference entries and
citation tags (per the guidance in RFC 7322), eliminate the use of
citation tags in the References section, and make the text and
References section as user friendly as possible. 
-->
    
      <references title="Normative References">
        &rfc1847;
        &rfc2045; &rfc2046; &rfc2047; &rfc2049;
        &rfc2119;
        &rfc2183;
        &rfc2634;
        &rfc3274;
        &rfc3370;
        &rfc3560;
        &rfc3565;
        &rfc4056;
        &rfc6838;  &rfc4289;
        &rfc5035;
        &rfc5652;  &rfc5083;
        &rfc5754;
        &rfc4086;
        &rfc5084;
        &rfc5753;
        &rfc8174;

<!-- draft-ietf-curdle-cms-ecdh-new-curves (RFC 8418; published) -->
        &rfc8418;

<!-- draft-ietf-curdle-cms-eddsa-signatures (RFC 8419; published) -->
        &rfc8419;

        <reference anchor="CMS">
          <front>
            <title>Cryptographic Message Syntax</title>
            <author/>
            <date/>
          </front>
          <annotation>
            This is the set of documents dealing with the cryptographic message syntax and refers to <xref target="RFC5652"/> and <xref target="RFC5083"/>.
          </annotation>
        </reference>

        <reference anchor="ESS">
          <front>
            <title>Enhanced Security Services for S/MIME</title>
            <author/>
            <date/>
          </front>
          <annotation>
            This is the set of documents dealing with enhanced security services and refers to <xref target="RFC2634"/> and <xref target="RFC5035"/>.
          </annotation>
        </reference>

        <reference anchor="MIME-SPEC">
          <front>
            <title>MIME Message Specifications</title>
            <author/>
            <date/>
          </front>
          <annotation>
            This is the set of documents that define how to use MIME.
            These documents are <xref target="RFC2045"/>, <xref target="RFC2046"/>, <xref target="RFC2047"/>, <xref target="RFC2049"/>, <xref target="RFC6838"/>, and <xref target="RFC4289"/>.
          </annotation>
        </reference>

        <reference anchor="CHARSETS" target="http://www.iana.org/assignments/character-sets.">
          <front>
            <title>Character sets assigned by IANA</title>
            <author/>
            <date/>
          </front>
          
        </reference>

        <reference anchor="FIPS186-4" target="https://nvlpubs.nist.gov/nistpubs/fips/nist.fips.186-4.pdf">
          <front>
            <title>Digital Signature Standard (DSS)</title>
            <author><organization>National Institute of Standards and Technology (NIST)</organization></author>
            <date month="July" year="2013"/>
          </front>
          <seriesInfo name="Federal Information Processing Standards Publication" value="186-4"/>
          <seriesInfo name="DOI" value="10.6028/NIST.FIPS.186-4"/>
        </reference>
        
        <reference anchor="ASN.1">
          <front>
            <title>Information Technology - Abstract Syntax Notation (ASN.1)</title>
            <author/>
            <date/>
          </front>
          <annotation>
            ASN.1 syntax references consist of the following: <xref target="X.680"/>, <xref target="X.681"/>, <xref target="X.682"/>, and <xref target="X.683"/>.
          </annotation>
        </reference>
            
        <reference anchor="X.680" target="https://www.itu.int/rec/T-REC-X.680">
          <front>
            <title>Information Technology - Abstract Syntax
            Notation One (ASN.1): Specification of basic notation
            </title>
            <author/>
            <date month="August" year="2015"/>
          </front>
          <seriesInfo name="ITU-T" value="Recommendation X.680"/>
          <seriesInfo name="ISO/IEC"  value="8824-1:2015"/>
        </reference>

        <reference anchor="X.681" target="https://www.itu.int/rec/T-REC-X.681">
          <front>
            <title>Information Technology - Abstract Syntax
            Notation One (ASN.1): Information object specification
            </title>
            <author/>
            <date month="August" year="2015"/>
          </front>
          <seriesInfo name="ITU-T" value="Recommendation X.681"/>
          <seriesInfo name="ISO/IEC"  value="8824-2:2015"/>
        </reference>

        <reference anchor="X.682" target="https://www.itu.int/rec/T-REC-X.682">
          <front>
            <title>Information Technology - Abstract Syntax
            Notation One (ASN.1): Constraint specification
            </title>
            <author/>
            <date month="August" year="2015"/>
          </front>
          <seriesInfo name="ITU-T" value="Recommendation X.682"/>
          <seriesInfo name="ISO/IEC"  value="8824-3:2015"/>
        </reference>

        <reference anchor="X.683" target="https://www.itu.int/rec/T-REC-X.683">
          <front>
            <title>Information Technology - Abstract Syntax
            Notation One (ASN.1): Parameterization of ASN.1 specifications
            </title>
            <author/>
            <date month="August" year="2015"/>
          </front>
          <seriesInfo name="ITU-T" value="Recommendation X.683"/>
          <seriesInfo name="ISO/IEC"  value="8824-4:2015"/>
        </reference>

        <reference anchor="X.690" target="https://www.itu.int/rec/T-REC-X.690">
          <front>
            <title>
              Information Technology - ASN.1 encoding
              rules: Specification of Basic Encoding Rules (BER),
              Canonical Encoding Rules (CER) and Distinguished
              Encoding Rules (DER)
            </title>
            <author/>
            <date month="August" year="2015"/>
          </front>
          <seriesInfo name="ITU-T" value="Recommendation X.690"/>
          <seriesInfo name="ISO/IEC"  value="8825-1:2015"/>
        </reference>

        <reference anchor="SMIMEv4">
          <front>
            <title>S/MIME version 4.0</title>
            <author/>
            <date/>
          </front>
          <annotation>
            This group of documents represents S/MIME version 4.0.
            These documents are <xref target="RFC2634"/>,
            this document (RFC 8551), <xref target="RFC8550"/>,
            <xref target="RFC5652"/>, and <xref target="RFC5035"/>.
          </annotation>
        </reference>

<!-- draft-ietf-lamps-rfc5750-bis (RFC 8550) -->
<reference anchor='RFC8550' target="https://www.rfc-editor.org/info/rfc8550">
<front>
<title>Secure/Multipurpose Internet Mail Extensions (S/MIME) Version 4.0 Certificate Handling
</title>
<author initials='J' surname='Schaad' fullname='Jim Schaad'>
    <organization />
</author>
<author initials='B' surname='Ramsdell' fullname='Blake Ramsdell'>
    <organization />
</author>
<author initials='S' surname='Turner' fullname='Sean Turner'>
    <organization />
</author>
<date month='January' year='2019'/>
</front>
<seriesInfo name="RFC" value="8550"/>
<seriesInfo name="DOI" value="10.17487/RFC8550"/>
</reference>

      </references>
      
      <references title="Informative References">
        &rfc2311; &rfc2312; &rfc2313; &rfc2314; &rfc2315;
        &rfc2630; &rfc2631; &rfc2632; &rfc2633;
        &rfc2785;
        &rfc3218;
        &rfc3850; &rfc3851; &rfc3852;
        &rfc4270;
        &rfc3766;
        &rfc5750; &rfc5751;
        &rfc4949;
        &rfc6278;
        &rfc6194; &rfc6151;
        &rfc2268;
        &rfc7905;
        &rfc1866;

        <reference anchor="SMIMEv2">
          <front>
            <title>S/MIME version 2</title>
            <author/>
            <date/>
          </front>
          <annotation>
            This group of documents represents S/MIME version 2.
            These documents are <xref target="RFC2311"/>, <xref target="RFC2312"/>, <xref target="RFC2313"/>, <xref target="RFC2314"/>, and <xref target="RFC2315"/>.
          </annotation>
        </reference>

        <reference anchor="SMIMEv3">
          <front>
            <title>S/MIME version 3</title>
            <author/>
            <date/>
          </front>
          <annotation>
            This group of documents represents S/MIME version 3.
            These documents are <xref target="RFC2630"/>, <xref target="RFC2631"/>, <xref target="RFC2632"/>, <xref target="RFC2633"/>, <xref target="RFC2634"/>, and <xref target="RFC5035"/>.
          </annotation>
        </reference>

        <reference anchor="TripleDES">
          <front>
            <title>Hellman Presents No Shortcut Solutions to the DES</title>
            <author surname="Tuchman" initials="W."/>
            <date month="July" year="1979"/>
          </front>
          <seriesInfo name="IEEE Spectrum" value="v. 16, n. 7, pp. 40-41"/>
          <seriesInfo name="DOI" value="10.1109/MSPEC.1979.6368160"/>
        </reference>

        <reference anchor="SMIMEv3.1">
          <front>
            <title>S/MIME version 3.1</title>
            <author/>
            <date/>
          </front>
          <annotation>
            This group of documents represents S/MIME version 3.1.
            These documents are <xref target="RFC2634"/>, <xref target="RFC3850"/>, <xref target="RFC3851"/>, <xref target="RFC3852"/>,  and <xref target="RFC5035"/>.
          </annotation>
        </reference>


        <reference anchor="SMIMEv3.2">
          <front>
            <title>S/MIME version 3.2</title>
            <author/>
            <date/>
          </front>
          <annotation>
            This group of documents represents S/MIME version 3.2.
            These documents are <xref target="RFC2634"/>, <xref target="RFC5750"/>, <xref target="RFC5751"/>, <xref target="RFC5652"/>, and <xref target="RFC5035"/>.
          </annotation>
        </reference>

        <reference anchor="SP800-57"
                   target="https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-57pt1r4.pdf">
          <front>
            <title>
              Recommendation for Key Management - Part 1: General
            </title>
            <author><organization>
              National Institute of Standards and Technology (NIST)
            </organization>
            </author>
            <date month="January" year="2016"/>
          </front>
         <seriesInfo name="NIST Special Publication 800-57"
                     value="Revision 4"/>
         <seriesInfo name="DOI" value="10.6028/NIST.SP.800-57pt1r4"/>
        </reference>

<!-- 186-2 marked "Superseded," but OK because 186-4 is also listed. -->
        <reference anchor="FIPS186-2" target="https://csrc.nist.gov/publications/detail/fips/186/2/archive/2000-01-27">
          <front>
            <title>Digital Signature Standard (DSS) (also with Change Notice&nbsp;1)</title>
            <author><organization>National Institute of Standards and Technology (NIST)</organization></author>
            <date month="January" year="2000"/>
          </front>
          <seriesInfo name="Federal Information Processing Standards Publication"
                      value="186-2"/>
        </reference>

<!-- Superseded, but OK because the latest version (Rev. 3) doesn't
     address the "1024-bit" part of "1024-bit and larger DH, see
     [SP800-56A]" in Appendix B.4.  (Looks like Rev. 3 only deals with
     2048 and up; it doesn't contain "1024.") -->
        <reference anchor="SP800-56A" target="https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-56Ar2.pdf">
          <front>
            <title>Recommendation for Pair-Wise Key Establishment Schemes Using Discrete Logarithm Cryptography</title>
            <author><organization>National Institute of Standards and Technology (NIST)</organization></author>
            <date month="May" year="2013"/>
          </front>
         <seriesInfo name="NIST Special Publication 800-56A" value="Revision 2"/>
         <seriesInfo name="DOI" value="10.6028/NIST.SP.800-56Ar2"/>
        </reference>

        &rfc7114;
        &rfc4134;

        <reference anchor="Efail" target="https://www.usenix.org/system/files/conference/usenixsecurity18/sec18-poddebniak.pdf">
          <front>
            <title>Efail: Breaking S/MIME and OpenPGP Email Encryption using Exfiltration Channels</title>
            <author surname="Poddebniak" initials="D"/>
            <author surname="Dresen" initials="C"/>
            <author surname="Muller" initials="J"/>
            <author surname="Ising" initials="F"/>
            <author surname="Schinzel" initials="S"/>
            <author surname="Friedberger" initials="S"/>
            <author surname="Somorovsky" initials="J"/>
            <author surname="Schwenk" initials="J"/>
            <date month="August" year="2018"/>
          </front>
          <!-- JLS - This needs to be formated according to correct conventions -->
          <seriesInfo name="UsenixSecurity" value="2018"/>
        </reference>

        <?rfc include="reference.RFC.6268.xml"?>

      </references>


      <section title="ASN.1 Module" anchor="ASN1Module">
        <t>
Note: The ASN.1 module contained herein is unchanged from RFC 3851
<xref target="SMIMEv3.1"/>, with the exception of a change to the
preferBinaryInside ASN.1 comment.
If a module is needed that is compatible with current ASN.1 standards, one can be found in <xref target="RFC6268"/>.

<!-- [rfced] This is a follow-up to one of our AUTH-state questions.

Apologies, but because RFC 3851 does not use "prefersBinaryInside" -
only RFC 5751 uses it, and only once (it appears to be a typo that
was carried into this document) - we are concerned that updating this
sentence per the feedback below would cause confusion for readers,
as RFC 3851 does not apply.  Please clarify.

Original question:
31) Appendix A:  Per <http://www.oid-info.com/cgi-bin/
display?oid=1.2.840.113549.1.9.16.11.1&action=display>, the rest of this
document, and published RFCs (except for one instance in RFC 5751), we
changed "prefersBinaryInside" to "preferBinaryInside."
Please let us know any objections.

Original:
Note: The ASN.1 module contained herein is unchanged from RFC 3851
[SMIMEv3.1] with the exception of a change to the prefersBinaryInside
ASN.1 comment.

Currently:
Note: The ASN.1 module contained herein is unchanged from RFC 3851
[SMIMEv3.1], with the exception of a change to the preferBinaryInside
ASN.1 comment.

Author reply:
'I would rather not change it.  It refers to the old module not the new.  If
you really feel the need to change it then it should be "a change from
prefersBinaryInside to preferBinaryInside in the ASN.1 comment."' -->

<!--[rfced] Can you please elaborate on / clarify what type of comment you would
like to add with regard to the following question sent
previously?
    
Original question:
b) Please review the following note in
<https://www.rfc-editor.org/errata_search.php?eid=5019>,
and let us know if any updates are needed for this document:

"2. Apply the note to the latest RFC/draft that obsoletes RFC 2633; I guess you
went for upstream, but generally the IETF applies changes to the
latest/greatest RFC/draft.  That obsoletes chain is: RFC 3851 obsoleted RFC
2633, RFC 3851 was obsoleted by RFC 5751, and draft-ietf-lamps-rfc5751-bis is
about to obsolete RFC 5751.  Luckily, draft-ietf-lamps-rfc5751-bis isn't yet an
RFC so there's an option to have the note added there."

The erratum suggests adding "sic" after "id-aa-encrypKeyPref."

Please also note that "id-aa-encrypKeyPref" is used on <http://www.oid-
info.com/cgi-bin/ display?oid=1.2.840.113549.1.9.16.2.11&action=display>.

Author reply:
I am not inclined to make any changes except for a possible comment.
Note that Perf is not a word either.  This is not a on the wire item
thus editorial.  I am not going to change the string and the sic as
suggested causes a syntax error. -->

  This module uses the 1988 version of ASN.1.
        </t>
              <figure>
      <artwork>
SecureMimeMessageV3dot1

  { iso(1) member-body(2) us(840) rsadsi(113549)
         pkcs(1) pkcs-9(9) smime(16) modules(0) msg-v3dot1(21) }

DEFINITIONS IMPLICIT TAGS ::=

BEGIN

IMPORTS

-- Cryptographic Message Syntax [CMS]
   SubjectKeyIdentifier, IssuerAndSerialNumber,
   RecipientKeyIdentifier
       FROM  CryptographicMessageSyntax
             { iso(1) member-body(2) us(840) rsadsi(113549)
               pkcs(1) pkcs-9(9) smime(16) modules(0) cms-2001(14) };

-- id-aa is the arc with all new authenticated and unauthenticated
-- attributes produced by the S/MIME Working Group.

id-aa OBJECT IDENTIFIER ::= {iso(1) member-body(2) usa(840)
        rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) attributes(2)}

-- S/MIME Capabilities provides a method of broadcasting the
-- symmetric capabilities understood.  Algorithms SHOULD be ordered
-- by preference and grouped by type.

smimeCapabilities OBJECT IDENTIFIER ::= {iso(1) member-body(2)
        us(840) rsadsi(113549) pkcs(1) pkcs-9(9) 15}

SMIMECapability ::= SEQUENCE {
   capabilityID OBJECT IDENTIFIER,
   parameters ANY DEFINED BY capabilityID OPTIONAL }

SMIMECapabilities ::= SEQUENCE OF SMIMECapability

-- Encryption Key Preference provides a method of broadcasting the
-- preferred encryption certificate.

id-aa-encrypKeyPref OBJECT IDENTIFIER ::= {id-aa 11}

SMIMEEncryptionKeyPreference ::= CHOICE {
   issuerAndSerialNumber   [0] IssuerAndSerialNumber,
   receipentKeyId          [1] RecipientKeyIdentifier,
   subjectAltKeyIdentifier [2] SubjectKeyIdentifier
}

-- "receipentKeyId" is spelled incorrectly but is kept for
-- historical reasons.

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

id-cap  OBJECT IDENTIFIER ::= { id-smime 11 }

-- The preferBinaryInside OID indicates an ability to receive
-- messages with binary encoding inside the CMS wrapper.
-- The preferBinaryInside attribute's value field is ABSENT.

id-cap-preferBinaryInside  OBJECT IDENTIFIER ::= { id-cap 1 }

-- The following is a list of OIDs to be used with S/MIME v3.

-- Signature Algorithms Not Found in [RFC3370], [RFC5754], [RFC4056],
-- and [RFC3560]

--
-- md2WithRSAEncryption OBJECT IDENTIFIER ::=
--    {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1)
--     2}

--
-- Other Signed Attributes
--
-- signingTime OBJECT IDENTIFIER ::=
--    {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9)
--     5}
--    See [CMS] for a description of how to encode the attribute
--    value.

SMIMECapabilitiesParametersForRC2CBC ::= INTEGER
--        (RC2 Key Length (number of bits))

END
      </artwork>
              </figure>

    </section>

    <section title="Historic Mail Considerations" anchor="HistoricMail">
      <t>
        Over the course of updating the S/MIME specifications, the set of
        recommended algorithms has been modified each time the documents have
        been updated.  This means that if a user has historic emails and their user agent has been updated to only support the current set of recommended algorithms, some of those old emails will no longer be accessible.
        It is strongly suggested that user agents implement some of the following algorithms for dealing with historic emails.
      </t>

      <t>
        This appendix contains a number of references to documents that have
        been obsoleted or replaced. This is intentional, as the updated
        documents often do not have the same information in them.
      </t>

      <section title="DigestAlgorithmIdentifier">
        <t>
          The following algorithms have been called out for some level of
          support by previous S/MIME specifications:

          <list style="symbols">
            <t>
              SHA&nbhy;1 was dropped in <xref target="SMIMEv4"/>.
              SHA-1 is no longer considered to be secure, as it is no longer
              collision resistant.
              The IETF statement on SHA-1 can be found in <xref
              target="RFC6194"/>, but it is out of date relative to the most recent advances.
            </t>
            <t>
              MD5 was dropped in <xref target="SMIMEv4"/>.
              MD5 is no longer considered to be secure, as it is no longer
              collision resistant.
              Details can be found in <xref target="RFC6151"/>.
            </t>
          </list>
        </t>
              
      </section>
      
      <section title="Signature Algorithms">
        <t>
          There are a number of problems with validating signatures on sufficiently historic messages.
          For this reason, it is strongly suggested that user agents treat these signatures differently from those on current messages.
          These problems include the following:
          <list style="symbols">
            <t>
              Certification authorities are not required to keep certificates on a CRL beyond one update after a certificate has expired.
              This means that unless CRLs are cached as part of the message it
              is not always possible to check to see if a certificate has been revoked.
              The same problems exist with Online Certificate Status Protocol (OCSP) responses, as they may be based on a CRL rather than on the certificate database.
            </t>
            <t>
              RSA and DSA keys of less than 2048 bits are now considered by many experts to be cryptographically insecure (due to advances in computing power).
              Such keys were previously considered secure, so the processing of historic signed messages will often result in the use of weak keys.
              Implementations that wish to support previous versions of S/&wj;MIME or process old messages need to consider the security risks that result from smaller key sizes (e.g., spoofed messages) versus the costs of denial of service.
              <vspace blankLines="1"/>
              <xref target="SMIMEv3.1"/> set the lower limit on suggested key sizes for creating and validation at 1024 bits.
              Prior to that, the lower bound on key sizes was 512 bits.
            </t>
            <t>
              Hash functions used to validate signatures on historic messages
              may no longer be considered to be secure (see below).
              While there are not currently any known practical pre-image or
              second pre&nbhy;image attacks against MD5 or SHA&nbhy;1, the
              fact that they are no longer considered to be collision resistant implies that the security levels of the signatures are generally considered suspect.
              If a message is known to be historic and it has been in the possession of the client for some time, then it might still be considered to be secure.
            </t>
            <t>
              The previous two issues apply to the certificates used to validate the binding of the public key to the identity that signed the message as well.
            </t>
          </list>
        </t>
        <t>
          The following algorithms have been called out for some level of support by previous S/MIME specifications:
          <list style="symbols">
            <t>
              RSA with MD5 was dropped in <xref target="SMIMEv4"/>.
              MD5 is no longer considered to be secure, as it is no longer
              collision resistant.
              Details can be found in <xref target="RFC6151"/>.
            </t>
            <t>
              RSA and DSA with SHA&nbhy;1 were dropped in <xref target="SMIMEv4"/>.
              SHA-1 is no longer considered to be secure, as it is no longer
              collision resistant.
              The IETF statement on SHA-1 can be found in <xref
              target="RFC6194"/>, but it is out of date relative to the most recent advances.
            </t>
            <t>
              DSA with SHA-256 was dropped in <xref target="SMIMEv4"/>.
              DSA has been replaced by elliptic curve versions.
            </t>
          </list>
        </t>

        <t>
          As requirements for "mandatory to implement" have changed over time, some issues have been created that can cause interoperability problems:
          <list style="symbols">
            <t>
              S/&wj;MIME v2 clients are only required to verify digital signatures using the rsaEncryption algorithm with SHA&nbhy;1 or MD5 and might not implement id-dsa-with-sha1 or id-dsa at all.
            </t>
            <t>
              S/&wj;MIME v3 clients might only implement signing or signature verification using id-dsa-with-sha1 and might also use id-dsa as an AlgorithmIdentifier in this field.
            </t>
            <t>
              Note that S/&wj;MIME v3.1 clients support verifying id-dsa-with-sha1 and rsaEncryption and might not implement sha256WithRSAEncryption.
            </t>
          </list>
        </t>

        <t>
          NOTE: Receiving clients SHOULD recognize id-dsa as equivalent to
 id&nbhy;dsa-with-sha1.
        </t>

        <t>
          For 512-bit RSA with SHA&nbhy;1, see <xref target="RFC3370"/> and
          <xref target="FIPS186-2"/> without Change Notice 1; for 512-bit RSA
          with SHA-256, see <xref target="RFC5754"/> and <xref
          target="FIPS186-2"/> without Change Notice 1; and for 1024-bit through 2048-bit RSA with SHA-256, see <xref target="RFC5754"/> and <xref target="FIPS186-2"/> with Change Notice 1.
          The first reference provides the signature algorithm's OID, and the second provides the signature algorithm's definition.
        </t>

        <t>
          For 512-bit DSA with SHA&nbhy;1, see <xref target="RFC3370"/> and
          <xref target="FIPS186-2"/> without Change Notice 1; for 512-bit DSA
          with SHA-256, see <xref target="RFC5754"/> and <xref
          target="FIPS186-2"/> without Change Notice 1; for 1024-bit DSA with
          SHA&nbhy;1, see <xref target="RFC3370"/> and <xref
          target="FIPS186-2"/> with Change Notice 1; and for 1024-bit and above DSA with SHA-256, see <xref target="RFC5754"/> and <xref target="FIPS186-4"/>.
          The first reference provides the signature algorithm's OID, and the second provides the signature algorithm's definition.
        </t>
        
      </section>

      <section title="ContentEncryptionAlgorithmIdentifier">
        <t>
          The following algorithms have been called out for some level of support by previous S/MIME specifications:
          <list style="symbols">
            <t>
              RC2/40 <xref target="RFC2268"/> was dropped in <xref target="SMIMEv3.2"/>.
              The algorithm is known to be insecure and, if supported, should only be used to decrypt existing email.
            </t>
            <t>
              DES EDE3 CBC <xref target="TripleDES"/>, also known as "tripleDES", was dropped in <xref target="SMIMEv4"/>.
              This algorithm is removed from the list of supported algorithms because (1)&nbsp;it has a 64-bit block size and (2)&nbsp;it offers less than 128&nbsp;bits of security.
              This algorithm should be supported only to decrypt existing email; it should not be used to encrypt new emails.
            </t>
          </list>
        </t>
      </section>

      <section title="KeyEncryptionAlgorithmIdentifier">
        <t>
          The following algorithms have been called out for some level of support by previous S/MIME specifications:
          <list style="symbols">
            <t>
              DH ephemeral-static mode, as specified in
              <xref target="RFC3370"/> and <xref target="SP800-57"/>, was dropped in <xref target="SMIMEv4"/>.
              
            </t>
            <t>
              RSA key sizes have been increased over time.
              Decrypting old mail with smaller key sizes is reasonable;
              however, new mail should use the updated key sizes.
            </t>
          </list>
        </t>

        <t>
          For 1024-bit DH, see <xref target="RFC3370"/>.
          For 1024-bit and larger DH, see <xref target="SP800-56A"/>; regardless, use the KDF, which is from X9.42, specified in <xref target="RFC3370"/>.
        </t>
              
      </section>
    </section>

    <section title="Moving S/MIME v2 Message Specification to Historic Status" anchor="V2Historic">
      <t>
        The S/&wj;MIME v3 <xref target="SMIMEv3"/>, v3.1 <xref
        target="SMIMEv3.1"/>, and v3.2 <xref target="SMIMEv3.2"/> 
        specifications
        are backward compatible with the S/&wj;MIME v2 Message Specification
        <xref target="SMIMEv2"/>, with the exception of the algorithms (dropped RC2/40
        requirement and added DSA and RSASSA-PSS requirements).  Therefore,
        RFC&nbsp;2311 <xref target="SMIMEv2"/> was moved to Historic status.
      </t>
    </section>
    
    <section title="Acknowledgements" numbered="no">
      <t>
        Many thanks go out to the other authors of the S/&wj;MIME version 2
        Message Specification RFC: Steve Dusse, Paul Hoffman, Laurence
        Lundblade, and Lisa Repka.  Without v2, there wouldn't be a v3, v3.1,
        v3.2, or v4.0.
      </t>
      <t>
        Some of the examples in this document were copied from <xref target="RFC4134"/>.
        Thanks go to the people who wrote and verified the examples in that document.
      </t>
      <t>
        A number of the members of the S/&wj;MIME Working Group have also worked
        very hard and contributed to this document.  Any list of people is
        doomed to omission, and for that I apologize.  In alphabetical order,
        the following people stand out in my mind because they made direct
        contributions to this document:
      </t>
      <t>
        Tony Capel, Piers Chivers, Dave Crocker, Bill Flanigan, Peter
        Gutmann, Alfred Hoenes, Paul Hoffman, Russ Housley, William Ottaway,
        and John Pawling.
      </t>
  <t>
    The version 4 update to the S/&wj;MIME documents was done under the auspices of the LAMPS Working Group.
  </t>

    </section>
  </back>
</rfc>
