module ietf-keystore {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-keystore";
prefix "ks";
import ietf-crypto-types {
prefix ct;
reference
"RFC CCCC: Common YANG Data Types for Cryptography";
}
import ietf-netconf-acm {
prefix nacm;
reference
"RFC 8341: Network Configuration Access Control Model";
}
organization
"IETF NETCONF (Network Configuration) Working Group";
contact
"WG Web:
WG List:
Author: Kent Watsen
";
description
"This module defines a keystore to centralize management
of security credentials.
Copyright (c) 2018 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 Simplified
BSD License set forth in Section 4.c of the IETF Trust's
Legal Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC VVVV; see
the RFC itself for full legal notices.";
revision "2018-10-22" {
description
"Initial version";
reference
"RFC VVVV:
YANG Data Model for a Centralized Keystore Mechanism";
}
// Features
feature keystore-supported {
description
"The 'keystore-supported' feature indicates that the server
supports the keystore.";
}
feature local-keys-supported {
description
"The 'local-keys-supported' feature indocates that the
server supports locally-defined keys.";
}
// Typedefs
typedef asymmetric-key-ref {
type leafref {
path "/ks:keystore/ks:asymmetric-keys/ks:asymmetric-key"
+ "/ks:name";
}
description
"This typedef enables modules to easily define a reference
to an asymmetric key stored in the keystore.";
reference
"RFC 8342: Network Management Datastore Architecture (NMDA)";
}
typedef asymmetric-key-certificate-ref {
type leafref {
path "/ks:keystore/ks:asymmetric-keys/ks:asymmetric-key"
+ "/ks:certificates/ks:certificate/ks:name";
}
description
"This typedef enables modules to easily define a reference
to a specific certificate associated with an asymmetric key
stored in the keystore.";
reference
"RFC 8342: Network Management Datastore Architecture (NMDA)";
}
// Groupings
grouping local-or-keystore-asymmetric-key-grouping {
description
"A grouping that expands to allow the asymmetric key to be
either stored locally, within the using data model, or be
a reference to an asymmetric key stored in the keystore.";
choice local-or-keystore {
mandatory true;
case local {
if-feature "local-keys-supported";
uses ct:asymmetric-key-pair-grouping;
}
case keystore {
if-feature "keystore-supported";
leaf reference {
type ks:asymmetric-key-ref;
description
"A reference to an asymmetric key that exists in
the keystore. The intent is to reference just the
asymmetric key, not any certificates that may also
be associated with the asymmetric key.";
}
}
description
"A choice between an inlined definition and a definition
that exists in the keystore.";
}
}
grouping local-or-keystore-asymmetric-key-with-certs-grouping {
description
"A grouping that expands to allow an asymmetric key and its
associated certificates to be either stored locally, within
the using data model, or be a reference to an asymmetric key
(and its associated certificates) stored in the keystore.";
choice local-or-keystore {
mandatory true;
case local {
if-feature "local-keys-supported";
uses ct:asymmetric-key-pair-with-certs-grouping;
}
case keystore {
if-feature "keystore-supported";
leaf reference {
type ks:asymmetric-key-ref;
description
"A reference to a value that exists in the keystore.";
}
}
description
"A choice between an inlined definition and a definition
that exists in the keystore.";
}
}
grouping local-or-keystore-end-entity-cert-with-key-grouping {
description
"A grouping that expands to allow an end-entity certificate
(and its associated private key) to be either stored locally,
within the using data model, or be a reference to a specific
certificate in the keystore.";
choice local-or-keystore {
mandatory true;
case local {
if-feature "local-keys-supported";
uses ct:asymmetric-key-pair-grouping;
uses ct:end-entity-cert-grouping;
}
case keystore {
if-feature "keystore-supported";
leaf reference {
type ks:asymmetric-key-certificate-ref;
description
"A reference to a specific certificate, and its
associated private key, stored in the keystore.";
}
}
description
"A choice between an inlined definition and a definition
that exists in the keystore.";
}
}
// protocol accessible nodes
container keystore {
nacm:default-deny-write;
description
"The keystore contains a list of keys.";
container asymmetric-keys {
description
"A list of asymmetric keys.";
list asymmetric-key {
must "(algorithm and public-key and private-key)
or not (algorithm or public-key or private-key)";
key name;
description
"An asymmetric key.";
leaf name {
type string;
description
"An arbitrary name for the asymmetric key. If the name
matches the name of a key that exists independently in
(i.e., a 'permanently-hidden' key), then
the 'algorithm', 'public-key', and 'private-key' nodes
MUST NOT be configured.";
}
uses ct:asymmetric-key-pair-with-certs-grouping;
} // end asymmetric-key
} // end asymmetric-keys
} // end keystore
}