NETCONF Working Group                                          K. Watsen
Internet-Draft                                           Watsen Networks
Intended status: Standards Track                                 H. Wang
Expires: April 20, May 4, 2020                                              Huawei
                                                        October 18,
                                                        November 1, 2019

                Common YANG Data Types for Cryptography
                   draft-ietf-netconf-crypto-types-11
                   draft-ietf-netconf-crypto-types-12

Abstract

   This document defines four YANG identities, typedefs, the groupings useful modules for types useful to
   cryptographic applications.  The modules defined include:

   o  ietf-crypto-types

   o  iana-symmetric-algs

   o  iana-asymmetric-algs

   o  iana-hash-algs

Editorial Note (To be removed by RFC Editor)

   This draft contains many 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.

   Artwork in this document contains shorthand references to drafts in
   progress.  Please apply the following replacements:

   o  "XXXX" --> the assigned RFC value for this draft

   Artwork in this document contains placeholder values for the date of
   publication of this draft.  Please apply the following replacement:

   o  "2019-10-18"  "2019-11-02" --> the publication date of this draft

   The following Appendix section is to be removed prior to publication:

   o  Appendix B.  Change Log

Status of This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at https://datatracker.ietf.org/drafts/current/.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on April 20, May 4, 2020.

Copyright Notice

   Copyright (c) 2019 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (https://trustee.ietf.org/license-info) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   3
   2.  The Crypto Types Module . . . . . . . . . . . . . . . . . . .   3   4
     2.1.  Tree Diagram  . . . . . . . . . . . . . . . . . . . . . .   3   4
     2.2.  YANG Module . . . . . . . . . . . . . . . . . . . . . . .   5
   3.  Security Considerations   6
     2.3.  Examples  . . . . . . . . . . . . . . . . . . .  51
     3.1.  Support for . . . . .  23
   3.  The Symmetric Algorithms Module . . . . . . . . . . . . . . .  27
     3.1.  Tree Diagram  . . .  51 . . . . . . . . . . . . . . . . . . .  27
     3.2.  No Support for CRMF  YANG Module . . . . . . . . . . . . . . . . . . . .  51
     3.3.  Access to Data Nodes . . .  27
     3.3.  Examples  . . . . . . . . . . . . . . . . .  51
   4.  IANA Considerations . . . . . . .  31
   4.  The Asymmetric Algorithms Module  . . . . . . . . . . . . . .  52  31
     4.1.  The IETF XML Registry  Tree Diagram  . . . . . . . . . . . . . . . . . .  52 . . . .  31
     4.2.  The  YANG Module Names Registry . . . . . . . . . . . . .  53
   5.  References . . . . . . . . . .  32
     4.3.  Examples  . . . . . . . . . . . . . . .  53
     5.1.  Normative References . . . . . . . . .  36
   5.  The Hash Algorithms Module  . . . . . . . . .  53
     5.2.  Informative References . . . . . . . .  36
     5.1.  Tree Diagram  . . . . . . . . .  55
   Appendix A.  Examples . . . . . . . . . . . . .  36
     5.2.  YANG Module . . . . . . . . .  58
     A.1.  The "asymmetric-key-pair-with-certs-grouping" Grouping .  58
     A.2.  The "generate-certificate-signing-request" Action . . . .  60
     A.3.  The "certificate-expiration" Notification . . . . . . . .  61
   Appendix B.  Change Log .  36
     5.3.  Examples  . . . . . . . . . . . . . . . . . . . . .  62
     B.1.  I-D to 00 . . .  40
   6.  Security Considerations . . . . . . . . . . . . . . . . . . .  40
     6.1.  Support for Algorithms  . .  62
     B.2.  00 to 01 . . . . . . . . . . . . . . .  40
     6.2.  No Support for CRMF . . . . . . . . .  62
     B.3.  01 . . . . . . . . . .  41
     6.3.  Access to 02 Data Nodes  . . . . . . . . . . . . . . . . . .  41
   7.  IANA Considerations . . . . . .  62
     B.4.  02 to 03 . . . . . . . . . . . . . . .  42
     7.1.  The IETF XML Registry . . . . . . . . . .  63
     B.5.  03 to 04 . . . . . . . .  42
     7.2.  The YANG Module Names Registry  . . . . . . . . . . . . .  43
   8.  References  . . .  63
     B.6.  04 to 05 . . . . . . . . . . . . . . . . . . . . . .  43
     8.1.  Normative References  . . . .  64
     B.7.  05 to 06 . . . . . . . . . . . . . .  43
     8.2.  Informative References  . . . . . . . . . . . . .  64
     B.8.  06 to 07 . . . .  46
   Appendix A.  Change Log . . . . . . . . . . . . . . . . . . . .  64
     B.9.  07 .  49
     A.1.  I-D to 08 00 . . . . . . . . . . . . . . . . . . . . . . . .  65
     B.10. 08  49
     A.2.  00 to 09 01  . . . . . . . . . . . . . . . . . . . . . . . .  65
     B.11. 09  49
     A.3.  01 to 10 02  . . . . . . . . . . . . . . . . . . . . . . . .  65
     B.12. 10  49
     A.4.  02 to 11 03  . . . . . . . . . . . . . . . . . . . . . . . .  65
   Acknowledgements  49
     A.5.  03 to 04  . . . . . . . . . . . . . . . . . . . . . . . .  66
   Authors' Addresses  50
     A.6.  04 to 05  . . . . . . . . . . . . . . . . . . . . . . .  66

1.  Introduction

   This document defines a YANG 1.1 [RFC7950] module specifying
   identities, typedefs, and groupings useful for cryptography.

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
   "OPTIONAL" in this document are .  50
     A.7.  05 to be interpreted as described in BCP
   14 [RFC2119] [RFC8174] when, and only when, they appear in all
   capitals, as shown here.

2.  The Crypto Types Module

2.1.  Tree Diagram

   This section provides a tree diagram [RFC8340] for the "ietf-crypto-
   types" module.  Only the groupings as represented, as tree diagrams
   have no means 06  . . . . . . . . . . . . . . . . . . . . . . . .  50
     A.8.  06 to represent identities or typedefs.

   module: ietf-crypto-types

     grouping symmetric-key-grouping
       +-- algorithm           encryption-algorithm-t
       +-- key-format?         identityref
       +-- (key-type)
          +--:(key)
          |  +-- key?          binary
          +--:(hidden-key)
             +-- hidden-key?   empty
     grouping public-key-grouping
       +-- algorithm            asymmetric-key-algorithm-t
       +-- public-key-format?   identityref
       +-- public-key           binary
     grouping asymmetric-key-pair-grouping
       +-- algorithm                   asymmetric-key-algorithm-t
       +-- public-key-format?          identityref
       +-- public-key                  binary
       +-- private-key-format?         identityref
       +-- (private-key-type)
          +--:(private-key)
          |  +-- private-key?          binary
          +--:(hidden-private-key)
             +-- hidden-private-key?   empty
     grouping trust-anchor-cert-grouping
       +-- cert?                     trust-anchor-cert-cms
       +---n certificate-expiration
          +-- expiration-date    yang:date-and-time
     grouping trust-anchor-certs-grouping
       +-- cert*                     trust-anchor-cert-cms
       +---n certificate-expiration
          +-- expiration-date    yang:date-and-time
     grouping end-entity-cert-grouping
       +-- cert?                     end-entity-cert-cms
       +---n certificate-expiration
          +-- expiration-date    yang:date-and-time
     grouping end-entity-certs-grouping
       +-- cert*                     end-entity-cert-cms
       +---n certificate-expiration
          +-- expiration-date    yang:date-and-time
     grouping asymmetric-key-pair-with-cert-grouping
       +-- algorithm
       |       asymmetric-key-algorithm-t
       +-- public-key-format?                      identityref
       +-- public-key                              binary
       +-- private-key-format?                     identityref
       +-- (private-key-type)
       |  +--:(private-key)
       |  |  +-- private-key?                      binary
       |  +--:(hidden-private-key)
       |     +-- hidden-private-key?               empty
       +-- cert?                                   end-entity-cert-cms
       +---n certificate-expiration
       |  +-- expiration-date    yang:date-and-time
       +---x generate-certificate-signing-request
          +---w input
          |  +---w subject       binary
          |  +---w attributes?   binary
          +--ro output
             +--ro certificate-signing-request    binary
     grouping asymmetric-key-pair-with-certs-grouping
       +-- algorithm
       |       asymmetric-key-algorithm-t
       +-- public-key-format?                      identityref
       +-- public-key                              binary
       +-- private-key-format?                     identityref
       +-- (private-key-type)
       |  +--:(private-key)
       |  |  +-- private-key?                      binary
       |  +--:(hidden-private-key)
       |     +-- hidden-private-key?               empty
       +-- certificates
       |  +-- certificate* [name]
       |     +-- name?                     string
       |     +-- cert?                     end-entity-cert-cms
       |     +---n certificate-expiration
       |        +-- expiration-date    yang:date-and-time
       +---x generate-certificate-signing-request
          +---w input
          |  +---w subject       binary
          |  +---w attributes?   binary
          +--ro output
             +--ro certificate-signing-request    binary

2.2.  YANG Module

   This module has normative references 07  . . . . . . . . . . . . . . . . . . . . . . . .  51
     A.9.  07 to [RFC2404], [RFC3565],
   [RFC3686], [RFC4106], [RFC4253], [RFC4279], [RFC4309], [RFC4494],
   [RFC4543], [RFC4868], [RFC5280], [RFC5652], [RFC5656], [RFC6187],
   [RFC6991], [RFC7919], [RFC8268], [RFC8332], [RFC8341], [RFC8422],
   [RFC8446], and [ITU.X690.2015].

   This module has an informational reference 08  . . . . . . . . . . . . . . . . . . . . . . . .  51
     A.10. 08 to [RFC2986], [RFC3174],
   [RFC4493], [RFC5915], [RFC6125], [RFC6234], [RFC6239], [RFC6507],
   [RFC8017], [RFC8032], [RFC8439].

   <CODE BEGINS> file "ietf-crypto-types@2019-10-18.yang"

   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:   <http://datatracker.ietf.org/wg/netconf/>
        WG List:  <mailto:netconf@ietf.org>
        Author:   Kent Watsen <mailto:kent+ietf@watsen.net>
        Author:   Wang Haiguang <wang.haiguang.shieldlab@huawei.com>";

     description
       "This module defines common YANG types for cryptographic
        applications.

        Copyright (c) 2019 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
        (https://trustee.ietf.org/license-info).

        This version of this YANG module is part of RFC XXXX
        (https://www.rfc-editor.org/info/rfcXXXX); 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 09  . . . . . . . . . . . . . . . . . . . . . . . .  51
     A.11. 09 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 2019-10-18 {
       description
         "Initial version";
       reference
         "RFC XXXX: Common YANG Data Types for Cryptography";
     }

     /**************************************/
     /*   Identities for Hash Algorithms   */
     /**************************************/

     typedef hash-algorithm-t {
       type union {
         type uint16;
         type enumeration {
           enum NONE {
             value 0;
             description
               "Hash algorithm is NULL.";
           }
           enum sha1 {
             value 1;
             status obsolete;
             description
               "The SHA1 algorithm.";
             reference
               "RFC 3174: US Secure Hash Algorithms 1 (SHA1).";
           }
           enum sha-224 {
             value 2;
             description
               "The SHA-224 algorithm.";
             reference
               "RFC 6234: US Secure Hash Algorithms.";
           }
           enum sha-256 {
             value 3;
             description
               "The SHA-256 algorithm.";
             reference
               "RFC 6234: US Secure Hash Algorithms.";
           }
           enum sha-384 {
             value 4;
             description
               "The SHA-384 algorithm.";
             reference
               "RFC 6234: US Secure Hash Algorithms.";
           }
           enum sha-512 {
             value 5;
             description
               "The SHA-512 algorithm.";
             reference
               "RFC 6234: US Secure Hash Algorithms.";
           }
           enum shake-128 {
             value 6;
             description
               "The SHA3 algorithm with 128-bits output.";
             reference
               "National Institute of Standards and Technology,
               SHA-3 Standard: Permutation-Based Hash and
               Extendable-Output Functions, FIPS PUB 202, DOI
               10.6028/NIST.FIPS.202, August 2015.";

           }
           enum shake-224 {
             value 7;
             description
               "The SHA3 algorithm with 224-bits output.";
             reference
               "National Institute of Standards and Technology,
               SHA-3 Standard: Permutation-Based Hash and
               Extendable-Output Functions, FIPS PUB 202, DOI
               10.6028/NIST.FIPS.202, August 2015.";
           }
           enum shake-256 {
             value 8;
             description
               "The SHA3 algorithm with 256-bits output.";
             reference
               "National Institute of Standards and Technology,
               SHA-3 Standard: Permutation-Based Hash and
               Extendable-Output Functions, FIPS PUB 202, DOI
               10.6028/NIST.FIPS.202, August 2015.";
           }
           enum shake-384 {
             value 9;
             description
               "The SHA3 algorithm with 384-bits output.";
             reference
               "National Institute of Standards and Technology,
               SHA-3 Standard: Permutation-Based Hash and
               Extendable-Output Functions, FIPS PUB 202, DOI
               10.6028/NIST.FIPS.202, August 2015.";
           }
           enum shake-512 {
             value 10;
             description
               "The SHA3 algorithm with 384-bits output.";
             reference
               "National Institute of Standards and Technology,
               SHA-3 Standard: Permutation-Based Hash and
               Extendable-Output Functions, FIPS PUB 202, DOI
               10.6028/NIST.FIPS.202, August 2015.";
           }
         }
       }
       default "0";
       description
         "The uint16 filed shall be set by individual protocol families
          according to the hash algorithm value assigned by IANA. The
          setting is optional and by default is 0.  The enumeration
          filed is set to the selected hash algorithm.";
     }

     /***********************************************/
     /*  Identities for Asymmetric Key Algorithms   */
     /***********************************************/

     typedef asymmetric-key-algorithm-t {
       type union {
         type uint16;
         type enumeration {
           enum NONE {
             value 0;
             description
               "Asymetric key algorithm is NULL.";
           }
           enum rsa1024 {
             value 1;
             description
               "The RSA algorithm using a 1024-bit key.";
             reference
               "RFC 8017: PKCS #1: RSA Cryptography
                Specifications Version 2.2.";
           }
           enum rsa2048 {
             value 2;
             description
               "The RSA algorithm using a 2048-bit key.";
             reference
               "RFC 8017:
                PKCS #1: RSA Cryptography Specifications Version 2.2.";
           }
           enum rsa3072 {
             value 3;
             description
               "The RSA algorithm using a 3072-bit key.";
             reference
               "RFC 8017:
                PKCS #1: RSA Cryptography Specifications Version 2.2.";
           }
           enum rsa4096 {
             value 4;
             description
               "The RSA algorithm using a 4096-bit key.";
             reference
               "RFC 8017:
                PKCS #1: RSA Cryptography Specifications Version 2.2.";
           }
           enum rsa7680 {
             value 5;
             description
               "The RSA algorithm using a 7680-bit key.";
             reference
               "RFC 8017:
                PKCS #1: RSA Cryptography Specifications Version 2.2.";
           }
           enum rsa15360 {
             value 6;
             description
               "The RSA algorithm using a 15360-bit key.";
             reference
               "RFC 8017:
                PKCS #1: RSA Cryptography Specifications Version 2.2.";
           }
           enum secp192r1 {
             value 7;
             description
               "The asymmetric algorithm using a NIST P192 Curve.";
             reference
               "RFC 6090:
                  Fundamental Elliptic Curve Cryptography Algorithms.
                RFC 5480:
                   Elliptic Curve Cryptography Subject Public Key
                   Information.";
           }
           enum secp224r1 {
             value 8;
             description
               "The asymmetric algorithm using a NIST P224 Curve.";
             reference
               "RFC 6090:
                  Fundamental Elliptic Curve Cryptography Algorithms.
                RFC 5480:
                  Elliptic Curve Cryptography Subject Public Key
                  Information.";
           }
           enum secp256r1 {
             value 9;
             description
               "The asymmetric algorithm using a NIST P256 Curve.";
             reference
               "RFC 6090:
                  Fundamental Elliptic Curve Cryptography Algorithms.
                RFC 5480:
                  Elliptic Curve Cryptography Subject Public Key
                  Information.";

           }
           enum secp384r1 {
             value 10;
             description
               "The asymmetric algorithm using a NIST P384 Curve.";
             reference
               "RFC 6090:
                  Fundamental Elliptic Curve Cryptography Algorithms.
                RFC 5480:
                  Elliptic Curve Cryptography Subject Public Key
                  Information.";
           }
           enum secp521r1 {
             value 11;
             description
               "The asymmetric algorithm using a NIST P521 Curve.";
             reference
               "RFC 6090:
                  Fundamental Elliptic Curve Cryptography Algorithms.
                RFC 5480:
                  Elliptic Curve Cryptography Subject Public Key
                  Information.";
           }
           enum x25519 {
             value 12;
             description
               "The asymmetric algorithm using a x.25519 Curve.";
             reference
               "RFC 7748:
                  Elliptic Curves for Security.";
           }
           enum x448 {
             value 13;
             description
               "The asymmetric algorithm using a x.448 Curve.";
             reference
               "RFC 7748:
                  Elliptic Curves for Security.";
           }
         }
       }
       default "0";
       description
         "The uint16 filed shall be set by individual protocol
          families according to the asymmetric key algorithm value
          assigned by IANA. The setting is optional and by default
          is 0.  The enumeration filed is set to the selected
          asymmetric key algorithm.";

     }

     /*************************************/
     /*   Identities for MAC Algorithms   */
     /*************************************/

     typedef mac-algorithm-t {
       type union {
         type uint16;
         type enumeration {
           enum NONE {
             value 0;
             description
               "mac algorithm is NULL.";
           }
           enum hmac-sha1 {
             value 1;
             description
               "Generating MAC using SHA1 hash function";
             reference
               "RFC 3174: US Secure Hash Algorithm 1 (SHA1)";
           }
           enum hmac-sha1-96 {
             value 2;
             description
               "Generating MAC using SHA1 hash function";
             reference
               "RFC 2404: The Use of HMAC-SHA-1-96 within ESP and AH";
           }
           enum hmac-sha2-224 {
             value 3;
             description
               "Generating MAC using SHA2 hash function";
             reference
               "RFC 6234: US Secure Hash Algorithms
                (SHA and SHA-based HMAC and HKDF)";
           }
           enum hmac-sha2-256 {
             value 4;
             description
               "Generating MAC using SHA2 hash function";
             reference
               "RFC 6234: US Secure Hash Algorithms
                (SHA and SHA-based HMAC and HKDF)";
           }
           enum hmac-sha2-256-128 {
             value 5;
             description
               "Generating a 256 bits MAC using SHA2 hash function and
                truncate it to 128 bits";
             reference
               "RFC 4868: Using HMAC-SHA-256, HMAC-SHA-384,
                and HMAC-SHA-512 with IPsec";
           }
           enum hmac-sha2-384 {
             value 6;
             description
               "Generating a 384 bits MAC using SHA2 hash function";
             reference
               "RFC 6234: US Secure Hash Algorithms
                (SHA and SHA-based HMAC and HKDF)";
           }
           enum hmac-sha2-384-192 {
             value 7;
             description
               "Generating a 384 bits MAC using SHA2 hash function and
                truncate it to 192 bits";
             reference
               "RFC 4868: Using HMAC-SHA-256, HMAC-SHA-384,
                and HMAC-SHA-512 with IPsec";
           }
           enum hmac-sha2-512 {
             value 8;
             description
               "Generating a 512 bits MAC using SHA2 hash function";
             reference
               "RFC 6234: US Secure Hash Algorithms
                (SHA and SHA-based HMAC and HKDF)";
           }
           enum hmac-sha2-512-256 {
             value 9;
             description
               "Generating a 512 bits MAC using SHA2 hash function and
                truncate it to 256 bits";
             reference
               "RFC 4868: Using HMAC-SHA-256, HMAC-SHA-384,
                and HMAC-SHA-512 with IPsec";
           }
           enum aes-128-gmac {
             value 10;
             description
               "Generating 128-bit MAC using the Advanced Encryption
                Standard (AES) Galois Message Authentication Code
                (GMAC) as a mechanism to provide data origin
                authentication.";
             reference
               "RFC 4543:
                  The Use of Galois Message Authentication Code (GMAC)
                  in IPsec ESP and AH";
           }
           enum aes-192-gmac {
             value 11;
             description
               "Generating 192-bit MAC using the Advanced Encryption
                Standard (AES) Galois Message Authentication Code
                (GMAC) as a mechanism to provide data origin
                authentication.";
             reference
               "RFC 4543:
                  The Use of Galois Message Authentication Code (GMAC)
                  in IPsec ESP and AH";
           }
           enum aes-256-gmac {
             value 12;
             description
               "Generating 256-bit MAC using the Advanced Encryption
                Standard (AES) Galois Message Authentication Code
                (GMAC) as a mechanism to provide data origin
                authentication.";
             reference
               "RFC 4543:
                  The Use of Galois Message Authentication Code (GMAC)
                  in IPsec ESP and AH";
           }
           enum aes-cmac-96 {
             value 13;
             description
               "Generating 96-bit MAC using Advanced Encryption
                Standard (AES) Cipher-based Message Authentication
                Code (CMAC)";
             reference
               "RFC 4494:
                  The AES-CMAC Algorithm and its Use with IPsec";
           }
           enum aes-cmac-128 {
             value 14;
             description
               "Generating 128-bit MAC using Advanced Encryption
                Standard (AES) Cipher-based Message Authentication
                Code (CMAC)";
             reference
               "RFC 4494:
                  The AES-CMAC Algorithm and its Use with IPsec";
           }
           enum sha1-des3-kd {
             value 15;
             description
               "Generating MAC using triple DES encryption function";
             reference
               "RFC 3961:
                  Encryption and Checksum Specifications for Kerberos
                  5";
           }
         }
       }
       default "0";
       description
         "The uint16 filed shall be set by individual protocol
          families according to the mac algorithm value assigned by
          IANA. The setting is optional and by default is 0.  The
          enumeration filed is set to the selected mac algorithm.";
     }

     /********************************************/
     /*   Identities for Encryption Algorithms   */
     /********************************************/

     typedef encryption-algorithm-t {
       type union {
         type uint16;
         type enumeration {
           enum NONE {
             value 0;
             description
               "Encryption algorithm is NULL.";
           }
           enum aes-128-cbc {
             value 1;
             description
               "Encrypt message with AES algorithm in CBC mode with
                a key length of 128 bits.";
             reference
               "RFC 3565: Use of the Advanced Encryption Standard (AES)
                Encryption Algorithm in Cryptographic Message Syntax
                (CMS)";
           }
           enum aes-192-cbc {
             value 2;
             description
               "Encrypt message with AES algorithm in CBC mode with
                a key length of 192 bits";
             reference
               "RFC 3565: Use of the Advanced Encryption Standard (AES)
                Encryption Algorithm in Cryptographic Message Syntax
                (CMS)";
           }
           enum aes-256-cbc {
             value 3;
             description
               "Encrypt message with AES algorithm in CBC mode with
                a key length of 256 bits";
             reference
               "RFC 3565: Use of the Advanced Encryption Standard (AES)
                Encryption Algorithm in Cryptographic Message Syntax
                (CMS)";
           }
           enum aes-128-ctr {
             value 4;
             description
               "Encrypt message with AES algorithm in CTR mode with
                a key length of 128 bits";
             reference
               "RFC 3686:
                  Using Advanced Encryption Standard (AES) Counter
                  Mode with IPsec Encapsulating Security Payload
                  (ESP)";
           }
           enum aes-192-ctr {
             value 5;
             description
               "Encrypt message with AES algorithm in CTR mode with
                a key length of 192 bits";
             reference
               "RFC 3686:
                  Using Advanced Encryption Standard (AES) Counter
                  Mode with IPsec Encapsulating Security Payload
                  (ESP)";
           }
           enum aes-256-ctr {
             value 6;
             description
               "Encrypt message with AES algorithm in CTR mode with
                a key length of 256 bits";
             reference
               "RFC 3686:
                  Using Advanced Encryption Standard (AES) Counter
                  Mode with IPsec Encapsulating Security Payload
                  (ESP)";
           }
           enum des3-cbc-sha1-kd {
             value 7;
             description
               "Encrypt message with 3DES algorithm in CBC mode
                with sha1 function for key derivation";
             reference
               "RFC 3961:
                  Encryption and Checksum Specifications for
                  Kerberos 5";
           }
           enum rc4-hmac {
             value 8;
             description
               "Encrypt message with rc4 algorithm";
             reference
               "RFC 4757:
                  The RC4-HMAC Kerberos Encryption Types Used by
                  Microsoft Windows";
           }
           enum rc4-hmac-exp {
             value 9;
             description
               "Encrypt message with rc4 algorithm that is exportable";
             reference
               "RFC 4757:
                  The RC4-HMAC Kerberos Encryption Types Used by
                  Microsoft Windows";
           }
         }
       }
       default "0";
       description
         "The uint16 filed shall be set by individual protocol
          families according to the encryption algorithm value
          assigned by IANA. The setting is optional and by default
          is 0.  The enumeration filed is set to the selected
          encryption algorithm.";
     }

     /****************************************************/
     /*   Identities for Encryption and MAC Algorithms   */
     /****************************************************/

     typedef encryption-and-mac-algorithm-t {
       type union {
         type uint16;
         type enumeration {
           enum NONE {
             value 0;
             description
               "Encryption and MAC algorithm is NULL.";
             reference
               "None";
           }
           enum aes-128-ccm {
             value 1;
             description
               "Encrypt message with AES algorithm in CCM
                mode with a key length of 128 bits; it can
                also be used for generating MAC";
             reference
               "RFC 4309: Using Advanced Encryption Standard
                (AES) CCM Mode with IPsec Encapsulating Security
                Payload (ESP)";
           }
           enum aes-192-ccm {
             value 2;
             description
               "Encrypt message with AES algorithm in CCM
                mode with a key length of 192 bits; it can
                also be used for generating MAC";
             reference
               "RFC 4309: Using Advanced Encryption Standard
                (AES) CCM Mode with IPsec Encapsulating Security
                Payload (ESP)";
           }
           enum aes-256-ccm {
             value 3;
             description
               "Encrypt message with AES algorithm in CCM
                mode with a key length of 256 bits; it can
                also be used for generating MAC";
             reference
               "RFC 4309: Using Advanced Encryption Standard
                (AES) CCM Mode with IPsec Encapsulating Security
                Payload (ESP)";
           }
           enum aes-128-gcm {
             value 4;
             description
               "Encrypt message with AES algorithm in GCM
                mode with a key length of 128 bits; it can
                also be used for generating MAC";
             reference
               "RFC 4106: The Use of Galois/Counter Mode (GCM)
                in IPsec Encapsulating Security Payload (ESP)";
           }
           enum aes-192-gcm {
             value 5;
             description
               "Encrypt message with AES algorithm in GCM
                mode with a key length of 192 bits; it can
                also be used for generating MAC";
             reference
               "RFC 4106: The Use of Galois/Counter Mode (GCM)
                in IPsec Encapsulating Security Payload (ESP)";
           }
           enum aes-256-gcm {
             value 6;
             description
               "Encrypt message with AES algorithm in GCM
                mode with a key length of 256 bits; it can
                also be used for generating MAC";
             reference
               "RFC 4106: The Use of Galois/Counter Mode (GCM)
                in IPsec Encapsulating Security Payload (ESP)";
           }
           enum chacha20-poly1305 {
             value 7;
             description
               "Encrypt message with chacha20 algorithm and generate
                MAC with POLY1305; it can also be used for generating
                MAC";
             reference
               "RFC 8439: ChaCha20 and Poly1305 for IETF Protocols";
           }
         }
       }
       default "0";
       description
         "The uint16 filed shall be set by individual protocol
          families according to the encryption and mac algorithm value
          assigned by IANA. The setting is optional and by default is
          0.  The enumeration filed is set to the selected encryption
          and mac algorithm.";
     }

     /******************************************/
     /*   Identities for signature algorithm   */
     /******************************************/

     typedef signature-algorithm-t {
       type union {
         type uint16;
         type enumeration {
           enum NONE {
             value 0;
             description
               "Signature algorithm is NULL";
           }
           enum dsa-sha1 {
             value 1;
             description
               "The signature algorithm using DSA algorithm with SHA1
                hash algorithm";
             reference
               "RFC 4253:
                  The Secure Shell (SSH) Transport Layer Protocol";
           }
           enum rsassa-pkcs1-sha1 {
             value 2;
             description
               "The signature algorithm using RSASSA-PKCS1-v1_5 with
                the SHA1 hash algorithm.";
             reference
               "RFC 4253:
                  The Secure Shell (SSH) Transport Layer Protocol";
           }
           enum rsassa-pkcs1-sha256 {
             value 3;
             description
               "The signature algorithm using RSASSA-PKCS1-v1_5 with
                the SHA256 hash algorithm.";
             reference
               "RFC 8332:
                  Use of RSA Keys with SHA-256 and SHA-512 in the
                  Secure Shell (SSH) Protocol
                RFC 8446:
                  The Transport Layer Security (TLS) Protocol
                  Version 1.3";
           }
           enum rsassa-pkcs1-sha384 {
             value 4;
             description
               "The signature algorithm using RSASSA-PKCS1-v1_5 with
                the SHA384 hash algorithm.";
             reference
               "RFC 8446:
                  The Transport Layer Security (TLS) Protocol
                  Version 1.3";
           }
           enum rsassa-pkcs1-sha512 {
             value 5;
             description
               "The signature algorithm using RSASSA-PKCS1-v1_5 with
                the SHA512 hash algorithm.";
             reference
               "RFC 8332:
                  Use of RSA Keys with SHA-256 and SHA-512 in the
                  Secure Shell (SSH) Protocol
                RFC 8446:
                  The Transport Layer Security (TLS) Protocol
                  Version 1.3";
           }
           enum rsassa-pss-rsae-sha256 {
             value 6;
             description
               "The signature algorithm using RSASSA-PSS with mask
                generation function 1 and SHA256 hash algorithm. If
                the public key is carried in an X.509 certificate,
                it MUST use the rsaEncryption OID";
             reference
               "RFC 8446:
                  The Transport Layer Security (TLS) Protocol
                  Version 1.3";
           }
           enum rsassa-pss-rsae-sha384 {
             value 7;
             description
               "The signature algorithm using RSASSA-PSS with mask
                generation function 1 and SHA384 hash algorithm. If
                the public key is carried in an X.509 certificate,
                it MUST use the rsaEncryption OID";
             reference
               "RFC 8446:
                  The Transport Layer Security (TLS) Protocol
                  Version 1.3";
           }
           enum rsassa-pss-rsae-sha512 {
             value 8;
             description
               "The signature algorithm using RSASSA-PSS with mask
                generation function 1 and SHA512 hash algorithm. If
                the public key is carried in an X.509 certificate,
                it MUST use the rsaEncryption OID";
             reference
               "RFC 8446:
                  The Transport Layer Security (TLS) Protocol
                  Version 1.3";
           }
           enum rsassa-pss-pss-sha256 {
             value 9;
             description
               "The signature algorithm using RSASSA-PSS with mask
                generation function 1 and SHA256 hash algorithm. If
                the public key is carried in an X.509 certificate,
                it MUST use the rsaEncryption OID";
             reference
               "RFC 8446:
                  The Transport Layer Security (TLS) Protocol
                  Version 1.3";
           }
           enum rsassa-pss-pss-sha384 {
             value 10;
             description
               "The signature algorithm using RSASSA-PSS with mask
                generation function 1 and SHA384 hash algorithm. If
                the public key is carried in an X.509 certificate,
                it MUST use the rsaEncryption OID";
             reference
               "RFC 8446:
                  The Transport Layer Security (TLS) Protocol
                  Version 1.3";
           }
           enum rsassa-pss-pss-sha512 {
             value 11;
             description
               "The signature algorithm using RSASSA-PSS with mask
                generation function 1 and SHA512 hash algorithm. If
                the public key is carried in an X.509 certificate,
                it MUST use the rsaEncryption OID";
             reference
               "RFC 8446:
                  The Transport Layer Security (TLS) Protocol
                  Version 1.3";
           }
           enum ecdsa-secp256r1-sha256 {
             value 12;
             description
               "The signature algorithm using ECDSA with curve name
                secp256r1 and SHA256 hash algorithm.";
             reference
               "RFC 5656:
                  Elliptic Curve Algorithm Integration in the Secure
                  Shell Transport Layer
                RFC 8446:
                  The Transport Layer Security (TLS) Protocol
                  Version 1.3";
           }
           enum ecdsa-secp384r1-sha384 {
             value 13;
             description
               "The signature algorithm using ECDSA with curve name
                secp384r1 and SHA384 hash algorithm.";
             reference
               "RFC 5656:
                  Elliptic Curve Algorithm Integration in the Secure
                  Shell Transport Layer
                RFC 8446: 10  . . . . . . . . . . . . . . . . . . . . . . . .  51
     A.12. 10 to 11  . . . . . . . . . . . . . . . . . . . . . . . .  52
     A.13. 11 to 12  . . . . . . . . . . . . . . . . . . . . . . . .  52
   Acknowledgements  . . . . . . . . . . . . . . . . . . . . . . . .  52
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .  52

1.  Introduction

   This document defines four YANG 1.1 [RFC7950] modules for types
   useful to cryptographic applications.  The Transport Layer Security (TLS) Protocol
                  Version 1.3";
           }
           enum ecdsa-secp521r1-sha512 {
             value 14;
             description
               "The signature algorithm using ECDSA with curve name
                secp521r1 and SHA512 hash algorithm.";
             reference
               "RFC 5656:
                  Elliptic Curve Algorithm Integration in the Secure
                  Shell Transport Layer
                RFC 8446: modules defined include:

   o  ietf-crypto-types

   o  iana-symmetric-algs

   o  iana-asymmetric-algs

   o  iana-hash-algs

   The Transport Layer Security (TLS) Protocol
                  Version 1.3";
           }
           enum ed25519 {
             value 15;
             description
               "The signature algorithm using EdDSA with curve x25519";
             reference
               "RFC 8032:
                  Edwards-Curve Digital Signature Algorithm (EdDSA)";
           }
           enum ed25519-cts {
             value 16;
             description
               "The signature algorithm using EdDSA with curve x25519
                with phflag = 0";
             reference
               "RFC 8032:
                  Edwards-Curve Digital Signature Algorithm (EdDSA)";
           }
           enum ed25519-ph {
             value 17;
             description
               "The signature algorithm using EdDSA with curve x25519
                with phflag = 1";

             reference
               "RFC 8032:
                  Edwards-Curve Digital Signature Algorithm (EdDSA)";
           }
           enum ed25519-sha512 {
             value 18;
             description
               "The signature algorithm using EdDSA with curve x25519 key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and SHA-512 function";
             reference
               "RFC 8419:
                  Use of Edwards-Curve Digital Signature Algorithm
                  (EdDSA) Signatures
   "OPTIONAL" in this document are to be interpreted as described in BCP
   14 [RFC2119] [RFC8174] when, and only when, they appear in all
   capitals, as shown here.

2.  The Crypto Types Module

2.1.  Tree Diagram

   This section provides a tree diagram [RFC8340] for the Cryptographic Message
                  Syntax (CMS)";
           }
           enum ed448 {
             value 19;
             description
               "The signature "ietf-crypto-
   types" module.  Only "grouping" statements are represented, as tree
   diagrams have no means to represent identities or typedefs.

   module: ietf-crypto-types

     grouping symmetric-key-grouping
       +-- algorithm using EdDSA with curve x448";
             reference
               "RFC 8032:
                  Edwards-Curve Digital Signature Algorithm (EdDSA)";
           }
           enum ed448-ph {
             value 20;
             description
               "The signature           isa:symmetric-algorithm-type
       +-- key-format?         identityref
       +-- (key-type)
          +--:(key)
          |  +-- key?          binary
          +--:(hidden-key)
             +-- hidden-key?   empty
     grouping public-key-grouping
       +-- algorithm            iasa:asymmetric-algorithm-type
       +-- public-key-format?   identityref
       +-- public-key           binary
     grouping asymmetric-key-pair-grouping
       +-- algorithm                   iasa:asymmetric-algorithm-type
       +-- public-key-format?          identityref
       +-- public-key                  binary
       +-- private-key-format?         identityref
       +-- (private-key-type)
          +--:(private-key)
          |  +-- private-key?          binary
          +--:(hidden-private-key)
             +-- hidden-private-key?   empty
     grouping trust-anchor-cert-grouping
       +-- cert?                     trust-anchor-cert-cms
       +---n certificate-expiration
          +-- expiration-date    yang:date-and-time
     grouping trust-anchor-certs-grouping
       +-- cert*                     trust-anchor-cert-cms
       +---n certificate-expiration
          +-- expiration-date    yang:date-and-time
     grouping end-entity-cert-grouping
       +-- cert?                     end-entity-cert-cms
       +---n certificate-expiration
          +-- expiration-date    yang:date-and-time
     grouping end-entity-certs-grouping
       +-- cert*                     end-entity-cert-cms
       +---n certificate-expiration
          +-- expiration-date    yang:date-and-time

     grouping asymmetric-key-pair-with-cert-grouping
       +-- algorithm
       |       iasa:asymmetric-algorithm-type
       +-- public-key-format?                      identityref
       +-- public-key                              binary
       +-- private-key-format?                     identityref
       +-- (private-key-type)
       |  +--:(private-key)
       |  |  +-- private-key?                      binary
       |  +--:(hidden-private-key)
       |     +-- hidden-private-key?               empty
       +-- cert?                                   end-entity-cert-cms
       +---n certificate-expiration
       |  +-- expiration-date    yang:date-and-time
       +---x generate-certificate-signing-request
          +---w input
          |  +---w subject       binary
          |  +---w attributes?   binary
          +--ro output
             +--ro certificate-signing-request    binary
     grouping asymmetric-key-pair-with-certs-grouping
       +-- algorithm using EdDSA with curve x448
                and with PH being SHAKE256(x, 64)
       |       iasa:asymmetric-algorithm-type
       +-- public-key-format?                      identityref
       +-- public-key                              binary
       +-- private-key-format?                     identityref
       +-- (private-key-type)
       |  +--:(private-key)
       |  |  +-- private-key?                      binary
       |  +--:(hidden-private-key)
       |     +-- hidden-private-key?               empty
       +-- certificates
       |  +-- certificate* [name]
       |     +-- name?                     string
       |     +-- cert?                     end-entity-cert-cms
       |     +---n certificate-expiration
       |        +-- expiration-date    yang:date-and-time
       +---x generate-certificate-signing-request
          +---w input
          |  +---w subject       binary
          |  +---w attributes?   binary
          +--ro output
             +--ro certificate-signing-request    binary

2.2.  YANG Module

   This module has normative references to [RFC2404], [RFC3565],
   [RFC3686], [RFC4106], [RFC4253], [RFC4279], [RFC4309], [RFC4494],
   [RFC4543], [RFC4868], [RFC5280], [RFC5652], [RFC5656], [RFC6187],
   [RFC6991], [RFC7919], [RFC8268], [RFC8332], [RFC8341], [RFC8422],
   [RFC8446], and phflag being 1"; [ITU.X690.2015].

   This module has an informational reference
               "RFC 8032:
                  Edwards-Curve Digital Signature Algorithm (EdDSA)";
           }
           enum ed448-shake256 to [RFC2986], [RFC3174],
   [RFC4493], [RFC5915], [RFC6125], [RFC6234], [RFC6239], [RFC6507],
   [RFC8017], [RFC8032], [RFC8439].

   <CODE BEGINS> file "ietf-crypto-types@2019-11-02.yang"

   module ietf-crypto-types {
             value 21;
             description
               "The signature algorithm using EdDSA with curve x448
               and SHAKE-256 function";
     yang-version 1.1;
     namespace "urn:ietf:params:xml:ns:yang:ietf-crypto-types";
     prefix ct;

     import ietf-yang-types {
       prefix yang;
       reference
         "RFC 8419:
                  Use of Edwards-Curve Digital Signature Algorithm
                  (EdDSA) Signatures in the Cryptographic Message
                  Syntax (CMS)"; 6991: Common YANG Data Types";
     }
           enum ed448-shake256-len

     import ietf-netconf-acm {
             value 22;
             description
               "The signature algorithm using EdDSA with curve x448
               and SHAKE-256 function and a customized hash output";
       prefix nacm;
       reference
         "RFC 8419:
                  Use of Edwards-Curve Digital Signature Algorithm
                  (EdDSA) Signatures in the Cryptographic Message
                  Syntax (CMS)"; 8341: Network Configuration Access Control Model";
     }
           enum rsa-sha2-256

     //import iana-hash-algs {
             value 23;
             description
               "The signature algorithm using RSA with SHA2 function
                for SSH protocol";
     //  prefix iha;
     //  reference
     //    "RFC 8332:
                Use of RSA Keys with SHA-256 and SHA-512
                in the Secure Shell (SSH) Protocol";
           }
           enum rsa-sha2-512 {
             value 24;
             description
               "The signature algorithm using RSA with SHA2 function XXXX: Common YANG Data Types for SSH protocol"; Cryptography";
     //}

     import iana-symmetric-algs {
       prefix isa;
       reference
         "RFC 8332:
                Use of RSA Keys with SHA-256 and SHA-512
                in the Secure Shell (SSH) Protocol"; XXXX: Common YANG Data Types for Cryptography";
     }
           enum eccsi

     import iana-asymmetric-algs {
             value 25;
             description
               "The signature algorithm using ECCSI signature as
                defined in RFC 6507.";
       prefix iasa;
       reference
         "RFC 6507:
                  Elliptic Curve-Based Certificateless Signatures XXXX: Common YANG Data Types for Identity-based Encryption (ECCSI)";
           }
         } Cryptography";
     }
       default "0";
     organization
       "IETF NETCONF (Network Configuration) Working Group";

     contact
       "WG Web:   <http://datatracker.ietf.org/wg/netconf/>
        WG List:  <mailto:netconf@ietf.org>
        Author:   Kent Watsen <mailto:kent+ietf@watsen.net>
        Author:   Wang Haiguang <wang.haiguang.shieldlab@huawei.com>";

     description
         "The uint16 filed shall be set by individual protocol
          families according to
       "This module defines common YANG types for cryptographic
        applications.

        Copyright (c) 2019 IETF Trust and the signature algorithm value
          assigned by IANA. The setting is optional persons identified
        as authors of the code. All rights reserved.

        Redistribution and by default
          is 0.  The enumeration filed 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
        (https://trustee.ietf.org/license-info).

        This version of this YANG module is part of RFC XXXX
        (https://www.rfc-editor.org/info/rfcXXXX); see the selected
          signature algorithm."; 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 2019-11-02 {
       description
         "Initial version";
       reference
         "RFC XXXX: Common YANG Data Types for Cryptography";
     }

     /**********************************************/

     /********************************************/
     /*   Identities for key exchange algorithms   */
     /**********************************************/

     typedef key-exchange-algorithm-t {
       type union {
         type uint16;
         type enumeration {
           enum NONE Key Format Structures   */
     /********************************************/

     /*** all key format types ****/

     identity key-format-base {
             value 0;
       description
               "Key exchange algorithm is NULL."; "Base key-format identity for all keys.";
     }
           enum psk-only

     identity public-key-format {
             value 1;
       base "key-format-base";
       description
               "Using Pre-shared key for authentication and key
                exchange";
             reference
               "RFC 4279:
                  Pre-Shared Key cipher suites "Base key-format identity for Transport Layer
                  Security (TLS)"; public keys.";
     }
           enum dhe-ffdhe2048

     identity private-key-format {
             value 2;
       base "key-format-base";
       description
               "Ephemeral Diffie Hellman key exchange with 2048 bit
                finite field";
             reference
               "RFC 7919:
                  Negotiated Finite Field Diffie-Hellman Ephemeral
                  Parameters "Base key-format identity for Transport Layer Security (TLS)"; private keys.";
     }
           enum dhe-ffdhe3072

     identity symmetric-key-format {
             value 3;
       base "key-format-base";
       description
               "Ephemeral Diffie Hellman key exchange with 3072 bit
                finite field";
             reference
               "RFC 7919:
                  Negotiated Finite Field Diffie-Hellman Ephemeral
                  Parameters "Base key-format identity for Transport Layer Security (TLS)"; symmetric keys.";
     }
           enum dhe-ffdhe4096

     /**** for private keys ****/

     identity rsa-private-key-format {
             value 4;
         base "private-key-format";
         description
               "Ephemeral Diffie Hellman key exchange with 4096 bit
                finite field";
             reference
               "RFC 7919:
                  Negotiated Finite Field Diffie-Hellman Ephemeral
                  Parameters for Transport Layer Security (TLS)"; "An RSAPrivateKey (from RFC 3447).";
     }
           enum dhe-ffdhe6144

     identity ec-private-key-format {
             value 5;
         base "private-key-format";
         description
               "Ephemeral Diffie Hellman key exchange with 6144 bit
                finite field";
             reference
               "RFC 7919:
                  Negotiated Finite Field Diffie-Hellman Ephemeral
                  Parameters for Transport Layer Security (TLS)"; "An ECPrivateKey (from RFC 5915)";
     }
           enum dhe-ffdhe8192

     identity one-asymmetric-key-format {
             value 6;
         base "private-key-format";
         description
               "Ephemeral Diffie Hellman key exchange with 8192 bit
                finite field";
             reference
               "RFC 7919:
                  Negotiated Finite Field Diffie-Hellman Ephemeral
                  Parameters for Transport Layer Security (TLS)"; "A OneAsymmetricKey (from RFC 5958).";
     }
           enum psk-dhe-ffdhe2048

     identity encrypted-private-key-format {
             value 7;
         base "private-key-format";
         description
               "Key exchange using pre-shared key with Diffie-Hellman
                key generation mechanism, where the DH group is
                FFDHE2048";
             reference
               "RFC 8446:
                  The Transport Layer Security (TLS) Protocol
                  Version 1.3";
           "A CMS EncryptedData structure (RFC 5652)
            containing a OneAsymmetricKey (RFC 5958).";
      }
           enum psk-dhe-ffdhe3072

     /**** for public keys ****/

     identity ssh-public-key-format {
             value 8;
         base "public-key-format";
         description
               "Key exchange using pre-shared key with Diffie-Hellman
           "The public key generation mechanism, where the DH group is
                FFDHE3072";
             reference
               "RFC 8446:
                  The Transport Layer Security (TLS) Protocol
                  Version 1.3"; format described by RFC 4716.";
     }
           enum psk-dhe-ffdhe4096

     identity subject-public-key-info-format {
             value 9;
         base "public-key-format";
         description
               "Key exchange using pre-shared key with Diffie-Hellman
                key generation mechanism, where the DH group is
                FFDHE4096";
             reference
               "RFC 8446:
                  The Transport Layer Security (TLS) Protocol
                  Version 1.3";
           "A SubjectPublicKeyInfo (from RFC 5280).";
     }
           enum psk-dhe-ffdhe6144

     /**** for symmetric keys ****/

     identity octet-string-key-format {
             value 10;
         base "symmetric-key-format";
         description
               "Key exchange using pre-shared key with Diffie-Hellman
                key generation mechanism, where the DH group "An OctetString from ASN.1.";
           /*
           // Knowing that it is
                FFDHE6144";
             reference
               "RFC 8446:
                  The Transport Layer Security (TLS) Protocol
                  Version 1.3"; an "OctetString" isn't really helpful.
           // Knowing the length of the octet string would be helpful,
           // as it relates to the algorithm's block size.  We may want
           // to only (for now) use "one-symmetric-key-format" for
           // symmetric keys...were the usability issues Juergen
           // mentioned before only apply to asymmetric keys?
           */
     }
           enum psk-dhe-ffdhe8192

     identity one-symmetric-key-format {
             value 11;
         base "symmetric-key-format";
         description
               "Key exchange using pre-shared key with Diffie-Hellman
                key generation mechanism, where the DH group is
                FFDHE8192";
             reference
               "RFC 8446:
                  The Transport Layer Security (TLS) Protocol
                  Version 1.3"; "A OneSymmetricKey (from RFC6031).";
     }
           enum ecdhe-secp256r1

     identity encrypted-symmetric-key-format {
             value 12;
         base "symmetric-key-format";
         description
               "Ephemeral Diffie Hellman key exchange with elliptic
                group over curve secp256r1";
           "A CMS EncryptedData structure (RFC 5652)
            containing a OneSymmetricKey (RFC 6031).";
     }

     /***************************************************/
     /*   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 8422:
                  Elliptic Curve Cryptography (ECC) Cipher Suites
                  for Transport Layer Security (TLS) Versions 1.2 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 Earlier"; Distinguished
            Encoding Rules (DER).";
     }
           enum ecdhe-secp384r1

     typedef crl {
             value 13;
       type binary;
       description
               "Ephemeral Diffie Hellman key exchange with elliptic
                group over curve secp384r1";
         "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 8422:
                  Elliptic Curve Cryptography (ECC) Cipher Suites
                  for Transport Layer Security (TLS) Versions 1.2 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 Earlier"; Distinguished
            Encoding Rules (DER).";
     }
           enum ecdhe-secp521r1

     /***********************************************/
     /*   Typedefs for ASN.1 structures from 5652   */
     /***********************************************/

     typedef cms {
             value 14;
       type binary;
       description
               "Ephemeral Diffie Hellman key exchange with elliptic
                group over curve secp521r1";
         "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 8422:
                  Elliptic Curve Cryptography (ECC) Cipher Suites
                  for Transport Layer Security (TLS) Versions 1.2 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 Earlier"; Distinguished
            Encoding Rules (DER).";

     }
           enum ecdhe-x25519

     typedef data-content-cms {
             value 15;
       type cms;
       description
               "Ephemeral Diffie Hellman key exchange with elliptic
                group over curve x25519";
         "A CMS structure whose top-most content type MUST be the
          data content type, as described by Section 4 in RFC 5652.";
       reference
         "RFC 8422:
                  Elliptic Curve Cryptography (ECC) Cipher Suites
                  for Transport Layer Security (TLS) Versions 1.2
                  and Earlier"; 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)";
     }
           enum ecdhe-x448

     typedef enveloped-data-cms {
             value 16;
       type cms;
       description
               "Ephemeral Diffie Hellman key exchange with elliptic
                group over curve x448";
         "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 8422:
                  Elliptic Curve Cryptography (ECC) Cipher Suites
                  for Transport Layer Security (TLS) Versions 1.2
                  and Earlier"; 5652: Cryptographic Message Syntax (CMS)";
     }
           enum psk-ecdhe-secp256r1

     typedef digested-data-cms {
             value 17;
       type cms;
       description
               "Key exchange using pre-shared key with elliptic
                group-based Ephemeral Diffie Hellman key exchange
                over curve secp256r1";
         "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 8446:
                  The Transport Layer Security (TLS) Protocol
                  Version 1.3"; 5652: Cryptographic Message Syntax (CMS)";
     }
           enum psk-ecdhe-secp384r1

     typedef encrypted-data-cms {
             value 18;
       type cms;
       description
               "Key exchange using pre-shared key with elliptic
                group-based Ephemeral Diffie Hellman key exchange
                over curve secp384r1";
         "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 8446:
                  The Transport Layer Security (TLS) Protocol
                  Version 1.3"; 5652: Cryptographic Message Syntax (CMS)";
     }
           enum psk-ecdhe-secp521r1

     typedef authenticated-data-cms {
             value 19;
       type cms;
       description
               "Key exchange using pre-shared key with elliptic
                group-based Ephemeral Diffie Hellman key exchange
                over curve secp521r1";
         "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 8446:
                  The Transport Layer Security (TLS) Protocol
                  Version 1.3"; 5652: Cryptographic Message Syntax (CMS)";
     }
           enum psk-ecdhe-x25519

     /***************************************************/
     /*   Typedefs for structures related to !!FIXME!!  */
     /***************************************************/

     typedef psk {
             value 20;
       type binary;
       description
               "Key exchange using pre-shared key with elliptic
                group-based Ephemeral Diffie Hellman
         "The binary key exchange
                over curve x25519";
             reference
               "RFC 8446:
                  The Transport Layer Security (TLS) Protocol
                  Version 1.3"; data for a PSK (pairwise-symmetric or
          pre-shared key).  FIXME: specify how it is formmated.";
     }
           enum psk-ecdhe-x448

     typedef raw-public-key {
             value 21;
       type binary;
       description
               "Key exchange using pre-shared key with elliptic
                group-based Ephemeral Diffie Hellman
         "The binary key exchange
                over curve x448";
             reference
               "RFC 8446:
                  The Transport Layer Security (TLS) Protocol
                  Version 1.3"; data for a raw public key.
          FIXME: specify how it is formmated.";
     }
           enum diffie-hellman-group14-sha1

     /***************************************************/
     /*   Typedefs for structures related to RFC 4253   */
     /***************************************************/

     typedef ssh-host-key {
             value 22;
       type binary;
       description
               "Using DH group14 and SHA1
         "The binary public key data for an SSH key, as
          specified by RFC 4253, Section 6.6, i.e.:

            string    certificate or public key exchange"; format
                      identifier
            byte[n]   key/certificate data.";
       reference
         "RFC 4253: The Secure Shell (SSH) Transport Layer
                    Protocol";
     }
           enum diffie-hellman-group14-sha256
     /*********************************************************/
     /*   Typedefs for ASN.1 structures related to RFC 5280   */
     /*********************************************************/

     typedef trust-anchor-cert-x509 {
             value 23;
       type x509;
       description
               "Using DH group14 and SHA-256 for key exchange";
             reference
               "RFC 8268:
                 More Modular Exponentiation (MODP) Diffie-Hellman (DH)
                 Key Exchange (KEX) Groups for Secure Shell (SSH)";
         "A Certificate structure that MUST encode a self-signed
          root certificate.";
     }
           enum diffie-hellman-group15-sha512

     typedef end-entity-cert-x509 {
             value 24;
       type x509;
       description
               "Using DH group15 and SHA-512 for key exchange";
             reference
               "RFC 8268:
                 More Modular Exponentiation (MODP) Diffie-Hellman (DH)
                 Key Exchange (KEX) Groups for Secure Shell (SSH)";
         "A Certificate structure that MUST encode a certificate
          that is neither self-signed nor having Basic constraint
          CA true.";
     }
           enum diffie-hellman-group16-sha512

     /*********************************************************/
     /*   Typedefs for ASN.1 structures related to RFC 5652   */
     /*********************************************************/

     typedef trust-anchor-cert-cms {
             value 25;
       type signed-data-cms;
       description
               "Using DH group16
         "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 SHA-512 for key exchange"; revocation objects (RFC 5280).";
       reference
         "RFC 8268:
                 More Modular Exponentiation (MODP) Diffie-Hellman (DH) 5280:
            Internet X.509 Public Key Exchange (KEX) Groups for Secure Shell (SSH)";
           }
           enum diffie-hellman-group17-sha512 {
             value 26;
             description
               "Using DH group17 Infrastructure Certificate
            and SHA-512 for key exchange";
             reference
               "RFC 8268:
                 More Modular Exponentiation (MODP) Diffie-Hellman (DH)
                 Key Exchange (KEX) Groups for Secure Shell (SSH)"; Certificate Revocation List (CRL) Profile.";
     }
           enum diffie-hellman-group18-sha512

     typedef end-entity-cert-cms {
             value 27;
       type signed-data-cms;
       description
               "Using DH group18
         "A CMS SignedData structure that MUST contain the end
          entity certificate itself, and SHA-512 for key exchange";
             reference
               "RFC 8268:
                 More Modular Exponentiation (MODP) Diffie-Hellman (DH)
                 Key Exchange (KEX) Groups for Secure Shell (SSH)";
           }
           enum ecdh-sha2-secp256r1 {
             value 28;
             description
               "Elliptic curve-based Diffie Hellman key exchange over
                curve ecp256r1 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 using SHA2 for MAC generation"; revocation objects (RFC 5280).";
       reference
         "RFC 6239:
                  Suite B Cryptographic Suites for Secure Shell (SSH)"; 5280:
            Internet X.509 Public Key Infrastructure Certificate
            and Certificate Revocation List (CRL) Profile.";
     }
           enum ecdh-sha2-secp384r1

     typedef ssh-public-key-type {
             value 29;  // DELETE?
        type binary;
        description
               "Elliptic curve-based Diffie Hellman
          "The binary public key exchange over
                curve ecp384r1 and using SHA2 data for MAC generation"; 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 6239:
                  Suite B Cryptographic Suites for 4253: The Secure Shell (SSH)"; (SSH) Transport
                     Layer Protocol";
     }
           enum ecdh-x25519-x9.63-sha256

     /**********************************************/
     /*   Groupings for keys and/or certificates   */
     /**********************************************/
     grouping symmetric-key-grouping {
             value 30;
       description
               "Elliptic curve-based Diffie Hellman
         "A symmetric key exchange over
                curve x.25519 and using ANSI x9.63 with SHA256 as KDF";
             reference
               "RFC 8418:
                  Use of the Elliptic Curve Diffie-Hellman Key Agreement
                  Algorithm with X25519 and X448 in the Cryptographic
                  Message Syntax (CMS)";
           }
           enum ecdh-x25519-x9.63-sha384 algorithm.";
       leaf algorithm {
             value 31;
         type isa:symmetric-algorithm-type;
         mandatory true;
         description
               "Elliptic curve-based Diffie Hellman key exchange over
                curve x.25519 and using ANSI x9.63 with SHA384 as KDF";
             reference
               "RFC 8418:
                  Use of the Elliptic Curve Diffie-Hellman Key Agreement
                  Algorithm with X25519 and X448 in
           "The algorithm to be used when generating the Cryptographic
                  Message Syntax (CMS)";
           }
           enum ecdh-x25519-x9.63-sha512 {
             value 32;
             description
               "Elliptic curve-based Diffie Hellman key exchange over
                curve x.25519 and using ANSI x9.63 with SHA512 as KDF"; key.";
         reference
           "RFC 8418:
                  Use of the Elliptic Curve Diffie-Hellman Key Agreement
                  Algorithm with X25519 and X448 in the Cryptographic
                  Message Syntax (CMS)"; CCCC: Common YANG Data Types for Cryptography";
       }
           enum ecdh-x25519-hkdf-sha256
       leaf key-format {
             value 33;
         nacm:default-deny-write;
         when "../key";
         type identityref {
           base symmetric-key-format;
         }
         description
               "Elliptic curve-based Diffie Hellman key exchange over
                curve x.25519 and using HKDF with SHA256 as KDF";
             reference
               "RFC 8418:
                  Use of the Elliptic Curve Diffie-Hellman Key Agreement
                  Algorithm with X25519 and X448 in "Identifies the Cryptographic
                  Message Syntax (CMS)"; symmetric key's format.";
       }
           enum ecdh-x25519-hkdf-sha384
       choice key-type {
             value 34;
         mandatory true;
         description
               "Elliptic curve-based Diffie Hellman
           "Choice between key exchange over
                curve x.25519 and using HKDF with SHA384 as KDF";
             reference
               "RFC 8418:
                  Use types.";
         leaf key {
           nacm:default-deny-all;
           type binary;
           //must "../key-format";  FIXME: remove comment if approach ok
           description
             "The binary value of the Elliptic Curve Diffie-Hellman Key Agreement
                  Algorithm with X25519 and X448 in key.  The interpretation of
              the Cryptographic
                  Message Syntax (CMS)";
           }
           enum ecdh-x25519-hkdf-sha512 { value 35;
             description
               "Elliptic curve-based Diffie Hellman key exchange over
                curve x.25519 and using HKDF with SHA512 as KDF"; is defined by 'key-format'.  For example,
              FIXME.";
           reference
             "RFC 8418:
                  Use of the Elliptic Curve Diffie-Hellman Key Agreement
                  Algorithm with X25519 and X448 in the Cryptographic
                  Message Syntax (CMS)"; XXXX: FIXME";
         }
           enum ecdh-x448-x9.63-sha256
         leaf hidden-key {
             value 36;
           nacm:default-deny-write;
           type empty;
           description
               "Elliptic curve-based Diffie Hellman key exchange over
                curve x.448 and using ANSI x9.63 with SHA256 as KDF";
             reference
               "RFC 8418:
                  Use of the Elliptic Curve Diffie-Hellman Key Agreement
                  Algorithm with X25519 and X448 in
             "A permanently hidden key.  How such keys are created
              is outside the Cryptographic
                  Message Syntax (CMS)"; scope of this module.";
         }
           enum ecdh-x448-x9.63-sha384
       }
     }

     grouping public-key-grouping {
             value 37;
       description
               "Elliptic curve-based Diffie Hellman
         "A public key exchange over
                curve x.448 and using ANSI x9.63 with SHA384 as KDF"; its associated algorithm.";
       leaf algorithm {
         nacm:default-deny-write;
         type iasa:asymmetric-algorithm-type;
         mandatory true;
         description
           "Identifies the key's algorithm.";
         reference
           "RFC 8418:
                  Use of the Elliptic Curve Diffie-Hellman Key Agreement
                  Algorithm with X25519 and X448 in CCCC: Common YANG Data Types for Cryptography";
       }
       leaf public-key-format {
         nacm:default-deny-write;
         when "../public-key";
         type identityref {
           base public-key-format;
         }
         description "Identifies the Cryptographic
                  Message Syntax (CMS)"; key's format.";
       }
           enum ecdh-x448-x9.63-sha512
       leaf public-key {
             value 38;
         nacm:default-deny-write;
         type binary;
         //must "../public-key-format"; FIXME: rm comment if approach ok
         mandatory true;
         description
               "Elliptic curve-based Diffie Hellman key exchange over
                curve x.448 and using ANSI x9.63 with SHA512 as KDF";
             reference
               "RFC 8418:
                  Use
           "The binary value of the Elliptic Curve Diffie-Hellman Key Agreement
                  Algorithm with X25519 and X448 in public key.  The interpretation
            of the Cryptographic
                  Message Syntax (CMS)"; value is defined by 'public-key-format' field.";
       }
           enum ecdh-x448-hkdf-sha256
     }

     grouping asymmetric-key-pair-grouping {
             value 39;
       description
               "Elliptic curve-based Diffie Hellman
         "A private key exchange over
                curve x.448 and using HKDF with SHA256 as KDF";
             reference
               "RFC 8418:
                  Use of the Elliptic Curve Diffie-Hellman Key Agreement
                  Algorithm with X25519 its associated public key and X448 in algorithm.";
       uses public-key-grouping;
       leaf private-key-format {
         nacm:default-deny-write;
         when "../private-key";
         type identityref {
           base private-key-format;
         }
         description "Identifies the Cryptographic
                  Message Syntax (CMS)"; key's format.";
       }
           enum ecdh-x448-hkdf-sha384
       choice private-key-type {
             value 40;
         mandatory true;
         description
               "Elliptic curve-based Diffie Hellman
           "Choice between key exchange over
                curve x.448 and using HKDF with SHA384 as KDF";
             reference
               "RFC 8418:
                  Use types.";
         leaf private-key {
           nacm:default-deny-all;
           type binary;
           //must "../private-key-format"; FIXME: rm comment if ok
           description
             "The value of the Elliptic Curve Diffie-Hellman Key Agreement
                  Algorithm with X25519 and X448 in binary key.  The key's value is
              interpreted by the Cryptographic
                  Message Syntax (CMS)"; 'private-key-format' field.";
         }
           enum ecdh-x448-hkdf-sha512
         leaf hidden-private-key {
             value 41;
           nacm:default-deny-write;
           type empty;
           description
               "Elliptic curve-based Diffie Hellman key exchange over
                curve x.448
             "A permanently hidden key.  How such keys are created
              is outside the scope of this module.";
         }
       }
     }

     grouping trust-anchor-cert-grouping {
       description
         "A trust anchor certificate, and using HKDF with SHA512 as KDF"; a notification for when
          it is about to (or already has) expire.";
       leaf cert {
         nacm:default-deny-write;
         type trust-anchor-cert-cms;
         description
           "The binary certificate data for this certificate.";
         reference
           "RFC 8418:
                  Use of YYYY: Common YANG Data Types for Cryptography";
       }
       notification certificate-expiration {
         description
           "A notification indicating that the Elliptic Curve Diffie-Hellman Key Agreement
                  Algorithm with X25519 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 X448 in
            then once a day thereafter until the Cryptographic
                  Message Syntax (CMS)";
           }

           enum rsaes-oaep issue is resolved.";
         leaf expiration-date {
             value 42;
           type yang:date-and-time;
           mandatory true;
           description
               "RSAES-OAEP combines
             "Identifies the RSAEP and RSADP primitives with expiration date on the EME-OAEP encoding method";
             reference
               "RFC 8017:
                  PKCS #1:
                    RSA Cryptography Specifications Version 2.2."; certificate.";
         }
           enum rsaes-pkcs1-v1_5
       }
     }

     grouping trust-anchor-certs-grouping {
             value 43;
       description
               "RSAES-PKCS1-v1_5 combines the RSAEP
         "A list of trust anchor certificates, and RSADP
                primitives with the EME-PKCS1-v1_5 encoding method"; a notification
          for when one is about to (or already has) expire.";
       leaf-list cert {
         nacm:default-deny-write;
         type trust-anchor-cert-cms;
         description
           "The binary certificate data for this certificate.";
         reference
           "RFC 8017:
                  PKCS #1:
                    RSA Cryptography Specifications Version 2.2.";
           }
         } YYYY: Common YANG Data Types for Cryptography";
       }
       default "0";
       notification certificate-expiration {
         description
         "The uint16 filed shall be set by individual protocol
          families according to
           "A notification indicating that the key exchange algorithm value
          assigned by IANA. The setting configured certificate
            is optional and by default either about to expire or has already expired.  When to
            send notifications is 0.  The enumeration filed an implementation specific decision,
            but it is set to the selected key
          exchange algorithm.";
     }

     /********************************************/
     /*   Identities RECOMMENDED that a notification be sent once a
            month for Key Format Structures   */
     /********************************************/

     /*** all key format types ****/

     identity key-format-base 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 "Base key-format identity for all keys.";
             "Identifies the expiration date on the certificate.";
         }

     identity public-key-format
       }
     }

     grouping end-entity-cert-grouping {
       base "key-format-base";
       description "Base key-format identity
         "An end entity certificate, and a notification for when
          it is about to (or already has) expire.  Implementations
          SHOULD assert that, where used, the end entity certificate
          contains the expected public keys.";
     }

     identity private-key-format key.";
       leaf cert {
       base "key-format-base";
         nacm:default-deny-write;
         type end-entity-cert-cms;
         description "Base key-format identity
           "The binary certificate data for private keys."; this certificate.";
         reference
           "RFC YYYY: Common YANG Data Types for Cryptography";
       }

     identity symmetric-key-format
       notification certificate-expiration {
       base "key-format-base";
         description "Base key-format identity
           "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 symmetric keys.";
     }

     /**** 3 months, then once a week for private keys ****/

     identity rsa-private-key-format four weeks, and
            then once a day thereafter until the issue is resolved.";
         leaf expiration-date {
         base "private-key-format";
           type yang:date-and-time;
           mandatory true;
           description "An RSAPrivateKey (from RFC 3447).";
             "Identifies the expiration date on the certificate.";
         }

     identity ec-private-key-format {
         base "private-key-format";
         description "An ECPrivateKey (from RFC 5915)";
       }

     identity one-asymmetric-key-format
     }

     grouping end-entity-certs-grouping {
         base "private-key-format";
       description
         "A OneAsymmetricKey (from RFC 5958)."; list of end entity certificates, and a notification for
          when one is about to (or already has) expire.";
       leaf-list cert {
         nacm:default-deny-write;
         type end-entity-cert-cms;
         description
           "The binary certificate data for this certificate.";
         reference
           "RFC YYYY: Common YANG Data Types for Cryptography";
       }

     identity encrypted-private-key-format
       notification certificate-expiration {
         base "private-key-format";
         description
           "A CMS EncryptedData structure (RFC 5652)
            containing 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 OneAsymmetricKey (RFC 5958).";
      }

     /**** notification be sent once a
            month for 3 months, then once a week for public keys ****/

     identity ssh-public-key-format four weeks, and
            then once a day thereafter until the issue is resolved.";
         leaf expiration-date {
         base "public-key-format";
           type yang:date-and-time;
           mandatory true;
           description
           "The public key format described by RFC 4716.";
             "Identifies the expiration date on the certificate.";
         }

     identity subject-public-key-info-format {
         base "public-key-format";
         description
           "A SubjectPublicKeyInfo (from RFC 5280).";
       }

     /**** for symmetric keys ****/

     identity octet-string-key-format
     }

     grouping asymmetric-key-pair-with-cert-grouping {
         base "symmetric-key-format";
       description "An OctetString from ASN.1.";
           /*
           // Knowing that it is
         "A private/public key pair and an "OctetString" isn't really helpful.
           // Knowing associated certificate.
          Implementations SHOULD assert that certificates contain
          the length of matching public key.";
       uses asymmetric-key-pair-grouping;
       uses end-entity-cert-grouping;
       action generate-certificate-signing-request {
         nacm:default-deny-all;
         description
           "Generates a certificate signing request structure for
            the octet string would be helpful,
           // as it relates to associated asymmetric key using the algorithm's block size.  We may want
           // passed subject
            and attribute values.  The specified assertions need
            to only (for now) use "one-symmetric-key-format" be appropriate for
           // symmetric keys...were the usability issues Juergen
           // mentioned before only apply certificate's use.  For
            example, an entity certificate for a TLS server
            SHOULD have values that enable clients to asymmetric keys?
           */
     }

     identity one-symmetric-key-format satisfy
            RFC 6125 processing.";
         input {
         base "symmetric-key-format";
         description "A OneSymmetricKey (from RFC6031).";
     }

     identity encrypted-symmetric-key-format
           leaf subject {
         base "symmetric-key-format";
             type binary;
             mandatory true;
             description
           "A CMS EncryptedData
               "The 'subject' field per the CertificationRequestInfo
                 structure (RFC 5652)
            containing a OneSymmetricKey (RFC 6031).";
     }

     /***************************************************/
     /*   Typedefs for 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 structures from RFC 5280   */
     /***************************************************/

     typedef x509 encoding rules:
                  Specification of Basic Encoding Rules (BER),
                  Canonical Encoding Rules (CER) and Distinguished
                  Encoding Rules (DER).";
           }
           leaf attributes {
             type binary; // FIXME: does this need to be mandatory?
             description
         "A Certificate structure,
               "The 'attributes' field from the structure
                CertificationRequestInfo as specified in by RFC 5280, 2986,
                Section 4.1 encoded using the 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 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).";
           }

     typedef crl
         }
         output {
           leaf certificate-signing-request {
             type binary;
             mandatory true;
             description
               "A CertificateList structure, CertificationRequest structure as specified in by
                RFC 5280, 2986, Section 4.2 encoded using the 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 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).";
     }

     /***********************************************/
     /*   Typedefs Distinguished
                  Encoding Rules (DER).";
           }
         }
       } // generate-certificate-signing-request
     } // asymmetric-key-pair-with-cert-grouping

     grouping asymmetric-key-pair-with-certs-grouping {
       description
         "A private/public key pair and associated certificates.
          Implementations SHOULD assert that certificates contain
          the matching public key.";
       uses asymmetric-key-pair-grouping;
       container certificates {
         nacm:default-deny-write;
         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 {
           key "name";
           description
             "A certificate for this asymmetric key.";
           leaf name {
             type string;
             description
               "An arbitrary name for the certificate.  If the name
                matches the name of a certificate that exists
                independently in <operational> (i.e., an IDevID),
                then the 'cert' node MUST NOT be configured.";
           }
           uses end-entity-cert-grouping;
         }
       } // certificates
       action generate-certificate-signing-request {
         nacm:default-deny-all;
         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 ASN.1 structures from 5652   */
     /***********************************************/

     typedef cms 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
         "A ContentInfo structure,
               "The 'subject' field per the CertificationRequestInfo
                 structure as specified in by RFC 5652, 2986, Section 4.1
                 encoded using the ASN.1 distinguished encoding
                 rules (DER), as specified in ITU-T X.690.";
             reference
               "RFC 5652:
            Cryptographic Message 2986:
                  PKCS #10: Certification Request Syntax (CMS)
                            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).";
           }
     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
           leaf attributes {
             type cms;
       description
         "A CMS structure whose top-most content type MUST binary; // FIXME: does this need to be mandatory?
             description
               "The 'attributes' field from the
          encrypted-data content type, structure
                CertificationRequestInfo as described specified by RFC 2986,
                Section 8 4.1 encoded using the ASN.1 distinguished
                encoding rules (DER), as specified in RFC 5652."; ITU-T X.690.";
             reference
               "RFC 5652: Cryptographic Message 2986:
                  PKCS #10: Certification Request Syntax (CMS)";
                            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).";
           }
     typedef authenticated-data-cms
         }
         output {
           leaf certificate-signing-request {
             type cms; binary;
             mandatory true;
             description
               "A CMS CertificationRequest structure whose top-most content type MUST be the
          authenticated-data content type, as described specified by
                RFC 2986, Section 9 4.2 encoded using the ASN.1
                distinguished encoding rules (DER), as specified
                in RFC 5652."; ITU-T X.690.";
             reference
               "RFC 5652: Cryptographic Message 2986:
                  PKCS #10: Certification Request Syntax (CMS)";
                            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).";
           }

     /***************************************************/
     /*   Typedefs for structures related to RFC 4253   */
     /***************************************************/

     typedef ssh-host-key
         }
       } // generate-certificate-signing-request
     } // asymmetric-key-pair-with-certs-grouping
   }

   <CODE ENDS>

