<?xml version="1.0" encoding="UTF-8"?><?rfc linefile="1:pubkey-caps.xml"?>
<!-- automatically generated by xml2rfc v1.35 on 2012-05-16T05:01:05Z -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
    <!-- xml2rfc-processed-entity RFC2119 -->
  <!--

--><!-- xml2rfc-processed-entity RFC3279 -->
  <!--
--><!-- xml2rfc-processed-entity RFC3370 -->
  <!--
--><!-- xml2rfc-processed-entity RFC5751 -->
  <!--
--><!-- xml2rfc-processed-entity RFC4055 -->
  <!--
--><!-- xml2rfc-processed-entity RFC4262 -->
  <!--
--><!-- xml2rfc-processed-entity RFC5912 -->
  <!--
--><!-- xml2rfc-processed-entity RFC5480 -->

  <!--
--><!-- xml2rfc-processed-entity RFC6277 -->

  <!-- xml2rfc-processed-entity SMIME-REFS -->

  <?rfc linefile="1:bibxml/smime.xml"?>  <!-- xml2rfc-processed-entity ESS-BASE -->
  <!-- xml2rfc-processed-entity CMS -->
  <!-- xml2rfc-processed-entity CMS-ASN -->
  <!-- xml2rfc-processed-entity CMS-AED -->
  <!-- xml2rfc-processed-entity SMIME-MSG -->
  <!-- xml2rfc-processed-entity AED-RANT -->
  <!-- xml2rfc-processed-entity XOR-HASH -->
  <!-- xml2rfc-processed-entity SMIMEv3-MSG -->
  <!-- xml2rfc-processed-entity SMIME-MSG -->


<?rfc linefile="25:pubkey-caps.xml"?>

  <!-- xml2rfc-processed-entity ASN-2008 -->
  <!-- xml2rfc-processed-entity ASN-1988 -->
  <!-- xml2rfc-processed-entity RSA-PUBKEY -->
  <!-- xml2rfc-processed-entity PUBKEY-RSA-OAEP -->
  <!-- xml2rfc-processed-entity PUBKEY-RSA-PSS -->
  <!-- xml2rfc-processed-entity PUBKEY-DSA -->
  <!-- xml2rfc-processed-entity PUBKEY-DH -->
  <!-- xml2rfc-processed-entity PUBKEY-ECC -->
  <!-- xml2rfc-processed-entity PUBKEY-ECC-DH -->
  <!-- xml2rfc-processed-entity PUBKEY-ECC-MQV -->
  <!-- xml2rfc-processed-entity PUBKEY-SIG-RSA-PSS -->
]>

<?rfc strict="yes"?>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<rfc category="info" docName="draft-ietf-pkix-pubkey-caps-07"
ipr="trust200902">
  <front>
    <title abbrev="PubKey Caps">S/MIME Capabilities for Public Key
Definitions</title>
    <author fullname="Jim Schaad" initials="J." surname="Schaad">
      <organization>Soaring Hawk Consulting</organization>
      <address>
        <email>ietf@augustcellars.com</email>
      </address>
    </author>
    <date/>

    <abstract>
      <t>
        This document defines a set of Secure/Multipurpose Internet Mail Extensions (S/MIME) Capability types for ASN.1
        encoding for the current set of public keys defined by the PKIX
        working group.  This facilitates the ability for a requester to specify information on the public keys and signature algorithms to be used in responses.  An example of where this is used is is detailed in Online Certificate Status Protocol Algorithm Agility (RFC 6277).
      </t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>In the process of dealing with the Online Certificate Status Protocol (OCSP) agility issues in <xref
target="RFC6277"/> it was noted that we really wanted to
describe information to be used in selecting a public key, but we did
not have any way of doing so.  This document
fills that hole by defining a set of Secure/Multipurpose Internet Mail Extensions (S/MIME) Capability types for a small set
of public key representations. </t>

      <t>S/MIME Capabilities where originally defined in <xref target="SMIMEv3-MSG"/> as a way for the sender of an S/MIME message to tell the recipient of the message the set of encryption algorithms that were supported by the sender's system.

      In the beginning, the focus was primarily on communicating the set of encryption algorithms that were supported by the sender.
      Over time it was expanded to allow for an S/MIME client to state that it supported new features such as the compression data type and binary encoded contents.
      The structure was defined so that parameters can be passed in as part of the capability to allow for subsets of algorithms to be used.
      This was used for the RC2 encryption algorithm, although only two values out of the set of values were ever used.
      The object of restricting the set of values is that a client can use a simple binary comparison in order to check for equality.
      The client should never need to decode the capability and do an element by element comparison.
      Historically this has been not been a problem as the vast majority of S/MIME capabilities consist of just the algorithm identifier for the algorithm.</t>

<!--
      As originally defined it was targeted toward supporting items with a small number of possible parameters.
      For the RC2 encryption algorithm only two values from the entire range of values were ever used.
      The object of restricting the set of values was so that a client could do a simple binary comparison without having to decode the S/MIME capability.
      This was especially easy since most just consisted of the object identifier for the algorithm.</t> -->

    <t>Many people are under the impression that only a single data structure can be assigned to an object identifer, this is not the case.  As an example the OID rsaEncryption is used in multiple locations for different data.  It represents a public key, a key transport algoritm (in S/MIME), and was originally used in the PKCS#7 specfication as a signature value identifier (this has since been changed by the S/MIME specifications).  One of the implications is that when mapping an object identifier to a data type structure, the location in the ASN.1 structure needs to be taken into consideration as well.</t>

<!--
      <t>Given that we are assigning different data types to the algorithm descriptors here, and many of the algorithm descriptors are the same as are used in signature, key transport or key agreement algorithms, the public key versions of these structures MUST NOT be placed in the same locations as the other versions.  It is expected that  the places where one needs S/MIME capabilities for public keys is going to be vastly different than for the other values.</t> -->

      <section title="ASN.1 Notation">
        <t>The main body of the text is written using snippets of ASN.1 that
