rfc-9640

YANG Data Types and Groupings for Cryptography

K. Watsen
date2024-10 streamIETF areaops wgnetconf statusPROPOSED STANDARD pages47 canonicalhttps://www.rfc-editor.org/rfc/rfc9640 doi10.17487/RFC9640
This document presents a YANG 1.1 (RFC 7950) module defining identities, typedefs, and groupings useful to cryptographic applications.

Extracted elements (30)

design-rationale §3.2

Key generation RPCs were removed from earlier revisions of this document due to an inability to reach consensus on how to generically identify the key algorithm to use. As a result, this module only supports keys configured via an external client; protocol-specific key generation is delegated to separate modules (e.g., RFC 9644, RFC 9645).

crypto, yang, netconf

design-rationale §3.1

PKCS #10 (RFC 2986) was chosen for the generate-csr action over Certificate Request Message Format (CRMF, RFC 4211) because it was unclear whether there was market demand for CRMF. A backwards-compatible CRMF-supporting solution can be defined in the future if desired.

crypto, pkix, yang

interoperability-note §1.1

The ietf-crypto-types module is the foundational dependency in a layered RFC family: truststore (RFC 9641) and keystore (RFC 9642) depend on it; these in turn support SSH, TLS, HTTP, NETCONF, and RESTCONF client/server modules. Implementors must implement ietf-crypto-types for the identity namespace to be available to all consuming modules.

yang, netconf, crypto, tls

normative-requirement §2.3 RECOMMENDED

Certificate expiration notifications are RECOMMENDED to be sent once a month for 3 months, then once a week for four weeks, then once a day until resolved. The notification MAY also be sent when the issuer's CRL is about to expire.

yang, crypto, pkix

normative-requirement §3.7 SHOULD

Cleartext key values (cleartext-symmetric-key and cleartext-private-key nodes) SHOULD be zeroized when deleted to prevent analysis of remnant data in persistent storage locations.

crypto, security, yang

normative-requirement §3.5 RECOMMENDED

Storing cleartext values for passwords and keys is NOT RECOMMENDED. The module enables cleartext storage only when specific feature statements (cleartext-passwords, cleartext-symmetric-keys, cleartext-private-keys) are explicitly enabled.

crypto, security, yang

normative-requirement §2.3 MUST

The cms-enveloped-data-format identity requires that the EnvelopedData structure MUST have exactly one RecipientInfo. For RSA keys, it MUST be KeyTransRecipientInfo with subjectKeyIdentifier using method 1 from RFC 7093. For ECC keys, it MUST be KeyAgreeRecipientInfo using OriginatorPublicKey with no UserKeyingMaterial and exactly one RecipientEncryptedKeys.

yang, crypto, pkix

normative-requirement §2.1.4.1 MUST

The 'encrypted-by' container in encrypted-value-grouping MUST be augmented by consuming modules with key references. A symmetric key MUST be referenced via a leaf named 'symmetric-key-ref' and an asymmetric key via 'asymmetric-key-ref'. These leaf nodes MUST be direct descendants in the data tree.

yang, crypto, netconf

normative-requirement §3.8 SHOULD

The 'generate-csr' action SHOULD only be executed by authorized users; NACM 'default-deny-all' is applied to it. It is RECOMMENDED that implementations assert channel binding (RFC 5056) to ensure the requesting application layer matches the device authenticated at the secure transport layer.

yang, crypto, security, netconf

normative-requirement §2.1.5 MUST

The 'ietf-crypto-types' module does not define protocol-accessible nodes but MUST be 'implemented' (per RFC 7950 Section 5.6.5) in order for the identities defined in Section 2.1.2 to be available for use by other modules.

yang, netconf

normative-requirement §3.6 MUST

To securely encrypt a password or key with a symmetric key, a proper block cipher mode such as AEAD or CBC MUST be used to ensure a random IV is included. The Electronic Codebook (ECB) block cipher mode MUST NOT be used, as it leaks whether identical keys/passwords share the same ciphertext.

crypto, security

protocol-element §2.1.2

Five base identity hierarchies are defined: 'public-key-format' (with derived ssh-public-key-format and subject-public-key-info-format), 'private-key-format' (rsa-private-key-format, ec-private-key-format, one-asymmetric-key-format), 'symmetric-key-format' (octet-string-key-format, one-symmetric-key-format), 'encrypted-value-format' (symmetrically- and asymmetrically-encrypted-value-format), and 'csr-format' (p10-csr-format). Base identities are abstract; additional derived identities MAY be defined by future efforts.

yang, crypto, pkix

protocol-element §2.1.4.6

The 'asymmetric-key-pair-grouping' combines public-key-grouping and private-key-grouping, with public key fields made optional via refine. Implementations MUST ensure that when both keys are specified, they are a matching pair.

yang, crypto, pkix

protocol-element §2.1.4.12

The 'asymmetric-key-pair-with-certs-grouping' combines asymmetric-key-pair-grouping, a 'certificates' container (list of named end-entity-cert-grouping instances), and generate-csr-grouping. Implementations MUST assert that certificates contain the matching public key. This is the primary grouping for managing asymmetric keys with multiple associated certificates.

yang, crypto, pkix

protocol-element §2.1.4.7

The 'certificate-expiration-grouping' defines a 'certificate-expiration' notification (guarded by certificate-expiration-notification feature) with a mandatory 'expiration-date' leaf of type yang:date-and-time. It is used by trust-anchor-cert-grouping and end-entity-cert-grouping.