2.3.  Examples

2.3.1.  The "asymmetric-key-pair-with-certs-grouping" Grouping

   The following example module illustrates the use of both the
   "symmetric-key-grouping" and the "asymmetric-key-pair-with-certs-
   grouping" groupings defined in the "ietf-crypto-types" module.

   module ex-crypto-types-usage {
       type binary;
       description
         "The binary public key data
     yang-version 1.1;

     namespace "http://example.com/ns/example-crypto-types-usage";
     prefix "ectu";

     import ietf-crypto-types {
       prefix ct;
       reference
         "RFC XXXX: Common YANG Data Types 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."; Cryptography";
     }

     organization
      "Example Corporation";

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

     description
      "This module illustrates the grouping
       defined in the crypto-types draft called
       'asymmetric-key-pair-with-certs-grouping'.";

     revision "1001-01-01" {
       description
        "Initial version";
       reference
        "RFC 4253: The Secure Shell (SSH) Transport Layer
                    Protocol";
     }

     /*********************************************************/
     /*   Typedefs ????: Usage Example for ASN.1 structures related to RFC 5280   */
     /*********************************************************/

     typedef trust-anchor-cert-x509 XXXX";
     }

     container symmetric-keys {
       type x509;
       description
         "A Certificate structure that MUST encode a self-signed
          root certificate.";
     }

     typedef end-entity-cert-x509 container of symmetric keys.";
       list symmetric-key {
       type x509;
         key name;
         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 symmetric key";
         leaf name {
           type signed-data-cms; string;
           description
             "An arbitrary name for this key.";
         }
         uses ct:symmetric-key-grouping;
       }
     }
     container asymmetric-keys {
       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 container 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 asymmetric keys.";
       list asymmetric-key {
         key name;
         leaf name {
           type string;
           description
             "An arbitrary name for this key.";
         }
         uses ct:asymmetric-key-pair-with-certs-grouping;
         description
           "An asymmetric key pair with associated certificates.";
       }
     }
   }

   Given the root certificate is
          itself above example usage module, the issuer of following example
   illustrates some configured keys.

   <symmetric-keys
     xmlns="http://example.com/ns/example-crypto-types-usage"
     xmlns:ct="urn:ietf:params:xml:ns:yang:ietf-crypto-types">
     <symmetric-key>
       <name>ex-symmetric-key</name>
       <algorithm>aes-256-cbc</algorithm>
       <key-format>ct:octet-string-key-format</key-format>
       <key>base64encodedvalue==</key>
     </symmetric-key>
     <symmetric-key>
       <name>ex-hidden-symmetric-key</name>
       <algorithm>aes-256-cbc</algorithm>
       <hidden-key/>
     </symmetric-key>
   </symmetric-keys>

   <asymmetric-keys
     xmlns="http://example.com/ns/example-crypto-types-usage"
     xmlns:ct="urn:ietf:params:xml:ns:yang:ietf-crypto-types">
     <asymmetric-key>
       <name>ex-asymmetric-key</name>
       <algorithm>rsa2048</algorithm>
       <public-key-format>
         ct:subject-public-key-info-format
       </public-key-format>
       <public-key>base64encodedvalue==</public-key>
       <private-key-format>
         ct:rsa-private-key-format
       </private-key-format>
       <private-key>base64encodedvalue==</private-key>
       <certificates>
         <certificate>
           <name>ex-cert</name>
           <cert>base64encodedvalue==</cert>
         </certificate>
       </certificates>
     </asymmetric-key>
     <asymmetric-key>
       <name>ex-hidden-asymmetric-key</name>
       <algorithm>rsa2048</algorithm>
       <public-key-format>
         ct:subject-public-key-info-format
       </public-key-format>
       <public-key>base64encodedvalue==</public-key>
       <hidden-private-key/>
       <certificates>
         <certificate>
           <name>ex-hidden-key-cert</name>
           <cert>base64encodedvalue==</cert>
         </certificate>

       </certificates>
     </asymmetric-key>
   </asymmetric-keys>

