Refactor folder structure.
[sim/o1-interface.git] / ntsimulator / yang / x-ran / ietf-crypto-types.yang
1 module ietf-crypto-types {
2   yang-version 1.1;
3   namespace "urn:ietf:params:xml:ns:yang:ietf-crypto-types";
4   prefix ct;
5
6   import ietf-yang-types {
7     prefix yang;
8     reference
9       "RFC 6991: Common YANG Data Types";
10   }
11
12   import ietf-netconf-acm {
13     prefix nacm;
14     reference
15       "RFC 8341: Network Configuration Access Control Model";
16   }
17
18   organization
19     "IETF NETCONF (Network Configuration) Working Group";
20   contact
21     "WG Web:   <http://datatracker.ietf.org/wg/netconf/>
22      WG List:  <mailto:netconf@ietf.org>
23      Author:   Kent Watsen <mailto:kent+ietf@watsen.net>
24      Author:   Wang Haiguang <wang.haiguang.shieldlab@huawei.com>";
25
26   description
27     "This module defines common YANG types for cryptographic
28      applications.
29
30      Copyright (c) 2019 IETF Trust and the persons identified
31      as authors of the code. All rights reserved.
32
33      Redistribution and use in source and binary forms, with
34      or without modification, is permitted pursuant to, and
35      subject to the license terms contained in, the Simplified
36      BSD License set forth in Section 4.c of the IETF Trust's
37      Legal Provisions Relating to IETF Documents
38      (https://trustee.ietf.org/license-info).
39
40      This version of this YANG module is part of RFC XXXX
41      (https://www.rfc-editor.org/info/rfcXXXX); see the RFC
42      itself for full legal notices.;
43
44      The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL',
45      'SHALL NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED',
46      'NOT RECOMMENDED', 'MAY', and 'OPTIONAL' in this document
47      are to be interpreted as described in BCP 14 (RFC 2119)
48      (RFC 8174) when, and only when, they appear in all
49      capitals, as shown here.";
50
51   revision 2019-10-18 {
52     description
53       "Initial version";
54     reference
55       "RFC XXXX: Common YANG Data Types for Cryptography";
56   }
57
58   /**************************************/
59   /*   Identities for Hash Algorithms   */
60   /**************************************/
61
62   typedef hash-algorithm-t {
63     type union {
64       type uint16;
65       type enumeration {
66         enum NONE {
67           value 0;
68           description
69             "Hash algorithm is NULL.";
70         }
71         enum sha1 {
72           value 1;
73           status obsolete;
74           description
75             "The SHA1 algorithm.";
76           reference
77             "RFC 3174: US Secure Hash Algorithms 1 (SHA1).";
78         }
79         enum sha-224 {
80           value 2;
81           description
82             "The SHA-224 algorithm.";
83           reference
84             "RFC 6234: US Secure Hash Algorithms.";
85         }
86         enum sha-256 {
87           value 3;
88           description
89             "The SHA-256 algorithm.";
90           reference
91             "RFC 6234: US Secure Hash Algorithms.";
92         }
93         enum sha-384 {
94           value 4;
95           description
96             "The SHA-384 algorithm.";
97           reference
98             "RFC 6234: US Secure Hash Algorithms.";
99         }
100         enum sha-512 {
101           value 5;
102           description
103             "The SHA-512 algorithm.";
104           reference
105             "RFC 6234: US Secure Hash Algorithms.";
106         }
107         enum shake-128 {
108           value 6;
109           description
110             "The SHA3 algorithm with 128-bits output.";
111           reference
112             "National Institute of Standards and Technology,
113             SHA-3 Standard: Permutation-Based Hash and
114             Extendable-Output Functions, FIPS PUB 202, DOI
115             10.6028/NIST.FIPS.202, August 2015.";
116         }
117         enum shake-224 {
118           value 7;
119           description
120             "The SHA3 algorithm with 224-bits output.";
121           reference
122             "National Institute of Standards and Technology,
123             SHA-3 Standard: Permutation-Based Hash and
124             Extendable-Output Functions, FIPS PUB 202, DOI
125             10.6028/NIST.FIPS.202, August 2015.";
126         }
127         enum shake-256 {
128           value 8;
129           description
130             "The SHA3 algorithm with 256-bits output.";
131           reference
132             "National Institute of Standards and Technology,
133             SHA-3 Standard: Permutation-Based Hash and
134             Extendable-Output Functions, FIPS PUB 202, DOI
135             10.6028/NIST.FIPS.202, August 2015.";
136         }
137         enum shake-384 {
138           value 9;
139           description
140             "The SHA3 algorithm with 384-bits output.";
141           reference
142             "National Institute of Standards and Technology,
143             SHA-3 Standard: Permutation-Based Hash and
144             Extendable-Output Functions, FIPS PUB 202, DOI
145             10.6028/NIST.FIPS.202, August 2015.";
146         }
147         enum shake-512 {
148           value 10;
149           description
150             "The SHA3 algorithm with 384-bits output.";
151           reference
152             "National Institute of Standards and Technology,
153             SHA-3 Standard: Permutation-Based Hash and
154             Extendable-Output Functions, FIPS PUB 202, DOI
155             10.6028/NIST.FIPS.202, August 2015.";
156         }
157       }
158     }
159     default "0";
160     description
161       "The uint16 filed shall be set by individual protocol families
162        according to the hash algorithm value assigned by IANA. The
163        setting is optional and by default is 0.  The enumeration
164        filed is set to the selected hash algorithm.";
165   }
166
167   /***********************************************/
168   /*  Identities for Asymmetric Key Algorithms   */
169   /***********************************************/
170
171   typedef asymmetric-key-algorithm-t {
172     type union {
173       type uint16;
174       type enumeration {
175         enum NONE {
176           value 0;
177           description
178             "Asymetric key algorithm is NULL.";
179         }
180         enum rsa1024 {
181           value 1;
182           description
183             "The RSA algorithm using a 1024-bit key.";
184           reference
185             "RFC 8017: PKCS #1: RSA Cryptography
186              Specifications Version 2.2.";
187         }
188         enum rsa2048 {
189           value 2;
190           description
191             "The RSA algorithm using a 2048-bit key.";
192           reference
193             "RFC 8017:
194              PKCS #1: RSA Cryptography Specifications Version 2.2.";
195         }
196         enum rsa3072 {
197           value 3;
198           description
199             "The RSA algorithm using a 3072-bit key.";
200           reference
201             "RFC 8017:
202              PKCS #1: RSA Cryptography Specifications Version 2.2.";
203         }
204         enum rsa4096 {
205           value 4;
206           description
207             "The RSA algorithm using a 4096-bit key.";
208           reference
209             "RFC 8017:
210              PKCS #1: RSA Cryptography Specifications Version 2.2.";
211         }
212         enum rsa7680 {
213           value 5;
214           description
215             "The RSA algorithm using a 7680-bit key.";
216           reference
217             "RFC 8017:
218              PKCS #1: RSA Cryptography Specifications Version 2.2.";
219         }
220         enum rsa15360 {
221           value 6;
222           description
223             "The RSA algorithm using a 15360-bit key.";
224           reference
225             "RFC 8017:
226              PKCS #1: RSA Cryptography Specifications Version 2.2.";
227         }
228         enum secp192r1 {
229           value 7;
230           description
231             "The asymmetric algorithm using a NIST P192 Curve.";
232           reference
233             "RFC 6090:
234                Fundamental Elliptic Curve Cryptography Algorithms.
235              RFC 5480:
236                 Elliptic Curve Cryptography Subject Public Key
237                 Information.";
238         }
239         enum secp224r1 {
240           value 8;
241           description
242             "The asymmetric algorithm using a NIST P224 Curve.";
243           reference
244             "RFC 6090:
245                Fundamental Elliptic Curve Cryptography Algorithms.
246              RFC 5480:
247                Elliptic Curve Cryptography Subject Public Key
248                Information.";
249         }
250         enum secp256r1 {
251           value 9;
252           description
253             "The asymmetric algorithm using a NIST P256 Curve.";
254           reference
255             "RFC 6090:
256                Fundamental Elliptic Curve Cryptography Algorithms.
257              RFC 5480:
258                Elliptic Curve Cryptography Subject Public Key
259                Information.";
260         }
261         enum secp384r1 {
262           value 10;
263           description
264             "The asymmetric algorithm using a NIST P384 Curve.";
265           reference
266             "RFC 6090:
267                Fundamental Elliptic Curve Cryptography Algorithms.
268              RFC 5480:
269                Elliptic Curve Cryptography Subject Public Key
270                Information.";
271         }
272         enum secp521r1 {
273           value 11;
274           description
275             "The asymmetric algorithm using a NIST P521 Curve.";
276           reference
277             "RFC 6090:
278                Fundamental Elliptic Curve Cryptography Algorithms.
279              RFC 5480:
280                Elliptic Curve Cryptography Subject Public Key
281                Information.";
282         }
283         enum x25519 {
284           value 12;
285           description
286             "The asymmetric algorithm using a x.25519 Curve.";
287           reference
288             "RFC 7748:
289                Elliptic Curves for Security.";
290         }
291         enum x448 {
292           value 13;
293           description
294             "The asymmetric algorithm using a x.448 Curve.";
295           reference
296             "RFC 7748:
297                Elliptic Curves for Security.";
298         }
299       }
300     }
301     default "0";
302     description
303       "The uint16 filed shall be set by individual protocol
304        families according to the asymmetric key algorithm value
305        assigned by IANA. The setting is optional and by default
306        is 0.  The enumeration filed is set to the selected
307        asymmetric key algorithm.";
308   }
309
310   /*************************************/
311   /*   Identities for MAC Algorithms   */
312   /*************************************/
313
314   typedef mac-algorithm-t {
315     type union {
316       type uint16;
317       type enumeration {
318         enum NONE {
319           value 0;
320           description
321             "mac algorithm is NULL.";
322         }
323         enum hmac-sha1 {
324           value 1;
325           description
326             "Generating MAC using SHA1 hash function";
327           reference
328             "RFC 3174: US Secure Hash Algorithm 1 (SHA1)";
329         }
330         enum hmac-sha1-96 {
331           value 2;
332           description
333             "Generating MAC using SHA1 hash function";
334           reference
335             "RFC 2404: The Use of HMAC-SHA-1-96 within ESP and AH";
336         }
337         enum hmac-sha2-224 {
338           value 3;
339           description
340             "Generating MAC using SHA2 hash function";
341           reference
342             "RFC 6234: US Secure Hash Algorithms
343              (SHA and SHA-based HMAC and HKDF)";
344         }
345         enum hmac-sha2-256 {
346           value 4;
347           description
348             "Generating MAC using SHA2 hash function";
349           reference
350             "RFC 6234: US Secure Hash Algorithms
351              (SHA and SHA-based HMAC and HKDF)";
352         }
353         enum hmac-sha2-256-128 {
354           value 5;
355           description
356             "Generating a 256 bits MAC using SHA2 hash function and
357              truncate it to 128 bits";
358           reference
359             "RFC 4868: Using HMAC-SHA-256, HMAC-SHA-384,
360              and HMAC-SHA-512 with IPsec";
361         }
362         enum hmac-sha2-384 {
363           value 6;
364           description
365             "Generating a 384 bits MAC using SHA2 hash function";
366           reference
367             "RFC 6234: US Secure Hash Algorithms
368              (SHA and SHA-based HMAC and HKDF)";
369         }
370         enum hmac-sha2-384-192 {
371           value 7;
372           description
373             "Generating a 384 bits MAC using SHA2 hash function and
374              truncate it to 192 bits";
375           reference
376             "RFC 4868: Using HMAC-SHA-256, HMAC-SHA-384,
377              and HMAC-SHA-512 with IPsec";
378         }
379         enum hmac-sha2-512 {
380           value 8;
381           description
382             "Generating a 512 bits MAC using SHA2 hash function";
383           reference
384             "RFC 6234: US Secure Hash Algorithms
385              (SHA and SHA-based HMAC and HKDF)";
386         }
387         enum hmac-sha2-512-256 {
388           value 9;
389           description
390             "Generating a 512 bits MAC using SHA2 hash function and
391              truncate it to 256 bits";
392           reference
393             "RFC 4868: Using HMAC-SHA-256, HMAC-SHA-384,
394              and HMAC-SHA-512 with IPsec";
395         }
396         enum aes-128-gmac {
397           value 10;
398           description
399             "Generating 128-bit MAC using the Advanced Encryption
400              Standard (AES) Galois Message Authentication Code
401              (GMAC) as a mechanism to provide data origin
402              authentication.";
403           reference
404             "RFC 4543:
405                The Use of Galois Message Authentication Code (GMAC)
406                in IPsec ESP and AH";
407         }
408         enum aes-192-gmac {
409           value 11;
410           description
411             "Generating 192-bit MAC using the Advanced Encryption
412              Standard (AES) Galois Message Authentication Code
413              (GMAC) as a mechanism to provide data origin
414              authentication.";
415           reference
416             "RFC 4543:
417                The Use of Galois Message Authentication Code (GMAC)
418                in IPsec ESP and AH";
419         }
420         enum aes-256-gmac {
421           value 12;
422           description
423             "Generating 256-bit MAC using the Advanced Encryption
424              Standard (AES) Galois Message Authentication Code
425              (GMAC) as a mechanism to provide data origin
426              authentication.";
427           reference
428             "RFC 4543:
429                The Use of Galois Message Authentication Code (GMAC)
430                in IPsec ESP and AH";
431         }
432         enum aes-cmac-96 {
433           value 13;
434           description
435             "Generating 96-bit MAC using Advanced Encryption
436              Standard (AES) Cipher-based Message Authentication
437              Code (CMAC)";
438           reference
439             "RFC 4494:
440                The AES-CMAC Algorithm and its Use with IPsec";
441         }
442         enum aes-cmac-128 {
443           value 14;
444           description
445             "Generating 128-bit MAC using Advanced Encryption
446              Standard (AES) Cipher-based Message Authentication
447              Code (CMAC)";
448           reference
449             "RFC 4494:
450                The AES-CMAC Algorithm and its Use with IPsec";
451         }
452         enum sha1-des3-kd {
453           value 15;
454           description
455             "Generating MAC using triple DES encryption function";
456           reference
457             "RFC 3961:
458                Encryption and Checksum Specifications for Kerberos
459                5";
460         }
461       }
462     }
463     default "0";
464     description
465       "The uint16 filed shall be set by individual protocol
466        families according to the mac algorithm value assigned by
467        IANA. The setting is optional and by default is 0.  The
468        enumeration filed is set to the selected mac algorithm.";
469   }
470
471   /********************************************/
472   /*   Identities for Encryption Algorithms   */
473   /********************************************/
474
475   typedef encryption-algorithm-t {
476     type union {
477       type uint16;
478       type enumeration {
479         enum NONE {
480           value 0;
481           description
482             "Encryption algorithm is NULL.";
483         }
484         enum aes-128-cbc {
485           value 1;
486           description
487             "Encrypt message with AES algorithm in CBC mode with
488              a key length of 128 bits.";
489           reference
490             "RFC 3565: Use of the Advanced Encryption Standard (AES)
491              Encryption Algorithm in Cryptographic Message Syntax
492              (CMS)";
493         }
494         enum aes-192-cbc {
495           value 2;
496           description
497             "Encrypt message with AES algorithm in CBC mode with
498              a key length of 192 bits";
499           reference
500             "RFC 3565: Use of the Advanced Encryption Standard (AES)
501              Encryption Algorithm in Cryptographic Message Syntax
502              (CMS)";
503         }
504         enum aes-256-cbc {
505           value 3;
506           description
507             "Encrypt message with AES algorithm in CBC mode with
508              a key length of 256 bits";
509           reference
510             "RFC 3565: Use of the Advanced Encryption Standard (AES)
511              Encryption Algorithm in Cryptographic Message Syntax
512              (CMS)";
513         }
514         enum aes-128-ctr {
515           value 4;
516           description
517             "Encrypt message with AES algorithm in CTR mode with
518              a key length of 128 bits";
519           reference
520             "RFC 3686:
521                Using Advanced Encryption Standard (AES) Counter
522                Mode with IPsec Encapsulating Security Payload
523                (ESP)";
524         }
525         enum aes-192-ctr {
526           value 5;
527           description
528             "Encrypt message with AES algorithm in CTR mode with
529              a key length of 192 bits";
530           reference
531             "RFC 3686:
532                Using Advanced Encryption Standard (AES) Counter
533                Mode with IPsec Encapsulating Security Payload
534                (ESP)";
535         }
536         enum aes-256-ctr {
537           value 6;
538           description
539             "Encrypt message with AES algorithm in CTR mode with
540              a key length of 256 bits";
541           reference
542             "RFC 3686:
543                Using Advanced Encryption Standard (AES) Counter
544                Mode with IPsec Encapsulating Security Payload
545                (ESP)";
546         }
547         enum des3-cbc-sha1-kd {
548           value 7;
549           description
550             "Encrypt message with 3DES algorithm in CBC mode
551              with sha1 function for key derivation";
552           reference
553             "RFC 3961:
554                Encryption and Checksum Specifications for
555                Kerberos 5";
556         }
557         enum rc4-hmac {
558           value 8;
559           description
560             "Encrypt message with rc4 algorithm";
561           reference
562             "RFC 4757:
563                The RC4-HMAC Kerberos Encryption Types Used by
564                Microsoft Windows";
565         }
566         enum rc4-hmac-exp {
567           value 9;
568           description
569             "Encrypt message with rc4 algorithm that is exportable";
570           reference
571             "RFC 4757:
572                The RC4-HMAC Kerberos Encryption Types Used by
573                Microsoft Windows";
574         }
575       }
576     }
577     default "0";
578     description
579       "The uint16 filed shall be set by individual protocol
580        families according to the encryption algorithm value
581        assigned by IANA. The setting is optional and by default
582        is 0.  The enumeration filed is set to the selected
583        encryption algorithm.";
584   }
585
586   /****************************************************/
587   /*   Identities for Encryption and MAC Algorithms   */
588   /****************************************************/
589
590   typedef encryption-and-mac-algorithm-t {
591     type union {
592       type uint16;
593       type enumeration {
594         enum NONE {
595           value 0;
596           description
597             "Encryption and MAC algorithm is NULL.";
598           reference
599             "None";
600         }
601         enum aes-128-ccm {
602           value 1;
603           description
604             "Encrypt message with AES algorithm in CCM
605              mode with a key length of 128 bits; it can
606              also be used for generating MAC";
607           reference
608             "RFC 4309: Using Advanced Encryption Standard
609              (AES) CCM Mode with IPsec Encapsulating Security
610              Payload (ESP)";
611         }
612         enum aes-192-ccm {
613           value 2;
614           description
615             "Encrypt message with AES algorithm in CCM
616              mode with a key length of 192 bits; it can
617              also be used for generating MAC";
618           reference
619             "RFC 4309: Using Advanced Encryption Standard
620              (AES) CCM Mode with IPsec Encapsulating Security
621              Payload (ESP)";
622         }
623         enum aes-256-ccm {
624           value 3;
625           description
626             "Encrypt message with AES algorithm in CCM
627              mode with a key length of 256 bits; it can
628              also be used for generating MAC";
629           reference
630             "RFC 4309: Using Advanced Encryption Standard
631              (AES) CCM Mode with IPsec Encapsulating Security
632              Payload (ESP)";
633         }
634         enum aes-128-gcm {
635           value 4;
636           description
637             "Encrypt message with AES algorithm in GCM
638              mode with a key length of 128 bits; it can
639              also be used for generating MAC";
640           reference
641             "RFC 4106: The Use of Galois/Counter Mode (GCM)
642              in IPsec Encapsulating Security Payload (ESP)";
643         }
644         enum aes-192-gcm {
645           value 5;
646           description
647             "Encrypt message with AES algorithm in GCM
648              mode with a key length of 192 bits; it can
649              also be used for generating MAC";
650           reference
651             "RFC 4106: The Use of Galois/Counter Mode (GCM)
652              in IPsec Encapsulating Security Payload (ESP)";
653         }
654         enum aes-256-gcm {
655           value 6;
656           description
657             "Encrypt message with AES algorithm in GCM
658              mode with a key length of 256 bits; it can
659              also be used for generating MAC";
660           reference
661             "RFC 4106: The Use of Galois/Counter Mode (GCM)
662              in IPsec Encapsulating Security Payload (ESP)";
663         }
664         enum chacha20-poly1305 {
665           value 7;
666           description
667             "Encrypt message with chacha20 algorithm and generate
668              MAC with POLY1305; it can also be used for generating
669              MAC";
670           reference
671             "RFC 8439: ChaCha20 and Poly1305 for IETF Protocols";
672         }
673       }
674     }
675     default "0";
676     description
677       "The uint16 filed shall be set by individual protocol
678        families according to the encryption and mac algorithm value
679        assigned by IANA. The setting is optional and by default is
680        0.  The enumeration filed is set to the selected encryption
681        and mac algorithm.";
682   }
683
684   /******************************************/
685   /*   Identities for signature algorithm   */
686   /******************************************/
687
688   typedef signature-algorithm-t {
689     type union {
690       type uint16;
691       type enumeration {
692         enum NONE {
693           value 0;
694           description
695             "Signature algorithm is NULL";
696         }
697         enum dsa-sha1 {
698           value 1;
699           description
700             "The signature algorithm using DSA algorithm with SHA1
701              hash algorithm";
702           reference
703             "RFC 4253:
704                The Secure Shell (SSH) Transport Layer Protocol";
705         }
706         enum rsassa-pkcs1-sha1 {
707           value 2;
708           description
709             "The signature algorithm using RSASSA-PKCS1-v1_5 with
710              the SHA1 hash algorithm.";
711           reference
712             "RFC 4253:
713                The Secure Shell (SSH) Transport Layer Protocol";
714         }
715         enum rsassa-pkcs1-sha256 {
716           value 3;
717           description
718             "The signature algorithm using RSASSA-PKCS1-v1_5 with
719              the SHA256 hash algorithm.";
720           reference
721             "RFC 8332:
722                Use of RSA Keys with SHA-256 and SHA-512 in the
723                Secure Shell (SSH) Protocol
724              RFC 8446:
725                The Transport Layer Security (TLS) Protocol
726                Version 1.3";
727         }
728         enum rsassa-pkcs1-sha384 {
729           value 4;
730           description
731             "The signature algorithm using RSASSA-PKCS1-v1_5 with
732              the SHA384 hash algorithm.";
733           reference
734             "RFC 8446:
735                The Transport Layer Security (TLS) Protocol
736                Version 1.3";
737         }
738         enum rsassa-pkcs1-sha512 {
739           value 5;
740           description
741             "The signature algorithm using RSASSA-PKCS1-v1_5 with
742              the SHA512 hash algorithm.";
743           reference
744             "RFC 8332:
745                Use of RSA Keys with SHA-256 and SHA-512 in the
746                Secure Shell (SSH) Protocol
747              RFC 8446:
748                The Transport Layer Security (TLS) Protocol
749                Version 1.3";
750         }
751         enum rsassa-pss-rsae-sha256 {
752           value 6;
753           description
754             "The signature algorithm using RSASSA-PSS with mask
755              generation function 1 and SHA256 hash algorithm. If
756              the public key is carried in an X.509 certificate,
757              it MUST use the rsaEncryption OID";
758           reference
759             "RFC 8446:
760                The Transport Layer Security (TLS) Protocol
761                Version 1.3";
762         }
763         enum rsassa-pss-rsae-sha384 {
764           value 7;
765           description
766             "The signature algorithm using RSASSA-PSS with mask
767              generation function 1 and SHA384 hash algorithm. If
768              the public key is carried in an X.509 certificate,
769              it MUST use the rsaEncryption OID";
770           reference
771             "RFC 8446:
772                The Transport Layer Security (TLS) Protocol
773                Version 1.3";
774         }
775         enum rsassa-pss-rsae-sha512 {
776           value 8;
777           description
778             "The signature algorithm using RSASSA-PSS with mask
779              generation function 1 and SHA512 hash algorithm. If
780              the public key is carried in an X.509 certificate,
781              it MUST use the rsaEncryption OID";
782           reference
783             "RFC 8446:
784                The Transport Layer Security (TLS) Protocol
785                Version 1.3";
786         }
787         enum rsassa-pss-pss-sha256 {
788           value 9;
789           description
790             "The signature algorithm using RSASSA-PSS with mask
791              generation function 1 and SHA256 hash algorithm. If
792              the public key is carried in an X.509 certificate,
793              it MUST use the rsaEncryption OID";
794           reference
795             "RFC 8446:
796                The Transport Layer Security (TLS) Protocol
797                Version 1.3";
798         }
799         enum rsassa-pss-pss-sha384 {
800           value 10;
801           description
802             "The signature algorithm using RSASSA-PSS with mask
803              generation function 1 and SHA384 hash algorithm. If
804              the public key is carried in an X.509 certificate,
805              it MUST use the rsaEncryption OID";
806           reference
807             "RFC 8446:
808                The Transport Layer Security (TLS) Protocol
809                Version 1.3";
810         }
811         enum rsassa-pss-pss-sha512 {
812           value 11;
813           description
814             "The signature algorithm using RSASSA-PSS with mask
815              generation function 1 and SHA512 hash algorithm. If
816              the public key is carried in an X.509 certificate,
817              it MUST use the rsaEncryption OID";
818           reference
819             "RFC 8446:
820                The Transport Layer Security (TLS) Protocol
821                Version 1.3";
822         }
823         enum ecdsa-secp256r1-sha256 {
824           value 12;
825           description
826             "The signature algorithm using ECDSA with curve name
827              secp256r1 and SHA256 hash algorithm.";
828           reference
829             "RFC 5656:
830                Elliptic Curve Algorithm Integration in the Secure
831                Shell Transport Layer
832              RFC 8446:
833                The Transport Layer Security (TLS) Protocol
834                Version 1.3";
835         }
836         enum ecdsa-secp384r1-sha384 {
837           value 13;
838           description
839             "The signature algorithm using ECDSA with curve name
840              secp384r1 and SHA384 hash algorithm.";
841           reference
842             "RFC 5656:
843                Elliptic Curve Algorithm Integration in the Secure
844                Shell Transport Layer
845              RFC 8446:
846                The Transport Layer Security (TLS) Protocol
847                Version 1.3";
848         }
849         enum ecdsa-secp521r1-sha512 {
850           value 14;
851           description
852             "The signature algorithm using ECDSA with curve name
853              secp521r1 and SHA512 hash algorithm.";
854           reference
855             "RFC 5656:
856                Elliptic Curve Algorithm Integration in the Secure
857                Shell Transport Layer
858              RFC 8446:
859                The Transport Layer Security (TLS) Protocol
860                Version 1.3";
861         }
862         enum ed25519 {
863           value 15;
864           description
865             "The signature algorithm using EdDSA with curve x25519";
866           reference
867             "RFC 8032:
868                Edwards-Curve Digital Signature Algorithm (EdDSA)";
869         }
870         enum ed25519-cts {
871           value 16;
872           description
873             "The signature algorithm using EdDSA with curve x25519
874              with phflag = 0";
875           reference
876             "RFC 8032:
877                Edwards-Curve Digital Signature Algorithm (EdDSA)";
878         }
879         enum ed25519-ph {
880           value 17;
881           description
882             "The signature algorithm using EdDSA with curve x25519
883              with phflag = 1";
884           reference
885             "RFC 8032:
886                Edwards-Curve Digital Signature Algorithm (EdDSA)";
887         }
888         enum ed25519-sha512 {
889           value 18;
890           description
891             "The signature algorithm using EdDSA with curve x25519
892             and SHA-512 function";
893           reference
894             "RFC 8419:
895                Use of Edwards-Curve Digital Signature Algorithm
896                (EdDSA) Signatures in the Cryptographic Message
897                Syntax (CMS)";
898         }
899         enum ed448 {
900           value 19;
901           description
902             "The signature algorithm using EdDSA with curve x448";
903           reference
904             "RFC 8032:
905                Edwards-Curve Digital Signature Algorithm (EdDSA)";
906         }
907         enum ed448-ph {
908           value 20;
909           description
910             "The signature algorithm using EdDSA with curve x448
911              and with PH being SHAKE256(x, 64) and phflag being 1";
912           reference
913             "RFC 8032:
914                Edwards-Curve Digital Signature Algorithm (EdDSA)";
915         }
916         enum ed448-shake256 {
917           value 21;
918           description
919             "The signature algorithm using EdDSA with curve x448
920             and SHAKE-256 function";
921           reference
922             "RFC 8419:
923                Use of Edwards-Curve Digital Signature Algorithm
924                (EdDSA) Signatures in the Cryptographic Message
925                Syntax (CMS)";
926         }
927         enum ed448-shake256-len {
928           value 22;
929           description
930             "The signature algorithm using EdDSA with curve x448
931             and SHAKE-256 function and a customized hash output";
932           reference
933             "RFC 8419:
934                Use of Edwards-Curve Digital Signature Algorithm
935                (EdDSA) Signatures in the Cryptographic Message
936                Syntax (CMS)";
937         }
938         enum rsa-sha2-256 {
939           value 23;
940           description
941             "The signature algorithm using RSA with SHA2 function
942              for SSH protocol";
943           reference
944             "RFC 8332:
945              Use of RSA Keys with SHA-256 and SHA-512
946              in the Secure Shell (SSH) Protocol";
947         }
948         enum rsa-sha2-512 {
949           value 24;
950           description
951             "The signature algorithm using RSA with SHA2 function
952              for SSH protocol";
953           reference
954             "RFC 8332:
955              Use of RSA Keys with SHA-256 and SHA-512
956              in the Secure Shell (SSH) Protocol";
957         }
958         enum eccsi {
959           value 25;
960           description
961             "The signature algorithm using ECCSI signature as
962              defined in RFC 6507.";
963           reference
964             "RFC 6507:
965                Elliptic Curve-Based Certificateless Signatures
966                for Identity-based Encryption (ECCSI)";
967         }
968       }
969     }
970     default "0";
971     description
972       "The uint16 filed shall be set by individual protocol
973        families according to the signature algorithm value
974        assigned by IANA. The setting is optional and by default
975        is 0.  The enumeration filed is set to the selected
976        signature algorithm.";
977   }
978
979   /**********************************************/
980   /*   Identities for key exchange algorithms   */
981   /**********************************************/
982
983   typedef key-exchange-algorithm-t {
984     type union {
985       type uint16;
986       type enumeration {
987         enum NONE {
988           value 0;
989           description
990             "Key exchange algorithm is NULL.";
991         }
992         enum psk-only {
993           value 1;
994           description
995             "Using Pre-shared key for authentication and key
996              exchange";
997           reference
998             "RFC 4279:
999                Pre-Shared Key cipher suites for Transport Layer
1000                Security (TLS)";
1001         }
1002         enum dhe-ffdhe2048 {
1003           value 2;
1004           description
1005             "Ephemeral Diffie Hellman key exchange with 2048 bit
1006              finite field";
1007           reference
1008             "RFC 7919:
1009                Negotiated Finite Field Diffie-Hellman Ephemeral
1010                Parameters for Transport Layer Security (TLS)";
1011         }
1012         enum dhe-ffdhe3072 {
1013           value 3;
1014           description
1015             "Ephemeral Diffie Hellman key exchange with 3072 bit
1016              finite field";
1017           reference
1018             "RFC 7919:
1019                Negotiated Finite Field Diffie-Hellman Ephemeral
1020                Parameters for Transport Layer Security (TLS)";
1021         }
1022         enum dhe-ffdhe4096 {
1023           value 4;
1024           description
1025             "Ephemeral Diffie Hellman key exchange with 4096 bit
1026              finite field";
1027           reference
1028             "RFC 7919:
1029                Negotiated Finite Field Diffie-Hellman Ephemeral
1030                Parameters for Transport Layer Security (TLS)";
1031         }
1032         enum dhe-ffdhe6144 {
1033           value 5;
1034           description
1035             "Ephemeral Diffie Hellman key exchange with 6144 bit
1036              finite field";
1037           reference
1038             "RFC 7919:
1039                Negotiated Finite Field Diffie-Hellman Ephemeral
1040                Parameters for Transport Layer Security (TLS)";
1041         }
1042         enum dhe-ffdhe8192 {
1043           value 6;
1044           description
1045             "Ephemeral Diffie Hellman key exchange with 8192 bit
1046              finite field";
1047           reference
1048             "RFC 7919:
1049                Negotiated Finite Field Diffie-Hellman Ephemeral
1050                Parameters for Transport Layer Security (TLS)";
1051         }
1052         enum psk-dhe-ffdhe2048 {
1053           value 7;
1054           description
1055             "Key exchange using pre-shared key with Diffie-Hellman
1056              key generation mechanism, where the DH group is
1057              FFDHE2048";
1058           reference
1059             "RFC 8446:
1060                The Transport Layer Security (TLS) Protocol
1061                Version 1.3";
1062         }
1063         enum psk-dhe-ffdhe3072 {
1064           value 8;
1065           description
1066             "Key exchange using pre-shared key with Diffie-Hellman
1067              key generation mechanism, where the DH group is
1068              FFDHE3072";
1069           reference
1070             "RFC 8446:
1071                The Transport Layer Security (TLS) Protocol
1072                Version 1.3";
1073         }
1074         enum psk-dhe-ffdhe4096 {
1075           value 9;
1076           description
1077             "Key exchange using pre-shared key with Diffie-Hellman
1078              key generation mechanism, where the DH group is
1079              FFDHE4096";
1080           reference
1081             "RFC 8446:
1082                The Transport Layer Security (TLS) Protocol
1083                Version 1.3";
1084         }
1085         enum psk-dhe-ffdhe6144 {
1086           value 10;
1087           description
1088             "Key exchange using pre-shared key with Diffie-Hellman
1089              key generation mechanism, where the DH group is
1090              FFDHE6144";
1091           reference
1092             "RFC 8446:
1093                The Transport Layer Security (TLS) Protocol
1094                Version 1.3";
1095         }
1096         enum psk-dhe-ffdhe8192 {
1097           value 11;
1098           description
1099             "Key exchange using pre-shared key with Diffie-Hellman
1100              key generation mechanism, where the DH group is
1101              FFDHE8192";
1102           reference
1103             "RFC 8446:
1104                The Transport Layer Security (TLS) Protocol
1105                Version 1.3";
1106         }
1107         enum ecdhe-secp256r1 {
1108           value 12;
1109           description
1110             "Ephemeral Diffie Hellman key exchange with elliptic
1111              group over curve secp256r1";
1112           reference
1113             "RFC 8422:
1114                Elliptic Curve Cryptography (ECC) Cipher Suites
1115                for Transport Layer Security (TLS) Versions 1.2
1116                and Earlier";
1117         }
1118         enum ecdhe-secp384r1 {
1119           value 13;
1120           description
1121             "Ephemeral Diffie Hellman key exchange with elliptic
1122              group over curve secp384r1";
1123           reference
1124             "RFC 8422:
1125                Elliptic Curve Cryptography (ECC) Cipher Suites
1126                for Transport Layer Security (TLS) Versions 1.2
1127                and Earlier";
1128         }
1129         enum ecdhe-secp521r1 {
1130           value 14;
1131           description
1132             "Ephemeral Diffie Hellman key exchange with elliptic
1133              group over curve secp521r1";
1134           reference
1135             "RFC 8422:
1136                Elliptic Curve Cryptography (ECC) Cipher Suites
1137                for Transport Layer Security (TLS) Versions 1.2
1138                and Earlier";
1139         }
1140         enum ecdhe-x25519 {
1141           value 15;
1142           description
1143             "Ephemeral Diffie Hellman key exchange with elliptic
1144              group over curve x25519";
1145           reference
1146             "RFC 8422:
1147                Elliptic Curve Cryptography (ECC) Cipher Suites
1148                for Transport Layer Security (TLS) Versions 1.2
1149                and Earlier";
1150         }
1151         enum ecdhe-x448 {
1152           value 16;
1153           description
1154             "Ephemeral Diffie Hellman key exchange with elliptic
1155              group over curve x448";
1156           reference
1157             "RFC 8422:
1158                Elliptic Curve Cryptography (ECC) Cipher Suites
1159                for Transport Layer Security (TLS) Versions 1.2
1160                and Earlier";
1161         }
1162         enum psk-ecdhe-secp256r1 {
1163           value 17;
1164           description
1165             "Key exchange using pre-shared key with elliptic
1166              group-based Ephemeral Diffie Hellman key exchange
1167              over curve secp256r1";
1168           reference
1169             "RFC 8446:
1170                The Transport Layer Security (TLS) Protocol
1171                Version 1.3";
1172         }
1173         enum psk-ecdhe-secp384r1 {
1174           value 18;
1175           description
1176             "Key exchange using pre-shared key with elliptic
1177              group-based Ephemeral Diffie Hellman key exchange
1178              over curve secp384r1";
1179           reference
1180             "RFC 8446:
1181                The Transport Layer Security (TLS) Protocol
1182                Version 1.3";
1183         }
1184         enum psk-ecdhe-secp521r1 {
1185           value 19;
1186           description
1187             "Key exchange using pre-shared key with elliptic
1188              group-based Ephemeral Diffie Hellman key exchange
1189              over curve secp521r1";
1190           reference
1191             "RFC 8446:
1192                The Transport Layer Security (TLS) Protocol
1193                Version 1.3";
1194         }
1195         enum psk-ecdhe-x25519 {
1196           value 20;
1197           description
1198             "Key exchange using pre-shared key with elliptic
1199              group-based Ephemeral Diffie Hellman key exchange
1200              over curve x25519";
1201           reference
1202             "RFC 8446:
1203                The Transport Layer Security (TLS) Protocol
1204                Version 1.3";
1205         }
1206         enum psk-ecdhe-x448 {
1207           value 21;
1208           description
1209             "Key exchange using pre-shared key with elliptic
1210              group-based Ephemeral Diffie Hellman key exchange
1211              over curve x448";
1212           reference
1213             "RFC 8446:
1214                The Transport Layer Security (TLS) Protocol
1215                Version 1.3";
1216         }
1217         enum diffie-hellman-group14-sha1 {
1218           value 22;
1219           description
1220             "Using DH group14 and SHA1 for key exchange";
1221           reference
1222             "RFC 4253:
1223                The Secure Shell (SSH) Transport Layer Protocol";
1224         }
1225         enum diffie-hellman-group14-sha256 {
1226           value 23;
1227           description
1228             "Using DH group14 and SHA-256 for key exchange";
1229           reference
1230             "RFC 8268:
1231               More Modular Exponentiation (MODP) Diffie-Hellman (DH)
1232               Key Exchange (KEX) Groups for Secure Shell (SSH)";
1233         }
1234         enum diffie-hellman-group15-sha512 {
1235           value 24;
1236           description
1237             "Using DH group15 and SHA-512 for key exchange";
1238           reference
1239             "RFC 8268:
1240               More Modular Exponentiation (MODP) Diffie-Hellman (DH)
1241               Key Exchange (KEX) Groups for Secure Shell (SSH)";
1242         }
1243         enum diffie-hellman-group16-sha512 {
1244           value 25;
1245           description
1246             "Using DH group16 and SHA-512 for key exchange";
1247           reference
1248             "RFC 8268:
1249               More Modular Exponentiation (MODP) Diffie-Hellman (DH)
1250               Key Exchange (KEX) Groups for Secure Shell (SSH)";
1251         }
1252         enum diffie-hellman-group17-sha512 {
1253           value 26;
1254           description
1255             "Using DH group17 and SHA-512 for key exchange";
1256           reference
1257             "RFC 8268:
1258               More Modular Exponentiation (MODP) Diffie-Hellman (DH)
1259               Key Exchange (KEX) Groups for Secure Shell (SSH)";
1260         }
1261         enum diffie-hellman-group18-sha512 {
1262           value 27;
1263           description
1264             "Using DH group18 and SHA-512 for key exchange";
1265           reference
1266             "RFC 8268:
1267               More Modular Exponentiation (MODP) Diffie-Hellman (DH)
1268               Key Exchange (KEX) Groups for Secure Shell (SSH)";
1269         }
1270         enum ecdh-sha2-secp256r1 {
1271           value 28;
1272           description
1273             "Elliptic curve-based Diffie Hellman key exchange over
1274              curve ecp256r1 and using SHA2 for MAC generation";
1275           reference
1276             "RFC 6239:
1277                Suite B Cryptographic Suites for Secure Shell (SSH)";
1278         }
1279         enum ecdh-sha2-secp384r1 {
1280           value 29;
1281           description
1282             "Elliptic curve-based Diffie Hellman key exchange over
1283              curve ecp384r1 and using SHA2 for MAC generation";
1284           reference
1285             "RFC 6239:
1286                Suite B Cryptographic Suites for Secure Shell (SSH)";
1287         }
1288         enum ecdh-x25519-x9.63-sha256 {
1289           value 30;
1290           description
1291             "Elliptic curve-based Diffie Hellman key exchange over
1292              curve x.25519 and using ANSI x9.63 with SHA256 as KDF";
1293           reference
1294             "RFC 8418:
1295                Use of the Elliptic Curve Diffie-Hellman Key Agreement
1296                Algorithm with X25519 and X448 in the Cryptographic
1297                Message Syntax (CMS)";
1298         }
1299         enum ecdh-x25519-x9.63-sha384 {
1300           value 31;
1301           description
1302             "Elliptic curve-based Diffie Hellman key exchange over
1303              curve x.25519 and using ANSI x9.63 with SHA384 as KDF";
1304           reference
1305             "RFC 8418:
1306                Use of the Elliptic Curve Diffie-Hellman Key Agreement
1307                Algorithm with X25519 and X448 in the Cryptographic
1308                Message Syntax (CMS)";
1309         }
1310         enum ecdh-x25519-x9.63-sha512 {
1311           value 32;
1312           description
1313             "Elliptic curve-based Diffie Hellman key exchange over
1314              curve x.25519 and using ANSI x9.63 with SHA512 as KDF";
1315           reference
1316             "RFC 8418:
1317                Use of the Elliptic Curve Diffie-Hellman Key Agreement
1318                Algorithm with X25519 and X448 in the Cryptographic
1319                Message Syntax (CMS)";
1320         }
1321         enum ecdh-x25519-hkdf-sha256 {
1322           value 33;
1323           description
1324             "Elliptic curve-based Diffie Hellman key exchange over
1325              curve x.25519 and using HKDF with SHA256 as KDF";
1326           reference
1327             "RFC 8418:
1328                Use of the Elliptic Curve Diffie-Hellman Key Agreement
1329                Algorithm with X25519 and X448 in the Cryptographic
1330                Message Syntax (CMS)";
1331         }
1332         enum ecdh-x25519-hkdf-sha384 {
1333           value 34;
1334           description
1335             "Elliptic curve-based Diffie Hellman key exchange over
1336              curve x.25519 and using HKDF with SHA384 as KDF";
1337           reference
1338             "RFC 8418:
1339                Use of the Elliptic Curve Diffie-Hellman Key Agreement
1340                Algorithm with X25519 and X448 in the Cryptographic
1341                Message Syntax (CMS)";
1342         }
1343         enum ecdh-x25519-hkdf-sha512 {
1344           value 35;
1345           description
1346             "Elliptic curve-based Diffie Hellman key exchange over
1347              curve x.25519 and using HKDF with SHA512 as KDF";
1348           reference
1349             "RFC 8418:
1350                Use of the Elliptic Curve Diffie-Hellman Key Agreement
1351                Algorithm with X25519 and X448 in the Cryptographic
1352                Message Syntax (CMS)";
1353         }
1354         enum ecdh-x448-x9.63-sha256 {
1355           value 36;
1356           description
1357             "Elliptic curve-based Diffie Hellman key exchange over
1358              curve x.448 and using ANSI x9.63 with SHA256 as KDF";
1359           reference
1360             "RFC 8418:
1361                Use of the Elliptic Curve Diffie-Hellman Key Agreement
1362                Algorithm with X25519 and X448 in the Cryptographic
1363                Message Syntax (CMS)";
1364         }
1365         enum ecdh-x448-x9.63-sha384 {
1366           value 37;
1367           description
1368             "Elliptic curve-based Diffie Hellman key exchange over
1369              curve x.448 and using ANSI x9.63 with SHA384 as KDF";
1370           reference
1371             "RFC 8418:
1372                Use of the Elliptic Curve Diffie-Hellman Key Agreement
1373                Algorithm with X25519 and X448 in the Cryptographic
1374                Message Syntax (CMS)";
1375         }
1376         enum ecdh-x448-x9.63-sha512 {
1377           value 38;
1378           description
1379             "Elliptic curve-based Diffie Hellman key exchange over
1380              curve x.448 and using ANSI x9.63 with SHA512 as KDF";
1381           reference
1382             "RFC 8418:
1383                Use of the Elliptic Curve Diffie-Hellman Key Agreement
1384                Algorithm with X25519 and X448 in the Cryptographic
1385                Message Syntax (CMS)";
1386         }
1387         enum ecdh-x448-hkdf-sha256 {
1388           value 39;
1389           description
1390             "Elliptic curve-based Diffie Hellman key exchange over
1391              curve x.448 and using HKDF with SHA256 as KDF";
1392           reference
1393             "RFC 8418:
1394                Use of the Elliptic Curve Diffie-Hellman Key Agreement
1395                Algorithm with X25519 and X448 in the Cryptographic
1396                Message Syntax (CMS)";
1397         }
1398         enum ecdh-x448-hkdf-sha384 {
1399           value 40;
1400           description
1401             "Elliptic curve-based Diffie Hellman key exchange over
1402              curve x.448 and using HKDF with SHA384 as KDF";
1403           reference
1404             "RFC 8418:
1405                Use of the Elliptic Curve Diffie-Hellman Key Agreement
1406                Algorithm with X25519 and X448 in the Cryptographic
1407                Message Syntax (CMS)";
1408         }
1409         enum ecdh-x448-hkdf-sha512 {
1410           value 41;
1411           description
1412             "Elliptic curve-based Diffie Hellman key exchange over
1413              curve x.448 and using HKDF with SHA512 as KDF";
1414           reference
1415             "RFC 8418:
1416                Use of the Elliptic Curve Diffie-Hellman Key Agreement
1417                Algorithm with X25519 and X448 in the Cryptographic
1418                Message Syntax (CMS)";
1419         }
1420
1421         enum rsaes-oaep {
1422           value 42;
1423           description
1424             "RSAES-OAEP combines the RSAEP and RSADP primitives with
1425              the EME-OAEP encoding method";
1426           reference
1427             "RFC 8017:
1428                PKCS #1:
1429                  RSA Cryptography Specifications Version 2.2.";
1430         }
1431         enum rsaes-pkcs1-v1_5 {
1432           value 43;
1433           description
1434             "RSAES-PKCS1-v1_5 combines the RSAEP and RSADP
1435              primitives with the EME-PKCS1-v1_5 encoding method";
1436           reference
1437             "RFC 8017:
1438                PKCS #1:
1439                  RSA Cryptography Specifications Version 2.2.";
1440         }
1441       }
1442     }
1443     default "0";
1444     description
1445       "The uint16 filed shall be set by individual protocol
1446        families according to the key exchange algorithm value
1447        assigned by IANA. The setting is optional and by default
1448        is 0.  The enumeration filed is set to the selected key
1449        exchange algorithm.";
1450   }
1451
1452   /********************************************/
1453   /*   Identities for Key Format Structures   */
1454   /********************************************/
1455
1456   /*** all key format types ****/
1457
1458   identity key-format-base {
1459     description "Base key-format identity for all keys.";
1460   }
1461
1462   identity public-key-format {
1463     base "key-format-base";
1464     description "Base key-format identity for public keys.";
1465   }
1466
1467   identity private-key-format {
1468     base "key-format-base";
1469     description "Base key-format identity for private keys.";
1470   }
1471
1472   identity symmetric-key-format {
1473     base "key-format-base";
1474     description "Base key-format identity for symmetric keys.";
1475   }
1476
1477   /**** for private keys ****/
1478
1479   identity rsa-private-key-format {
1480       base "private-key-format";
1481       description "An RSAPrivateKey (from RFC 3447).";
1482   }
1483
1484   identity ec-private-key-format {
1485       base "private-key-format";
1486       description "An ECPrivateKey (from RFC 5915)";
1487   }
1488
1489   identity one-asymmetric-key-format {
1490       base "private-key-format";
1491       description "A OneAsymmetricKey (from RFC 5958).";
1492   }
1493
1494   identity encrypted-private-key-format {
1495       base "private-key-format";
1496       description
1497         "A CMS EncryptedData structure (RFC 5652)
1498          containing a OneAsymmetricKey (RFC 5958).";
1499    }
1500
1501   /**** for public keys ****/
1502
1503   identity ssh-public-key-format {
1504       base "public-key-format";
1505       description
1506         "The public key format described by RFC 4716.";
1507   }
1508
1509   identity subject-public-key-info-format {
1510       base "public-key-format";
1511       description
1512         "A SubjectPublicKeyInfo (from RFC 5280).";
1513   }
1514
1515   /**** for symmetric keys ****/
1516
1517   identity octet-string-key-format {
1518       base "symmetric-key-format";
1519       description "An OctetString from ASN.1.";
1520         /*
1521         // Knowing that it is an "OctetString" isn't really helpful.
1522         // Knowing the length of the octet string would be helpful,
1523         // as it relates to the algorithm's block size.  We may want
1524         // to only (for now) use "one-symmetric-key-format" for
1525         // symmetric keys...were the usability issues Juergen
1526         // mentioned before only apply to asymmetric keys?
1527         */
1528   }
1529
1530   identity one-symmetric-key-format {
1531       base "symmetric-key-format";
1532       description "A OneSymmetricKey (from RFC6031).";
1533   }
1534
1535   identity encrypted-symmetric-key-format {
1536       base "symmetric-key-format";
1537       description
1538         "A CMS EncryptedData structure (RFC 5652)
1539          containing a OneSymmetricKey (RFC 6031).";
1540   }
1541
1542   /***************************************************/
1543   /*   Typedefs for ASN.1 structures from RFC 5280   */
1544   /***************************************************/
1545
1546   typedef x509 {
1547     type binary;
1548     description
1549       "A Certificate structure, as specified in RFC 5280,
1550        encoded using ASN.1 distinguished encoding rules (DER),
1551        as specified in ITU-T X.690.";
1552     reference
1553       "RFC 5280:
1554          Internet X.509 Public Key Infrastructure Certificate
1555          and Certificate Revocation List (CRL) Profile
1556        ITU-T X.690:
1557          Information technology - ASN.1 encoding rules:
1558          Specification of Basic Encoding Rules (BER),
1559          Canonical Encoding Rules (CER) and Distinguished
1560          Encoding Rules (DER).";
1561   }
1562
1563   typedef crl {
1564     type binary;
1565     description
1566       "A CertificateList structure, as specified in RFC 5280,
1567        encoded using ASN.1 distinguished encoding rules (DER),
1568        as specified in ITU-T X.690.";
1569     reference
1570       "RFC 5280:
1571          Internet X.509 Public Key Infrastructure Certificate
1572          and Certificate Revocation List (CRL) Profile
1573        ITU-T X.690:
1574          Information technology - ASN.1 encoding rules:
1575          Specification of Basic Encoding Rules (BER),
1576          Canonical Encoding Rules (CER) and Distinguished
1577          Encoding Rules (DER).";
1578   }
1579
1580   /***********************************************/
1581   /*   Typedefs for ASN.1 structures from 5652   */
1582   /***********************************************/
1583
1584   typedef cms {
1585     type binary;
1586     description
1587       "A ContentInfo structure, as specified in RFC 5652,
1588        encoded using ASN.1 distinguished encoding rules (DER),
1589        as specified in ITU-T X.690.";
1590     reference
1591       "RFC 5652:
1592          Cryptographic Message Syntax (CMS)
1593        ITU-T X.690:
1594          Information technology - ASN.1 encoding rules:
1595          Specification of Basic Encoding Rules (BER),
1596          Canonical Encoding Rules (CER) and Distinguished
1597          Encoding Rules (DER).";
1598   }
1599   typedef data-content-cms {
1600     type cms;
1601     description
1602       "A CMS structure whose top-most content type MUST be the
1603        data content type, as described by Section 4 in RFC 5652.";
1604     reference
1605       "RFC 5652: Cryptographic Message Syntax (CMS)";
1606   }
1607
1608   typedef signed-data-cms {
1609     type cms;
1610     description
1611       "A CMS structure whose top-most content type MUST be the
1612        signed-data content type, as described by Section 5 in
1613        RFC 5652.";
1614     reference
1615       "RFC 5652: Cryptographic Message Syntax (CMS)";
1616   }
1617
1618   typedef enveloped-data-cms {
1619     type cms;
1620     description
1621       "A CMS structure whose top-most content type MUST be the
1622        enveloped-data content type, as described by Section 6
1623        in RFC 5652.";
1624     reference
1625       "RFC 5652: Cryptographic Message Syntax (CMS)";
1626   }
1627
1628   typedef digested-data-cms {
1629     type cms;
1630     description
1631       "A CMS structure whose top-most content type MUST be the
1632        digested-data content type, as described by Section 7
1633        in RFC 5652.";
1634     reference
1635       "RFC 5652: Cryptographic Message Syntax (CMS)";
1636   }
1637
1638   typedef encrypted-data-cms {
1639     type cms;
1640     description
1641       "A CMS structure whose top-most content type MUST be the
1642        encrypted-data content type, as described by Section 8
1643        in RFC 5652.";
1644     reference
1645       "RFC 5652: Cryptographic Message Syntax (CMS)";
1646   }
1647   typedef authenticated-data-cms {
1648     type cms;
1649     description
1650       "A CMS structure whose top-most content type MUST be the
1651        authenticated-data content type, as described by Section 9
1652        in RFC 5652.";
1653     reference
1654       "RFC 5652: Cryptographic Message Syntax (CMS)";
1655   }
1656
1657   /***************************************************/
1658   /*   Typedefs for structures related to RFC 4253   */
1659   /***************************************************/
1660
1661   typedef ssh-host-key {
1662     type binary;
1663     description
1664       "The binary public key data for this SSH key, as
1665        specified by RFC 4253, Section 6.6, i.e.:
1666
1667          string    certificate or public key format
1668                    identifier
1669          byte[n]   key/certificate data.";
1670     reference
1671       "RFC 4253: The Secure Shell (SSH) Transport Layer
1672                  Protocol";
1673   }
1674
1675   /*********************************************************/
1676   /*   Typedefs for ASN.1 structures related to RFC 5280   */
1677   /*********************************************************/
1678
1679   typedef trust-anchor-cert-x509 {
1680     type x509;
1681     description
1682       "A Certificate structure that MUST encode a self-signed
1683        root certificate.";
1684   }
1685
1686   typedef end-entity-cert-x509 {
1687     type x509;
1688     description
1689       "A Certificate structure that MUST encode a certificate
1690        that is neither self-signed nor having Basic constraint
1691        CA true.";
1692   }
1693
1694   /*********************************************************/
1695   /*   Typedefs for ASN.1 structures related to RFC 5652   */
1696   /*********************************************************/
1697
1698   typedef trust-anchor-cert-cms {
1699     type signed-data-cms;
1700     description
1701       "A CMS SignedData structure that MUST contain the chain of
1702        X.509 certificates needed to authenticate the certificate
1703        presented by a client or end-entity.
1704
1705        The CMS MUST contain only a single chain of certificates.
1706        The client or end-entity certificate MUST only authenticate
1707        to last intermediate CA certificate listed in the chain.
1708
1709        In all cases, the chain MUST include a self-signed root
1710        certificate.  In the case where the root certificate is
1711        itself the issuer of the client or end-entity certificate,
1712        only one certificate is present.
1713
1714        This CMS structure MAY (as applicable where this type is
1715        used) also contain suitably fresh (as defined by local
1716        policy) revocation objects with which the device can
1717        verify the revocation status of the certificates.
1718
1719        This CMS encodes the degenerate form of the SignedData
1720        structure that is commonly used to disseminate X.509
1721        certificates and revocation objects (RFC 5280).";
1722     reference
1723       "RFC 5280:
1724          Internet X.509 Public Key Infrastructure Certificate
1725          and Certificate Revocation List (CRL) Profile.";
1726   }
1727
1728   typedef end-entity-cert-cms {
1729     type signed-data-cms;
1730     description
1731       "A CMS SignedData structure that MUST contain the end
1732        entity certificate itself, and MAY contain any number
1733        of intermediate certificates leading up to a trust
1734        anchor certificate.  The trust anchor certificate
1735        MAY be included as well.
1736
1737        The CMS MUST contain a single end entity certificate.
1738        The CMS MUST NOT contain any spurious certificates.
1739
1740        This CMS structure MAY (as applicable where this type is
1741        used) also contain suitably fresh (as defined by local
1742        policy) revocation objects with which the device can
1743        verify the revocation status of the certificates.
1744
1745        This CMS encodes the degenerate form of the SignedData
1746        structure that is commonly used to disseminate X.509
1747        certificates and revocation objects (RFC 5280).";
1748     reference
1749       "RFC 5280:
1750          Internet X.509 Public Key Infrastructure Certificate
1751          and Certificate Revocation List (CRL) Profile.";
1752   }
1753
1754   typedef ssh-public-key-type {  // DELETE?
1755      type binary;
1756      description
1757        "The binary public key data for this SSH key, as
1758         specified by RFC 4253, Section 6.6, i.e.:
1759
1760           string    certificate or public key format
1761                     identifier
1762           byte[n]   key/certificate data.";
1763      reference
1764        "RFC 4253: The Secure Shell (SSH) Transport
1765                   Layer Protocol";
1766   }
1767
1768   /**********************************************/
1769   /*   Groupings for keys and/or certificates   */
1770   /**********************************************/
1771
1772   grouping symmetric-key-grouping {
1773     description
1774       "A symmetric key and algorithm.";
1775     leaf algorithm {
1776       type encryption-algorithm-t;
1777       mandatory true;
1778       description
1779         "The algorithm to be used when generating the key.";
1780       reference
1781         "RFC CCCC: Common YANG Data Types for Cryptography";
1782     }
1783     leaf key-format {
1784       nacm:default-deny-write;
1785       when "../key";
1786       type identityref {
1787         base symmetric-key-format;
1788       }
1789       description "Identifies the symmetric key's format.";
1790     }
1791     choice key-type {
1792       mandatory true;
1793       description
1794         "Choice between key types.";
1795       leaf key {
1796         nacm:default-deny-all;
1797         type binary;
1798         //must "../key-format";  FIXME: remove comment if approach ok
1799         description
1800           "The binary value of the key.  The interpretation of
1801            the value is defined by 'key-format'.  For example,
1802            FIXME.";
1803         reference
1804           "RFC XXXX: FIXME";
1805       }
1806       leaf hidden-key {
1807         nacm:default-deny-write;
1808         type empty;
1809         description
1810           "A permanently hidden key.  How such keys are created
1811            is outside the scope of this module.";
1812       }
1813     }
1814   }
1815
1816   grouping public-key-grouping {
1817     description
1818       "A public key and its associated algorithm.";
1819     leaf algorithm {
1820       nacm:default-deny-write;
1821       type asymmetric-key-algorithm-t;
1822       mandatory true;
1823       description
1824         "Identifies the key's algorithm.";
1825       reference
1826         "RFC CCCC: Common YANG Data Types for Cryptography";
1827     }
1828     leaf public-key-format {
1829       nacm:default-deny-write;
1830       when "../public-key";
1831       type identityref {
1832         base public-key-format;
1833       }
1834       description "Identifies the key's format.";
1835     }
1836     leaf public-key {
1837       nacm:default-deny-write;
1838       type binary;
1839       //must "../public-key-format"; FIXME: rm comment if approach ok
1840       mandatory true;
1841       description
1842         "The binary value of the public key.  The interpretation
1843          of the value is defined by 'public-key-format' field.";
1844     }
1845   }
1846
1847   grouping asymmetric-key-pair-grouping {
1848     description
1849       "A private key and its associated public key and algorithm.";
1850     uses public-key-grouping;
1851     leaf private-key-format {
1852       nacm:default-deny-write;
1853       when "../private-key";
1854       type identityref {
1855         base private-key-format;
1856       }
1857       description "Identifies the key's format.";
1858     }
1859     choice private-key-type {
1860       mandatory true;
1861       description
1862         "Choice between key types.";
1863       leaf private-key {
1864         nacm:default-deny-all;
1865         type binary;
1866         //must "../private-key-format"; FIXME: rm comment if ok
1867         description
1868           "The value of the binary key.  The key's value is
1869            interpreted by the 'private-key-format' field.";
1870       }
1871       leaf hidden-private-key {
1872         nacm:default-deny-write;
1873         type empty;
1874         description
1875           "A permanently hidden key.  How such keys are created
1876            is outside the scope of this module.";
1877       }
1878     }
1879   }
1880
1881   grouping trust-anchor-cert-grouping {
1882     description
1883       "A trust anchor certificate, and a notification for when
1884        it is about to (or already has) expire.";
1885     leaf cert {
1886       nacm:default-deny-write;
1887       type trust-anchor-cert-cms;
1888       description
1889         "The binary certificate data for this certificate.";
1890       reference
1891         "RFC YYYY: Common YANG Data Types for Cryptography";
1892     }
1893     notification certificate-expiration {
1894       description
1895         "A notification indicating that the configured certificate
1896          is either about to expire or has already expired.  When to
1897          send notifications is an implementation specific decision,
1898          but it is RECOMMENDED that a notification be sent once a
1899          month for 3 months, then once a week for four weeks, and
1900          then once a day thereafter until the issue is resolved.";
1901       leaf expiration-date {
1902         type yang:date-and-time;
1903         mandatory true;
1904         description
1905           "Identifies the expiration date on the certificate.";
1906       }
1907     }
1908   }
1909
1910   grouping trust-anchor-certs-grouping {
1911     description
1912       "A list of trust anchor certificates, and a notification
1913        for when one is about to (or already has) expire.";
1914     leaf-list cert {
1915       nacm:default-deny-write;
1916       type trust-anchor-cert-cms;
1917       description
1918         "The binary certificate data for this certificate.";
1919       reference
1920         "RFC YYYY: Common YANG Data Types for Cryptography";
1921     }
1922     notification certificate-expiration {
1923       description
1924         "A notification indicating that the configured certificate
1925          is either about to expire or has already expired.  When to
1926          send notifications is an implementation specific decision,
1927          but it is RECOMMENDED that a notification be sent once a
1928          month for 3 months, then once a week for four weeks, and
1929          then once a day thereafter until the issue is resolved.";
1930       leaf expiration-date {
1931         type yang:date-and-time;
1932         mandatory true;
1933         description
1934           "Identifies the expiration date on the certificate.";
1935       }
1936     }
1937   }
1938
1939   grouping end-entity-cert-grouping {
1940     description
1941       "An end entity certificate, and a notification for when
1942        it is about to (or already has) expire.  Implementations
1943        SHOULD assert that, where used, the end entity certificate
1944        contains the expected public key.";
1945     leaf cert {
1946       nacm:default-deny-write;
1947       type end-entity-cert-cms;
1948       description
1949         "The binary certificate data for this certificate.";
1950       reference
1951         "RFC YYYY: Common YANG Data Types for Cryptography";
1952     }
1953     notification certificate-expiration {
1954       description
1955         "A notification indicating that the configured certificate
1956          is either about to expire or has already expired.  When to
1957          send notifications is an implementation specific decision,
1958          but it is RECOMMENDED that a notification be sent once a
1959          month for 3 months, then once a week for four weeks, and
1960          then once a day thereafter until the issue is resolved.";
1961       leaf expiration-date {
1962         type yang:date-and-time;
1963         mandatory true;
1964         description
1965           "Identifies the expiration date on the certificate.";
1966       }
1967     }
1968   }
1969
1970   grouping end-entity-certs-grouping {
1971     description
1972       "A list of end entity certificates, and a notification for
1973        when one is about to (or already has) expire.";
1974     leaf-list cert {
1975       nacm:default-deny-write;
1976       type end-entity-cert-cms;
1977       description
1978         "The binary certificate data for this certificate.";
1979       reference
1980         "RFC YYYY: Common YANG Data Types for Cryptography";
1981     }
1982     notification certificate-expiration {
1983       description
1984         "A notification indicating that the configured certificate
1985          is either about to expire or has already expired.  When to
1986          send notifications is an implementation specific decision,
1987          but it is RECOMMENDED that a notification be sent once a
1988          month for 3 months, then once a week for four weeks, and
1989          then once a day thereafter until the issue is resolved.";
1990       leaf expiration-date {
1991         type yang:date-and-time;
1992         mandatory true;
1993         description
1994           "Identifies the expiration date on the certificate.";
1995       }
1996     }
1997   }
1998
1999   grouping asymmetric-key-pair-with-cert-grouping {
2000     description
2001       "A private/public key pair and an associated certificate.
2002        Implementations SHOULD assert that certificates contain
2003        the matching public key.";
2004     uses asymmetric-key-pair-grouping;
2005     uses end-entity-cert-grouping;
2006     action generate-certificate-signing-request {
2007       nacm:default-deny-all;
2008       description
2009         "Generates a certificate signing request structure for
2010          the associated asymmetric key using the passed subject
2011          and attribute values.  The specified assertions need
2012          to be appropriate for the certificate's use.  For
2013          example, an entity certificate for a TLS server
2014          SHOULD have values that enable clients to satisfy
2015          RFC 6125 processing.";
2016       input {
2017         leaf subject {
2018           type binary;
2019           mandatory true;
2020           description
2021             "The 'subject' field per the CertificationRequestInfo
2022               structure as specified by RFC 2986, Section 4.1
2023               encoded using the ASN.1 distinguished encoding
2024               rules (DER), as specified in ITU-T X.690.";
2025           reference
2026             "RFC 2986:
2027                PKCS #10: Certification Request Syntax
2028                          Specification Version 1.7.
2029              ITU-T X.690:
2030                Information technology - ASN.1 encoding rules:
2031                Specification of Basic Encoding Rules (BER),
2032                Canonical Encoding Rules (CER) and Distinguished
2033                Encoding Rules (DER).";
2034         }
2035         leaf attributes {
2036           type binary; // FIXME: does this need to be mandatory?
2037           description
2038             "The 'attributes' field from the structure
2039              CertificationRequestInfo as specified by RFC 2986,
2040              Section 4.1 encoded using the ASN.1 distinguished
2041              encoding rules (DER), as specified in ITU-T X.690.";
2042           reference
2043             "RFC 2986:
2044                PKCS #10: Certification Request Syntax
2045                          Specification Version 1.7.
2046              ITU-T X.690:
2047                Information technology - ASN.1 encoding rules:
2048                Specification of Basic Encoding Rules (BER),
2049                Canonical Encoding Rules (CER) and Distinguished
2050                Encoding Rules (DER).";
2051         }
2052       }
2053       output {
2054         leaf certificate-signing-request {
2055           type binary;
2056           mandatory true;
2057           description
2058             "A CertificationRequest structure as specified by
2059              RFC 2986, Section 4.2 encoded using the ASN.1
2060              distinguished encoding rules (DER), as specified
2061              in ITU-T X.690.";
2062           reference
2063             "RFC 2986:
2064                PKCS #10: Certification Request Syntax
2065                          Specification Version 1.7.
2066              ITU-T X.690:
2067                Information technology - ASN.1 encoding rules:
2068                Specification of Basic Encoding Rules (BER),
2069                Canonical Encoding Rules (CER) and Distinguished
2070                Encoding Rules (DER).";
2071         }
2072       }
2073     } // generate-certificate-signing-request
2074   } // asymmetric-key-pair-with-cert-grouping
2075
2076   grouping asymmetric-key-pair-with-certs-grouping {
2077     description
2078       "A private/public key pair and associated certificates.
2079        Implementations SHOULD assert that certificates contain
2080        the matching public key.";
2081     uses asymmetric-key-pair-grouping;
2082     container certificates {
2083       nacm:default-deny-write;
2084       description
2085         "Certificates associated with this asymmetric key.
2086          More than one certificate supports, for instance,
2087          a TPM-protected asymmetric key that has both IDevID
2088          and LDevID certificates associated.";
2089       list certificate {
2090         key "name";
2091         description
2092           "A certificate for this asymmetric key.";
2093         leaf name {
2094           type string;
2095           description
2096             "An arbitrary name for the certificate.  If the name
2097              matches the name of a certificate that exists
2098              independently in <operational> (i.e., an IDevID),
2099              then the 'cert' node MUST NOT be configured.";
2100         }
2101         uses end-entity-cert-grouping;
2102       }
2103     } // certificates
2104     action generate-certificate-signing-request {
2105       nacm:default-deny-all;
2106       description
2107         "Generates a certificate signing request structure for
2108          the associated asymmetric key using the passed subject
2109          and attribute values.  The specified assertions need
2110          to be appropriate for the certificate's use.  For
2111          example, an entity certificate for a TLS server
2112          SHOULD have values that enable clients to satisfy
2113          RFC 6125 processing.";
2114       input {
2115         leaf subject {
2116           type binary;
2117           mandatory true;
2118           description
2119             "The 'subject' field per the CertificationRequestInfo
2120               structure as specified by RFC 2986, Section 4.1
2121               encoded using the ASN.1 distinguished encoding
2122               rules (DER), as specified in ITU-T X.690.";
2123           reference
2124             "RFC 2986:
2125                PKCS #10: Certification Request Syntax
2126                          Specification Version 1.7.
2127              ITU-T X.690:
2128                Information technology - ASN.1 encoding rules:
2129                Specification of Basic Encoding Rules (BER),
2130                Canonical Encoding Rules (CER) and Distinguished
2131                Encoding Rules (DER).";
2132         }
2133         leaf attributes {
2134           type binary; // FIXME: does this need to be mandatory?
2135           description
2136             "The 'attributes' field from the structure
2137              CertificationRequestInfo as specified by RFC 2986,
2138              Section 4.1 encoded using the ASN.1 distinguished
2139              encoding rules (DER), as specified in ITU-T X.690.";
2140           reference
2141             "RFC 2986:
2142                PKCS #10: Certification Request Syntax
2143                          Specification Version 1.7.
2144              ITU-T X.690:
2145                Information technology - ASN.1 encoding rules:
2146                Specification of Basic Encoding Rules (BER),
2147                Canonical Encoding Rules (CER) and Distinguished
2148                Encoding Rules (DER).";
2149         }
2150       }
2151       output {
2152         leaf certificate-signing-request {
2153           type binary;
2154           mandatory true;
2155           description
2156             "A CertificationRequest structure as specified by
2157              RFC 2986, Section 4.2 encoded using the ASN.1
2158              distinguished encoding rules (DER), as specified
2159              in ITU-T X.690.";
2160           reference
2161             "RFC 2986:
2162                PKCS #10: Certification Request Syntax
2163                          Specification Version 1.7.
2164              ITU-T X.690:
2165                Information technology - ASN.1 encoding rules:
2166                Specification of Basic Encoding Rules (BER),
2167                Canonical Encoding Rules (CER) and Distinguished
2168                Encoding Rules (DER).";
2169         }
2170       }
2171     } // generate-certificate-signing-request
2172   } // asymmetric-key-pair-with-certs-grouping
2173 }