module ietf-crypto-types {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-crypto-types";
prefix "ct";
import ietf-yang-types {
prefix yang;
reference
"RFC 6991: Common YANG Data Types";
}
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 common YANG types for cryptographic
applications.
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 XXXX; see
the RFC itself for full legal notices.";
revision "2018-09-20" {
description
"Initial version";
reference
"RFC XXXX: Common YANG Data Types for Cryptography";
}
/*****************************************/
/* Identities for Hashing Algorithms */
/*****************************************/
identity hash-algorithm {
description
"A base identity for hash algorithm verification.";
}
identity sha-256 {
base "hash-algorithm";
description "The SHA-256 algorithm.";
reference "RFC 6234: US Secure Hash Algorithms.";
}
/*************************************/
/* Identities for Key Algorithms */
/*************************************/
identity key-algorithm {
description
"Base identity from which all key-algorithms are derived.";
}
identity rsa1024 {
base key-algorithm;
description
"The RSA algorithm using a 1024-bit key.";
reference
"RFC 8017:
PKCS #1: RSA Cryptography Specifications Version 2.2.";
}
identity rsa2048 {
base key-algorithm;
description
"The RSA algorithm using a 2048-bit key.";
reference
"RFC 8017:
PKCS #1: RSA Cryptography Specifications Version 2.2.";
}
identity rsa3072 {
base key-algorithm;
description
"The RSA algorithm using a 3072-bit key.";
reference
"RFC 8017:
PKCS #1: RSA Cryptography Specifications Version 2.2.";
}
identity rsa4096 {
base key-algorithm;
description
"The RSA algorithm using a 4096-bit key.";
reference
"RFC 8017:
PKCS #1: RSA Cryptography Specifications Version 2.2.";
}
identity rsa7680 {
base key-algorithm;
description
"The RSA algorithm using a 7680-bit key.";
reference
"RFC 8017:
PKCS #1: RSA Cryptography Specifications Version 2.2.";
}
identity rsa15360 {
base key-algorithm;
description
"The RSA algorithm using a 15360-bit key.";
reference
"RFC 8017:
PKCS #1: RSA Cryptography Specifications Version 2.2.";
}
identity secp192r1 {
base key-algorithm;
description
"The secp192r1 algorithm.";
reference
"RFC 5480: Elliptic Curve Cryptography Subject Public
Key Information.";
}
identity secp256r1 {
base key-algorithm;
description
"The secp256r1 algorithm.";
reference
"RFC 5480: Elliptic Curve Cryptography Subject Public
Key Information.";
}
identity secp384r1 {
base key-algorithm;
description
"The secp384r1 algorithm.";
reference
"RFC 5480: Elliptic Curve Cryptography Subject Public
Key Information.";
}
identity secp521r1 {
base key-algorithm;
description
"The secp521r1 algorithm.";
reference
"RFC 5480: Elliptic Curve Cryptography Subject Public
Key Information.";
}
/*********************************************************/
/* Typedefs for identityrefs to above base identites */
/*********************************************************/
typedef hash-algorithm-ref {
type identityref {
base "hash-algorithm";
}
description
"This typedef enables importing modules to easily define an
identityref to the 'hash-algorithm' base identity.";
}
typedef key-algorithm-ref {
type identityref {
base "key-algorithm";
}
description
"This typedef enables importing modules to easily define an
identityref to the 'key-algorithm' base identity.";
}
/***************************************************/
/* Typedefs for ASN.1 structures from RFC 5280 */
/***************************************************/
typedef x509 {
type binary;
description
"A Certificate structure, as specified in RFC 5280,
encoded using ASN.1 distinguished encoding rules (DER),
as specified in ITU-T X.690.";
reference
"RFC 5280:
Internet X.509 Public Key Infrastructure Certificate
and Certificate Revocation List (CRL) Profile
ITU-T X.690:
Information technology - ASN.1 encoding rules:
Specification of Basic Encoding Rules (BER),
Canonical Encoding Rules (CER) and Distinguished
Encoding Rules (DER).";
}
typedef crl {
type binary;
description
"A CertificateList structure, as specified in RFC 5280,
encoded using ASN.1 distinguished encoding rules (DER),
as specified in ITU-T X.690.";
reference
"RFC 5280:
Internet X.509 Public Key Infrastructure Certificate
and Certificate Revocation List (CRL) Profile
ITU-T X.690:
Information technology - ASN.1 encoding rules:
Specification of Basic Encoding Rules (BER),
Canonical Encoding Rules (CER) and Distinguished
Encoding Rules (DER).";
}
/***********************************************/
/* Typedefs for ASN.1 structures from 5652 */
/***********************************************/
typedef cms {
type binary;
description
"A ContentInfo structure, as specified in RFC 5652,
encoded using ASN.1 distinguished encoding rules (DER),
as specified in ITU-T X.690.";
reference
"RFC 5652:
Cryptographic Message Syntax (CMS)
ITU-T X.690:
Information technology - ASN.1 encoding rules:
Specification of Basic Encoding Rules (BER),
Canonical Encoding Rules (CER) and Distinguished
Encoding Rules (DER).";
}
typedef data-content-cms {
type cms;
description
"A CMS structure whose top-most content type MUST be the
data content type, as described by Section 4 in RFC 5652.";
reference
"RFC 5652: Cryptographic Message Syntax (CMS)";
}
typedef signed-data-cms {
type cms;
description
"A CMS structure whose top-most content type MUST be the
signed-data content type, as described by Section 5 in
RFC 5652.";
reference
"RFC 5652: Cryptographic Message Syntax (CMS)";
}
typedef enveloped-data-cms {
type cms;
description
"A CMS structure whose top-most content type MUST be the
enveloped-data content type, as described by Section 6
in RFC 5652.";
reference
"RFC 5652: Cryptographic Message Syntax (CMS)";
}
typedef digested-data-cms {
type cms;
description
"A CMS structure whose top-most content type MUST be the
digested-data content type, as described by Section 7
in RFC 5652.";
reference
"RFC 5652: Cryptographic Message Syntax (CMS)";
}
typedef encrypted-data-cms {
type cms;
description
"A CMS structure whose top-most content type MUST be the
encrypted-data content type, as described by Section 8
in RFC 5652.";
reference
"RFC 5652: Cryptographic Message Syntax (CMS)";
}
typedef authenticated-data-cms {
type cms;
description
"A CMS structure whose top-most content type MUST be the
authenticated-data content type, as described by Section 9
in RFC 5652.";
reference
"RFC 5652: Cryptographic Message Syntax (CMS)";
}
/***************************************************/
/* Typedefs for structures related to RFC 4253 */
/***************************************************/
typedef ssh-host-key {
type binary;
description
"The binary public key data for this SSH key, as
specified by RFC 4253, Section 6.6, i.e.:
string certificate or public key format
identifier
byte[n] key/certificate data.";
reference
"RFC 4253: The Secure Shell (SSH) Transport Layer
Protocol";
}
/*********************************************************/
/* Typedefs for ASN.1 structures related to RFC 5280 */
/*********************************************************/
typedef trust-anchor-cert-x509 {
type x509;
description
"A Certificate structure that MUST encode a self-signed
root certificate.";
}
typedef end-entity-cert-x509 {
type x509;
description
"A Certificate structure that MUST encode a certificate
that is neither self-signed nor having Basic constraint
CA true.";
}
/*********************************************************/
/* Typedefs for ASN.1 structures related to RFC 5652 */
/*********************************************************/
typedef trust-anchor-cert-cms {
type signed-data-cms;
description
"A CMS SignedData structure that MUST contain the chain of
X.509 certificates needed to authenticate the certificate
presented by a client or end-entity.
The CMS MUST contain only a single chain of certificates.
The client or end-entity certificate MUST only authenticate
to last intermediate CA certificate listed in the chain.
In all cases, the chain MUST include a self-signed root
certificate. In the case where the root certificate is
itself the issuer of the client or end-entity certificate,
only one certificate is present.
This CMS structure MAY (as applicable where this type is
used) also contain suitably fresh (as defined by local
policy) revocation objects with which the device can
verify the revocation status of the certificates.
This CMS encodes the degenerate form of the SignedData
structure that is commonly used to disseminate X.509
certificates and revocation objects (RFC 5280).";
reference
"RFC 5280:
Internet X.509 Public Key Infrastructure Certificate
and Certificate Revocation List (CRL) Profile.";
}
typedef end-entity-cert-cms {
type signed-data-cms;
description
"A CMS SignedData structure that MUST contain the end
entity certificate itself, and MAY contain any number
of intermediate certificates leading up to a trust
anchor certificate. The trust anchor certificate
MAY be included as well.
The CMS MUST contain a single end entity certificate.
The CMS MUST NOT contain any spurious certificates.
This CMS structure MAY (as applicable where this type is
used) also contain suitably fresh (as defined by local
policy) revocation objects with which the device can
verify the revocation status of the certificates.
This CMS encodes the degenerate form of the SignedData
structure that is commonly used to disseminate X.509
certificates and revocation objects (RFC 5280).";
reference
"RFC 5280:
Internet X.509 Public Key Infrastructure Certificate
and Certificate Revocation List (CRL) Profile.";
}
/**********************************************/
/* Groupings for keys and/or certificates */
/**********************************************/
grouping public-key-grouping {
description
"A public key.";
leaf algorithm {
type ct:key-algorithm-ref;
description
"Identifies the key's algorithm. More specifically,
this leaf specifies how the 'public-key' binary leaf
is encoded.";
reference
"RFC CCCC: Common YANG Data Types for Cryptography";
}
leaf public-key {
type binary;
description
"A binary that contains the value of the public key. The
interpretation of the content is defined by the key
algorithm. For example, a DSA key is an integer, an RSA
key is represented as RSAPublicKey as defined in
RFC 8017, and an Elliptic Curve Cryptography (ECC) key
is represented using the 'publicKey' described in
RFC 5915.";
reference
"RFC 8017: Public-Key Cryptography Standards (PKCS) #1:
RSA Cryptography Specifications Version 2.2.
RFC 5915: Elliptic Curve Private Key Structure.";
}
} // end public-key-grouping
grouping asymmetric-key-pair-grouping {
description
"A private/public key pair.";
uses public-key-grouping;
leaf private-key {
nacm:default-deny-all;
type union {
type binary;
type enumeration {
enum "permanently-hidden" {
description
"The private key is inaccessible due to being
protected by the system (e.g., a cryptographic
hardware module). It is not possible to
configure a permanently hidden key, as a real
private key value must be set. Permanently
hidden keys cannot be archived or backed up.";
}
}
}
description
"A binary that contains the value of the private key. The
interpretation of the content is defined by the key
algorithm. For example, a DSA key is an integer, an RSA
key is represented as RSAPrivateKey as defined in
RFC 8017, and an Elliptic Curve Cryptography (ECC) key
is represented as ECPrivateKey as defined in RFC 5915.";
reference
"RFC 8017: Public-Key Cryptography Standards (PKCS) #1:
RSA Cryptography Specifications Version 2.2.
RFC 5915: Elliptic Curve Private Key Structure.";
}
action generate-hidden-key {
description
"Requests the device to generate a hidden key using the
specified asymmetric key algorithm. This action is
used to request the system the generate a key that
is 'permanently-hidden', perhaps protected by a
cryptographic hardware module. The resulting
asymmetric key values are considered operational
state and hence present only in .";
input {
leaf algorithm {
type ct:key-algorithm-ref;
mandatory true;
description
"The algorithm to be used when generating the
asymmetric key.";
reference
"RFC CCCC: Common YANG Data Types for Cryptography";
}
}
} // end generate-hidden-key
action install-hidden-key {
description
"Requests the device to load the specified values into
a hidden key. The resulting asymmetric key values are
considered operational state and hence present only in
.";
input {
leaf algorithm {
type ct:key-algorithm-ref;
mandatory true;
description
"The algorithm to be used when generating the
asymmetric key.";
reference
"RFC CCCC: Common YANG Data Types for Cryptography";
}
leaf public-key {
type binary;
description
"A binary that contains the value of the public key.
The interpretation of the content is defined by the key
algorithm. For example, a DSA key is an integer, an
RSA key is represented as RSAPublicKey as defined in
RFC 8017, and an Elliptic Curve Cryptography (ECC) key
is represented using the 'publicKey' described in
RFC 5915.";
reference
"RFC 8017: Public-Key Cryptography Standards (PKCS) #1:
RSA Cryptography Specifications Version 2.2.
RFC 5915: Elliptic Curve Private Key Structure.";
}
leaf private-key {
type binary;
description
"A binary that contains the value of the private key.
The interpretation of the content is defined by the key
algorithm. For example, a DSA key is an integer, an RSA
key is represented as RSAPrivateKey as defined in
RFC 8017, and an Elliptic Curve Cryptography (ECC) key
is represented as ECPrivateKey as defined in RFC 5915.";
reference
"RFC 8017: Public-Key Cryptography Standards (PKCS) #1:
RSA Cryptography Specifications Version 2.2.
RFC 5915: Elliptic Curve Private Key Structure.";
}
}
} // end install-hidden-key
} // end asymmetric-key-pair-grouping
grouping trust-anchor-cert-grouping {
description
"A certificate, and a notification for when it might expire.";
leaf cert {
type ct:trust-anchor-cert-cms;
mandatory true;
description
"The binary certificate data for this certificate.";
reference
"RFC YYYY: Common YANG Data Types for Cryptography";
}
} // end trust-anchor-cert-grouping
grouping end-entity-cert-grouping {
description
"A certificate, and a notification for when it might expire.";
leaf cert {
type ct:end-entity-cert-cms;
mandatory true;
description
"The binary certificate data for this certificate.";
reference
"RFC YYYY: Common YANG Data Types for Cryptography";
}
notification certificate-expiration {
description
"A notification indicating that the configured certificate
is either about to expire or has already expired. When to
send notifications is an implementation specific decision,
but it is RECOMMENDED that a notification be sent once a
month for 3 months, then once a week for four weeks, and
then once a day thereafter until the issue is resolved.";
leaf expiration-date {
type yang:date-and-time;
//mandatory true;
description
"Identifies the expiration date on the certificate.";
}
}
} // end end-entity-cert-grouping
grouping asymmetric-key-pair-with-certs-grouping {
description
"A private/public key pair and associated certificates.";
uses asymmetric-key-pair-grouping;
container certificates {
description
"Certificates associated with this asymmetric key.
More than one certificate supports, for instance,
a TPM-protected asymmetric key that has both IDevID
and LDevID certificates associated.";
list certificate {
must "../../algorithm
and ../../public-key
and ../../private-key";
key name;
description
"A certificate for this asymmetric key.";
leaf name {
type string;
description
"An arbitrary name for the certificate.";
}
uses end-entity-cert-grouping;
} // end certificate
} // end certificates
action generate-certificate-signing-request {
description
"Generates a certificate signing request structure for
the associated asymmetric key using the passed subject
and attribute values. The specified assertions need
to be appropriate for the certificate's use. For
example, an entity certificate for a TLS server
SHOULD have values that enable clients to satisfy
RFC 6125 processing.";
input {
leaf subject {
type binary;
mandatory true;
description
"The 'subject' field per the CertificationRequestInfo
structure as specified by RFC 2986, Section 4.1
encoded using the ASN.1 distinguished encoding
rules (DER), as specified in ITU-T X.690.";
reference
"RFC 2986:
PKCS #10: Certification Request Syntaxi
Specification Version 1.7.
ITU-T X.690:
Information technology - ASN.1 encoding rules:
Specification of Basic Encoding Rules (BER),
Canonical Encoding Rules (CER) and Distinguished
Encoding Rules (DER).";
}
leaf attributes {
type binary;
description
"The 'attributes' field from the structure
CertificationRequestInfo as specified by RFC 2986,
Section 4.1 encoded using the ASN.1 distinguished
encoding rules (DER), as specified in ITU-T X.690.";
reference
"RFC 2986:
PKCS #10: Certification Request Syntax
Specification Version 1.7.
ITU-T X.690:
Information technology - ASN.1 encoding rules:
Specification of Basic Encoding Rules (BER),
Canonical Encoding Rules (CER) and Distinguished
Encoding Rules (DER).";
}
}
output {
leaf certificate-signing-request {
type binary;
mandatory true;
description
"A CertificationRequest structure as specified by
RFC 2986, Section 4.2 encoded using the ASN.1
distinguished encoding rules (DER), as specified
in ITU-T X.690.";
reference
"RFC 2986:
PKCS #10: Certification Request Syntax
Specification Version 1.7.
ITU-T X.690:
Information technology - ASN.1 encoding rules:
Specification of Basic Encoding Rules (BER),
Canonical Encoding Rules (CER) and Distinguished
Encoding Rules (DER).";
}
}
} // end generate-certificate-signing-request
} // end asymmetric-key-pair-with-certs-grouping
}