2.3.2.  The "generate-certificate-signing-request" Action

   The following example illustrates 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 "generate-certificate-signing-
   request" action with which the device can
          verify NETCONF protocol.

   REQUEST

   <rpc message-id="101"
     xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <action xmlns="urn:ietf:params:xml:ns:yang:1">
       <asymmetric-keys
         xmlns="http://example.com/ns/example-crypto-types-usage">
         <asymmetric-key>
           <name>ex-key-sect571r1</name>
           <generate-certificate-signing-request>
             <subject>base64encodedvalue==</subject>
             <attributes>base64encodedvalue==</attributes>
           </generate-certificate-signing-request>
         </asymmetric-key>
       </asymmetric-keys>
     </action>
   </rpc>

   RESPONSE

   <rpc-reply message-id="101"
      xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
      <certificate-signing-request
        xmlns="http://example.com/ns/example-crypto-types-usage">
        base64encodedvalue==
      </certificate-signing-request>
   </rpc-reply>

2.3.3.  The "certificate-expiration" Notification

   The following example illustrates the revocation status of "certificate-expiration"
   notification with the certificates. NETCONF protocol.

   <notification
     xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
     <eventTime>2018-05-25T00:01:00Z</eventTime>
     <keys xmlns="http://example.com/ns/example-crypto-types-usage">
       <key>
         <name>locally-defined key</name>
         <certificates>
           <certificate>
             <name>my-cert</name>
             <certificate-expiration>
               <expiration-date>
                 2018-08-05T14:18:53-05:00
               </expiration-date>
             </certificate-expiration>
           </certificate>
         </certificates>
       </key>
     </keys>
   </notification>