are extracted from the ASN.1 2008 module in <xref target="ASN.2008"/>.  

ASN.1 2008 is used in the document because it directly represents the meta-data which is not representable in the 1988 version of
ASN.1 but instead is part of the text.

In keeping with the current policy of the PKIX working group, the
1988 module and the text is the normative module.  In the event of a
conflict between the contents of the two modules, the 1988 module is authoritative.</t>

        <t>When reading this document, it is assumed that you will have a
degree of familiarity with the basic object module that is presented in
section 3 of RFC 5912 (<xref target="RFC5912"/>).  We use the SMIME-CAPS
object in this document, it associates two fields together in a single
object.
<figure><artwork>
SMIME-CAPS ::= CLASS {
    &id         OBJECT IDENTIFIER UNIQUE,
    &Type       OPTIONAL
}
WITH SYNTAX { [TYPE &Type] IDENTIFIED BY &id }
</artwork></figure>

  These fields are:
          <list style="hanging">
            <t hangText="&amp;id">contains an object identifier.  When
placed in an object set, this element is tagged so that no two elements can
be placed in the set that have the same value in the &amp;id field.  Note that this is not a restriction which says that only a single object can exist with a single object identifier.</t>
            <t hangText="&amp;Type">optionally contains an ASN.1 type
identifier.  If the field &amp;Type is not defined then the optional
parameters field of the AlgorithmIdentifier type would be omitted.</t>
          </list>
        </t>
        <t>The class also has a specialized syntax for how to define an
object in this class.  The all upper case words TYPE IDENTIFIER and BY are
syntactic sugar to make it easier to read.  The square brackets define optional pieces of the syntax.</t>
        <t>One of the things that can be done is to reference the fields of
an object while defining other objects.  This means that if an object called
foo has a field named &amp;value, the value can be directly referenced
as foo.&amp;value.  This means that we automatically get any updates
to values or types and we do not need to do any replication of the data.</t>
      </section>
      <section title="Requirements Terminology">
        <t>When capitalized the key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in <xref target="RFC2119"/>.</t>
      </section>
    </section>

    <section title="RSA Public Keys">
      <t>There are currently three different public key object identifiers
for RSA public keys.  These are RSA, RSA Encryption Scheme - Optimal Asymmetric Encryption Padding (RSAES-OAEP) and RSA Signature Scheme with Appendix - Probablistic Signature Scheme (RSASSA-PSS).
      </t>
      <section title="Generic RSA Public Keys">
        <t>Almost all RSA keys that are contained in certificates today use
the generic RSA public key format and identifier.  This allows for the
public key to be used both for key transport and for signature validation
(assuming it is compatible with the bits in the key usage extension).  The
only reason for using one of more specific public key identifiers is if the
user wants to restrict the usage of the RSA public key to a specific
algorithm.</t>
        <t>For the generic RSA public key, the S/MIME capability that is
advertised is a request for a specific key size to be used.  This would
normally be used for dealing with a request on the key to be used for a
signature that the client would then verify.  In general the user would
provide a specific key when a key transport algorithm is being
considered.</t>
        <t>The ASN.1 that is used for the generic RSA public key is defined
as below:</t>
        <?rfc linefile="1:ForDraft/pubkeys-rsa.incl"?><figure><artwork>
   scap-pk-rsa SMIME-CAPS ::= {
     TYPE RSAKeyCapabilities
     IDENTIFIED BY pk-rsa.&amp;id
   }
 
   RSAKeyCapabilities ::= SEQUENCE {
      minKeySize        RSAKeySize,
      maxKeySize        RSAKeySize OPTIONAL
   }

   RSAKeySize ::= INTEGER (1024 | 2048 | 3072 | 4096 | 7680 |
                           8192 | 15360, ...)

</artwork></figure>
<?rfc linefile="163:pubkey-caps.xml"?>
        <t>In the above ASN.1 we have defined the following:
          <list style="hanging">
            <t hangText="scap-pk-rsa">is a new SMIME-CAP object.  This object associates the existing object identifier (rsaEncryption) used for the public key in certificates  (defined in <xref target="RFC3279"/> and <xref target="RFC5912"/>) with a new type defined in this document.</t>
            <t hangText="RSAKeyCapabilities">carries the set of desired capabilities for an RSA key.  The fields of this type are:
              <list style="hanging">
                <t hangText="minKeySize">contains the minimum length of the RSA modulus to be used.  This field SHOULD NOT contain a value less than 1024.</t>
                <t hangText="maxKeySize">contains the maximum length of the RSA modules that should be used.  If this field is absent then no maximum length is requested/expected.  This value is normally selected so as not to cause the current code to run unacceptably long when processing signatures.</t>
              </list>
            </t>
            <t hangText="RSAKeySize">provides a set of suggested values to be used.  The values 1024, 2048, 3072, 7680 and 15360 are from the NIST guide on signature sizes <xref target="NIST-SIZES"/> while the others are common powers of two that are used.  The list is not closed and other values can be used.</t>
          </list>
        </t>

      </section>

      <section title="RSASSA-PSS Signature Public Keys">
        <t>While most of the time one will use the generic RSA public key
identifier in a certificate, the RSASSA-PSS identifier can be used if the
owner of the key desires to restrict the usage of the key to just this
algorithm.  This algorithm does have the ability to place a set of algorithm parameters in the public key info structure, they have not been included in this location as the same information should be carried in the signature S/MIME capabilities instead.</t>
        <t>The ASN.1 that is used for the RSASSA-PSS public key is defined
