<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<rfc category="exp" docName="draft-belyavskiy-certificate-limitation-policy-07">
<front>
<title>Certificate Limitation Policy</title>
<author fullname="Dmitry Belyavskiy">
<organization abbrev="TCI">Technical Centre of Internet</organization>
<address>
<postal>
<street>8 Marta str., 1 bld. 12</street>
<city>Moscow</city>
<code>127083</code>
<country>RU</country>
</postal>
<email>beldmit@gmail.com</email>
</address>
</author>
<date/>
<area>sec</area>
<abstract>
<t>The document provides a specification of the application-level trust model.
Being provided at the application level, the limitations of trust can be
distributed separately using cryptographically protected format instead of
hardcoding the checks into the application itself.</t>
</abstract>
</front>
<middle>

<section title="Introduction">
<t>Binary trust model standardized as a set of trusted anchors and CRLs/OCSP
services does not cover all corner cases in the modern crypto world. There is a
need in more differentiated limitations. Some of them are <eref
target="https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/eUAKwjihhBs/rpxMXjZHCQAJ">suggested</eref>
by Google when it limits the usage of Symantec’s certificates. The CRL profile
does not fit the purpose of such limitations. The CRLs are issued by the same
CAs that are subject to be limited. </t>

<t>Currently the set of CAs trusted by OS or browsers can be used for the validation purposes.
In case when a large enough CA becomes untrusted, it cannot be deleted from the
storage of trusted CAs because it may cause error of validation of many
certificates. The measures usually taken in such cases usually include
application-level limitation of certificates lifetimes, refusing to accept
EV-certificates in other way than DV, requirements to use Certificate
Transparency, etc.</t>

<t>This document suggests a cryptographically signed format dubbed Certificate
Limitation Profile (CLP) designed for description of such limitations. This
format can be used by applications that use system-wide set of trust anchors
for validating purposes or by applications with own wide enough set of trusted
anchors in case when the trust anchor for the entity found misbehaving cannot
be revoked.</t>

<t>Currently the only way to provide such limitations is hard coding them in
application itself. Using of CLPs does not allow to completely avoid hard
coding but allows to hard code only the minimal set of rarely changing data:
<list>
<t>the fact that application uses CLP</t>
<t>the certificate to verify the signature under the CLP file</t> 
<t>minimal date of the CLP to be used for the current version of application.</t> 
</list>
It will be possible to move the checks for the limitations to the
external cryptographical libraries, such as OpenSSL, instead of checking them
at the application level.</t>
</section>

<section title="Certificate Limitations Profile">
<t>A proposed syntax and overall structure of CLP is very similar to the one
<eref target="https://tools.ietf.org/html/rfc5280#section-5">defined for
CRLs</eref>.
<figure><artwork><![CDATA[
   CertificateList  ::=  SEQUENCE  {
        tbsCertList          TBSCertList,
        signatureAlgorithm   AlgorithmIdentifier,
        signatureValue       BIT STRING  }

   TBSCertList  ::=  SEQUENCE  {
        version                 Version,
        signature               AlgorithmIdentifier,
        issuer                  Name,
        thisUpdate              Time,
        nextUpdate              Time,
        limitedCertificates     SEQUENCE OF SEQUENCE  {
             userCertificate         CertificateSerialNumber,
             certificateIssuer       Name, 
             limitationDate          Time,
             limitationPropagation   Enum,
             fingerprint SEQUENCE {
                 fingerprintAlgorithm AlgorithmIdentifier,
                 fingerprintValue     OCTET STRING
                                  } OPTIONAL,
             limitations          Limitations,
                                } OPTIONAL,
                              };

   Limitations  ::=  SEQUENCE SIZE (1..MAX) OF Limitation

   Limitation  ::=  SEQUENCE  {
        limitID      OBJECT IDENTIFIER,
        LimitationValue   OCTET STRING
                    -- contains the DER encoding of an ASN.1 value
                    -- corresponding to the limitation type 
                    -- identified by limitID
        }

]]></artwork></figure>
</t>
<t>
The ASN.1 format of particular limitations is provided in the corresponding sections.