3.  The Symmetric Algorithms Module

3.1.  Tree Diagram

   This CMS encodes section provides a tree diagram [RFC8340] for the degenerate form of "iana-
   symmetric-algs" module.  Only the SignedData
          structure that "container" statement is commonly used
   represented, as tree diagrams have no means 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 represent "typedef"
   statements.

   module: iana-symmetric-algs
     +--ro supported-symmetric-algorithms
        +--ro supported-symmetric-algorithm* [algorithm]
           +--ro algorithm    symmetric-algorithm-type

3.2.  YANG Module

   This module has normative references to FIXME...

   <CODE BEGINS> file "iana-symmetric-algs@2019-11-02.yang"

   module iana-symmetric-algs {
       type signed-data-cms;
     yang-version 1.1;
     namespace "urn:ietf:params:xml:ns:yang:iana-symmetric-algs";
     prefix isa;

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

     contact
       "WG Web:   <http://datatracker.ietf.org/wg/netconf/>
        WG List:  <mailto:netconf@ietf.org>
        Author:   Kent Watsen <mailto:kent+ietf@watsen.net>
        Author:   Wang Haiguang <wang.haiguang.shieldlab@huawei.com>";

     description
         "A CMS SignedData structure that MUST contain the end
          entity certificate itself,
       "This module defines a typedef for symmetric algorithms, 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 container for 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 list of symmetric algorithms supported by local
          policy) revocation objects with which
        the device can
          verify server.

        Copyright (c) 2019 IETF Trust and the revocation status persons identified
        as authors of the certificates.

          This CMS encodes code. All rights reserved.
        Redistribution and use in source and binary forms, with
        or without modification, is permitted pursuant to, and
        subject to the degenerate form license terms contained in, the Simplified
        BSD License set forth in Section 4.c of the SignedData
          structure that is commonly used IETF Trust's
        Legal Provisions Relating 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 ssh-public-key-type {  // DELETE?
        type binary;
        description
          "The binary public key data for IETF Documents
        (https://trustee.ietf.org/license-info).

        This version of this SSH key, as
           specified by YANG module is part of 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";
     }

     /**********************************************/
     /*   Groupings XXXX
        (https://www.rfc-editor.org/info/rfcXXXX); see the RFC
        itself for keys and/or certificates   */
     /**********************************************/

     grouping symmetric-key-grouping {
       description
         "A symmetric 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 algorithm.";
       leaf algorithm only when, they appear in all
        capitals, as shown here.";

     revision 2019-11-02 {
         type encryption-algorithm-t;
         mandatory true;
       description
           "The algorithm to be used when generating the key.";
         "Initial version";
       reference
         "RFC CCCC: XXXX: Common YANG Data Types for Cryptography";
     }
       leaf key-format

     // Typedefs

     typedef symmetric-algorithm-type {
         nacm:default-deny-write;
         when "../key";
       type identityref enumeration {
           base symmetric-key-format;
         }
         enum aes-128-cbc {
           value 1;
           description "Identifies
             "Encrypt message with AES algorithm in CBC mode with
              a key length of 128 bits.";
           reference
             "RFC 3565: Use of the symmetric key's format."; Advanced Encryption Standard (AES)
              Encryption Algorithm in Cryptographic Message Syntax
              (CMS)";
         }
       choice key-type
         enum aes-192-cbc {
         mandatory true;
           value 2;
           description
           "Choice between key types.";
         leaf
             "Encrypt message with AES algorithm in CBC mode with
              a key {
           nacm:default-deny-all;
           type binary;
           //must "../key-format";  FIXME: remove comment if approach ok
           description
             "The binary value length of the key.  The interpretation 192 bits";
           reference
             "RFC 3565: Use of the Advanced Encryption Standard (AES)
              Encryption Algorithm in Cryptographic Message Syntax
              (CMS)";
         }
         enum aes-256-cbc {
           value is defined by 'key-format'.  For example,
              FIXME."; 3;
           description
             "Encrypt message with AES algorithm in CBC mode with
              a key length of 256 bits";
           reference
             "RFC XXXX: FIXME"; 3565: Use of the Advanced Encryption Standard (AES)
              Encryption Algorithm in Cryptographic Message Syntax
              (CMS)";
         }
         leaf hidden-key
         enum aes-128-ctr {
           nacm:default-deny-write;
           type empty;
           value 4;
           description
             "A permanently hidden key.  How such keys are created
              is outside the scope
             "Encrypt message with AES algorithm in CTR mode with
              a key length of this module.";
         }
       } 128 bits";
           reference
             "RFC 3686:
                Using Advanced Encryption Standard (AES) Counter
                Mode with IPsec Encapsulating Security Payload
                (ESP)";
         }

     grouping public-key-grouping
         enum aes-192-ctr {
           value 5;
           description
         "A public key and its associated algorithm.";
       leaf
             "Encrypt message with AES algorithm {
         nacm:default-deny-write;
         type asymmetric-key-algorithm-t;
         mandatory true;
         description
           "Identifies the key's algorithm."; in CTR mode with
              a key length of 192 bits";
           reference
             "RFC CCCC: Common YANG Data Types for Cryptography";
       }
       leaf public-key-format {
         nacm:default-deny-write;
         when "../public-key";
         type identityref {
           base public-key-format;
         }
         description "Identifies the key's format."; 3686:
                Using Advanced Encryption Standard (AES) Counter
                Mode with IPsec Encapsulating Security Payload
                (ESP)";
         }
       leaf public-key
         enum aes-256-ctr {
         nacm:default-deny-write;
         type binary;
         //must "../public-key-format"; FIXME: rm comment if approach ok
         mandatory true;
         description
           "The binary
           value 6;
           description
             "Encrypt message with AES algorithm in CTR mode with
              a key length of the public key.  The interpretation
            of the value is defined by 'public-key-format' field.";
       } 256 bits";
           reference
             "RFC 3686:
                Using Advanced Encryption Standard (AES) Counter
                Mode with IPsec Encapsulating Security Payload
                (ESP)";
         }

     grouping asymmetric-key-pair-grouping
         enum des3-cbc-sha1-kd {
           value 7;
           description
         "A private key and its associated public
             "Encrypt message with 3DES algorithm in CBC mode
              with sha1 function for key derivation";
           reference
             "RFC 3961:
                Encryption and algorithm.";
       uses public-key-grouping;
       leaf private-key-format {
         nacm:default-deny-write;
         when "../private-key";
         type identityref {
           base private-key-format;
         }
         description "Identifies the key's format."; Checksum Specifications for
                Kerberos 5";
         }
       choice private-key-type {
         mandatory true;
         description
           "Choice between key types.";
         leaf private-key
         enum rc4-hmac {
           nacm:default-deny-all;
           type binary;
           //must "../private-key-format"; FIXME: rm comment if ok
           description
             "The
           value of the binary key. 8;
           description
             "Encrypt message with rc4 algorithm";
           reference
             "RFC 4757:
                The key's RC4-HMAC Kerberos Encryption Types Used by
                Microsoft Windows";
         }
         enum rc4-hmac-exp {
           value 9;
           description
             "Encrypt message with rc4 algorithm that is
              interpreted exportable";
           reference
             "RFC 4757:
                The RC4-HMAC Kerberos Encryption Types Used by the 'private-key-format' field.";
                Microsoft Windows";
         }
         leaf hidden-private-key
       }
       description
         "A typedef enumerating various symmetric key algorithms.";
     }

     // Protocol-accessible Nodes

     container supported-symmetric-algorithms {
           nacm:default-deny-write;
           type empty;
       config false;
       description
         "A permanently hidden key. container for a list of supported symmetric algorithms.

          How such keys are created algorithms come to be supported is outside the scope
          of this module.";
       list supported-symmetric-algorithm {
         key algorithm;
         description
           "A lists of symmetric algorithms supported by the server.";
         leaf algorithm {
           type symmetric-algorithm-type;
           description
             "An symmetric algorithms supported by the server.";
         }
       }
     }

     grouping trust-anchor-cert-grouping

   }

   <CODE ENDS>