below:</t>
        <?rfc linefile="1:ForDraft/pubkeys-rsa-pss.incl"?><figure><artwork>
   scap-pk-rsaSSA-PSS SMIME-CAPS ::= {
     TYPE RSAKeyCapabilities
     IDENTIFIED BY pk-rsaSSA-PSS.&amp;id
   }
</artwork></figure>
<?rfc linefile="186:pubkey-caps.xml"?>
        <t>In the above ASN.1 we have defined the following:
          <list style="hanging">
            <t hangText="scap-pk-rsaSSA-PSS">is a new SMIME-CAP object.  This object associates the existing object identifier (id-RSASSA-PSS) used for the public key certificates (defined in <xref target="RFC4055"/> and <xref target="RFC5912"/>) with type RSAKeyCapabilities.</t>
          </list>
        </t>
      </section>
      <section title="RSAES-OAEP Key Transport Public Keys">
        <t>While most of the time one will use the generic RSA public key
identifier in a certificate, the RSAES-OAEP identifier can be used if the
owner of the key desires to restrict the usage of the key to just this
algorithm.  This algorithm does have the ability to place a set of algorithm parameters in the public key info structure, they have not been included in this location as the same information should be carried in the key transport S/MIME capabilities instead.</t>
        <t>The ASN.1 that is used for the RSAES-OAEP public key is defined
below:</t>
        <?rfc linefile="1:ForDraft/pubkeys-rsa-oaep.incl"?><figure><artwork>
   scap-pk-rsaES-OAEP SMIME-CAPS ::= {
     TYPE RSAKeyCapabilities
     IDENTIFIED BY pk-rsaES-OAEP.&amp;id
   }
</artwork></figure>
<?rfc linefile="200:pubkey-caps.xml"?>
        <t>In the above ASN.1 we have defined the following:
          <list style="hanging">
            <t hangText="scap-pk-rsaES-OAEP">is a new SMIME-CAP object.  This object associates the existing object identifier (id-RSAES-OAEP) used for the public key certificates (defined in <xref target="RFC4055"/> and <xref target="RFC5912"/>) with type RSAKeyCapabilities.</t>
          </list>
        </t>
      </section>
    </section>

    <section title="Diffie-Hellman Keys">
      <t>There are currently two Diffie-Hellman (DH) public key object identifiers.
These are DH key agreement and Digital Signature Standard (DSA).</t>
      <section title="DSA Signature Public Key">
        <t>This public key type is used for the validation of DSA signatures.</t>
        <t>The ASN.1 that is used for DSA keys is defined below:</t>
        <?rfc linefile="1:ForDraft/pubkeys-dsa.incl"?><figure><artwork>
   scap-pk-dsa SMIME-CAPS ::= {
     TYPE DSAKeyCapabilities
     IDENTIFIED BY pk-dsa.&amp;id
   }

   DSAKeyCapabilities ::= CHOICE {
       keySizes         [0] SEQUENCE {
          minKeySize            DSAKeySize,
          maxKeySize            DSAKeySize OPTIONAL,
          maxSizeP              [1] INTEGER OPTIONAL,
          maxSizeQ              [2] INTEGER OPTIONAL,
          maxSizeG              [3] INTEGER OPTIONAL
       }, 
       keyParams        [1] pk-dsa.&amp;Params
   }

   DSAKeySize ::= INTEGER (1024 | 2048 | 3072 | 7680 | 15360 )
</artwork></figure>
<?rfc linefile="215:pubkey-caps.xml"?>
        <t>In the above ASN.1 we have defined the following:
          <list style="hanging">
            <t hangText="scap-pk-dsa">is a new SMIME-CAP object.  This object associates the existing object identifier (id-dsa) used for the public key in certificates (defined in <xref target="RFC3279"/> and <xref target="RFC5912"/>) with a new type defined here, DSAKeyCapabilities.</t>
            <t hangText="DSAKeyCapabilities">carries the desired set of capabilities for the DSA key.  The fields of this type are:
              <list style="hanging">
                <t hangText="keySizes">is used when only a key size is needed to be specified and not a specific group.  It is expected that this would be the most commonly used of the two options.  In key sizes the fields are used as follows:
                  <list style="hanging">
                    <t hangText="minKeySize">contains the minimum length of the DSA modulus to be used.</t>
                    <t hangText="maxKeySize">contains the maximum length of the DSA modules that should be used.  If this field is absent then no maximum length
                      is requested/expected.</t>
                    <t hangText="maxSizeP">contains the maximum length of the value p that should be used.  If this field is absent then no maximum length is imposed.</t>
                    <t hangText="maxSizeQ">contains the maximum length of the value q that should be used.  If this field is absent then no maximum length is imposed.</t>
                    <t hangText="maxSizeG">contains the maximum lenght of the value g that should be used.  If this field is absent then no maximum length is imposed.</t>
                  </list>
                </t>
                <t hangText="keyParams">contains the exact set of DSA for the key used to sign the message.  This field is provided for completeness and to match the fields for Elliptical Curve, however it is expected that usage of this field is extremely rare.</t>
              </list>
            </t>
          </list>
        </t>
      </section>
      <section title="DH Key Agreement Keys">
        <t>This public key type is used with the DH key agreement algorithm.</t>
        <t>The ASN.1 that is used for DH keys is defined below:</t>
        <?rfc linefile="1:ForDraft/pubkeys-dh.incl"?><figure><artwork>
   scap-pk-dh SMIME-CAPS ::= {
     TYPE DSAKeyCapabilities
     IDENTIFIED BY pk-dh.&amp;id
   }
</artwork></figure>
<?rfc linefile="240:pubkey-caps.xml"?>
        <t>In the above ASN.1 we have defined the following:
          <list style="hanging">
            <t hangText="scap-pk-dh">is a new SMIME-CAP object.  This object associates the existing object identifier (id-dh) used for the public key algorithm in the certificates (defined in <xref target="RFC3279"/> and <xref target="RFC5912"/>) with a new type defined above, DSAKeyCapabilities.</t>
          </list>
        </t>
      </section>
    </section>

    <section title="Elliptical Curve Keys">
      <t>There are currently three Elliptical Curve Cryptography (ECC) public key object