Anywhere below the Time in ASN.1 notation is treated according to RFC 5280:
<figure><artwork><![CDATA[
   Time ::= CHOICE {
        utcTime        UTCTime,
        generalTime    GeneralizedTime }
]]></artwork></figure>
</t>
<section title="CLP fields">
<t>CLP has general structure similar to CRLs. The upper-level fields are:
<list>
<t>TBSCertList - the sequence of individual certificates to be limited;</t>
<t>signatureAlgorithm - the OID of the signature algorithm used for signature;</t>
<t>signatureValue - the bit string representing signature of the TBSCertList.</t>
</list>
</t>
</section>
<section title="CLP signature">
<t>The key used for signing the CLP files should have a special Key Usage value and/or
an Extended Key Usage value.</t>
</section>
<section title="CLP entry fields">
<t>Each entry in list contains the following fields:
<list>
<t>The issuer of the certificate with limited trust.</t>
<t>The serial of the certificate with limited trust.</t>
<t>The fingerprint of the certificate with limited trust (optional).</t>
</list>
</t>
<t>
and a subset of the following limitations:
<list>
<t>issuedNotAfter - do not trust the certs issued after the specified date</t>
<t>trustNotAfter  - do not trust the certs after the specified date</t>
<t>validityPeriod, days - take minimal value from "native" validity period and specified in the limitation file</t>
<t>ignoredX509Extensions - list of X.509 extensions of limited certificate that MUST be ignored for the specified certificate (e.g. EV-indicating extensions)</t>
<t>requiredX509extensions - list of X.509 extensions that MUST be present in the certificate to be trusted.</t>
<t>requiredNativeChecking - list of the CA-provided checks that MUST be applied</t>
<t>applicationNameConstraints - list of domains allowed to be issued by this certificate</t>
<t>excludedIssueIntermediatory - disallow issuing of the Intermediatory certificates</t>
</list>
</t>
<t>The limitations are identified by OIDs</t>
<section title="Limitations">
<section title="issuedNotAfter">
<t>When this limitation is present, any certificate matching the entry and
issued after the specified date MUST NOT be trusted</t>
<t>The issuedNotAfter limitation is identified by OID TBA.</t>
<t><figure><artwork><![CDATA[
issuedNotAfter ::= SEQUENCE {
    IssuedNotAfter    Time
}
]]></artwork></figure></t>
</section>
<section title="trustNotAfter">
<t>When this limitation is present, any certificate matching the entry MUST NOT
be trusted after the specified date.</t>
<t>The trustNotAfter limitation is identified by OID TBA.</t>
<t><figure><artwork><![CDATA[
trustNotAfter ::= SEQUENCE {
    TrustNotAfter    Time
}
]]></artwork></figure></t>
</section>
<section title="validityPeriod">
<t>When this limitation is present, no certificate matching the entry should be
treated as valid after specified period from its validFrom.</t>
<t>The validityPeriod is measured in days.</t>
<t>The validityPeriod limitation is identified by OID TBA.</t>
<t><figure><artwork><![CDATA[
validityPeriod ::= SEQUENCE {
    Days INTEGER
}
]]></artwork></figure></t>
</section>
<section title="ignoredX509Extensions">
<t>When this limitation is present, the extensions listed in this element
should be ignored for the matching certificate.</t>
<t>The ignoredX509Extensions limitation is identified by OID TBA.</t>
<t><figure><artwork><![CDATA[
ignoredX509Extensions :: = SEQUENCE SIZE (1..MAX) OF ExtenID
ExtenID :: = OBJECT IDENTIFIER 
]]></artwork></figure></t>
</section>
<section title="requiredX509extensions">
<t>When this limitation is present, the extensions listed in this element
should be present for the matching certificate.</t>
<t>The requiredX509extensions limitation is identified by OID TBA.</t>
<t><figure><artwork><![CDATA[
requiredX509extensions :: = SEQUENCE SIZE (1..MAX) OF ExtenID
ExtenID :: = OBJECT IDENTIFIER 
]]></artwork></figure></t>
</section>
<section title="requiredNativeChecking">
<t>When this limitation is present, it specifies that the certificates issued
by this CA SHOULD be checked against CRL and/or OCSP, depending on
contents of the extension.</t>
<t>The requiredNativeChecking limitation is identified by OID TBA.</t>
<t><figure><artwork><![CDATA[
requiredNativeChecking ::= SEQUENCE {
    RequiredCRLChecking BOOLEAN,
    RequiredOCSPChecking BOOLEAN
}
]]></artwork></figure></t>
</section>
<section title="applicationNameConstraints">
<t>This limitation are applied like <eref
target="https://tools.ietf.org/html/rfc5280#section-4.2.1.10">Name
Constraints</eref> limitation specified in RFC 5280.</t>
<t>This section implies 2 variants of checks:
<list>
<t>The list of names that are allowed for the CA to issue certificates for</t>
<t>The list of names that are forbidden for the CA to issue certificates for</t>
</list>
The applicationNameConstraints limitation is specified according to 
RFC 5280, 4.2.1.10 and reuses OID specified in RFC 5280.
</t>
<t><figure><artwork><![CDATA[
      id-ce-nameConstraints OBJECT IDENTIFIER ::=  { id-ce 30 }

      NameConstraints ::= SEQUENCE {
           permittedSubtrees       [0]     GeneralSubtrees OPTIONAL,
           excludedSubtrees        [1]     GeneralSubtrees OPTIONAL }

      GeneralSubtrees ::= SEQUENCE SIZE (1..MAX) OF GeneralSubtree

      GeneralSubtree ::= SEQUENCE {
           base                    GeneralName,
           minimum         [0]     BaseDistance DEFAULT 0,
           maximum         [1]     BaseDistance OPTIONAL }

      BaseDistance ::= INTEGER (0..MAX)
]]></artwork></figure></t>
<section title="excludedIssueIntermediatory">
<t>When this limitation is present, the intermediate certificates issued by
this CA MUST NOT be trusted.</t>
<t>The excludedIssueIntermediatory limitation is identified by OID TBA.</t>
<t><figure><artwork><![CDATA[
]]></artwork></figure></t>
</section>
</section>
</section>
</section>
</section>
<section title="Verification of CLP">
<t>The verification of CLP SHOULD be performed by the application. The
application should check whether the provided CLP matches the internal
requirements and is correclty signed by the specified key.</t>
</section>
<section title="Verification with CLP">
<t>In case of using CLP the checks enforced by CLP should be applied after the other checks.</t>
<t>The limitation provided by CLP MUST NOT extend the trustworthy of the checked certificate.</t>
<t>The limitations are applied after cryptographic validation of the
certificate and during building its chain of trust.  If the certificate or any of its
ascendants in the chain of trust matches any record in the CLP, the limitations
are applied from the ascendant to descendants. The issuedNotAfter and trustNotAfter
limitations are applied to find out the actual validity periods for the any
certificate in the chain of trust. If the CLP prescribes to have a particular
extension(s) and the certificate does not have it, the certificate MUST NOT be
trusted.
</t>
<t>
Application MAY use more than one CLPs (e.g. app-wide, set of system-wide,
user-defined). When multiple CLPs are in use, the limitations are applied
simultaneously.
</t>
<t>
In case when more than one chain of trust are valid for a certificate, if any
of this chains is valid after applying the limitations, the certificate MUST be
treated as valid.</t>
</section>