3.3.  Examples

   The following example illustrates the "supported-symmetric-
   algorithms" "container" statement with the NETCONF protocol.

   <supported-symmetric-algorithms
     xmlns="urn:ietf:params:xml:ns:yang:iana-symmetric-algs">
     <supported-symmetric-algorithm>
       <algorithm>aes-128-cbc</algorithm>
     </supported-symmetric-algorithm>
     <supported-symmetric-algorithm>
       <algorithm>aes-256-cbc</algorithm>
     </supported-symmetric-algorithm>
   </supported-symmetric-algorithms>

4.  The Asymmetric Algorithms Module

4.1.  Tree Diagram

   This section provides a tree diagram [RFC8340] for the "iana-
   asymmetric-algs" module.  Only the "container" statement is
   represented, as tree diagrams have no means to represent "typedef"
   statements.

   module: iana-asymmetric-algs
     +--ro supported-asymmetric-algorithms
        +--ro supported-asymmetric-algorithm* [algorithm]
           +--ro algorithm    asymmetric-algorithm-type

4.2.  YANG Module

   This module has normative references to FIXME...

   <CODE BEGINS> file "iana-asymmetric-algs@2019-11-02.yang"

   module iana-asymmetric-algs {
     yang-version 1.1;
     namespace "urn:ietf:params:xml:ns:yang:iana-asymmetric-algs";
     prefix iasa;

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

     contact
       "WG Web:   <http://datatracker.ietf.org/wg/netconf/>
        WG List:  <mailto:netconf@ietf.org>
        Author:   Kent Watsen <mailto:kent+ietf@watsen.net>
        Author:   Wang Haiguang <wang.haiguang.shieldlab@huawei.com>";

     description
         "A trust anchor certificate,
       "This module defines a typedef for asymmetric algorithms, and
        a notification container for when
          it a list of asymmetric algorithms supported by
        the server.

        Copyright (c) 2019 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
        (https://trustee.ietf.org/license-info).

        This version of this YANG module is about part of RFC XXXX
        (https://www.rfc-editor.org/info/rfcXXXX); 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 (or already has) expire.";
       leaf cert be interpreted as described in BCP 14 (RFC 2119)
        (RFC 8174) when, and only when, they appear in all
        capitals, as shown here.";

     revision 2019-11-02 {
         nacm:default-deny-write;
         type trust-anchor-cert-cms;
       description
           "The binary certificate data for this certificate.";
         "Initial version";

       reference
         "RFC YYYY: XXXX: Common YANG Data Types for Cryptography";
     }
       notification certificate-expiration

     // Typedefs

     typedef asymmetric-algorithm-type {
       type enumeration {
         enum rsa1024 {
           value 1;
           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
             "The RSA algorithm using a day thereafter until the issue is resolved.";
         leaf expiration-date 1024-bit key.";
           reference
             "RFC 8017: PKCS #1: RSA Cryptography
              Specifications Version 2.2.";
         }
         enum rsa2048 {
           type yang:date-and-time;
           mandatory true;
           value 2;
           description
             "Identifies the expiration date on the certificate.";
         }
       }
             "The RSA algorithm using a 2048-bit key.";
           reference
             "RFC 8017:
              PKCS #1: RSA Cryptography Specifications Version 2.2.";
         }

     grouping trust-anchor-certs-grouping
         enum rsa3072 {
           value 3;
           description
         "A list of trust anchor certificates, and
             "The RSA algorithm using a notification
          for when one is about to (or already has) expire.";
       leaf-list cert 3072-bit key.";
           reference
             "RFC 8017:
              PKCS #1: RSA Cryptography Specifications Version 2.2.";
         }
         enum rsa4096 {
         nacm:default-deny-write;
         type trust-anchor-cert-cms;
           value 4;
           description
             "The binary certificate data for this certificate."; RSA algorithm using a 4096-bit key.";
           reference
             "RFC YYYY: Common YANG Data Types for Cryptography"; 8017:
              PKCS #1: RSA Cryptography Specifications Version 2.2.";
         }
       notification certificate-expiration
         enum rsa7680 {
           value 5;
           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
             "The RSA algorithm using a day thereafter until the issue is resolved.";
         leaf expiration-date 7680-bit key.";
           reference
             "RFC 8017:
              PKCS #1: RSA Cryptography Specifications Version 2.2.";
         }
         enum rsa15360 {
           type yang:date-and-time;
           mandatory true;
           value 6;
           description
             "Identifies the expiration date on the certificate.";

         }
       }
             "The RSA algorithm using a 15360-bit key.";
           reference
             "RFC 8017:
              PKCS #1: RSA Cryptography Specifications Version 2.2.";
         }

     grouping end-entity-cert-grouping
         enum secp192r1 {
           value 7;
           description
         "An end entity certificate, and
             "The asymmetric algorithm using a notification for when
          it is about to (or already has) expire.  Implementations
          SHOULD assert that, where used, the end entity certificate
          contains the expected public key.";
       leaf cert NIST P192 Curve.";
           reference
             "RFC 6090:
                Fundamental Elliptic Curve Cryptography Algorithms.
              RFC 5480:
                 Elliptic Curve Cryptography Subject Public Key
                 Information.";
         }
         enum secp224r1 {
         nacm:default-deny-write;
         type end-entity-cert-cms;
           value 8;
           description
             "The binary certificate data for this certificate."; asymmetric algorithm using a NIST P224 Curve.";
           reference
             "RFC YYYY: Common YANG Data Types for Cryptography"; 6090:
                Fundamental Elliptic Curve Cryptography Algorithms.
              RFC 5480:
                Elliptic Curve Cryptography Subject Public Key
                Information.";
         }
       notification certificate-expiration
         enum secp256r1 {
           value 9;
           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
             "The asymmetric algorithm using a day thereafter until the issue is resolved.";
         leaf expiration-date NIST P256 Curve.";
           reference
             "RFC 6090:
                Fundamental Elliptic Curve Cryptography Algorithms.
              RFC 5480:
                Elliptic Curve Cryptography Subject Public Key
                Information.";
         }
         enum secp384r1 {
           type yang:date-and-time;
           mandatory true;
           value 10;
           description
             "Identifies the expiration date on the certificate.";
         }
       }
             "The asymmetric algorithm using a NIST P384 Curve.";
           reference
             "RFC 6090:
                Fundamental Elliptic Curve Cryptography Algorithms.

              RFC 5480:
                Elliptic Curve Cryptography Subject Public Key
                Information.";
         }

     grouping end-entity-certs-grouping
         enum secp521r1 {
           value 11;
           description
         "A list of end entity certificates, and
             "The asymmetric algorithm using a notification for
          when one is about to (or already has) expire.";
       leaf-list cert NIST P521 Curve.";
           reference
             "RFC 6090:
                Fundamental Elliptic Curve Cryptography Algorithms.
              RFC 5480:
                Elliptic Curve Cryptography Subject Public Key
                Information.";
         }
         enum x25519 {
         nacm:default-deny-write;
         type end-entity-cert-cms;
           value 12;
           description
             "The binary certificate data for this certificate."; asymmetric algorithm using a x.25519 Curve.";
           reference
             "RFC YYYY: Common YANG Data Types 7748:
                Elliptic Curves for Cryptography"; Security.";
         }
       notification certificate-expiration
         enum x448 {
           value 13;
           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
             "The asymmetric algorithm using a
            month x.448 Curve.";
           reference
             "RFC 7748:
                Elliptic Curves for 3 months, then once a week Security.";
         }
       }
       description
         "A typedef enumerating various asymmetric key algorithms.";
     }

     // Protocol-accessible Nodes

     container supported-asymmetric-algorithms {
       config false;
       description
         "A container for four weeks, and
            then once a day thereafter until the issue list of supported asymmetric algorithms.
          How algorithms come to be supported is resolved."; outside the scope
          of this module.";
       list supported-asymmetric-algorithm {
         key algorithm;
         description
           "A lists of asymmetric algorithms supported by the server.";

         leaf expiration-date algorithm {
           type yang:date-and-time;
           mandatory true; asymmetric-algorithm-type;
           description
             "Identifies the expiration date on
             "An asymmetric algorithms supported by the certificate."; server.";
         }
       }
     }

     grouping asymmetric-key-pair-with-cert-grouping {
       description
         "A private/public key pair and an associated certificate.
          Implementations SHOULD assert that certificates contain

   }

   <CODE ENDS>