identifiers.  These are EC, EC-DH and Elliptical Curve Menezes-Qu-Vanstone (EC-MQV).</t>
      <section title="Generic Elliptical Curve Keys">
        <t>Almost all ECC keys  that are contained in certificates today use the generic ECC public key format and identifier.  This allows for the public key to be used both for key agreement and for signature validation (assuming the appropriate bits are in the certificate).  The only reason for using one of the more specific public key identifier is if the user wants to restrict the usage of the ECC public key to a specific algorithm.</t>
        <t>For the generic ECC public key, the S/MIME capability that is advertised is a request for a specific group to be used. </t>
        <t>The ASN.1 that is used for the generic ECC public key is defined as below:</t>
        <?rfc linefile="1:ForDraft/pubkeys-ecc.incl"?><figure><artwork>
   scap-pk-ec SMIME-CAPS ::= {
      TYPE EC-SMimeCaps
      IDENTIFIED BY pk-ec.&amp;id
   }

   EC-SMimeCaps ::= SEQUENCE (SIZE (1..MAX)) OF ECParameters
</artwork></figure>
<?rfc linefile="256:pubkey-caps.xml"?>
        <t>In the above ASN.1 we have defined the following:
          <list style="hanging">
            <t hangText="scap-pk-ec">is a new SMIME-CAP object.  This object associates the existing object identifier (id-ecPublicKey) used for the public key algorithm in the certificates (defined in <xref target="RFC5480"/> and <xref target="RFC5912"/>) with the new type EC-SMimeCaps.</t>
            <t hangText="EC-SMimeCaps">carries a sequence of at least one ECParameters structure.  This allows for multiple curves to be requested in a single capability request.  A maximum/minimum style of specifying sizes is not provided as much greater care is required in selecting a specific curve than is needed to create the parameters for a DSA/DH key.  As specified in <xref target="RFC5480"/>, for PKIX compliant certificates only the namedCurve choice of ECParameters can expected to be used.</t>
          </list>
        </t>
      </section>
      <section title="Elliptical Curve DH Keys">
        <t>This public key type is used with the Elliptical Curve Diffie-Hellman key agreement algorithm.</t>
        <t>The ASN.1 that is used for EC-DH keys is defined below:</t>
        <?rfc linefile="1:ForDraft/pubkeys-ecc-dh.incl"?><figure><artwork>
   scap-pk-ecDH SMIME-CAPS ::= {
     TYPE EC-SMimeCaps
     IDENTIFIED BY pk-ecDH.&amp;id
   }
</artwork></figure>
<?rfc linefile="267:pubkey-caps.xml"?>
        <t>In the above ASN.1 we have defined the following:
          <list style="hanging">
            <t hangText="scap-ec-dh">is a new SMIME-CAP object.  This object associates the existing object identifier (id-ecDH) used for the public key algorithm in the certificate (defined in <xref target="RFC5480"/> and <xref target="RFC5912"/>) with the same type structure used for public keys.</t>
          </list>
        </t>
      </section>
      <section title="Elliptical Curve MQV Keys">
        <t>This public key type is used with the Elliptical Curve MQV key agreement algorithm.</t>
        <t>The ASN.1 that is used for EC-MQV keys is defined below:</t>
        <?rfc linefile="1:ForDraft/pubkeys-ecc-mqv.incl"?><figure><artwork>
   scap-pk-ecMQV SMIME-CAPS ::= {
     TYPE EC-SMimeCaps
     IDENTIFIED BY pk-ecMQV.&amp;id
   }
</artwork></figure>
<?rfc linefile="277:pubkey-caps.xml"?>
        <t>In the above ASN.1 we have defined the following:
          <list style="hanging">
            <t hangText="scap-ec-MQV">is a new SMIME-CAP object.  This object associates the existing object identifier (id-eqMQV) used for the public key algorithm in the certificate (defined in <xref target="RFC5480"/> and <xref target="RFC5912"/>) with the same type structure used for public keys.</t>
          </list>
        </t>
      </section>
    </section>

    <section title="RSASSA-PSS Signature Algorithm Capability">
      <t>This document defines a new S/MIME Capability for the RSASSA-PSS signature algorithm.  There already exists one in <xref target="RFC4055"/> where the parameters field is not used.</t>
      <t>When the S/MIME group defined a S/MIME Capability for the RSASSA-PSS signature algorithm, it was done in the context of how S/MIME defines and uses S/MIME Capabilities.  When placed in an S/MIME message <xref target="SMIME-MSG"/> or in a certificate <xref target="RFC4262"/> it is always placed in a sequence of capabilities.  This means that one could place the identifier for RSASSA-PSS in the sequence along with the identifier for MD5, SHA-1 and SHA-256.  The assumption was then made that one could compute the matrix of all answers and the publisher would support all elements in the matrix.  This has the possibility that the publisher could accidently publish a point in the matrix that is not supported.</t>
      <t>In this situation, there is only a single item that is published.  This means that we need to publish all of the associated information along with the identifier for the signature algorithm in a single entity.  For this reason we now define a new parameter type to be used as the S/MIME capability type which contains a hash identifier and a mask identifier.  The ASN.1 used for this is as follows:</t>
      <?rfc linefile="1:ForDraft/pubkeys-sig-rsa-pss.incl"?><figure><artwork>
   scap-sa-rsaSSA-PSS SMIME-CAPS ::= {
      TYPE RsaSsa-Pss-sig-caps
      IDENTIFIED BY sa-rsaSSA-PSS.&amp;id
   }

   RsaSsa-Pss-sig-caps ::= SEQUENCE {
      hashAlg  SMIMECapability{{ MaskAlgorithmSet }},
      maskAlg  SMIMECapability{{ ... }} OPTIONAL,
      trailerField INTEGER DEFAULT 1
   }

   scap-mf-mgf1 SMIME-CAPS ::= {
      TYPE SMIMECapability{{ ... }}
      IDENTIFIED BY id-mgf1
   }
   
   MaskAlgorithmSet SMIME-CAPS ::= {scap-mf-mgf1, ...}
