<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent">
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc linkmailto="no" ?>
<?rfc editing="no" ?>
<?rfc comments="yes" ?>
<?rfc inline="yes"?>
<?rfc rfcedstyle="yes"?>
<?rfc-ext allow-markup-in-artwork="yes" ?>
<?rfc-ext include-index="no" ?>
<!--<?rfc strict="no"?> -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" category="std" consensus="true" ipr="trust200902" docName="draft-ietf-netconf-trust-anchors-17" obsoletes="" updates="" submissionType="IETF" xml:lang="en" tocInclude="true" symRefs="true" sortRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 2.45.3 -->
  <front>
    <title>A YANG Data Model for a Truststore</title>
    <seriesInfo name="Internet-Draft" value="draft-ietf-netconf-trust-anchors-17"/>
    <author initials="K." surname="Watsen" fullname="Kent Watsen">
      <organization>Watsen Networks</organization>
      <address>
        <email>kent+ietf@watsen.net</email>
      </address>
    </author>
    <date/>
    <area>Operations</area>
    <workgroup>NETCONF Working Group</workgroup>
    <abstract>
      <t>This document defines a YANG module for configuring
          bags of certificates and bags of public keys that can be
          referenced by other data models for trust.  Notifications
          are sent when certificates are about to expire.</t>
    </abstract>
    <note>
      <name>Editorial Note (To be removed by RFC Editor)</name>
      <t>This draft contains placeholder values that need to be replaced
          with finalized values at the time of publication.  This note summarizes
          all of the substitutions that are needed.  No other RFC Editor
          instructions are specified elsewhere in this document.</t>
      <t>Artwork in this document contains shorthand references to drafts in
          progress.  Please apply the following replacements:
      </t>
      <ul spacing="normal">
        <li>
          <tt>AAAA</tt> --&gt; the assigned RFC value for draft-ietf-netconf-crypto-types</li>
        <li>
          <tt>BBBB</tt> --&gt; the assigned RFC value for this draft</li>
      </ul>
      <t>Artwork in this document contains placeholder values for the date
          of publication of this draft.  Please apply the following replacement:
      </t>
      <ul spacing="normal">
        <li>
          <tt>2022-03-07</tt> --&gt; the publication date of this draft</li>
      </ul>
      <t>The following Appendix section is to be removed prior to publication:
      </t>
      <ul spacing="normal">
        <li>
          <xref target="change-log" format="default"/>.  Change Log</li>
      </ul>
    </note>
  </front>
  <middle>
    <section numbered="true" toc="default">
      <name>Introduction</name>
      <t>This document defines a YANG 1.1 <xref target="RFC7950" format="default"/> module having
          the following characteristics:
      </t>
      <ul empty="true" spacing="normal">
        <li>Provide a central truststore for storing raw public keys and/or certificates.</li>
        <li>Provide support for storing named bags of raw public keys and/or named bags
            of certificates.</li>
        <li>Provide types that can be used to reference raw public keys or certificates
            stored in the central truststore.</li>
        <li>Provide groupings that enable raw public keys and certificates to be
            configured locally or as references truststore instances.</li>
        <li>Enable the truststore to be instantiated in other data models, in addition
            to or in lieu of the central trusttore instance.</li>
      </ul>
      <section anchor="collective-effort" numbered="true" toc="default">
        <name>Relation to other RFCs</name>
        <t>This document presents one or more YANG modules <xref target="RFC7950" format="default"/>
            that are part of a collection of RFCs that work together to,
            ultimately, enable the configuration of the clients and
            servers of both the NETCONF <xref target="RFC6241" format="default"/> and RESTCONF
            <xref target="RFC8040" format="default"/> protocols.</t>
        <t>The modules have been defined in a modular fashion to enable
            their use by other efforts, some of which are known to be in
            progress at the time of this writing, with many more expected
            to be defined in time.</t>
        <t>The normative dependency relationship between the various RFCs in the collection
            is presented in the below diagram. The labels in the diagram
            represent the primary purpose provided by each RFC.  Hyperlinks to
            each RFC are provided below the diagram.</t>
        <artwork name="" type="" align="left" alt=""><![CDATA[
                               crypto-types
                                 ^      ^
                                /        \
                               /          \
                      truststore         keystore
                       ^     ^             ^  ^
                       |     +---------+   |  |
                       |               |   |  |
                       |      +------------+  |
tcp-client-server      |     /         |      |
   ^    ^        ssh-client-server     |      |
   |    |           ^            tls-client-server
   |    |           |              ^     ^        http-client-server
   |    |           |              |     |                 ^
   |    |           |        +-----+     +---------+       |
   |    |           |        |                     |       |
   |    +-----------|--------|--------------+      |       |
   |                |        |              |      |       |
   +-----------+    |        |              |      |       |
               |    |        |              |      |       |
               |    |        |              |      |       |
            netconf-client-server       restconf-client-server

]]></artwork>
        <!-- RFC Editor: is there anyway to flush-left the table in PDF/HTML views? -->
          <table>
          <name>Label to RFC Mapping</name>
          <tbody>
            <tr>
              <th>Label in Diagram</th>
              <th>Originating RFC</th>
            </tr>
            <tr>
              <td>crypto-types</td>
              <td>
                <xref target="I-D.ietf-netconf-crypto-types" format="default"/></td>
            </tr>
            <tr>
              <td>truststore</td>
              <td>
                <xref target="I-D.ietf-netconf-trust-anchors" format="default"/></td>
            </tr>
            <tr>
              <td>keystore</td>
              <td>
                <xref target="I-D.ietf-netconf-keystore" format="default"/></td>
            </tr>
            <tr>
              <td>tcp-client-server</td>
              <td>
                <xref target="I-D.ietf-netconf-tcp-client-server" format="default"/></td>
            </tr>
            <tr>
              <td>ssh-client-server</td>
              <td>
                <xref target="I-D.ietf-netconf-ssh-client-server" format="default"/></td>
            </tr>
            <tr>
              <td>tls-client-server</td>
              <td>
                <xref target="I-D.ietf-netconf-tls-client-server" format="default"/></td>
            </tr>
            <tr>
              <td>http-client-server</td>
              <td>
                <xref target="I-D.ietf-netconf-http-client-server" format="default"/></td>
            </tr>
            <tr>
              <td>netconf-client-server</td>
              <td>
                <xref target="I-D.ietf-netconf-netconf-client-server" format="default"/></td>
            </tr>
            <tr>
              <td>restconf-client-server</td>
              <td>
                <xref target="I-D.ietf-netconf-restconf-client-server" format="default"/></td>
            </tr>
          </tbody>
        </table>
      </section>
      <section numbered="true" toc="default">
        <name>Specification Language</name>
        <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
            NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED",
            "MAY", and "OPTIONAL" in this document are to be interpreted as
            described in BCP 14 <xref target="RFC2119" format="default"/> <xref target="RFC8174" format="default"/>
            when, and only when, they appear in all capitals, as shown here.</t>
      </section>
      <section numbered="true" toc="default">
        <name>Adherence to the NMDA</name>
        <t>This document is compliant with the Network Management Datastore Architecture
            (NMDA) <xref target="RFC8342" format="default"/>.  For instance, trust anchors installed
            during manufacturing (e.g., for trusted well-known services), are expected
            to appear in &lt;operational&gt; (see <xref target="built-ins" format="default"/>).</t>
      </section>
      <section numbered="true" toc="default">
        <name>Conventions</name>
        <t>Various examples used in this document use a placeholder
            value for binary data that has been base64 encoded (e.g.,
            "BASE64VALUE=").  This placeholder value is used as real
            base64 encoded structures are often many lines long and
            hence distracting to the example being presented.</t>
      </section>
    </section>
    <section numbered="true" toc="default">
      <name>The "ietf-truststore" Module</name>
      <t>This section defines a YANG 1.1 <xref target="RFC7950" format="default"/> module
         that defines a "truststore" and groupings supporting downstream
         modules to reference the truststore or have locally-defined definitions.</t>
      <t>This section defines a YANG 1.1 <xref target="RFC7950" format="default"/> module called
          "ietf-truststore".  A high-level overview of the module is provided in
          <xref target="truststore-verview" format="default"/>. Examples illustrating the module's use
          are provided in <xref target="truststore-examples" format="default">Examples</xref>. The YANG
          module itself is defined in <xref target="truststore-yang-module" format="default"/>.</t>
      <section anchor="truststore-verview" numbered="true" toc="default">
        <name>Data Model Overview</name>
        <t>This section provides an overview of the "ietf-truststore" module
            in terms of its features, typedefs, groupings, and protocol-accessible
            nodes.</t>
        <section anchor="features" toc="exclude" numbered="true">
          <name>Features</name>
          <t>The following diagram lists all the "feature" statements
              defined in the "ietf-truststore" module:</t>
          <artwork name="" type="" align="left" alt=""><![CDATA[
Features:
  +-- central-truststore-supported
  +-- local-definitions-supported
  +-- certificates
  +-- public-keys
]]></artwork>
          <aside>
            <t>The diagram above uses syntax that is similar to but not
                defined in <xref target="RFC8340" format="default"/>.</t>
          </aside>
        </section>
        <section anchor="typedefs" toc="exclude" numbered="true">
          <name>Typedefs</name>
          <t>The following diagram lists the "typedef" statements defined in
              the "ietf-truststore" module:</t>
          <artwork name="" type="" align="left" alt=""><![CDATA[
Typedefs:
  leafref
    +-- certificate-bag-ref
    +-- certificate-ref
    +-- public-key-bag-ref
    +-- public-key-ref
]]></artwork>
          <aside>
            <t>The diagram above uses syntax that is similar to but not
                defined in <xref target="RFC8340" format="default"/>.</t>
          </aside>
          <t>Comments:</t>
          <ul>
            <li>All the typedefs defined in the "ietf-truststore" module
                extend the base "leafref" type defined in <xref target="RFC7950" format="default"/>.</li>
            <li>The leafrefs refer to certificates, public keys, and bags
                in the central truststore, when this module is implemented.</li>
            <li>These typedefs are provided as an aid to downstream
                modules that import the "ietf-truststore" module.</li>
          </ul>
        </section>
        <section toc="exclude" numbered="true">
          <name>Groupings</name>
          <t>The "ietf-truststore" module defines the following "grouping" statements:</t>
          <ul spacing="compact">
            <li>local-or-truststore-certs-grouping</li>
            <li>local-or-truststore-public-keys-grouping</li>
            <li>truststore-grouping</li>
          </ul>
          <t>Each of these groupings are presented in the following subsections.</t>
          <section anchor="local-or-truststore-certs-grouping" numbered="true" toc="default">
            <name>The "local-or-truststore-certs-grouping" Grouping</name>
            <t>The following tree diagram <xref target="RFC8340" format="default"/> illustrates the
                "local-or-truststore-certs-grouping" grouping:</t>
            <artwork name="" type="" align="left" alt=""><![CDATA[
  grouping local-or-truststore-certs-grouping
    +-- (local-or-truststore)
       +--:(local) {local-definitions-supported}?
       |  +-- local-definition
       |     +-- certificate* [name]
       |        +-- name?                            string
       |        +---u ct:trust-anchor-cert-grouping
       +--:(truststore) {central-truststore-supported,certificates}?
          +-- truststore-reference?   ts:certificate-bag-ref
]]></artwork>
            <t>Comments:</t>
            <ul>
              <li>The "local-or-truststore-certs-grouping" grouping is provided
                  soley as convenience to downstream modules that wish to offer
                  an option whether a bag of certificates can be defined locally
                  or as a reference to a bag in the truststore.</li>
              <li>A "choice" statement is used to expose the various options.
                  Each option is enabled by a "feature" statement.  Additional
                  "case" statements MAY be augmented in if, e.g., there is a
                  need to reference a bag in an alternate location.</li>
              <li>For the "local-definition" option, the "certificate" node
                  uses the "trust-anchor-cert-grouping" grouping discussed in
                  <relref section="2.1.4.7" target="I-D.ietf-netconf-crypto-types"/>.</li>
              <li>For the "truststore" option, the "truststore-reference" is an
                  instance of the "certificate-bag-ref" discussed in <xref target="typedefs" format="default"/>.</li>
            </ul>
          </section>
          <section anchor="local-or-truststore-public-keys-grouping" numbered="true" toc="default">
            <name>The "local-or-truststore-public-keys-grouping" Grouping</name>
            <t>The following tree diagram <xref target="RFC8340" format="default"/> illustrates the
                "local-or-truststore-public-keys-grouping" grouping:</t>
            <artwork name="" type="" align="left" alt=""><![CDATA[
  grouping local-or-truststore-public-keys-grouping
    +-- (local-or-truststore)
       +--:(local) {local-definitions-supported}?
       |  +-- local-definition
       |     +-- public-key* [name]
       |        +-- name?                     string
       |        +---u ct:public-key-grouping
       +--:(truststore) {central-truststore-supported,public-keys}?
          +-- truststore-reference?   ts:public-key-bag-ref
]]></artwork>
            <t>Comments:</t>
            <ul>
              <li>The "local-or-truststore-public-keys-grouping" grouping is provided
                  soley as convenience to downstream modules that wish to offer
                  an option whether a bag of public keys can be defined locally
                  or as a reference to a bag in the truststore.</li>
              <li>A "choice" statement is used to expose the various options.
                  Each option is enabled by a "feature" statement.  Additional
                  "case" statements MAY be augmented in if, e.g., there is a
                  need to reference a bag in an alternate location.</li>
              <li>For the "local-definition" option, the "public-key" node uses the
                  "public-key-grouping" grouping discussed in <relref section="2.1.4.4" target="I-D.ietf-netconf-crypto-types"/>.</li>
              <li>For the "truststore" option, the "truststore-reference" is an
                  instance of the "certificate-bag-ref" discussed in <xref target="typedefs" format="default"/>.</li>
            </ul>
          </section>
          <section anchor="truststore-grouping" numbered="true" toc="default">
            <name>The "truststore-grouping" Grouping</name>
            <t>The following tree diagram <xref target="RFC8340" format="default"/> illustrates the
                "truststore-grouping" grouping:</t>
            <artwork name="" type="" align="left" alt=""><![CDATA[
  grouping truststore-grouping
    +-- certificate-bags {certificates}?
    |  +-- certificate-bag* [name]
    |     +-- name?          string
    |     +-- description?   string
    |     +-- certificate* [name]
    |        +-- name?                            string
    |        +---u ct:trust-anchor-cert-grouping
    +-- public-key-bags {public-keys}?
       +-- public-key-bag* [name]
          +-- name?          string
          +-- description?   string
          +-- public-key* [name]
             +-- name?                     string
             +---u ct:public-key-grouping
]]></artwork>
            <t>Comments:</t>
            <ul>
              <li>The "truststore-grouping" grouping defines a truststore instance
                  as being composed of certificates and/or public keys, both of which
                  are enabled by "feature" statements.  The structure supporting
                  certificates and public keys is essentially the same, having an
                  outer list of "bags" containing in inner list of objects
                  (certificates or public keys).  The bags enable trust anchors
                  serving a common purpose to be grouped and referenced together.</li>
              <li>For certificates, each certificate is defined by the
                  "trust-anchor-cert-grouping" grouping <relref section="2.1.4.7" target="I-D.ietf-netconf-crypto-types"/>.  Thus the "cert-data"
                  node is a CMS structure that can be composed of a chain of one or
                  more certificates.  Additionally, the "certificate-expiration"
                  notification enables the server to alert clients when certificates
                  are nearing or have already expired.</li>
              <li>For public keys, each public key is defined by the
                  "public-key-grouping" grouping <relref section="2.1.4.4" target="I-D.ietf-netconf-crypto-types"/>.  Thus the "public-key"
                  node can be one of any number of structures specified by the
                  "public-key-format" identity node.</li>
            </ul>
          </section>
        </section>
        <section anchor="proto-access-nodes" toc="exclude" numbered="true">
          <name>Protocol-accessible Nodes</name>
          <t>The following tree diagram <xref target="RFC8340" format="default"/> lists all the
              protocol-accessible nodes defined in the "ietf-truststore" module, without
              expanding the "grouping" statements:</t>
          <artwork name="" type="" align="left" alt=""><![CDATA[
module: ietf-truststore
  +--rw truststore
     +---u truststore-grouping

  grouping local-or-truststore-certs-grouping
    +-- (local-or-truststore)
       +--:(local) {local-definitions-supported}?
       |  +-- local-definition
       |     +-- certificate* [name]
       |        +-- name?                            string
       |        +---u ct:trust-anchor-cert-grouping
       +--:(truststore) {central-truststore-supported,certificates}?
          +-- truststore-reference?   ts:certificate-bag-ref
  grouping local-or-truststore-public-keys-grouping
    +-- (local-or-truststore)
       +--:(local) {local-definitions-supported}?
       |  +-- local-definition
       |     +-- public-key* [name]
       |        +-- name?                     string
       |        +---u ct:public-key-grouping
       +--:(truststore) {central-truststore-supported,public-keys}?
          +-- truststore-reference?   ts:public-key-bag-ref
  grouping truststore-grouping
    +-- certificate-bags {certificates}?
    |  +-- certificate-bag* [name]
    |     +-- name?          string
    |     +-- description?   string
    |     +-- certificate* [name]
    |        +-- name?                            string
    |        +---u ct:trust-anchor-cert-grouping
    +-- public-key-bags {public-keys}?
       +-- public-key-bag* [name]
          +-- name?          string
          +-- description?   string
          +-- public-key* [name]
             +-- name?                     string
             +---u ct:public-key-grouping
]]></artwork>
          <t>The following tree diagram <xref target="RFC8340" format="default"/> lists all the
              protocol-accessible nodes defined in the "ietf-truststore" module, with
              all "grouping" statements expanded, enabling the truststore's full
              structure to be seen:</t>
          <artwork name="" type="" align="left" alt=""><![CDATA[
module: ietf-truststore
  +--rw truststore
     +--rw certificate-bags {certificates}?
     |  +--rw certificate-bag* [name]
     |     +--rw name           string
     |     +--rw description?   string
     |     +--rw certificate* [name]
     |        +--rw name                      string
     |        +--rw cert-data                 trust-anchor-cert-cms
     |        +---n certificate-expiration
     |                {certificate-expiration-notification}?
     |           +-- expiration-date    yang:date-and-time
     +--rw public-key-bags {public-keys}?
        +--rw public-key-bag* [name]
           +--rw name           string
           +--rw description?   string
           +--rw public-key* [name]
              +--rw name                 string
              +--rw public-key-format    identityref
              +--rw public-key           binary

  grouping local-or-truststore-certs-grouping
    +-- (local-or-truststore)
       +--:(local) {local-definitions-supported}?
       |  +-- local-definition
       |     +-- certificate* [name]
       |        +-- name?                     string
       |        +-- cert-data                 trust-anchor-cert-cms
       |        +---n certificate-expiration
       |                {certificate-expiration-notification}?
       |           +-- expiration-date    yang:date-and-time
       +--:(truststore) {central-truststore-supported,certificates}?
          +-- truststore-reference?   ts:certificate-bag-ref
  grouping local-or-truststore-public-keys-grouping
    +-- (local-or-truststore)
       +--:(local) {local-definitions-supported}?
       |  +-- local-definition
       |     +-- public-key* [name]
       |        +-- name?                string
       |        +-- public-key-format    identityref
       |        +-- public-key           binary
       +--:(truststore) {central-truststore-supported,public-keys}?
          +-- truststore-reference?   ts:public-key-bag-ref
  grouping truststore-grouping
    +-- certificate-bags {certificates}?
    |  +-- certificate-bag* [name]
    |     +-- name?          string
    |     +-- description?   string
    |     +-- certificate* [name]
    |        +-- name?                     string
    |        +-- cert-data                 trust-anchor-cert-cms
    |        +---n certificate-expiration
    |                {certificate-expiration-notification}?
    |           +-- expiration-date    yang:date-and-time
    +-- public-key-bags {public-keys}?
       +-- public-key-bag* [name]
          +-- name?          string
          +-- description?   string
          +-- public-key* [name]
             +-- name?                string
             +-- public-key-format    identityref
             +-- public-key           binary
]]></artwork>
          <t>Comments:</t>
          <ul>
            <li>Protocol-accessible nodes are those nodes that are accessible
                when the module is "implemented", as described in <relref section="5.6.5" target="RFC7950"/>.</li>
            <li>The protcol-accessible nodes for the "ietf-truststore" module
                are an instance of the "truststore-grouping" grouping discussed in
                <xref target="truststore-grouping" format="default"/>.</li>
            <li>The reason for why the "truststore-grouping" exists separate from
                the protocol-accessible nodes definition is to enable
                instances of the truststore to be instantiated in other
                locations, as may be needed or desired by some modules.</li>
          </ul>
        </section>
      </section>
      <section anchor="truststore-examples" numbered="true" toc="default">
        <name>Example Usage</name>
        <t>The examples in this section are encoded using XML, such as might
            be the case when using the NETCONF protocol. Other encodings MAY
            be used, such as JSON when using the RESTCONF protocol.</t>
        <section anchor="ts-inst" toc="exclude" numbered="true">
          <name>A Truststore Instance</name>
          <t>This section presents an example illustrating trust anchors
              in &lt;intended&gt;, as per <xref target="proto-access-nodes" format="default"/>.
              Please see <xref target="built-ins" format="default"/> for an example illustrating
              built-in values in &lt;operational&gt;.</t>
          <t>The example contained in this section defines eight bags of trust
              anchors.  There are four certificate-based bags and four public
              key based bags.  The following diagram provides an overview of the
              contents in the example:</t>
          <artwork name="" type="" align="left" alt=""><![CDATA[
Certificate Bags
  +-- Trust anchor certs for authenticating a set of remote servers
  +-- End entity certs for authenticating a set of remote servers
  +-- Trust anchor certs for authenticating a set of remote clients
  +-- End entity certs for authenticating a set of remote clients

Public Key Bags
  +-- SSH keys to authenticate a set of remote SSH server
  +-- SSH keys to authenticate a set of remote SSH clients
  +-- Raw public keys to authenticate a set of remote SSH server
  +-- Raw public keys to authenticate a set of remote SSH clients
]]></artwork>
          <t>Following is the full example:</t>
          <artwork name="" type="" align="left" alt=""><![CDATA[
<truststore
  xmlns="urn:ietf:params:xml:ns:yang:ietf-truststore"
  xmlns:ct="urn:ietf:params:xml:ns:yang:ietf-crypto-types">

  <!-- A bag of Certificate Bags -->
  <certificate-bags>

    <!-- Trust Anchor Certs for Authenticating Servers -->
    <certificate-bag>
      <name>trusted-server-ca-certs</name>
      <description>
        Trust anchors (i.e. CA certs) used to authenticate server
        certificates.  A server certificate is authenticated if its
        end-entity certificate has a chain of trust to one of these
        certificates.
      </description>
      <certificate>
        <name>Server Cert Issuer #1</name>
        <cert-data>BASE64VALUE=</cert-data>
      </certificate>
      <certificate>
        <name>Server Cert Issuer #2</name>
        <cert-data>BASE64VALUE=</cert-data>
      </certificate>
    </certificate-bag>
  
    <!-- End Entity Certs for Authenticating Servers -->
    <certificate-bag>
      <name>trusted-server-ee-certs</name>
      <description>
        Specific end-entity certificates used to authenticate server
        certificates.  A server certificate is authenticated if its
        end-entity certificate is an exact match to one of these
        certificates.
      </description>
      <certificate>
        <name>My Application #1</name>
        <cert-data>BASE64VALUE=</cert-data>
      </certificate>
      <certificate>
        <name>My Application #2</name>
        <cert-data>BASE64VALUE=</cert-data>
      </certificate>
    </certificate-bag>
  
    <!-- Trust Anchor Certs for Authenticating Clients -->
    <certificate-bag>
      <name>trusted-client-ca-certs</name>
      <description>
        Trust anchors (i.e. CA certs) used to authenticate client
        certificates.  A client certificate is authenticated if its
        end-entity certificate has a chain of trust to one of these
        certificates.
      </description>
      <certificate>
        <name>Client Identity Issuer #1</name>
        <cert-data>BASE64VALUE=</cert-data>
      </certificate>
      <certificate>
        <name>Client Identity Issuer #2</name>
        <cert-data>BASE64VALUE=</cert-data>
      </certificate>
    </certificate-bag>
  
    <!-- End Entity Certs for Authenticating Clients -->
    <certificate-bag>
      <name>trusted-client-ee-certs</name>
      <description>
        Specific end-entity certificates used to authenticate client
        certificates.  A client certificate is authenticated if its
        end-entity certificate is an exact match to one of these
        certificates.
      </description>
      <certificate>
        <name>George Jetson</name>
        <cert-data>BASE64VALUE=</cert-data>
      </certificate>
      <certificate>
        <name>Fred Flintstone</name>
        <cert-data>BASE64VALUE=</cert-data>
      </certificate>
    </certificate-bag>
  </certificate-bags>

  <!-- A List of Public Key Bags -->
  <public-key-bags>

    <!-- Public Keys for Authenticating SSH Servers -->
    <public-key-bag>
      <name>trusted-ssh-public-keys</name>
      <description>
        Specific SSH public keys used to authenticate SSH server
        public keys.  An SSH server public key is authenticated if
        its public key is an exact match to one of these public keys.

        This list of SSH public keys is analogous to OpenSSH's
        "/etc/ssh/ssh_known_hosts" file.
      </description>
      <public-key>
        <name>corp-fw1</name>
        <public-key-format>
          ct:ssh-public-key-format
        </public-key-format>
        <public-key>BASE64VALUE=</public-key>
      </public-key>
      <public-key>
        <name>corp-fw2</name>
        <public-key-format>
          ct:ssh-public-key-format
        </public-key-format>
        <public-key>BASE64VALUE=</public-key>
      </public-key>
    </public-key-bag>

    <!-- SSH Public Keys for Authenticating Application A -->
    <public-key-bag>
      <name>SSH Public Keys for Application A</name>
      <description>
        SSH public keys used to authenticate application A's SSH
        public keys.  An SSH public key is authenticated if it
        is an exact match to one of these public keys.
      </description>
      <public-key>
        <name>Application Instance #1</name>
        <public-key-format>
          ct:ssh-public-key-format
        </public-key-format>
        <public-key>BASE64VALUE=</public-key>
      </public-key>
      <public-key>
        <name>Application Instance #2</name>
        <public-key-format>
          ct:ssh-public-key-format
        </public-key-format>
        <public-key>BASE64VALUE=</public-key>
      </public-key>
    </public-key-bag>

    <!-- Raw Public Keys for TLS Servers -->
    <public-key-bag>
      <name>Raw Public Keys for TLS Servers</name>
      <public-key>
        <name>Raw Public Key #1</name>
        <public-key-format>
          ct:subject-public-key-info-format</public-key-format>
        <public-key>BASE64VALUE=</public-key>
      </public-key>
      <public-key>
        <name>Raw Public Key #2</name>
        <public-key-format>
          ct:subject-public-key-info-format
        </public-key-format>
        <public-key>BASE64VALUE=</public-key>
      </public-key>
    </public-key-bag>

    <!-- Raw Public Keys for TLS Clients -->
    <public-key-bag>
      <name>Raw Public Keys for TLS Clients</name>
      <public-key>
        <name>Raw Public Key #1</name>
        <public-key-format>
          ct:subject-public-key-info-format
        </public-key-format>
        <public-key>BASE64VALUE=</public-key>
      </public-key>
      <public-key>
        <name>Raw Public Key #2</name>
        <public-key-format>
          ct:subject-public-key-info-format
      </public-key-format>
        <public-key>BASE64VALUE=</public-key>
      </public-key>
    </public-key-bag>
  </public-key-bags>
</truststore>
  ]]></artwork>
        </section>
        <section toc="exclude" numbered="true">
          <name>A Certificate Expiration Notification</name>
          <t>The following example illustrates the "certificate-expiration"
              notification (per <relref section="2.1.4.6" target="I-D.ietf-netconf-crypto-types"/>)
              for a certificate configured in the truststore in <xref target="ts-inst" format="default"/>.</t>
          <artwork name="" type="" align="left" alt=""><![CDATA[
=============== NOTE: '\' line wrapping per RFC 8792 ================

<notification
  xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
  <eventTime>2018-05-25T00:01:00Z</eventTime>
  <truststore xmlns="urn:ietf:params:xml:ns:yang:ietf-truststore">
    <certificate-bags>
      <certificate-bag>
        <name>trusted-client-ee-certs</name>
        <certificate>
          <name>George Jetson</name>
          <certificate-expiration>
            <expiration-date>2018-08-05T14:18:53-05:00</expiration-d\
ate>
          </certificate-expiration>
        </certificate>
      </certificate-bag>
    </certificate-bags>
  </truststore>
</notification>

]]></artwork>
        </section>
        <section toc="exclude" numbered="true">
          <name>The "Local or Truststore" Groupings</name>
          <t>This section illustrates the various "local-or-truststore" groupings
              defined in the "ietf-truststore" module, specifically the
              "local-or-truststore-certs-grouping"
              (<xref target="local-or-truststore-certs-grouping" format="default"/>) and
              "local-or-truststore-public-keys-grouping"
              (<xref target="local-or-truststore-public-keys-grouping" format="default"/>)
              groupings.</t>
          <t>These examples assume the existence of an example module called "ex-truststore-usage"
              having the namespace "http://example.com/ns/example-truststore-usage".</t>
          <t>The ex-truststore-usage module is first presented using tree diagrams
              <xref target="RFC8340" format="default"/>, followed by an instance example illustrating
              all the "local-or-truststore" groupings in use, followed by the YANG
              module itself.</t>
          <t>The following tree diagram illustrates "ex-truststore-usage" without
              expanding the "grouping" statements:</t>
          <artwork name="" type="" align="left" alt=""><![CDATA[
module: ex-truststore-usage
  +--rw truststore-usage
     +--rw cert* [name]
     |  +--rw name                                     string
     |  +---u ts:local-or-truststore-certs-grouping
     +--rw public-key* [name]
        +--rw name                                           string
        +---u ts:local-or-truststore-public-keys-grouping
]]></artwork>
          <t>The following tree diagram illustrates the "ex-truststore-usage"
              module, with all "grouping" statements expanded, enabling the
              truststore's full structure to be seen:</t>
          <artwork name="" type="" align="left" alt=""><![CDATA[
module: ex-truststore-usage
  +--rw truststore-usage
     +--rw cert* [name]
     |  +--rw name                          string
     |  +--rw (local-or-truststore)
     |     +--:(local) {local-definitions-supported}?
     |     |  +--rw local-definition
     |     |     +--rw certificate* [name]
     |     |        +--rw name                      string
     |     |        +--rw cert-data
     |     |        |       trust-anchor-cert-cms
     |     |        +---n certificate-expiration
     |     |                {certificate-expiration-notification}?
     |     |           +-- expiration-date    yang:date-and-time
     |     +--:(truststore)
     |              {central-truststore-supported,certificates}?
     |        +--rw truststore-reference?   ts:certificate-bag-ref
     +--rw public-key* [name]
        +--rw name                          string
        +--rw (local-or-truststore)
           +--:(local) {local-definitions-supported}?
           |  +--rw local-definition
           |     +--rw public-key* [name]
           |        +--rw name                 string
           |        +--rw public-key-format    identityref
           |        +--rw public-key           binary
           +--:(truststore)
                    {central-truststore-supported,public-keys}?
              +--rw truststore-reference?   ts:public-key-bag-ref
]]></artwork>
          <t>The following example provides two equivalent instances of
              each grouping, the first being a reference to a truststore
              and the second being locally-defined.  The instance having
              a reference to a truststore is consistent with the truststore
              defined in <xref target="ts-inst" format="default"/>.  The two instances are
              equivalent, as the locally-defined instance example contains
              the same values defined by the truststore instance referenced
              by its sibling example.</t>
          <artwork name="" type="" align="left" alt=""><![CDATA[
=============== NOTE: '\' line wrapping per RFC 8792 ================

<truststore-usage
  xmlns="http://example.com/ns/example-truststore-usage"
  xmlns:ct="urn:ietf:params:xml:ns:yang:ietf-crypto-types">

  <!-- The following two equivalent examples illustrate   -->
  <!-- the "local-or-truststore-certs-grouping" grouping: -->

  <cert>
    <name>example 1a</name>
    <truststore-reference>trusted-client-ca-certs</truststore-refere\
nce>
  </cert>

  <cert>
    <name>example 1b</name>
    <local-definition>
      <name>my-trusted-client-ca-certs</name>
      <certificate>
        <name>Client Identity Issuer #1</name>
        <cert>BASE64VALUE=</cert>
      </certificate>
      <certificate>
        <name>Client Identity Issuer #2</name>
        <cert>BASE64VALUE=</cert>
      </certificate>
    </local-definition>
  </cert>


  <!-- The following two equivalent examples illustrate the -->
  <!-- "local-or-truststore-public-keys-grouping" grouping: -->

  <public-key>
    <name>example 2a</name>
    <truststore-reference>trusted-ssh-public-keys</truststore-refere\
nce>
  </public-key>

  <public-key>
    <name>example 2b</name>
    <local-definition>
      <name>trusted-ssh-public-keys</name>
      <public-key>
        <name>corp-fw1</name>
        <public-key-format>
          ct:ssh-public-key-format
        </public-key-format>
        <public-key>BASE64VALUE=</public-key>
      </public-key>
      <public-key>
        <name>corp-fw2</name>
        <public-key-format>
          ct:ssh-public-key-format
        </public-key-format>
        <public-key>BASE64VALUE=</public-key>
      </public-key>
    </local-definition>
  </public-key>

</truststore-usage>
]]></artwork>
          <t>Following is the "ex-truststore-usage" module's YANG definition:</t>
          <artwork name="" type="" align="left" alt=""><![CDATA[
module ex-truststore-usage {
  yang-version 1.1;
  namespace "http://example.com/ns/example-truststore-usage";
  prefix etu;

  import ietf-truststore {
    prefix ts;
    reference
      "RFC BBBB: A YANG Data Model for a Truststore";
  }

  organization
    "Example Corporation";

  contact
    "Author: YANG Designer <mailto:yang.designer@example.com>";

  description
    "This module illustrates notable groupings defined in
     the 'ietf-truststore' module.";

  revision 2022-03-07 {
    description
      "Initial version";
    reference
      "RFC BBBB: A YANG Data Model for a Truststore";
  }

  container truststore-usage {
    description
      "An illustration of the various truststore groupings.";
    list cert {
      key "name";
      leaf name {
        type string;
        description
          "An arbitrary name for this cert.";
      }
      uses ts:local-or-truststore-certs-grouping;
      description
        "An cert that may be configured locally or be
         a reference to a cert in the truststore.";
    }
    list public-key {
      key "name";
      leaf name {
        type string;
        description
          "An arbitrary name for this cert.";
      }
      uses ts:local-or-truststore-public-keys-grouping;
      description
        "An public key that may be configured locally or be
         a reference to a public key in the truststore.";
    }
  }
}
]]></artwork>
        </section>
      </section>
      <section anchor="truststore-yang-module" numbered="true" toc="default">
        <name>YANG Module</name>
        <t>This YANG module imports modules from <xref target="RFC8341" format="default"/>
          and <xref target="I-D.ietf-netconf-crypto-types" format="default"/>.</t>
        <t keepWithNext="true">&lt;CODE BEGINS&gt; file "ietf-truststore@2022-03-07.yang"</t>
        <artwork name="" type="" align="left" alt=""><![CDATA[
module ietf-truststore {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-truststore";
  prefix ts;

  import ietf-netconf-acm {
    prefix nacm;
    reference
      "RFC 8341: Network Configuration Access Control Model";
  }

  import ietf-crypto-types {
    prefix ct;
    reference
      "RFC AAAA: YANG Data Types and Groupings for Cryptography";
  }

  organization
    "IETF NETCONF (Network Configuration) Working Group";

  contact
    "WG Web  : https://datatracker.ietf.org/wg/netconf
     WG List : NETCONF WG list <mailto:netconf@ietf.org>
     Author  : Kent Watsen <kent+ietf@watsen.net>";

  description
    "This module defines a 'truststore' to centralize management
     of trust anchors including certificates and public keys.

     Copyright (c) 2021 IETF Trust and the persons identified
     as authors of the code. All rights reserved.

     Redistribution and use in source and binary forms, with
     or without modification, is permitted pursuant to, and
     subject to the license terms contained in, the Revised
     BSD License set forth in Section 4.c of the IETF Trust's
     Legal Provisions Relating to IETF Documents
     (https://trustee.ietf.org/license-info).

     This version of this YANG module is part of RFC BBBB
     (https://www.rfc-editor.org/info/rfcBBBB); see the RFC
     itself for full legal notices.

     The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL',
     'SHALL NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED',
     'NOT RECOMMENDED', 'MAY', and 'OPTIONAL' in this document
     are to be interpreted as described in BCP 14 (RFC 2119)
     (RFC 8174) when, and only when, they appear in all
     capitals, as shown here.";

  revision 2022-03-07 {
    description
      "Initial version";
    reference
      "RFC BBBB: A YANG Data Model for a Truststore";
  }

  /****************/
  /*   Features   */
  /****************/

  feature central-truststore-supported {
    description
      "The 'central-truststore-supported' feature indicates that
       the server supports the truststore (i.e., implements the
       'ietf-truststore' module).";
  }

  feature local-definitions-supported {
    description
      "The 'local-definitions-supported' feature indicates that
       the server supports locally-defined trust anchors.";
  }

  feature certificates {
    description
      "The 'certificates' feature indicates that the server
       implements the /truststore/certificate-bags subtree.";
  }

  feature public-keys {
    description
      "The 'public-keys' feature indicates that the server
       implements the /truststore/public-key-bags subtree.";
  }

  /****************/
  /*   Typedefs   */
  /****************/

  typedef certificate-bag-ref {
    type leafref {
      path "/ts:truststore/ts:certificate-bags/"
         + "ts:certificate-bag/ts:name";
    }
    description
      "This typedef defines a reference to a certificate bag
       in the truststore, when this module is implemented.";
  }

  typedef certificate-ref {
    type leafref {
      path "/ts:truststore/ts:certificate-bags/ts:certificate-bag"
         + "[ts:name = current()/../ts:certificate-bag]/"
         + "ts:certificate/ts:name";
    }
    description
      "This typedef defines a reference to a specific certificate
       in a certificate bag in the truststore, when this module
       is implemented.  This typedef requires that there exist a
       sibling 'leaf' node called 'certificate-bag' that SHOULD
       have the typedef 'certificate-bag-ref'.";
  }

  typedef public-key-bag-ref {
    type leafref {
      path "/ts:truststore/ts:public-key-bags/"
         + "ts:public-key-bag/ts:name";
    }
    description
      "This typedef defines a reference to a public key bag
       in the truststore, when this module is implemented.";
  }

  typedef public-key-ref {
    type leafref {
      path "/ts:truststore/ts:public-key-bags/ts:public-key-bag"
         + "[ts:name = current()/../ts:public-key-bag]/"
         + "ts:public-key/ts:name";
    }
    description
      "This typedef defines a reference to a specific public key
       in a public key bag in the truststore, when this module is
       implemented.  This typedef requires that there exist a
       sibling 'leaf' node called 'public-key-bag' that SHOULD
       have the typedef 'public-key-bag-ref'.";
  }

  /*****************/
  /*   Groupings   */
  /*****************/

  grouping local-or-truststore-certs-grouping {
    description
      "A grouping that allows the certificates to be either
       configured locally, within the using data model, or be a
       reference to a certificate bag stored in the truststore.

       Servers that do not 'implement' this module, and hence
       'central-truststore-supported' is not defined, SHOULD
       augment in custom 'case' statements enabling references
       to the alternate truststore locations.";
    choice local-or-truststore {
      nacm:default-deny-write;
      mandatory true;
      description
        "A choice between an inlined definition and a definition
         that exists in the truststore.";
      case local {
        if-feature "local-definitions-supported";
        container local-definition {
          description
            "A container for locally configured trust anchor
             certificates.";
          list certificate {
            key "name";
            min-elements 1;
            description
              "A trust anchor certificate.";
            leaf name {
              type string;
              description
                "An arbitrary name for this certificate.";
            }
            uses ct:trust-anchor-cert-grouping {
              refine "cert-data" {
                mandatory true;
              }
            }
          }
        }
      }
      case truststore {
        if-feature "central-truststore-supported";
        if-feature "certificates";
        leaf truststore-reference {
          type ts:certificate-bag-ref;
          description
            "A reference to a certificate bag that exists in the
             truststore, when this module is implemented.";
        }
      }
    }
  }

  grouping local-or-truststore-public-keys-grouping {
    description
      "A grouping that allows the public keys to be either
       configured locally, within the using data model, or be a
       reference to a public key bag stored in the truststore.

       Servers that do not 'implement' this module, and hence
       'central-truststore-supported' is not defined, SHOULD
       augment in custom 'case' statements enabling references
       to the alternate truststore locations.";
    choice local-or-truststore {
      nacm:default-deny-write;
      mandatory true;
      description
        "A choice between an inlined definition and a definition
         that exists in the truststore.";
      case local {
        if-feature "local-definitions-supported";
        container local-definition {
          description
            "A container to hold local public key definitions.";
          list public-key {
            key "name";
            description
              "A public key definition.";
            leaf name {
              type string;
              description
                "An arbitrary name for this public key.";
            }
            uses ct:public-key-grouping;
          }
        }
      }
      case truststore {
        if-feature "central-truststore-supported";
        if-feature "public-keys";
        leaf truststore-reference {
          type ts:public-key-bag-ref;
          description
            "A reference to a bag of public keys that exists
             in the truststore, when this module is implemented.";
        }
      }
    }
  }

  grouping truststore-grouping {
    description
      "A grouping definition that enables use in other contexts.
       Where used, implementations MUST augment new 'case'
       statements into the various local-or-truststore 'choice'
       statements to supply leafrefs to the model-specific
       location(s).";
    container certificate-bags {
      nacm:default-deny-write;
      if-feature "certificates";
      description
        "A collection of certificate bags.";
      list certificate-bag {
        key "name";
        description
          "A bag of certificates.  Each bag of certificates SHOULD
           be for a specific purpose.  For instance, one bag could
           be used to authenticate a specific set of servers, while
           another could be used to authenticate a specific set of
           clients.";
        leaf name {
          type string;
          description
            "An arbitrary name for this bag of certificates.";
        }
        leaf description {
          type string;
          description
            "A description for this bag of certificates.  The
             intended purpose for the bag SHOULD be described.";
        }
        list certificate {
          key "name";
          description
            "A trust anchor certificate.";
          leaf name {
            type string;
            description
              "An arbitrary name for this certificate.";
          }
          uses ct:trust-anchor-cert-grouping {
            refine "cert-data" {
              mandatory true;
            }
          }
        }
      }
    }
    container public-key-bags {
      nacm:default-deny-write;
      if-feature "public-keys";
      description
        "A collection of public key bags.";
      list public-key-bag {
        key "name";
        description
          "A bag of public keys.  Each bag of keys SHOULD be for
           a specific purpose.  For instance, one bag could be used
           authenticate a specific set of servers, while another
           could be used to authenticate a specific set of clients.";
        leaf name {
          type string;
          description
            "An arbitrary name for this bag of public keys.";
        }
        leaf description {
          type string;
          description
            "A description for this bag public keys.  The
             intended purpose for the bag SHOULD be described.";
        }
        list public-key {
          key "name";
          description
            "A public key.";
          leaf name {
            type string;
            description
              "An arbitrary name for this public key.";
          }
          uses ct:public-key-grouping;
        }
      }
    }
  }

  /*********************************/
  /*   Protocol accessible nodes   */
  /*********************************/

  container truststore {
    nacm:default-deny-write;
    description
      "The truststore contains bags of certificates and
       public keys.";
    uses truststore-grouping;
  }
}
]]></artwork>
        <t keepWithPrevious="true">&lt;CODE ENDS&gt;</t>
      </section>
    </section>
    <section anchor="built-ins" numbered="true" toc="default">
      <name>Support for Built-in Trust Anchors</name>
      <t>In some implementations, a server may define some built-in trust anchors.
          For instance, there may be built-in trust anchors enabling the server to
          securely connect to well-known services (e.g., an SZTP <xref target="RFC8572" format="default"/>
          bootstrap server) or public CA certificates to connect to arbitrary services
          using public PKI.</t>
      <t>Built-in trust anchors are expected to be set by a vendor-specific process.
          Any ability for operators to modify built-in trust anchors is outside the
          scope of this document.</t>
      <t>As built-in trust anchors are provided by the server, they are present in
          &lt;operational&gt; (and &lt;system&gt; <xref target="I-D.ma-netmod-with-system" format="default"/>,
          if used). The example below illustrates what the truststore in &lt;operational&gt;
          might look like for a server in its factory default state.</t>
      <artwork name="" type="" align="left" alt=""><![CDATA[
<truststore
  xmlns="urn:ietf:params:xml:ns:yang:ietf-truststore"
  xmlns:ct="urn:ietf:params:xml:ns:yang:ietf-crypto-types"
  xmlns:or="urn:ietf:params:xml:ns:yang:ietf-origin"
  or:origin="or:intended">
  <certificate-bags>

    <certificate-bag or:origin="or:system">
      <name>Built-In Manufacturer Trust Anchor Certificates</name>
      <description>
        Certificates built into the device for authenticating
        manufacturer-signed objects, such as TLS server certificates,
        vouchers, etc.
      </description>
      <certificate>
        <name>Manufacturer Root CA Cert</name>
        <cert-data>BASE64VALUE=</cert-data>
      </certificate>
    </certificate-bag>

    <certificate-bag or:origin="or:system">
      <name>Built-In Public Trust Anchor Certificates</name>
      <description>
        Certificates built into the device for authenticating
        certificates issued by public certificate authorities,
        such as the end-entity certificate for web servers.
      </description>
      <certificate>
        <name>Public Root CA Cert 1</name>
        <cert-data>BASE64VALUE=</cert-data>
      </certificate>
      <certificate>
        <name>Public Root CA Cert 2</name>
        <cert-data>BASE64VALUE=</cert-data>
      </certificate>
      <certificate>
        <name>Public Root CA Cert 3</name>
        <cert-data>BASE64VALUE=</cert-data>
      </certificate>
    </certificate-bag>

  </certificate-bags>
</truststore>
]]></artwork>
      <t>In order for the built-in bags of trust anchors and/or their trust anchors to
          be referenced by configuration, they MUST first be copied into &lt;running&gt;.</t>
      <t>The built-in bags and/or their trust anchors MUST be copied into &lt;running&gt;
          using the same "key" values if it is desired for the server to maintain/update
          them (e.g., a software update may update a bag of trusted public CA
          certificates used for TLS-client connections).</t>
      <t>Built-in bags and/or their trust anchors MAY be copied into other parts
          of the configuration but, by doing so, they lose their association to the
          built-in entries and any assurances afforded by knowing they are/were built-in.</t>
      <t>The built-in bags and/or their trust anchors are immutable by configuration
          operations.  Servers MUST ignore attempts to modify any aspect of built-in
          bags and/or their trust anchors from &lt;running&gt;.</t>
      <t>The following example illustrates how a single built-in public CA
          certificate from the previous example has been propagated to &lt;running&gt;:</t>
      <artwork name="" type="" align="left" alt=""><![CDATA[
<truststore
  xmlns="urn:ietf:params:xml:ns:yang:ietf-truststore"
  xmlns:ct="urn:ietf:params:xml:ns:yang:ietf-crypto-types">
  <certificate-bags>

    <certificate-bag>
      <name>Built-In Public Trust Anchor Certificates</name>
      <description>
        Certificates built into the device for authenticating
        certificates issued by public certificate authorities,
        such as the end-entity certificate for web servers.

        Only the subset of the certificates that are referenced
        by other configuration nodes need to be copied.  For
        instance, only "Public Root CA Cert 3" is present here.

        No new certificates can be added, nor existing certificate
        values changed.  Missing certificates have no effect on
        "operational" when the configuration is applied.
      </description>
      <certificate>
        <name>Public Root CA Cert 3</name>
        <cert-data>BASE64VALUE=</cert-data>
      </certificate>
    </certificate-bag>

  </certificate-bags>
</truststore>
]]></artwork>
    </section>
    <section numbered="true" toc="default">
      <name>Security Considerations</name>
      <section numbered="true" toc="default">
        <name>Security of Data at Rest</name>
        <t>The YANG module defined in this document defines a mechanism called a
            "truststore" that, by its name, suggests that its contents are protected
            from unauthorized modification.</t>
        <t>Security controls for the API (i.e., data in motion) are
            discussed in <xref target="sec-mod" format="default"/>, but controls for the
            data at rest cannot be specified by the YANG module.</t>
        <t>In order to satisfy the expectations of a "truststore", it
            is RECOMMENDED that implementations ensure that the truststore
            contents are protected from unauthorized modifications when
            at rest.</t>
      </section>
      <section numbered="true" toc="default">
        <name>Unconstrained Public Key Usage</name>
        <t>This module enables the configuration of public keys without
            constraints on their usage, e.g., what operations the key is
            allowed to be used for (encryption, verification, both).</t>
        <t>This module also enables the configuration of certificates,
            where each certificate may constrain the usage of the public
            key according to local policy.</t>
      </section>
      <section anchor="sec-mod" numbered="true" toc="default">
        <name>The "ietf-truststore" YANG Module</name>
        <t>The YANG module defined in this document is designed to be accessed via YANG
            based management protocols, such as NETCONF <xref target="RFC6241" format="default"/> and
            RESTCONF <xref target="RFC8040" format="default"/>.  Both of these protocols have mandatory-to-implement
            secure transport layers (e.g., SSH, TLS) with mutual authentication.</t>
        <t>The NETCONF access control model (NACM) <xref target="RFC8341" format="default"/> provides the means
            to restrict access for particular users to a pre-configured subset of all available
            protocol operations and content.</t>
        <t>None of the readable data nodes defined in this YANG module are considered sensitive
            or vulnerable in network environments. The NACM "default-deny-all" extension
            has not been set for any data nodes defined in this module.</t>
        <t>All the writable data nodes defined by this module, both in the
            "grouping" statements as well as the protocol-accessible "truststore"
            instance, may be considered sensitive or vulnerable in some network
            environments. For instance, any modification to a trust anchor or
            reference to a trust anchor  may dramatically alter the implemented
            security policy.  For this reason, the NACM extension "default-deny-write"
            has been set for all data nodes defined in this module.</t>
        <t>This module does not define any "rpc" or "action" statements, and
            thus the security considerations for such is not provided here.</t>
      </section>
    </section>
    <section numbered="true" toc="default">
      <name>IANA Considerations</name>
      <section numbered="true" toc="default">
        <name>The "IETF XML" Registry</name>
        <t>This document registers one URI in the "ns" subregistry of
          the IETF XML Registry <xref target="RFC3688" format="default"/>.  Following the
          format in <xref target="RFC3688" format="default"/>, the following registration
          is requested:</t>
        <artwork name="" type="" align="left" alt=""><![CDATA[
   URI: urn:ietf:params:xml:ns:yang:ietf-truststore
   Registrant Contact: The IESG
   XML: N/A, the requested URI is an XML namespace.
]]></artwork>
      </section>
      <section numbered="true" toc="default">
        <name>The "YANG Module Names" Registry</name>
        <t>This document registers one YANG module in the
          YANG Module Names registry <xref target="RFC6020" format="default"/>.
          Following the format in <xref target="RFC6020" format="default"/>, the
          following registration is requested:</t>
        <artwork name="" type="" align="left" alt=""><![CDATA[
   name:         ietf-truststore
   namespace:    urn:ietf:params:xml:ns:yang:ietf-truststore
   prefix:       ts
   reference:    RFC BBBB
]]></artwork>
      </section>
    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
          <front>
            <title>Key words for use in RFCs to Indicate Requirement Levels</title>
            <seriesInfo name="DOI" value="10.17487/RFC2119"/>
            <seriesInfo name="RFC" value="2119"/>
            <seriesInfo name="BCP" value="14"/>
            <author initials="S." surname="Bradner" fullname="S. Bradner">
              <organization/>
            </author>
            <date year="1997" month="March"/>
            <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.  This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
            </abstract>
          </front>
        </reference>
        <reference anchor="RFC7950" target="https://www.rfc-editor.org/info/rfc7950" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7950.xml">
          <front>
            <title>The YANG 1.1 Data Modeling Language</title>
            <seriesInfo name="DOI" value="10.17487/RFC7950"/>
            <seriesInfo name="RFC" value="7950"/>
            <author initials="M." surname="Bjorklund" fullname="M. Bjorklund" role="editor">
              <organization/>
            </author>
            <date year="2016" month="August"/>
            <abstract>
              <t>YANG is a data modeling language used to model configuration data, state data, Remote Procedure Calls, and notifications for network management protocols.  This document describes the syntax and semantics of version 1.1 of the YANG language.  YANG version 1.1 is a maintenance release of the YANG language, addressing ambiguities and defects in the original specification.  There are a small number of backward incompatibilities from YANG version 1.  This document also specifies the YANG mappings to the Network Configuration Protocol (NETCONF).</t>
            </abstract>
          </front>
        </reference>
        <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml">
          <front>
            <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
            <seriesInfo name="DOI" value="10.17487/RFC8174"/>
            <seriesInfo name="RFC" value="8174"/>
            <seriesInfo name="BCP" value="14"/>
            <author initials="B." surname="Leiba" fullname="B. Leiba">
              <organization/>
            </author>
            <date year="2017" month="May"/>
            <abstract>
              <t>RFC 2119 specifies common key words that may be used in protocol  specifications.  This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the  defined special meanings.</t>
            </abstract>
          </front>
        </reference>
        <reference anchor="RFC8341" target="https://www.rfc-editor.org/info/rfc8341" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8341.xml">
          <front>
            <title>Network Configuration Access Control Model</title>
            <seriesInfo name="DOI" value="10.17487/RFC8341"/>
            <seriesInfo name="RFC" value="8341"/>
            <seriesInfo name="STD" value="91"/>
            <author initials="A." surname="Bierman" fullname="A. Bierman">
              <organization/>
            </author>
            <author initials="M." surname="Bjorklund" fullname="M. Bjorklund">
              <organization/>
            </author>
            <date year="2018" month="March"/>
            <abstract>
              <t>The standardization of network configuration interfaces for use with the Network Configuration Protocol (NETCONF) or the RESTCONF protocol requires a structured and secure operating environment that promotes human usability and multi-vendor interoperability.  There is a need for standard mechanisms to restrict NETCONF or RESTCONF protocol access for particular users to a preconfigured subset of all available NETCONF or RESTCONF protocol operations and content.  This document defines such an access control model.</t>
              <t>This document obsoletes RFC 6536.</t>
            </abstract>
          </front>
        </reference>
        <xi:include href="https://datatracker.ietf.org/doc/bibxml3/reference.I-D.ietf-netconf-crypto-types.xml"/>
      </references>
      <references>
        <name>Informative References</name>
        <reference anchor="RFC3688" target="https://www.rfc-editor.org/info/rfc3688" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.3688.xml">
          <front>
            <title>The IETF XML Registry</title>
            <seriesInfo name="DOI" value="10.17487/RFC3688"/>
            <seriesInfo name="RFC" value="3688"/>
            <seriesInfo name="BCP" value="81"/>
            <author initials="M." surname="Mealling" fullname="M. Mealling">
              <organization/>
            </author>
            <date year="2004" month="January"/>
            <abstract>
              <t>This document describes an IANA maintained registry for IETF standards which use Extensible Markup Language (XML) related items such as Namespaces, Document Type Declarations (DTDs), Schemas, and Resource Description Framework (RDF) Schemas.</t>
            </abstract>
          </front>
        </reference>
        <reference anchor="RFC6020" target="https://www.rfc-editor.org/info/rfc6020" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6020.xml">
          <front>
            <title>YANG - A Data Modeling Language for the Network Configuration Protocol (NETCONF)</title>
            <seriesInfo name="DOI" value="10.17487/RFC6020"/>
            <seriesInfo name="RFC" value="6020"/>
            <author initials="M." surname="Bjorklund" fullname="M. Bjorklund" role="editor">
              <organization/>
            </author>
            <date year="2010" month="October"/>
            <abstract>
              <t>YANG is a data modeling language used to model configuration and state data manipulated by the Network Configuration Protocol (NETCONF), NETCONF remote procedure calls, and NETCONF notifications. [STANDARDS-TRACK]</t>
            </abstract>
          </front>
        </reference>
        <reference anchor="RFC6241" target="https://www.rfc-editor.org/info/rfc6241" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6241.xml">
          <front>
            <title>Network Configuration Protocol (NETCONF)</title>
            <seriesInfo name="DOI" value="10.17487/RFC6241"/>
            <seriesInfo name="RFC" value="6241"/>
            <author initials="R." surname="Enns" fullname="R. Enns" role="editor">
              <organization/>
            </author>
            <author initials="M." surname="Bjorklund" fullname="M. Bjorklund" role="editor">
              <organization/>
            </author>
            <author initials="J." surname="Schoenwaelder" fullname="J. Schoenwaelder" role="editor">
              <organization/>
            </author>
            <author initials="A." surname="Bierman" fullname="A. Bierman" role="editor">
              <organization/>
            </author>
            <date year="2011" month="June"/>
            <abstract>
              <t>The Network Configuration Protocol (NETCONF) defined in this document provides mechanisms to install, manipulate, and delete the configuration of network devices.  It uses an Extensible Markup Language (XML)-based data encoding for the configuration data as well as the protocol messages.  The NETCONF protocol operations are realized as remote procedure calls (RPCs).  This document obsoletes RFC 4741.  [STANDARDS-TRACK]</t>
            </abstract>
          </front>
        </reference>
        <reference anchor="RFC8040" target="https://www.rfc-editor.org/info/rfc8040" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8040.xml">
          <front>
            <title>RESTCONF Protocol</title>
            <seriesInfo name="DOI" value="10.17487/RFC8040"/>
            <seriesInfo name="RFC" value="8040"/>
            <author initials="A." surname="Bierman" fullname="A. Bierman">
              <organization/>
            </author>
            <author initials="M." surname="Bjorklund" fullname="M. Bjorklund">
              <organization/>
            </author>
            <author initials="K." surname="Watsen" fullname="K. Watsen">
              <organization/>
            </author>
            <date year="2017" month="January"/>
            <abstract>
              <t>This document describes an HTTP-based protocol that provides a programmatic interface for accessing data defined in YANG, using the datastore concepts defined in the Network Configuration Protocol (NETCONF).</t>
            </abstract>
          </front>
        </reference>
        <reference anchor="RFC8340" target="https://www.rfc-editor.org/info/rfc8340" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8340.xml">
          <front>
            <title>YANG Tree Diagrams</title>
            <seriesInfo name="DOI" value="10.17487/RFC8340"/>
            <seriesInfo name="RFC" value="8340"/>
            <seriesInfo name="BCP" value="215"/>
            <author initials="M." surname="Bjorklund" fullname="M. Bjorklund">
              <organization/>
            </author>
            <author initials="L." surname="Berger" fullname="L. Berger" role="editor">
              <organization/>
            </author>
            <date year="2018" month="March"/>
            <abstract>
              <t>This document captures the current syntax used in YANG module tree diagrams.  The purpose of this document is to provide a single location for this definition.  This syntax may be updated from time to time based on the evolution of the YANG language.</t>
            </abstract>
          </front>
        </reference>
        <reference anchor="RFC8342" target="https://www.rfc-editor.org/info/rfc8342" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8342.xml">
          <front>
            <title>Network Management Datastore Architecture (NMDA)</title>
            <seriesInfo name="DOI" value="10.17487/RFC8342"/>
            <seriesInfo name="RFC" value="8342"/>
            <author initials="M." surname="Bjorklund" fullname="M. Bjorklund">
              <organization/>
            </author>
            <author initials="J." surname="Schoenwaelder" fullname="J. Schoenwaelder">
              <organization/>
            </author>
            <author initials="P." surname="Shafer" fullname="P. Shafer">
              <organization/>
            </author>
            <author initials="K." surname="Watsen" fullname="K. Watsen">
              <organization/>
            </author>
            <author initials="R." surname="Wilton" fullname="R. Wilton">
              <organization/>
            </author>
            <date year="2018" month="March"/>
            <abstract>
              <t>Datastores are a fundamental concept binding the data models written in the YANG data modeling language to network management protocols such as the Network Configuration Protocol (NETCONF) and RESTCONF. This document defines an architectural framework for datastores based on the experience gained with the initial simpler model, addressing requirements that were not well supported in the initial model.  This document updates RFC 7950.</t>
            </abstract>
          </front>
        </reference>
        <reference anchor="RFC8572" target="https://www.rfc-editor.org/info/rfc8572" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8572.xml">
          <front>
            <title>Secure Zero Touch Provisioning (SZTP)</title>
            <seriesInfo name="DOI" value="10.17487/RFC8572"/>
            <seriesInfo name="RFC" value="8572"/>
            <author initials="K." surname="Watsen" fullname="K. Watsen">
              <organization/>
            </author>
            <author initials="I." surname="Farrer" fullname="I. Farrer">
              <organization/>
            </author>
            <author initials="M." surname="Abrahamsson" fullname="M. Abrahamsson">
              <organization/>
            </author>
            <date year="2019" month="April"/>
            <abstract>
              <t>This document presents a technique to securely provision a networking device when it is booting in a factory-default state.  Variations in the solution enable it to be used on both public and private networks.  The provisioning steps are able to update the boot image, commit an initial configuration, and execute arbitrary scripts to address auxiliary needs.  The updated device is subsequently able to establish secure connections with other systems.  For instance, a device may establish NETCONF (RFC 6241) and/or RESTCONF (RFC 8040) connections with deployment-specific network management systems.</t>
            </abstract>
          </front>
        </reference>
        <xi:include href="https://datatracker.ietf.org/doc/bibxml3/reference.I-D.ietf-netconf-trust-anchors.xml"/>
        <xi:include href="https://datatracker.ietf.org/doc/bibxml3/reference.I-D.ietf-netconf-keystore.xml"/>
        <xi:include href="https://datatracker.ietf.org/doc/bibxml3/reference.I-D.ietf-netconf-tcp-client-server.xml"/>
        <xi:include href="https://datatracker.ietf.org/doc/bibxml3/reference.I-D.ietf-netconf-ssh-client-server.xml"/>
        <xi:include href="https://datatracker.ietf.org/doc/bibxml3/reference.I-D.ietf-netconf-tls-client-server.xml"/>
        <xi:include href="https://datatracker.ietf.org/doc/bibxml3/reference.I-D.ietf-netconf-http-client-server.xml"/>
        <xi:include href="https://datatracker.ietf.org/doc/bibxml3/reference.I-D.ietf-netconf-netconf-client-server.xml"/>
        <xi:include href="https://datatracker.ietf.org/doc/bibxml3/reference.I-D.ietf-netconf-restconf-client-server.xml"/>
        <xi:include href="https://datatracker.ietf.org/doc/bibxml3/reference.I-D.ma-netmod-with-system.xml"/>
      </references>
    </references>
    <section removeInRFC="true" anchor="change-log" numbered="true" toc="default">
      <name>Change Log</name>
      <section numbered="true" toc="default">
        <name>00 to 01</name>
        <ul spacing="normal">
          <li>Added features "x509-certificates" and "ssh-host-keys".</li>
          <li>Added nacm:default-deny-write to "trust-anchors" container.</li>
        </ul>
      </section>
      <section numbered="true" toc="default">
        <name>01 to 02</name>
        <ul spacing="normal">
          <li>Switched "list pinned-certificate" to use the
                 "trust-anchor-cert-grouping" from crypto-types.
                 Effectively the same definition as before.</li>
        </ul>
      </section>
      <section numbered="true" toc="default">
        <name>02 to 03</name>
        <ul spacing="normal">
          <li>Updated copyright date, boilerplate template, affiliation,
                folding algorithm, and reformatted the YANG module.</li>
        </ul>
      </section>
      <section numbered="true" toc="default">
        <name>03 to 04</name>
        <ul spacing="normal">
          <li>Added groupings 'local-or-truststore-certs-grouping'
                and 'local-or-truststore-host-keys-grouping', matching
                similar definitions in the keystore draft.  Note new
                (and incomplete) "truststore" usage!</li>
          <li>Related to above, also added features 'truststore-supported'
                and 'local-trust-anchors-supported'.</li>
        </ul>
      </section>
      <section numbered="true" toc="default">
        <name>04 to 05</name>
        <ul spacing="normal">
          <li>Renamed "trust-anchors" to "truststore"</li>
          <li>Removed "pinned." prefix everywhere, to match truststore rename</li>
          <li>Moved everything under a top-level 'grouping' to enable use in other contexts.</li>
          <li>Renamed feature from 'local-trust-anchors-supported' to 'local-definitions-supported' (same name used in keystore)</li>
          <li>Removed the "require-instance false" statement from the "*-ref" typedefs.</li>
          <li>Added missing "ssh-host-keys" and "x509-certificates" if-feature statements</li>
        </ul>
      </section>
      <section numbered="true" toc="default">
        <name>05 to 06</name>
        <ul spacing="normal">
          <li>Editorial changes only.</li>
        </ul>
      </section>
      <section numbered="true" toc="default">
        <name>06 to 07</name>
        <ul spacing="normal">
          <li>Added Henk Birkholz as a co-author (thanks Henk!)</li>
          <li>Added PSKs and raw public keys to truststore.</li>
        </ul>
      </section>
      <section numbered="true" toc="default">
        <name>07 to 08</name>
        <ul spacing="normal">
          <li>Added new "Support for Built-in Trust Anchors" section.</li>
          <li>Removed spurious "uses ct:trust-anchor-certs-grouping" line.</li>
          <li>Removed PSK from model.</li>
        </ul>
      </section>
      <section numbered="true" toc="default">
        <name>08 to 09</name>
        <ul spacing="normal">
          <li>Removed remaining PSK references from text.</li>
          <li>Wrapped each top-level list with a container.</li>
          <li>Introduced "bag" term.</li>
          <li>Merged "SSH Public Keys" and "Raw Public Keys" in a single "Public Keys" bag.
                Consuming downstream modules (i.e., "ietf-[ssh/tls]-[client/server]) refine
                the "public-key-format" to be either SSH or TLS specific as needed.</li>
        </ul>
      </section>
      <section numbered="true" toc="default">
        <name>09 to 10</name>
        <ul spacing="normal">
          <li>Removed "algorithm" node from examples.</li>
          <li>Removed the no longer used statements supporting the old "ssh-public-key" and "raw-public-key" nodes.</li>
          <li>Added a "Note to Reviewers" note to first page.</li>
        </ul>
      </section>
      <section numbered="true" toc="default">
        <name>10 to 11</name>
        <ul spacing="normal">
          <li>Corrected module prefix registered in the IANA Considerations section.</li>
          <li>Modified 'local-or-truststore-certs-grouping' to use a list (not a leaf-list).</li>
          <li>Added new example section "The Local or Truststore Groupings".</li>
          <li>Clarified expected behavior for "built-in" certificates in &lt;operational&gt;</li>
          <li>Expanded "Data Model Overview section(s) [remove "wall" of tree diagrams].</li>
          <li>Updated the Security Considerations section.</li>
        </ul>
      </section>
      <section numbered="true" toc="default">
        <name>11 to 12</name>
        <ul spacing="normal">
          <li>Fixed a copy/paste issue in the "Data at Rest" Security Considerations section.</li>
        </ul>
      </section>
      <section numbered="true" toc="default">
        <name>12 to 13</name>
        <ul spacing="normal">
          <li>Fixed issues found by the SecDir review of the "keystore" draft.</li>
        </ul>
      </section>
      <section numbered="true" toc="default">
        <name>13 to 14</name>
        <ul spacing="normal">
          <li>Added an "Unconstrained Public Key Usage" Security Consideration to address
                concern raised by SecDir.</li>
          <li>Addressed comments raised by YANG Doctor.</li>
        </ul>
      </section>
      <section numbered="true" toc="default">
        <name>14 to 15</name>
        <ul spacing="normal">
          <li>Added prefixes to 'path' statements per trust-anchors/issues/1</li>
          <li>Renamed feature "truststore-supported" to "central-truststore-supported".</li>
          <li>Associated with above, generally moved text to refer to a "central" truststore.</li>
          <li>Removed two unecessary/unwanted "min-elements 1" and associated "presence" statements.</li>
          <li>Aligned modules with `pyang -f` formatting.</li>
          <li>Fixed nits found by YANG Doctor reviews.</li>
        </ul>
      </section>
      <section numbered="true" toc="default">
        <name>15 to 16</name>
        <ul spacing="normal">
          <li>Replaced "base64encodedvalue==" with "BASE64VALUE=" in examples.</li>
          <li>Minor editorial nits</li>
        </ul>
      </section>
      <section numbered="true" toc="default">
        <name>16 to 17</name>
        <ul spacing="normal">
          <li>fixup the 'WG Web' and 'WG List' lines in YANG module(s)</li>
          <li>fixup copyright (i.e., s/Simplified/Revised/) in YANG module(s)</li>
          <li>Added Informative reference to ma-netmod-with-system</li>
        </ul>
      </section>
      <!--
        <section title="17 to 18">
          <t>
            <list style="symbols">
              <t>SUBMISSION PENDING</t>
            </list>
          </t>
        </section>
        -->
      </section>
    <section numbered="false" toc="default">
      <name>Acknowledgements</name>
      <t>The authors especially thank Henk Birkholz for contributing YANG
          to the ietf-truststore module supporting raw public keys and PSKs
          (pre-shared or pairwise-symmetric keys).  While these contributions
          were eventually replaced by reusing the existing support for
          asymmetric and symmetric trust anchors, respectively, it was only
          thru Henk's initiative that the WG was able to come to that result.</t>
      <t>The authors additionally thank the following for helping give shape
          to this work (ordered by first name):
          Balazs Kovacs,
          Eric Voit,
          Juergen Schoenwaelder,
          Liang Xia,
          Martin Bjoerklund,
          Nick Hancock,
          and Yoav Nir.
      </t>
    </section>
  </back>
</rfc>