4.3.  Examples

   The following example illustrates the matching public key.";
       uses asymmetric-key-pair-grouping;
       uses end-entity-cert-grouping;
       action generate-certificate-signing-request "supported-asymmetric-
   algorithms" "container" statement with the NETCONF protocol.

   <supported-asymmetric-algorithms
     xmlns="urn:ietf:params:xml:ns:yang:iana-asymmetric-algs">
     <supported-asymmetric-algorithm>
       <algorithm>rsa2048</algorithm>
     </supported-asymmetric-algorithm>
     <supported-asymmetric-algorithm>
       <algorithm>secp256r1</algorithm>
     </supported-asymmetric-algorithm>
   </supported-asymmetric-algorithms>

5.  The Hash Algorithms Module

5.1.  Tree Diagram

   This section provides a tree diagram [RFC8340] for the "iana-hash-
   algs" module.  Only the "container" statement is represented, as tree
   diagrams have no means to represent "typedef" statements.

   module: iana-hash-algs
     +--ro supported-hash-algorithms
        +--ro supported-hash-algorithm* [algorithm]
           +--ro algorithm    hash-algorithm-type

5.2.  YANG Module

   This module has normative references to FIXME...

   <CODE BEGINS> file "iana-hash-algs@2019-11-02.yang"

   module iana-hash-algs {
         nacm:default-deny-all;
     yang-version 1.1;
     namespace "urn:ietf:params:xml:ns:yang:iana-hash-algs";
     prefix iha;

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

     contact
       "WG Web:   <http://datatracker.ietf.org/wg/netconf/>
        WG List:  <mailto:netconf@ietf.org>
        Author:   Kent Watsen <mailto:kent+ietf@watsen.net>
        Author:   Wang Haiguang <wang.haiguang.shieldlab@huawei.com>";

     description
           "Generates
       "This module defines a certificate signing request structure typedef for hash algorithms, and
        a container for a list of hash algorithms supported by
        the associated asymmetric key using server.

        Copyright (c) 2019 IETF Trust and the passed subject 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 attribute values.  The specified assertions need
        subject 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 license terms contained in, the CertificationRequestInfo
                 structure as specified by RFC 2986, Simplified
        BSD License set forth in Section 4.1
                 encoded using 4.c of 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 IETF Trust's
        Legal Provisions Relating to IETF Documents
        (https://trustee.ietf.org/license-info).

        This version of Basic Encoding Rules (BER),
                  Canonical Encoding Rules (CER) this YANG module is part of RFC XXXX
        (https://www.rfc-editor.org/info/rfcXXXX); 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 Distinguished
                  Encoding Rules (DER).";
           }
           leaf attributes {
             type binary; // FIXME: does 'OPTIONAL' in this need document
        are to be mandatory?
             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), interpreted as specified described 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) BCP 14 (RFC 2119)
        (RFC 8174) when, and Distinguished
                  Encoding Rules (DER).";
           }
         }
         output only when, they appear in all
        capitals, as shown here.";

     revision 2019-11-02 {
           leaf certificate-signing-request
       description
         "Initial version";
       reference
         "RFC XXXX: Common YANG Data Types for Cryptography";
     }

     // Typedefs

     typedef hash-algorithm-type {
       type binary;
             mandatory true; enumeration {
         enum sha1 {
           value 1;
           status obsolete;
           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.";
             "The SHA1 algorithm.";
           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)."; 3174: US Secure Hash Algorithms 1 (SHA1).";
         }
         enum sha-224 {
           value 2;
           description
             "The SHA-224 algorithm.";
           reference
             "RFC 6234: US Secure Hash Algorithms.";
         }
         enum sha-256 {
           value 3;
           description
             "The SHA-256 algorithm.";
           reference
             "RFC 6234: US Secure Hash Algorithms.";
         } // generate-certificate-signing-request
         enum sha-384 {
           value 4;
           description
             "The SHA-384 algorithm.";
           reference
             "RFC 6234: US Secure Hash Algorithms.";
         } // asymmetric-key-pair-with-cert-grouping

     grouping asymmetric-key-pair-with-certs-grouping
         enum sha-512 {
           value 5;
           description
         "A private/public key pair and associated certificates.

          Implementations SHOULD assert that certificates contain
          the matching public key.";
       uses asymmetric-key-pair-grouping;
       container certificates
             "The SHA-512 algorithm.";
           reference
             "RFC 6234: US Secure Hash Algorithms.";
         }
         enum shake-128 {
         nacm:default-deny-write;
           value 6;
           description
           "Certificates associated
             "The SHA3 algorithm with this asymmetric key.
            More than one certificate supports, for instance,
            a TPM-protected asymmetric key that has both IDevID 128-bits output.";
           reference
             "National Institute of Standards and LDevID certificates associated.";
         list certificate {
           key "name";
           description
             "A certificate for this asymmetric key.";
           leaf name Technology,
              SHA-3 Standard: Permutation-Based Hash and
              Extendable-Output Functions, FIPS PUB 202, DOI
              10.6028/NIST.FIPS.202, August 2015.";
         }
         enum shake-224 {
             type string;
           value 7;
           description
               "An arbitrary name for the certificate.  If the name
                matches the name
             "The SHA3 algorithm with 224-bits output.";
           reference
             "National Institute of a certificate that exists
                independently in <operational> (i.e., an IDevID),
                then the 'cert' node MUST NOT be configured.";
           }
           uses end-entity-cert-grouping;
         } Standards and Technology,
              SHA-3 Standard: Permutation-Based Hash and
              Extendable-Output Functions, FIPS PUB 202, DOI
              10.6028/NIST.FIPS.202, August 2015.";
         } // certificates
       action generate-certificate-signing-request
         enum shake-256 {
         nacm:default-deny-all;
           value 8;
           description
           "Generates a certificate signing request structure for
            the associated asymmetric key using the passed subject
             "The SHA3 algorithm with 256-bits output.";
           reference
             "National Institute of Standards 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 Technology,
              SHA-3 Standard: Permutation-Based Hash and
              Extendable-Output Functions, FIPS PUB 202, DOI
              10.6028/NIST.FIPS.202, August 2015.";
         }
         enum shake-384 {
             type binary;
             mandatory true;
           value 9;
           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."; SHA3 algorithm with 384-bits output.";
           reference
               "RFC 2986:
                  PKCS #10: Certification Request Syntax
                            Specification Version 1.7.

                ITU-T X.690:
                  Information technology - ASN.1 encoding rules:
                  Specification
             "National Institute of Basic Encoding Rules (BER),
                  Canonical Encoding Rules (CER) Standards and Distinguished
                  Encoding Rules (DER)."; Technology,
              SHA-3 Standard: Permutation-Based Hash and
              Extendable-Output Functions, FIPS PUB 202, DOI
              10.6028/NIST.FIPS.202, August 2015.";
         }
           leaf attributes {
             type binary; // FIXME: does this need to be mandatory?
         enum shake-512 {
           value 10;
           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."; SHA3 algorithm with 384-bits output.";
           reference
               "RFC 2986:
                  PKCS #10: Certification Request Syntax
                            Specification Version 1.7.
                ITU-T X.690:
                  Information technology - ASN.1 encoding rules:
                  Specification
             "National Institute of Basic Encoding Rules (BER),
                  Canonical Encoding Rules (CER) Standards and Distinguished
                  Encoding Rules (DER)."; Technology,
              SHA-3 Standard: Permutation-Based Hash and
              Extendable-Output Functions, FIPS PUB 202, DOI
              10.6028/NIST.FIPS.202, August 2015.";
         }
       }
         output
       description
         "A typedef enumerating various hash key algorithms.";
     }

     // Protocol-accessible Nodes

     container supported-hash-algorithms {
       config false;
       description
         "A container for a list of supported hash algorithms.
          How algorithms come to be supported is outside the
          scope of this module.";
       list supported-hash-algorithm {
         key algorithm;
         description
           "A lists of hash algorithms supported by the server.";
         leaf certificate-signing-request algorithm {
           type binary;
             mandatory true; hash-algorithm-type;
           description
               "A CertificationRequest structure as specified
             "An hash algorithms supported 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).";
           } server.";
         }
       } // generate-certificate-signing-request
     } // asymmetric-key-pair-with-certs-grouping

   }

   <CODE ENDS>

3.

5.3.  Examples

   The following example illustrates the "supported-hash-algorithms"
   "container" statement with the NETCONF protocol.

   <supported-hash-algorithms
     xmlns="urn:ietf:params:xml:ns:yang:iana-hash-algs">
     <supported-hash-algorithm>
       <algorithm>sha-256</algorithm>
     </supported-hash-algorithm>
     <supported-hash-algorithm>
       <algorithm>sha-512</algorithm>
     </supported-hash-algorithm>
   </supported-hash-algorithms>

6.  Security Considerations

3.1.

6.1.  Support for Algorithms

   In order to use YANG identities for algorithm identifiers, only the
   most commonly used RSA key lengths are supported for the RSA
   algorithm.  Additional key lengths can be defined in another module
   or added into a future version of this document.

   This document limits the number of elliptical curves supported.  This
   was done to match industry trends and IETF best practice (e.g.,
   matching work being done in TLS 1.3).  If additional algorithms are
   needed, they can be defined by another module or added into a future
   version of this document.

3.2.

6.2.  No Support for CRMF

   This document uses PKCS #10 [RFC2986] for the "generate-certificate-
   signing-request" action.  The use of Certificate Request Message
   Format (CRMF) [RFC4211] was considered, but is was unclear if there
   was market demand for it.  If it is desired to support CRMF in the
   future, a backwards compatible solution can be defined at that time.

3.3.

6.3.  Access to Data Nodes

   The YANG module in this document defines "grouping" statements that
   are designed to be accessed via YANG based management protocols, such
   as NETCONF [RFC6241] and RESTCONF [RFC8040].  Both of these protocols
   have mandatory-to-implement secure transport layers (e.g., SSH, TLS)
   with mutual authentication.

   The NETCONF access control model (NACM) [RFC8341] provides the means
   to restrict access for particular users to a pre-configured subset of
   all available protocol operations and content.

   Since the module in this document only define groupings, these
   considerations are primarily for the designers of other modules that
   use these groupings.

   There are a number of data nodes defined by the grouping statements
   that are writable/creatable/deletable (i.e., config true, which is
   the default).  Some of these data nodes may be considered sensitive
   or vulnerable in some network environments.  Write operations (e.g.,
   edit-config) to these data nodes without proper protection can have a
   negative effect on network operations.  These are the subtrees and
   data nodes and their sensitivity/vulnerability:

      *: All of the data nodes defined by all the groupings are
         considered sensitive to write operations.  For instance, the
         modification of a public key or a certificate can dramatically
         alter the implemented security policy.  For this reason, the
         NACM extension "default-deny-write" has been applied to all the
         data nodes defined by all the groupings.

   Some of the readable data nodes in the YANG module may be considered
   sensitive or vulnerable in some network environments.  It is thus
   important to control read access (e.g., via get, get-config, or
   notification) to these data nodes.  These are the subtrees and data
   nodes and their sensitivity/vulnerability:

      /private-key:  The "private-key" node defined in the "asymmetric-
         key-pair-grouping" grouping is additionally sensitive to read
         operations such that, in normal use cases, it should never be
         returned to a client.  For this reason, the NACM extension
         "default-deny-all" has been applied to it here.

   Some of the operations in this YANG module may be considered
   sensitive or vulnerable in some network environments.  It is thus
   important to control access to these operations.  These are the
   operations and their sensitivity/vulnerability:

      *: All of the "action" statements defined by groupings SHOULD only
         be executed by authorized users.  For this reason, the NACM
         extension "default-deny-all" has been applied to all of them.
         Note that NACM uses "default-deny-all" to protect "RPC" and
         "action" statements; it does not define, e.g., an extension
         called "default-deny-execute".

      generate-certificate-signing-request:  For this action, it is
         RECOMMENDED that implementations assert channel binding
         [RFC5056], so as to ensure that the application layer that sent
         the request is the same as the device authenticated when the
         secure transport layer was established.

4.