</artwork></figure>
<?rfc linefile="290:pubkey-caps.xml"?>
      <t>In the above ASN.1 we have defined the following:
        <list style="hanging">
          <t hangText="scap-sa-rsaSSA-PSS">is a new SMIME-CAP object.  This object associates the existing object identifier (id-RSASSA-PSS) used for the signature algorithm (defined in <xref target="RFC4055"/> and <xref target="RFC5912"/>) with the new type RsaSsa-Pss-sig-caps.</t>
          <t hangText="RsaSsa-Pss-sig-caps">carries the desired set of capabilities for the RSASSA-PSS signature algorithm.  The fields of this type are:
            <list style="hanging">
              <t hangText="hashAlg">contains the S/MIME capability for the hash algorithm we are declaring we support with the RSASSA-PSS signature algorithm.</t>
              <t hangText="maskAlg">contains the S/MIME capability for the mask algorithm we are declaring we support with the RSASSA-PSS signature algorithm.</t>
              <t hangText="trailerField">specifies which trailer field algorithm is being supported.  This MUST be the value 1.</t>
            </list>
          </t>
        </list>
      </t>

      <t>NOTE:  In at least one iteration of the design we used a sequence of hash identifiers and a sequence of masking functions and again made the assumption that the entire the matrix would be supported.  This has been removed at this point since the original intent of S/MIME capabilities is that one should be able to do a binary comparison of the DER encoding of the field and determine a specific capability was published.   We could return back to using the sequence if we wanted to lose the ability to do a binary compare but needed to shorten the encodings.  This does not currently appear to be an issue at this point.</t>
    </section>

    <section title="Security Considerations">
      <t>This document provides new fields that can be placed in an S/MIME capabilities sequence.  There are number of considerations that need to be taken into account when doing this.</t>

      <t>As mentioned above, we have defined data structures to be associated with Object Identifiers in cases where an association already exists.  When either encoding or decoding structures, care needs to be taken that the association used is one appropriate for the location in the surrounding ASN.1 structure.  This means that one needs to make sure that only public keys are place in public key locations, signatures are placed in signature locations and S/MIME capabilities are placed in S/MIME Capability locations.  Failure to do so at best will create decode errors and at worst can cause incorrect behavior.</t>

<!--
      <t>As mentioned above, there are a small number of cases where the same object identifier may be used to identify a public key and an algorithm.  This is the case for many years with the OID rsaEncryption where it identifies both a public key and the RSA v1.5 key transport algorithm.  This means that when an S/MIME capabilities sequence is defined care needs to be taken to specify the types of algorithms and/or public keys that are to be specified in that sequence.  In general, it is expected that algorithms and public keys will be segregated.</t> -->

      <t>The more specific the information that is provided in an S/MIME Capabilities field, the better the end results are going to be.  Specifying a signature algorithm means that there are no questions for the receiver that the signature algorithm is supported.  Signature algorithms can be implied by specifying both public key algorithms and hash algorithms together.  If the list includes RSA v1.5, EC-DSA, SHA-1 and SHA-256, the implication is that all four values in the cross section are supported by the sender.  If the sender does not support EC-DSA with SHA-1, this would lead to a situation where the recipient uses a signature algorithm that the sender does not support.  Omitting SHA-1 from the list may lead to the problem where both entities support RSA v1.5 with SHA-1 as their only common algorithm, but this is no longer discoverable by the recipient.</t>

      <t>As a general rule, providing more information about the algorithms that are supported is preferable.  The more choices that are provided the recipient, the greater the likelihood that a common algorithm with good security can be used by both parties.  One should avoid being exhaustive in providing the list of algorithms to the recipient however.  The greater the number of algorithms that are passed the more difficult it is for a recipient to make intellegent decisions about which algorithm to be used.  This is a more significant problem when there are more than two entities involved in the "negotiation" of a common algorithm to be used (such as sending an encrypted S/MIME message where a common content encryption algorithm is needed).  The larger the set of algorithms and the more recipients involved, the more memory and processing time will be needed in order to complete the decision making process.</t>

<!--
      <t>The more information passed the better.  The more choices that are passed, the better the odds that both parties will be able to agree on a common algorithm.</t>

      <t>The less information passed the better.  Passing too much information can lead to computational issues in trying to deal with the possibilities.  This becomes acute when a negotiation over algorithms is going on between multiple parties (such as sending an encrypted S/MIME message) where the amount of memory and processing time can be greatly expanded if there are a large number of choices for each recipient.</t>
-->
      <t>The S/MIME capabilities is defined so that the order of algorithms in the sequence is meant to encode a preference order by the sender of the sequence.  Many entities will ignore the order preference when making a decision either by using their own preferred order or using a random decision from a matrix.</t>

<!--
      <t>Ordering of preference of algorithms is not always supported by all places where S/MIME capabilities are used.  The addition of preference ordering greatly complicates the decisions to be used, especially as it is expected that not all parties will agree on the same ordering.</t> -->

    </section>

    <section title="IANA Considerations">
      <t>This document has no IANA considerations.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc linefile="1:bibxml/reference.RFC.2119.xml"?>

<reference anchor='RFC2119'>