<section title="ASN.1 notation">
<t>TBD</t>
</section>

<section title="Real-world considerations">
<section title="Expected sources and consumers of CLPs">
<t>Public CLPs can be created and distributed by such parties as OS vendors,
browser vendors and other parties treated as worth trusting.</t>
<t>Usage of CLPs is reasonable for applications establishing TLS connections
with unpredictable sets of peers.  The main examples of such applications are
web-browsers and MTAs.</t>
</section>
<section title="Size limitation">
<t>To avoid uncontrolled growth of CLPs, the limitations are applied to root
and intermediate CA certificates.</t>
</section>
</section>

<section title="Security considerations">
<t>In case when an application uses CLP, it is recommended to specify the minimal
date of issuing of the CLP document somewhere in code. It allows to avoid an
attack of CLP rollback when the stale version of CLP is used.</t>
<t>It is recommended to distribute CLPs using the channels that are used for
distribution of the applications themselves to avoid possible DoS
consequences.</t>
<t>If application checks for fresh CLPs, it SHOULD check that nextUpdate field
in a fresh one is newer than in the current one. The application MAY accept a
CLP with nextUpdate in past.  If an application is failing to get updates, then
it can continue to run with what it has.</t>
<section title="Unsigned CLP">
<t>
In case of trusted environment signing CLP can be reluctant. If CLP is
delivered via application bundle, it can be verified together with other
application data. But it makes sense to separate trust to the source of the
content from trust to the content itself.  On the other hand it is not a
problem to create a local CLP signed by a locally created key. 
</t>
</section>
</section>

<section title="IANA considerations">
<t>TBD</t>
</section>
<section title="Acknoledgements">
<t>Special thanks to Rich Salz, Igor Ustinov, Vasily Dolmatov, Stanislav
Smyishlyaev, Patrik Fältström, Alexander Venedioukhin, Artem Chuprina, Viktor Dukhovni.</t>
</section>
<section title="References">
<t>The current version of the document is available on GitHub
https://github.com/beldmit/clp
</t>
</section>
</middle>
</rfc>