7.  IANA Considerations

4.1.

7.1.  The IETF XML Registry

   This document registers one URI four URIs in the "ns" subregistry of the IETF IETF
   XML Registry [RFC3688].  Following the format in [RFC3688], the
   following registrations are requested:

      URI: urn:ietf:params:xml:ns:yang:ietf-crypto-types
      Registrant Contact: The NETCONF WG of the IETF.
      XML: N/A, the requested URI is an XML namespace.

      URI: urn:ietf:params:xml:ns:yang:iana-symmetric-algs
      Registrant Contact: The NETCONF WG of the IETF.
      XML: N/A, the requested URI is an XML Registry [RFC3688].  Following namespace.

      URI: urn:ietf:params:xml:ns:yang:iana-ssymmetric-algs
      Registrant Contact: The NETCONF WG of the format in [RFC3688], IETF.
      XML: N/A, the
   following registration requested URI is requested: an XML namespace.

      URI: urn:ietf:params:xml:ns:yang:ietf-crypto-types urn:ietf:params:xml:ns:yang:iana-hash-algs
      Registrant Contact: The NETCONF WG of the IETF.
      XML: N/A, the requested URI is an XML namespace.

4.2.

7.2.  The YANG Module Names Registry

   This document registers one four YANG module modules in the YANG Module Names
   registry [RFC6020].  Following the format in [RFC6020], the the
   following registration is registrations are requested:

      name:         ietf-crypto-types
      namespace:    urn:ietf:params:xml:ns:yang:ietf-crypto-types
      prefix:       ct
      reference:    RFC XXXX

5.  References

5.1.  Normative References

   [ITU.X690.2015]
              International Telecommunication Union, "Information
              Technology - ASN.1 encoding rules: Specification of Basic
              Encoding Rules (BER), Canonical Encoding Rules (CER) and
              Distinguished Encoding Rules (DER)", ITU-T Recommendation
              X.690, ISO/IEC 8825-1, August 2015,
              <https://www.itu.int/rec/T-REC-X.690/>.

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119,
              DOI 10.17487/RFC2119, March 1997,
              <https://www.rfc-editor.org/info/rfc2119>.

   [RFC2404]  Madson, C. and R. Glenn, "The Use of HMAC-SHA-1-96 within
              ESP and AH", RFC 2404, DOI 10.17487/RFC2404, November
              1998, <https://www.rfc-editor.org/info/rfc2404>.

   [RFC3565]  Schaad, J., "Use of the Advanced Encryption Standard (AES)
              Encryption Algorithm in Cryptographic Message Syntax
              (CMS)", RFC 3565, DOI 10.17487/RFC3565, July 2003,
              <https://www.rfc-editor.org/info/rfc3565>.

   [RFC3686]  Housley, R., "Using Advanced Encryption Standard (AES)
              Counter Mode With IPsec Encapsulating Security Payload
              (ESP)", RFC 3686, DOI 10.17487/RFC3686, January 2004,
              <https://www.rfc-editor.org/info/rfc3686>.

   [RFC4106]  Viega, J. and D. McGrew, "The Use of Galois/Counter Mode
              (GCM) in IPsec Encapsulating Security Payload (ESP)",
              RFC 4106, DOI 10.17487/RFC4106, June 2005,
              <https://www.rfc-editor.org/info/rfc4106>.

   [RFC4253]  Ylonen, T. and C. Lonvick, Ed., "The Secure Shell (SSH)
              Transport Layer Protocol", RFC 4253, DOI 10.17487/RFC4253,
              January 2006, <https://www.rfc-editor.org/info/rfc4253>.

   [RFC4279]  Eronen, P., Ed. and H. Tschofenig, Ed., "Pre-Shared Key
              Ciphersuites for Transport Layer Security (TLS)",
              RFC 4279, DOI 10.17487/RFC4279, December 2005,
              <https://www.rfc-editor.org/info/rfc4279>.

   [RFC4309]  Housley, R., "Using Advanced Encryption Standard (AES) CCM
              Mode with IPsec Encapsulating Security Payload (ESP)",
              RFC 4309, DOI 10.17487/RFC4309, December 2005,
              <https://www.rfc-editor.org/info/rfc4309>.

   [RFC4494]  Song, JH., Poovendran, R., and J. Lee, "The AES-CMAC-96
              Algorithm XXXX

      name:         iana-symmetric-algs
      namespace:    urn:ietf:params:xml:ns:yang:iana-symmetric-algs
      prefix:       isa
      reference:    RFC XXXX

      name:         iana-asymmetric-algs
      namespace:    urn:ietf:params:xml:ns:yang:iana-asymmetric-algs
      prefix:       iasa
      reference:    RFC XXXX

      name:         iana-hash-algs
      namespace:    urn:ietf:params:xml:ns:yang:iana-hash-algs
      prefix:       iha
      reference:    RFC XXXX

8.  References

8.1.  Normative References

   [ITU.X690.2015]
              International Telecommunication Union, "Information
              Technology - ASN.1 encoding rules: Specification of Basic
              Encoding Rules (BER), Canonical Encoding Rules (CER) and Its Use with IPsec",
              Distinguished Encoding Rules (DER)", ITU-T Recommendation
              X.690, ISO/IEC 8825-1, August 2015,
              <https://www.itu.int/rec/T-REC-X.690/>.

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 4494, 2119,
              DOI 10.17487/RFC4494, June 2006,
              <https://www.rfc-editor.org/info/rfc4494>.

   [RFC4543]  McGrew, D. 10.17487/RFC2119, March 1997,
              <https://www.rfc-editor.org/info/rfc2119>.

   [RFC2404]  Madson, C. and J. Viega, R. Glenn, "The Use of Galois Message
              Authentication Code (GMAC) in IPsec HMAC-SHA-1-96 within
              ESP and AH", RFC 4543,
              DOI 10.17487/RFC4543, May 2006,
              <https://www.rfc-editor.org/info/rfc4543>.

   [RFC4868]  Kelly, S. and S. Frankel, "Using HMAC-SHA-256, HMAC-SHA-
              384, and HMAC-SHA-512 with IPsec", RFC 4868,
              DOI 10.17487/RFC4868, May 2007,
              <https://www.rfc-editor.org/info/rfc4868>.

   [RFC5280]  Cooper, D., Santesson, S., Farrell, S., Boeyen, S.,
              Housley, R., and W. Polk, "Internet X.509 Public Key
              Infrastructure Certificate and Certificate Revocation List
              (CRL) Profile", RFC 5280, DOI 10.17487/RFC5280, May 2008,
              <https://www.rfc-editor.org/info/rfc5280>.

   [RFC5652]  Housley, R., "Cryptographic Message Syntax (CMS)", STD 70,
              RFC 5652, DOI 10.17487/RFC5652, September 2009,
              <https://www.rfc-editor.org/info/rfc5652>.

   [RFC5656]  Stebila, D. and J. Green, "Elliptic Curve Algorithm
              Integration in the Secure Shell Transport Layer",
              RFC 5656, DOI 10.17487/RFC5656, December 2009,
              <https://www.rfc-editor.org/info/rfc5656>.

   [RFC6187]  Igoe, K. and D. Stebila, "X.509v3 Certificates for Secure
              Shell Authentication", RFC 6187, 2404, DOI 10.17487/RFC6187,
              March 2011, <https://www.rfc-editor.org/info/rfc6187>.

   [RFC6991]  Schoenwaelder, 10.17487/RFC2404, November
              1998, <https://www.rfc-editor.org/info/rfc2404>.

   [RFC3565]  Schaad, J., Ed., "Common YANG Data Types", "Use of the Advanced Encryption Standard (AES)
              Encryption Algorithm in Cryptographic Message Syntax
              (CMS)", RFC 6991, 3565, DOI 10.17487/RFC6991, 10.17487/RFC3565, July 2013,
              <https://www.rfc-editor.org/info/rfc6991>.

   [RFC7919]  Gillmor, D., "Negotiated Finite Field Diffie-Hellman
              Ephemeral Parameters for Transport Layer 2003,
              <https://www.rfc-editor.org/info/rfc3565>.

   [RFC3686]  Housley, R., "Using Advanced Encryption Standard (AES)
              Counter Mode With IPsec Encapsulating Security (TLS)", Payload
              (ESP)", RFC 7919, 3686, DOI 10.17487/RFC7919, August 2016,
              <https://www.rfc-editor.org/info/rfc7919>.

   [RFC7950]  Bjorklund, M., Ed., 10.17487/RFC3686, January 2004,
              <https://www.rfc-editor.org/info/rfc3686>.

   [RFC4106]  Viega, J. and D. McGrew, "The YANG 1.1 Data Modeling Language",
              RFC 7950, DOI 10.17487/RFC7950, August 2016,
              <https://www.rfc-editor.org/info/rfc7950>.

   [RFC8174]  Leiba, B., "Ambiguity Use of Uppercase vs Lowercase Galois/Counter Mode
              (GCM) in IPsec Encapsulating Security Payload (ESP)",
              RFC
              2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
              May 2017, <https://www.rfc-editor.org/info/rfc8174>.

   [RFC8268]  Baushke, M., "More Modular Exponentiation (MODP) Diffie-
              Hellman (DH) Key Exchange (KEX) Groups for Secure Shell
              (SSH)", RFC 8268, 4106, DOI 10.17487/RFC8268, December 2017,
              <https://www.rfc-editor.org/info/rfc8268>.

   [RFC8332]  Bider, D., "Use of RSA Keys with SHA-256 10.17487/RFC4106, June 2005,
              <https://www.rfc-editor.org/info/rfc4106>.

   [RFC4253]  Ylonen, T. and SHA-512 in
              the C. Lonvick, Ed., "The Secure Shell (SSH)
              Transport Layer Protocol", RFC 8332,
              DOI 10.17487/RFC8332, March 2018,
              <https://www.rfc-editor.org/info/rfc8332>.

   [RFC8341]  Bierman, A. and M. Bjorklund, "Network Configuration
              Access Control Model", STD 91, RFC 8341, 4253, DOI 10.17487/RFC8341, March 2018,
              <https://www.rfc-editor.org/info/rfc8341>.

   [RFC8422]  Nir, Y., Josefsson, S., 10.17487/RFC4253,
              January 2006, <https://www.rfc-editor.org/info/rfc4253>.

   [RFC4279]  Eronen, P., Ed. and M. Pegourie-Gonnard, "Elliptic
              Curve Cryptography (ECC) Cipher Suites H. Tschofenig, Ed., "Pre-Shared Key
              Ciphersuites for Transport Layer Security (TLS) Versions 1.2 and Earlier", (TLS)",
              RFC 8422, 4279, DOI 10.17487/RFC8422, August 2018,
              <https://www.rfc-editor.org/info/rfc8422>.

   [RFC8446]  Rescorla, E., 10.17487/RFC4279, December 2005,
              <https://www.rfc-editor.org/info/rfc4279>.

   [RFC4309]  Housley, R., "Using Advanced Encryption Standard (AES) CCM
              Mode with IPsec Encapsulating Security Payload (ESP)",
              RFC 4309, DOI 10.17487/RFC4309, December 2005,
              <https://www.rfc-editor.org/info/rfc4309>.

   [RFC4494]  Song, JH., Poovendran, R., and J. Lee, "The Transport Layer Security (TLS) Protocol
              Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018,
              <https://www.rfc-editor.org/info/rfc8446>.

5.2.  Informative References

   [RFC2986]  Nystrom, M. AES-CMAC-96
              Algorithm and B. Kaliski, "PKCS #10: Certification
              Request Syntax Specification Version 1.7", Its Use with IPsec", RFC 2986, 4494,
              DOI 10.17487/RFC2986, November 2000,
              <https://www.rfc-editor.org/info/rfc2986>.

   [RFC3174]  Eastlake 3rd, 10.17487/RFC4494, June 2006,
              <https://www.rfc-editor.org/info/rfc4494>.

   [RFC4543]  McGrew, D. and P. Jones, "US Secure Hash Algorithm 1
              (SHA1)", J. Viega, "The Use of Galois Message
              Authentication Code (GMAC) in IPsec ESP and AH", RFC 3174, 4543,
              DOI 10.17487/RFC3174, September 2001,
              <https://www.rfc-editor.org/info/rfc3174>.

   [RFC3688]  Mealling, M., "The IETF XML Registry", BCP 81, 10.17487/RFC4543, May 2006,
              <https://www.rfc-editor.org/info/rfc4543>.

   [RFC4868]  Kelly, S. and S. Frankel, "Using HMAC-SHA-256, HMAC-SHA-
              384, and HMAC-SHA-512 with IPsec", RFC 3688, 4868,
              DOI 10.17487/RFC3688, January 2004,
              <https://www.rfc-editor.org/info/rfc3688>.

   [RFC4211]  Schaad, J., 10.17487/RFC4868, May 2007,
              <https://www.rfc-editor.org/info/rfc4868>.

   [RFC5280]  Cooper, D., Santesson, S., Farrell, S., Boeyen, S.,
              Housley, R., and W. Polk, "Internet X.509 Public Key
              Infrastructure Certificate Request Message Format (CRMF)", and Certificate Revocation List
              (CRL) Profile", RFC 4211, 5280, DOI 10.17487/RFC4211, September 2005,
              <https://www.rfc-editor.org/info/rfc4211>.

   [RFC4493]  Song, JH., Poovendran, 10.17487/RFC5280, May 2008,
              <https://www.rfc-editor.org/info/rfc5280>.

   [RFC5652]  Housley, R., Lee, J., and T. Iwata, "The
              AES-CMAC Algorithm", "Cryptographic Message Syntax (CMS)", STD 70,
              RFC 4493, 5652, DOI 10.17487/RFC4493, June
              2006, <https://www.rfc-editor.org/info/rfc4493>.

   [RFC5056]  Williams, N., "On 10.17487/RFC5652, September 2009,
              <https://www.rfc-editor.org/info/rfc5652>.

   [RFC5656]  Stebila, D. and J. Green, "Elliptic Curve Algorithm
              Integration in the Use of Channel Bindings to Secure
              Channels", Shell Transport Layer",
              RFC 5056, 5656, DOI 10.17487/RFC5056, November 2007,
              <https://www.rfc-editor.org/info/rfc5056>.

   [RFC5915]  Turner, S. 10.17487/RFC5656, December 2009,
              <https://www.rfc-editor.org/info/rfc5656>.

   [RFC6187]  Igoe, K. and D. Brown, "Elliptic Curve Private Key
              Structure", Stebila, "X.509v3 Certificates for Secure
              Shell Authentication", RFC 6187, DOI 10.17487/RFC6187,
              March 2011, <https://www.rfc-editor.org/info/rfc6187>.

   [RFC6991]  Schoenwaelder, J., Ed., "Common YANG Data Types",
              RFC 6991, DOI 10.17487/RFC6991, July 2013,
              <https://www.rfc-editor.org/info/rfc6991>.

   [RFC7919]  Gillmor, D., "Negotiated Finite Field Diffie-Hellman
              Ephemeral Parameters for Transport Layer Security (TLS)",
              RFC 5915, 7919, DOI 10.17487/RFC5915, June 2010,
              <https://www.rfc-editor.org/info/rfc5915>.

   [RFC6020] 10.17487/RFC7919, August 2016,
              <https://www.rfc-editor.org/info/rfc7919>.

   [RFC7950]  Bjorklund, M., Ed., "YANG - A "The YANG 1.1 Data Modeling Language for
              the Network Configuration Protocol (NETCONF)", Language",
              RFC 6020, 7950, DOI 10.17487/RFC6020, October 2010,
              <https://www.rfc-editor.org/info/rfc6020>.

   [RFC6125]  Saint-Andre, P. and J. Hodges, "Representation and
              Verification 10.17487/RFC7950, August 2016,
              <https://www.rfc-editor.org/info/rfc7950>.

   [RFC8174]  Leiba, B., "Ambiguity of Domain-Based Application Service Identity
              within Internet Public Key Infrastructure Using X.509
              (PKIX) Certificates Uppercase vs Lowercase in the Context of Transport Layer
              Security (TLS)", RFC 6125, DOI 10.17487/RFC6125, March
              2011, <https://www.rfc-editor.org/info/rfc6125>.

   [RFC6234]  Eastlake 3rd, D. and T. Hansen, "US Secure Hash Algorithms
              (SHA and SHA-based HMAC and HKDF)",
              2119 Key Words", BCP 14, RFC 6234, 8174, DOI 10.17487/RFC6234, 10.17487/RFC8174,
              May 2011,
              <https://www.rfc-editor.org/info/rfc6234>.

   [RFC6239]  Igoe, K., "Suite B Cryptographic Suites 2017, <https://www.rfc-editor.org/info/rfc8174>.

   [RFC8268]  Baushke, M., "More Modular Exponentiation (MODP) Diffie-
              Hellman (DH) Key Exchange (KEX) Groups for Secure Shell
              (SSH)", RFC 6239, 8268, DOI 10.17487/RFC6239, May 2011,
              <https://www.rfc-editor.org/info/rfc6239>.

   [RFC6241]  Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed., 10.17487/RFC8268, December 2017,
              <https://www.rfc-editor.org/info/rfc8268>.

   [RFC8332]  Bider, D., "Use of RSA Keys with SHA-256 and A. SHA-512 in
              the Secure Shell (SSH) Protocol", RFC 8332,
              DOI 10.17487/RFC8332, March 2018,
              <https://www.rfc-editor.org/info/rfc8332>.

   [RFC8341]  Bierman, Ed., A. and M. Bjorklund, "Network Configuration Protocol
              (NETCONF)",
              Access Control Model", STD 91, RFC 6241, 8341,
              DOI 10.17487/RFC6241, June 2011,
              <https://www.rfc-editor.org/info/rfc6241>.

   [RFC6507]  Groves, M., 10.17487/RFC8341, March 2018,
              <https://www.rfc-editor.org/info/rfc8341>.

   [RFC8422]  Nir, Y., Josefsson, S., and M. Pegourie-Gonnard, "Elliptic Curve-Based Certificateless
              Signatures
              Curve Cryptography (ECC) Cipher Suites for Identity-Based Encryption (ECCSI)", Transport Layer
              Security (TLS) Versions 1.2 and Earlier", RFC 8422,
              DOI 10.17487/RFC8422, August 2018,
              <https://www.rfc-editor.org/info/rfc8422>.

   [RFC8446]  Rescorla, E., "The Transport Layer Security (TLS) Protocol
              Version 1.3", RFC 6507, 8446, DOI 10.17487/RFC6507, February 2012,
              <https://www.rfc-editor.org/info/rfc6507>.

   [RFC8017]  Moriarty, K., Ed., Kaliski, B., Jonsson, J., 10.17487/RFC8446, August 2018,
              <https://www.rfc-editor.org/info/rfc8446>.