<front>
<title abbrev='RFC Key Words'>Key words for use in RFCs to Indicate Requirement Levels</title>
<author initials='S.' surname='Bradner' fullname='Scott Bradner'>
<organization>Harvard University</organization>
<address>
<postal>
<street>1350 Mass. Ave.</street>
<street>Cambridge</street>
<street>MA 02138</street></postal>
<phone>- +1 617 495 3864</phone>
<email>sob@harvard.edu</email></address></author>
<date year='1997' month='March' />
<area>General</area>
<keyword>keyword</keyword>
<abstract>
<t>
   In many standards track documents several words are used to signify
   the requirements in the specification.  These words are often
   capitalized.  This document defines these words as they should be
   interpreted in IETF documents.  Authors who follow these guidelines
   should incorporate this phrase near the beginning of their document:

<list>
<t>
      The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
      NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED",  "MAY", and
      "OPTIONAL" in this document are to be interpreted as described in
      RFC 2119.
</t></list></t>
<t>
   Note that the force of these words is modified by the requirement
   level of the document in which they are used.
</t></abstract></front>

<seriesInfo name='BCP' value='14' />
<seriesInfo name='RFC' value='2119' />
<format type='TXT' octets='4723' target='ftp://ftp.isi.edu/in-notes/rfc2119.txt' />
<format type='HTML' octets='17491' target='http://xml.resource.org/public/rfc/html/rfc2119.html' />
<format type='XML' octets='5777' target='http://xml.resource.org/public/rfc/xml/rfc2119.xml' />
</reference>
<?rfc linefile="338:pubkey-caps.xml"?>
      <?rfc linefile="1:bibxml/reference.RFC.3279.xml"?>

<reference anchor='RFC3279'>

<front>
<title>Algorithms and Identifiers for the Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile</title>
<author initials='L.' surname='Bassham' fullname='L. Bassham'>
<organization /></author>
<author initials='W.' surname='Polk' fullname='W. Polk'>
<organization /></author>
<author initials='R.' surname='Housley' fullname='R. Housley'>
<organization /></author>
<date year='2002' month='April' /></front>

<seriesInfo name='RFC' value='3279' />
<format type='TXT' octets='53833' target='ftp://ftp.isi.edu/in-notes/rfc3279.txt' />
</reference>
<?rfc linefile="339:pubkey-caps.xml"?>
      <?rfc linefile="1:bibxml/reference.RFC.4055.xml"?>

<reference anchor='RFC4055'>

<front>
<title>Additional Algorithms and Identifiers for RSA Cryptography for use in the Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile</title>
<author initials='J.' surname='Schaad' fullname='J. Schaad'>
<organization /></author>
<author initials='B.' surname='Kaliski' fullname='B. Kaliski'>
<organization /></author>
<author initials='R.' surname='Housley' fullname='R. Housley'>
<organization /></author>
<date year='2005' month='June' /></front>

<seriesInfo name='RFC' value='4055' />
<format type='TXT' octets='57479' target='ftp://ftp.isi.edu/in-notes/rfc4055.txt' />
</reference>
<?rfc linefile="340:pubkey-caps.xml"?>
      <?rfc linefile="1:bibxml/reference.RFC.5480.xml"?>

<reference anchor='RFC5480'>

<front>
<title>Elliptic Curve Cryptography Subject Public Key Information</title>
<author initials='S.' surname='Turner' fullname='S. Turner'>
<organization /></author>
<author initials='D.' surname='Brown' fullname='D. Brown'>
<organization /></author>
<author initials='K.' surname='Yiu' fullname='K. Yiu'>
<organization /></author>
<author initials='R.' surname='Housley' fullname='R. Housley'>
<organization /></author>
<author initials='T.' surname='Polk' fullname='T. Polk'>
<organization /></author>
<date year='2009' month='March' /></front>

<seriesInfo name='RFC' value='5480' />
<format type='TXT' octets='36209' target='ftp://ftp.isi.edu/in-notes/rfc5480.txt' />
</reference>
<?rfc linefile="341:pubkey-caps.xml"?>
    </references>
    <references title="Informative References">
      <?rfc linefile="1:bibxml/reference.RFC.5912.xml"?>

<reference anchor='RFC5912'>

<front>
<title>New ASN.1 Modules for the Public Key Infrastructure Using X.509 (PKIX)</title>
<author initials='P.' surname='Hoffman' fullname='P. Hoffman'>
<organization /></author>
<author initials='J.' surname='Schaad' fullname='J. Schaad'>
<organization /></author>
<date year='2010' month='June' /></front>

<seriesInfo name='RFC' value='5912' />
<format type='TXT' octets='216154' target='ftp://ftp.isi.edu/in-notes/rfc5912.txt' />
</reference>
<?rfc linefile="344:pubkey-caps.xml"?>
      <?rfc linefile="1:http://xml.resource.org/public/rfc/bibxml/reference.RFC.6277.xml"?>

<reference anchor='RFC6277'>

<front>
<title>Online Certificate Status Protocol Algorithm Agility</title>
<author initials='S.' surname='Santesson' fullname='S. Santesson'>
<organization /></author>
<author initials='P.' surname='Hallam-Baker' fullname='P. Hallam-Baker'>
<organization /></author>
<date year='2011' month='June' />
<abstract>
<t>The Online Certificate Status Protocol (OCSP) requires server responses to be signed but does not specify a mechanism for selecting the signature algorithm to be used.  This may lead to avoidable interoperability failures in contexts where multiple signature algorithms are in use.  This document specifies rules for server signature algorithm selection and an extension that allows a client to advise a server that specific signature algorithms are supported. [STANDARDS-TRACK]</t></abstract></front>

<seriesInfo name='RFC' value='6277' />
<format type='TXT' octets='21682' target='http://www.rfc-editor.org/rfc/rfc6277.txt' />
</reference>
<?rfc linefile="345:pubkey-caps.xml"?>
      <?rfc linefile="1:bibxml/reference.RFC.5751.xml"?>