yang, crypto, pkix

protocol-element §2.1.4.1

The 'encrypted-value-grouping' grouping contains three nodes: 'encrypted-by' (an empty container that consuming modules MUST augment with key references), 'encrypted-value-format' (identityref indicating the encoding format), and 'encrypted-value' (binary containing the ciphertext). The 'encrypted-by' container has NACM 'default-deny-write' applied.

yang, crypto, security

protocol-element §2.1.4.10

The 'generate-csr-grouping' defines a 'generate-csr' action (guarded by csr-generation feature, protected by NACM 'default-deny-all') that takes 'csr-format' (identityref) and 'csr-info' (DER-encoded CertificationRequestInfo) as inputs and returns the CSR in the requested format. Only available when the associated public key uses subject-public-key-info-format.

yang, crypto, pkix

protocol-element §2

The 'ietf-crypto-types' YANG 1.1 module defines identities, typedefs, and groupings for cryptographic applications. It serves as the foundational dependency for a collection of RFCs supporting NETCONF and RESTCONF client/server configuration, including truststore, keystore, SSH, TLS, and HTTP client/server modules.

yang, netconf, crypto, security

protocol-element §2.1.4.2

The 'password-grouping' grouping provides a choice between 'cleartext-password' (string, guarded by cleartext-passwords feature) and 'encrypted-password' (uses encrypted-value-grouping, guarded by encrypted-passwords feature). Intended for remote authentication credentials; for local account passwords, the 'ianach:crypt-hash' typedef from RFC 7317 should be used instead.

yang, crypto, security

protocol-element §2.1.4.5

The 'private-key-grouping' grouping provides 'private-key-format' identityref and a three-way choice: 'cleartext-private-key' (binary), 'hidden-private-key' (type empty), or 'encrypted-private-key' (uses encrypted-value-grouping). All nodes carry NACM 'default-deny-write'; cleartext-private-key additionally has 'default-deny-all'.

yang, crypto, security

protocol-element §2.1.4.4

The 'public-key-grouping' grouping contains two mandatory nodes: 'public-key-format' (identityref to public-key-format base identity) and 'public-key' (binary). No choice statement is provided to hide or encrypt public key data because it is unnecessary for public keys.

yang, crypto, pkix

protocol-element §2.1.4.3

The 'symmetric-key-grouping' grouping provides a 'key-format' identityref and a three-way choice: 'cleartext-symmetric-key' (binary), 'hidden-symmetric-key' (type empty, not exportable via management interfaces), or 'encrypted-symmetric-key' (uses encrypted-value-grouping). Each case is gated by a corresponding feature statement.

yang, crypto, security

registry §4.1

IANA has registered the namespace URI 'urn:ietf:params:xml:ns:yang:ietf-crypto-types' in the 'ns' registry of the IETF XML Registry (RFC 3688), with the IESG as registrant contact.

registry, yang

registry §4.2

IANA has registered the YANG module 'ietf-crypto-types' in the YANG Module Names registry (RFC 6020), with namespace 'urn:ietf:params:xml:ns:yang:ietf-crypto-types', prefix 'ct', and reference RFC 9640.

registry, yang, netconf

security-consideration §3.8

NACM 'default-deny-all' is applied to cleartext-password, cleartext-symmetric-key, and cleartext-private-key nodes so they are never returned to clients in normal use. NACM 'default-deny-write' is applied to all writable data nodes in the module, because even modification of a public key or certificate can dramatically alter the security policy.

security, yang, netconf, crypto

security-consideration §3.8

The cert-data node (in both trust-anchor-cert-grouping and end-entity-cert-grouping) has NACM 'default-deny-all' applied because certificates may reveal which servers this device communicates with and may contain personally identifying information in end-entity certificates.

security, privacy, pkix, yang

security-consideration §3.8

The ietf-crypto-types YANG module is accessed via NETCONF and RESTCONF, both of which have mandatory-to-implement secure transport (SSH, TLS, QUIC) and mandatory mutual authentication. NACM (RFC 8341) provides access control for restricting users to authorized protocol operations and content.

security, yang, netconf, tls

security-consideration §3.3

The public-key-grouping and asymmetric-key-pair-grouping enable configuration of keys without usage constraints (e.g., encryption vs. verification). The asymmetric-key-pair-with-cert-grouping partially mitigates this by requiring associated certificates to constrain key usage according to local policy.

security, crypto, pkix

wire-format §2.1.3

All typedefs in the module extend the 'binary' YANG base type and encode ASN.1 structures using DER (ITU-T X.690). Specific typedefs include: x509 (RFC 5280 Certificate), crl (RFC 5280 CertificateList), p10-csr (RFC 2986 CertificationRequest), csr-info (RFC 2986 CertificationRequestInfo), and CMS content types (cms, signed-data-cms, enveloped-data-cms, encrypted-data-cms, authenticated-data-cms).

yang, crypto, pkix, json

wire-format §2.1.3

The 'trust-anchor-cert-cms' typedef is a signed-data-cms that MUST contain a single chain of X.509 certificates with exactly one self-signed root certificate, and MAY contain revocation objects. The 'end-entity-cert-cms' typedef MUST contain exactly one end-entity certificate, MUST NOT contain spurious certificates, and MAY contain intermediate CA certificates and revocation objects.

yang, crypto, pkix