8.2.  Informative References

   [RFC2986]  Nystrom, M. and A. Rusch, B. Kaliski, "PKCS #1: RSA Cryptography Specifications #10: Certification
              Request Syntax Specification Version 2.2", 1.7", RFC 8017, 2986,
              DOI 10.17487/RFC8017, 10.17487/RFC2986, November 2016,
              <https://www.rfc-editor.org/info/rfc8017>.

   [RFC8032]  Josefsson, S. 2000,
              <https://www.rfc-editor.org/info/rfc2986>.

   [RFC3174]  Eastlake 3rd, D. and I. Liusvaara, "Edwards-Curve Digital
              Signature P. Jones, "US Secure Hash Algorithm (EdDSA)", 1
              (SHA1)", RFC 8032, 3174, DOI 10.17487/RFC8032, January 2017,
              <https://www.rfc-editor.org/info/rfc8032>.

   [RFC8040]  Bierman, A., Bjorklund, 10.17487/RFC3174, September 2001,
              <https://www.rfc-editor.org/info/rfc3174>.

   [RFC3688]  Mealling, M., and K. Watsen, "RESTCONF
              Protocol", "The IETF XML Registry", BCP 81, RFC 8040, 3688,
              DOI 10.17487/RFC8040, 10.17487/RFC3688, January 2017,
              <https://www.rfc-editor.org/info/rfc8040>.

   [RFC8340]  Bjorklund, M. and L. Berger, Ed., "YANG Tree Diagrams",
              BCP 215, 2004,
              <https://www.rfc-editor.org/info/rfc3688>.

   [RFC4211]  Schaad, J., "Internet X.509 Public Key Infrastructure
              Certificate Request Message Format (CRMF)", RFC 8340, 4211,
              DOI 10.17487/RFC8340, March 2018,
              <https://www.rfc-editor.org/info/rfc8340>.

   [RFC8439]  Nir, Y. and A. Langley, "ChaCha20 10.17487/RFC4211, September 2005,
              <https://www.rfc-editor.org/info/rfc4211>.

   [RFC4493]  Song, JH., Poovendran, R., Lee, J., and Poly1305 for IETF
              Protocols", T. Iwata, "The
              AES-CMAC Algorithm", RFC 8439, 4493, DOI 10.17487/RFC8439, 10.17487/RFC4493, June 2018,
              <https://www.rfc-editor.org/info/rfc8439>.

Appendix A.  Examples

A.1.  The "asymmetric-key-pair-with-certs-grouping" Grouping

   The following example module illustrates
              2006, <https://www.rfc-editor.org/info/rfc4493>.

   [RFC5056]  Williams, N., "On the use Use of both the
   "symmetric-key-grouping" Channel Bindings to Secure
              Channels", RFC 5056, DOI 10.17487/RFC5056, November 2007,
              <https://www.rfc-editor.org/info/rfc5056>.

   [RFC5915]  Turner, S. and the "asymmetric-key-pair-with-certs-
   grouping" groupings defined in the "ietf-crypto-types" module.

   module ex-crypto-types-usage {
     yang-version 1.1;

     namespace "http://example.com/ns/example-crypto-types-usage";
     prefix "ectu";

     import ietf-crypto-types {
       prefix ct;
       reference
         "RFC XXXX: Common YANG D. Brown, "Elliptic Curve Private Key
              Structure", RFC 5915, DOI 10.17487/RFC5915, June 2010,
              <https://www.rfc-editor.org/info/rfc5915>.

   [RFC6020]  Bjorklund, M., Ed., "YANG - A Data Types Modeling Language for Cryptography";
     }

     organization
      "Example Corporation";

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

     description
      "This module illustrates the grouping
       defined in
              the crypto-types draft called
       'asymmetric-key-pair-with-certs-grouping'.";

     revision "1001-01-01" {
       description
        "Initial version";
       reference
        "RFC ????: Usage Example for Network Configuration Protocol (NETCONF)", RFC XXXX";
     }

     container symmetric-keys {
       description
         "A container of symmetric keys.";
       list symmetric-key {
         key name;
         description
           "A symmetric key";
         leaf name {
           type string;
           description
             "An arbitrary name for this key.";
         }
         uses ct:symmetric-key-grouping;
       }
     }
     container asymmetric-keys {
       description
         "A container 6020,
              DOI 10.17487/RFC6020, October 2010,
              <https://www.rfc-editor.org/info/rfc6020>.

   [RFC6125]  Saint-Andre, P. and J. Hodges, "Representation and
              Verification of asymmetric keys.";
       list asymmetric-key {
         key name;
         leaf name {
           type string;
           description
             "An arbitrary name for this key.";
         }
         uses ct:asymmetric-key-pair-with-certs-grouping;
         description
           "An asymmetric key pair with associated certificates.";
       }
     }
   }

   Given the above example usage module, the following example
   illustrates some configured keys.

   ========== NOTE: '\' line wrapping per BCP XXX (RFC XXXX) ===========

   <symmetric-keys xmlns="http://example.com/ns/example-crypto-types-us\
   age"
         xmlns:ct="urn:ietf:params:xml:ns:yang:ietf-crypto-types">
     <symmetric-key>
       <name>ex-symmetric-key</name>
       <algorithm>aes-256-cbc</algorithm>
       <key-format>ct:octet-string-key-format</key-format>
       <key>base64encodedvalue==</key>
     </symmetric-key>
     <symmetric-key>
       <name>ex-hidden-symmetric-key</name>
       <algorithm>aes-256-cbc</algorithm>
       <hidden-key/>
     </symmetric-key>
   </symmetric-keys>

   <asymmetric-keys xmlns="http://example.com/ns/example-crypto-types-u\
   sage"
         xmlns:ct="urn:ietf:params:xml:ns:yang:ietf-crypto-types">
     <asymmetric-key>
       <name>ex-asymmetric-key</name>
       <algorithm>rsa2048</algorithm>
       <public-key-format>ct:subject-public-key-info-format</public-key\
   -format>
       <public-key>base64encodedvalue==</public-key>
       <private-key-format>ct:rsa-private-key-format</private-key-forma\
   t>
       <private-key>base64encodedvalue==</private-key>
       <certificates>
         <certificate>
           <name>ex-cert</name>
           <cert>base64encodedvalue==</cert>
         </certificate>
       </certificates>
     </asymmetric-key>
     <asymmetric-key>
       <name>ex-hidden-asymmetric-key</name>
       <algorithm>rsa2048</algorithm>
       <public-key-format>ct:subject-public-key-info-format</public-key\
   -format>
       <public-key>base64encodedvalue==</public-key>
       <hidden-private-key/>
       <certificates>
         <certificate>
           <name>ex-hidden-key-cert</name>
           <cert>base64encodedvalue==</cert>
         </certificate>
       </certificates>
     </asymmetric-key>
   </asymmetric-keys>

A.2.  The "generate-certificate-signing-request" Action

   The following example illustrates the "generate-certificate-signing-
   request" action in use with the NETCONF protocol.

   REQUEST

   ========== NOTE: '\' line wrapping per BCP XXX (RFC XXXX) ===========

   <rpc message-id="101"
     xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <action xmlns="urn:ietf:params:xml:ns:yang:1">
       <asymmetric-keys xmlns="http://example.com/ns/example-crypto-typ\
   es-usage">
         <asymmetric-key>
           <name>ex-key-sect571r1</name>
           <generate-certificate-signing-request>
             <subject>base64encodedvalue==</subject>
             <attributes>base64encodedvalue==</attributes>
           </generate-certificate-signing-request>
         </asymmetric-key>
       </asymmetric-keys>
     </action>
   </rpc>

   RESPONSE

   <rpc-reply message-id="101"
      xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
      <certificate-signing-request
        xmlns="http://example.com/ns/example-crypto-types-usage">
        base64encodedvalue==
      </certificate-signing-request>
   </rpc-reply>

A.3.  The "certificate-expiration" Notification

   The following example illustrates the "certificate-expiration"
   notification Domain-Based Application Service Identity
              within Internet Public Key Infrastructure Using X.509
              (PKIX) Certificates in use with the NETCONF protocol.

   <notification
     xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
     <eventTime>2018-05-25T00:01:00Z</eventTime>
     <keys xmlns="http://example.com/ns/example-crypto-types-usage">
       <key>
         <name>locally-defined key</name>
         <certificates>
           <certificate>
             <name>my-cert</name>
             <certificate-expiration>
               <expiration-date>
                 2018-08-05T14:18:53-05:00
               </expiration-date>
             </certificate-expiration>
           </certificate>
         </certificates>
       </key>
     </keys>
   </notification> Context of Transport Layer
              Security (TLS)", RFC 6125, DOI 10.17487/RFC6125, March
              2011, <https://www.rfc-editor.org/info/rfc6125>.

   [RFC6234]  Eastlake 3rd, D. and T. Hansen, "US Secure Hash Algorithms
              (SHA and SHA-based HMAC and HKDF)", RFC 6234,
              DOI 10.17487/RFC6234, May 2011,
              <https://www.rfc-editor.org/info/rfc6234>.

   [RFC6239]  Igoe, K., "Suite B Cryptographic Suites for Secure Shell
              (SSH)", RFC 6239, DOI 10.17487/RFC6239, May 2011,
              <https://www.rfc-editor.org/info/rfc6239>.

   [RFC6241]  Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed.,
              and A. Bierman, Ed., "Network Configuration Protocol
              (NETCONF)", RFC 6241, DOI 10.17487/RFC6241, June 2011,
              <https://www.rfc-editor.org/info/rfc6241>.

   [RFC6507]  Groves, M., "Elliptic Curve-Based Certificateless
              Signatures for Identity-Based Encryption (ECCSI)",
              RFC 6507, DOI 10.17487/RFC6507, February 2012,
              <https://www.rfc-editor.org/info/rfc6507>.

   [RFC8017]  Moriarty, K., Ed., Kaliski, B., Jonsson, J., and A. Rusch,
              "PKCS #1: RSA Cryptography Specifications Version 2.2",
              RFC 8017, DOI 10.17487/RFC8017, November 2016,
              <https://www.rfc-editor.org/info/rfc8017>.

   [RFC8032]  Josefsson, S. and I. Liusvaara, "Edwards-Curve Digital
              Signature Algorithm (EdDSA)", RFC 8032,
              DOI 10.17487/RFC8032, January 2017,
              <https://www.rfc-editor.org/info/rfc8032>.

   [RFC8040]  Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF
              Protocol", RFC 8040, DOI 10.17487/RFC8040, January 2017,
              <https://www.rfc-editor.org/info/rfc8040>.

   [RFC8340]  Bjorklund, M. and L. Berger, Ed., "YANG Tree Diagrams",
              BCP 215, RFC 8340, DOI 10.17487/RFC8340, March 2018,
              <https://www.rfc-editor.org/info/rfc8340>.

   [RFC8439]  Nir, Y. and A. Langley, "ChaCha20 and Poly1305 for IETF
              Protocols", RFC 8439, DOI 10.17487/RFC8439, June 2018,
              <https://www.rfc-editor.org/info/rfc8439>.

Appendix B. A.  Change Log

B.1.

A.1.  I-D to 00

   o  Removed groupings and notifications.

   o  Added typedefs for identityrefs.

   o  Added typedefs for other RFC 5280 structures.

   o  Added typedefs for other RFC 5652 structures.

   o  Added convenience typedefs for RFC 4253, RFC 5280, and RFC 5652.

B.2.

A.2.  00 to 01

   o  Moved groupings from the draft-ietf-netconf-keystore here.

B.3.

A.3.  01 to 02

   o  Removed unwanted "mandatory" and "must" statements.

   o  Added many new crypto algorithms (thanks Haiguang!)

   o  Clarified in asymmetric-key-pair-with-certs-grouping, in
      certificates/certificate/name/description, that if the name MUST
      NOT match the name of a certificate that exists independently in
      <operational>, enabling certs installed by the manufacturer (e.g.,
      an IDevID).

B.4.

A.4.  02 to 03

   o  renamed base identity 'asymmetric-key-encryption-algorithm' to
      'asymmetric-key-algorithm'.

   o  added new 'asymmetric-key-algorithm' identities for secp192r1,
      secp224r1, secp256r1, secp384r1, and secp521r1.

   o  removed 'mac-algorithm' identities for mac-aes-128-ccm, mac-aes-
      192-ccm, mac-aes-256-ccm, mac-aes-128-gcm, mac-aes-192-gcm, mac-
      aes-256-gcm, and mac-chacha20-poly1305.

   o  for all -cbc and -ctr identities, renamed base identity
      'symmetric-key-encryption-algorithm' to 'encryption-algorithm'.

   o  for all -ccm and -gcm identities, renamed base identity
      'symmetric-key-encryption-algorithm' to 'encryption-and-mac-
      algorithm' and renamed the identity to remove the "enc-" prefix.

   o  for all the 'signature-algorithm' based identities, renamed from
      'rsa-*' to 'rsassa-*'.

   o  removed all of the "x509v3-" prefixed 'signature-algorithm' based
      identities.

   o  added 'key-exchange-algorithm' based identities for 'rsaes-oaep'
      and 'rsaes-pkcs1-v1_5'.

   o  renamed typedef 'symmetric-key-encryption-algorithm-ref' to
      'symmetric-key-algorithm-ref'.

   o  renamed typedef 'asymmetric-key-encryption-algorithm-ref' to
      'asymmetric-key-algorithm-ref'.

   o  added typedef 'encryption-and-mac-algorithm-ref'.

   o  Updated copyright date, boilerplate template, affiliation, and
      folding algorithm.

B.5.

A.5.  03 to 04

   o  ran YANG module through formatter.

B.6.

A.6.  04 to 05

   o  fixed broken symlink causing reformatted YANG module to not show.

B.7.

A.7.  05 to 06

   o  Added NACM annotations.

   o  Updated Security Considerations section.

   o  Added 'asymmetric-key-pair-with-cert-grouping' grouping.

   o  Removed text from 'permanently-hidden' enum regarding such keys
      not being backed up or restored.

   o  Updated the boilerplate text in module-level "description"
      statement to match copyeditor convention.

   o  Added an explanation to the 'public-key-grouping' and 'asymmetric-
      key-pair-grouping' statements as for why the nodes are not
      mandatory (e.g., because they may exist only in <operational>.

   o  Added 'must' expressions to the 'public-key-grouping' and
      'asymmetric-key-pair-grouping' statements ensuring sibling nodes
      are either all exist or do not all exist.

   o  Added an explanation to the 'permanently-hidden' that the value
      cannot be configured directly by clients and servers MUST fail any
      attempt to do so.

   o  Added 'trust-anchor-certs-grouping' and 'end-entity-certs-
      grouping' (the plural form of existing groupings).

   o  Now states that keys created in <operational> by the *-hidden-key
      actions are bound to the lifetime of the parent 'config true'
      node, and that subsequent invocations of either action results in
      a failure.

B.8.

A.8.  06 to 07

   o  Added clarifications that implementations SHOULD assert that
      configured certificates contain the matching public key.

   o  Replaced the 'generate-hidden-key' and 'install-hidden-key'
      actions with special 'crypt-hash' -like input/output values.

B.9.

A.9.  07 to 08

   o  Removed the 'generate-key and 'hidden-key' features.

   o  Added grouping symmetric-key-grouping

   o  Modified 'asymmetric-key-pair-grouping' to have a 'choice'
      statement for the keystone module to augment into, as well as
      replacing the 'union' with leafs (having different NACM settings.

B.10.

A.10.  08 to 09

   o  Converting algorithm from identities to enumerations.

B.11.

A.11.  09 to 10

   o  All of the below changes are to the algorithm enumerations defined
      in ietf-crypto-types.

   o  Add in support for key exchange over x.25519 and x.448 based on
      RFC 8418.

   o  Add in SHAKE-128, SHAKE-224, SHAKE-256, SHAKE-384 and SHAKE 512
   o  Revise/add in enum of signature algorithm for x25519 and x448

   o  Add in des3-cbc-sha1 for IPSec

   o  Add in sha1-des3-kd for IPSec

   o  Add in definit for rc4-hmac and rc4-hmac-exp.  These two
      algorithms have been deprecated in RFC 8429.  But some existing
      draft in i2nsf may still want to use them.

   o  Add x25519 and x448 curve for asymmetric algorithms

   o  Add signature algorithms ed25519, ed25519-cts, ed25519ph

   o  add signature algorithms ed448, ed448ph

   o  Add in rsa-sha2-256 and rsa-sha2-512 for SSH protocols (rfc8332)

B.12.

A.12.  10 to 11

   o  Added a "key-format" identity.

   o  Added symmetric keys to the example in Appendix A. Section 2.3.

A.13.  11 to 12

   o  Removed all non-essential (to NC/RC) algorithm types.

   o  Moved remaining algorithm types each into its own module.

   o  Added a 'config false' "algorithms-supported" list to each of the
      algorithm-type modules.

Acknowledgements

   The authors would like to thank for following for lively discussions
   on list and in the halls (ordered by last name): Martin Bjorklund,
   Nick Hancock, Balazs Kovacs, Juergen Schoenwaelder, Eric Voit, and
   Liang Xia.

Authors' Addresses

   Kent Watsen
   Watsen Networks

   EMail: kent+ietf@watsen.net
   Wang Haiguang
   Huawei

   EMail: wang.haiguang.shieldlab@huawei.com