<reference anchor='SMIME-MSG'>

<front>
<title>Secure/Multipurpose Internet Mail Extensions (S/MIME) Version 3.2 Message Specification</title>
<author initials='B.' surname='Ramsdell' fullname='B. Ramsdell'>
<organization /></author>
<author initials='S.' surname='Turner' fullname='S. Turner'>
<organization /></author>
<date year='2010' month='January' /></front>

<seriesInfo name='RFC' value='5751' />
<format type='TXT' octets='98638' target='ftp://ftp.isi.edu/in-notes/rfc5751.txt' />
</reference>
<?rfc linefile="346:pubkey-caps.xml"?>
      <?rfc linefile="1:bibxml/reference.RFC.4262.xml"?>

<reference anchor='RFC4262'>

<front>
<title>X.509 Certificate Extension for Secure/Multipurpose Internet Mail Extensions (S/MIME) Capabilities</title>
<author initials='S.' surname='Santesson' fullname='S. Santesson'>
<organization /></author>
<date year='2005' month='December' /></front>

<seriesInfo name='RFC' value='4262' />
<format type='TXT' octets='9801' target='ftp://ftp.isi.edu/in-notes/rfc4262.txt' />
</reference>
<?rfc linefile="347:pubkey-caps.xml"?>
      <?rfc linefile="1:bibxml/reference.RFC.2633.xml"?>

<reference anchor='SMIMEv3-MSG'>

<front>
<title>S/MIME Version 3 Message Specification</title>
<author initials='B.' surname='Ramsdell' fullname='B. Ramsdell'>
<organization /></author>
<date year='1999' month='June' /></front>

<seriesInfo name='RFC' value='2633' />
<format type='TXT' octets='67870' target='ftp://ftp.isi.edu/in-notes/rfc2633.txt' />
</reference>
<?rfc linefile="348:pubkey-caps.xml"?>
      <reference anchor="NIST-SIZES">
        <front>
          <title>Recommendation for Key Management -- Part 1: General</title>
          <author initials="E." surname="Barker"/>
          <author initials="W." surname="Barker"/>
          <author initials="W." surname="Burr"/>
          <author initials="W." surname="Polk"/>
          <author initials="M." surname="Smid"/>
          <date year="2007" month="March"/>
        </front>
        <seriesInfo name="NIST Special Publication" value="800-57"/>
        <format type="PDF" target="http://csrc.nist.gov/publications/nistpubs/800-57/sp800-57-Part1-revised2_Mar08-2007.pdf"/>
      </reference>
    </references>

    <section title="2008 ASN.1 Module" anchor="ASN.2008">
      <t>This appendix contains a module compatible with the work done to update the PKIX ASN.1 modules to recent versions of the ASN.1 specifications <xref target="RFC5912"/>.  This appendix is to be considered informational per the current direction of the PKIX working group.</t>

      <?rfc linefile="1:ForDraft/pubkeys-2008.incl"?><figure><artwork>
PUBLIC-KEY-SMIME-CAPABILITIES
   { iso(1) identified-organization(3) dod(6) internet(1) 
     security(5) mechanisms(5) pkix(7) id-mod(0)
     id-mod-pubKeySMIMECaps-08(78) }
DEFINITIONS ::=
BEGIN
   IMPORTS
   SMIME-CAPS, PUBLIC-KEY, SMIMECapability
   FROM AlgorithmInformation-2009
      { iso(1) identified-organization(3) dod(6) internet(1) 
        security(5) mechanisms(5) pkix(7) id-mod(0)
        id-mod-algorithmInformation-02(58)}

   pk-rsa, pk-dsa, pk-dh, pk-ec, pk-ecDH, pk-ecMQV, ECParameters
   FROM PKIXAlgs-2009 
      { iso(1) identified-organization(3) dod(6) internet(1) 
        security(5) mechanisms(5) pkix(7) id-mod(0)
        id-mod-pkix1-algorithms2008-02(56) }

   pk-rsaSSA-PSS, pk-rsaES-OAEP, sa-rsaSSA-PSS,
   HashAlgorithms, id-mgf1
   FROM PKIX1-PSS-OAEP-Algorithms-2009
      { iso(1) identified-organization(3) dod(6) internet(1) 
        security(5) mechanisms(5) pkix(7) id-mod(0) 
        id-mod-pkix1-rsa-pkalgs-02(54)}
   ;

   --
   --  Define a set containing all of the S/MIME capabilties defined
   --  by this document
   --

   SMimeCaps SMIME-CAPS ::= {
      PubKeys-SMimeCaps | 
      scap-sa-rsaSSA-PSS
   }

   PubKeys-SMimeCaps SMIME-CAPS ::= {
      scap-pk-rsa | scap-pk-rsaSSA-PSS |
      scap-pk-dsa | 
      scap-pk-ec | scap-pk-ecDH | scap-pk-ecMQV
   }

   --
   --  We defined RSA keys from the modules RFC3279 and RFC4055
   --

   scap-pk-rsa SMIME-CAPS ::= {
     TYPE RSAKeyCapabilities
     IDENTIFIED BY pk-rsa.&amp;id
   }
 
   RSAKeyCapabilities ::= SEQUENCE {
      minKeySize        RSAKeySize,
      maxKeySize        RSAKeySize OPTIONAL
   }

   RSAKeySize ::= INTEGER (1024 | 2048 | 3072 | 4096 | 7680 |
                           8192 | 15360, ...)


   scap-pk-rsaES-OAEP SMIME-CAPS ::= {
     TYPE RSAKeyCapabilities
     IDENTIFIED BY pk-rsaES-OAEP.&amp;id
   }

   scap-pk-rsaSSA-PSS SMIME-CAPS ::= {
     TYPE RSAKeyCapabilities
     IDENTIFIED BY pk-rsaSSA-PSS.&amp;id
   }

   scap-sa-rsaSSA-PSS SMIME-CAPS ::= {
      TYPE RsaSsa-Pss-sig-caps
      IDENTIFIED BY sa-rsaSSA-PSS.&amp;id
   }

   RsaSsa-Pss-sig-caps ::= SEQUENCE {
      hashAlg  SMIMECapability{{ MaskAlgorithmSet }},
      maskAlg  SMIMECapability{{ ... }} OPTIONAL,
      trailerField INTEGER DEFAULT 1
   }

   scap-mf-mgf1 SMIME-CAPS ::= {
      TYPE SMIMECapability{{ ... }}
      IDENTIFIED BY id-mgf1
   }
   
   MaskAlgorithmSet SMIME-CAPS ::= {scap-mf-mgf1, ...}

   --
   --  we define DH/DSA keys from the module RFC3279
   --

   scap-pk-dsa SMIME-CAPS ::= {
     TYPE DSAKeyCapabilities
     IDENTIFIED BY pk-dsa.&amp;id
   }

   DSAKeyCapabilities ::= CHOICE {
       keySizes         [0] SEQUENCE {
          minKeySize            DSAKeySize,
          maxKeySize            DSAKeySize OPTIONAL,
          maxSizeP              [1] INTEGER OPTIONAL,
          maxSizeQ              [2] INTEGER OPTIONAL,
          maxSizeG              [3] INTEGER OPTIONAL
       }, 
       keyParams        [1] pk-dsa.&amp;Params
   }

   DSAKeySize ::= INTEGER (1024 | 2048 | 3072 | 7680 | 15360 )

   scap-pk-dh SMIME-CAPS ::= {
     TYPE DSAKeyCapabilities
     IDENTIFIED BY pk-dh.&amp;id
   }

   --
   --  we define Eliptical Curve keys from the module RFC3279
   --

   scap-pk-ec SMIME-CAPS ::= {
      TYPE EC-SMimeCaps
      IDENTIFIED BY pk-ec.&amp;id
   }

   EC-SMimeCaps ::= SEQUENCE (SIZE (1..MAX)) OF ECParameters

   scap-pk-ecDH SMIME-CAPS ::= {
     TYPE EC-SMimeCaps
     IDENTIFIED BY pk-ecDH.&amp;id
   }

   scap-pk-ecMQV SMIME-CAPS ::= {
     TYPE EC-SMimeCaps
     IDENTIFIED BY pk-ecMQV.&amp;id
   }

END
</artwork></figure>
<?rfc linefile="367:pubkey-caps.xml"?>
    </section>

    <section title="1988 ASN.1 Module">
      <t>This appendix contains the normative ASN.1 module for this document.</t>

      <?rfc linefile="1:ForDraft/pubkeys-1998.incl"?><figure><artwork>
PUBLIC-KEY-SMIME-CAPABILITIES-88
   { iso(1) identified-organization(3) dod(6) internet(1) 
     security(5) mechanisms(5) pkix(7) id-mod(0)
     id-mod-pubKeySMIMECaps-88(77) }
DEFINITIONS ::=
BEGIN
   IMPORTS

   ECParameters
   FROM  PKIX1Algorithms2008
        { iso(1) identified-organization(3) dod(6)
          internet(1) security(5) mechanisms(5) pkix(7) id-mod(0)
          45 }

   id-mgf1
   FROM   PKIX1-PSS-OAEP-Algorithms
        { iso(1) identified-organization(3) dod(6)
          internet(1) security(5) mechanisms(5) pkix(7) id-mod(0)
          id-mod-pkix1-rsa-pkalgs(33) }

   AlgorithmIdentifier
   FROM PKIX1Explicit88
        { iso(1) identified-organization(3) dod(6) internet(1)
        security(5) mechanisms(5) pkix(7) id-mod(0)
        id-pkix1-explicit(18) }
          
   ;

   --
   --  We defined RSA keys from the modules RFC3279 and RFC4055
   --

   RSAKeyCapabilities ::= SEQUENCE {
      minKeySize        RSAKeySize,
      maxKeySize        RSAKeySize OPTIONAL
   }

   RSAKeySize ::= INTEGER (1024 | 2048 | 3072 | 4096 | 7680 |
                           8192 | 15360, ...)


   RsaSsa-Pss-sig-caps ::= SEQUENCE {
      hashAlg  AlgorithmIdentifier,
      maskAlg  AlgorithmIdentifier OPTIONAL,
      trailerField INTEGER DEFAULT 1
   }

   --
   --  we define DH/DSA keys from the module RFC3279
   --

   DSAKeyCapabilities ::= CHOICE {
       keySizes         [0] SEQUENCE {
          minKeySize            DSAKeySize,
          maxKeySize            DSAKeySize OPTIONAL,
          maxSizeP              [1] INTEGER OPTIONAL,
          maxSizeQ              [2] INTEGER OPTIONAL,
          maxSizeG              [3] INTEGER OPTIONAL
       }, 
       keyParams        [1] pk-dsa.&amp;Params
   }

   DSAKeySize ::= INTEGER (1024 | 2048 | 3072 | 7680 | 15360 )

   --
   --  we define Eliptical Curve keys from the module RFC3279
   --

   EC-SMimeCaps ::= SEQUENCE (SIZE (1..MAX)) OF ECParameters

END
</artwork></figure>
<?rfc linefile="373:pubkey-caps.xml"?>
    </section>

    <section title="Future Work">
      <t>A future revision of <xref target="RFC5912"/> should be done at
some point which expands the definition of the PUBLIC-KEY class and allows
for an S/MIME Capability to be included in the class definition.  This would
encourage people to think about this as an issue when defining new public
key structures in the future.</t>
    </section>
  </back>
</rfc>
