kyberlib/oid.rs
1// Copyright © 2026 kyberlib. All rights reserved.
2// SPDX-License-Identifier: Apache-2.0 OR MIT
3
4//! Object identifiers for ML-KEM parameter sets per the IETF LAMPS
5//! drafts (`draft-ietf-lamps-kyber-certificates`,
6//! `draft-ietf-lamps-cms-kyber`, RFC 9936).
7//!
8//! These OIDs are assigned under
9//! `joint-iso-itu-t.country.us.organization.gov.csor.nistAlgorithm.kems.kyber`
10//! (`2.16.840.1.101.3.4.4.*`). They identify ML-KEM parameter sets in
11//! X.509 SubjectPublicKeyInfo, PKCS#8 PrivateKeyInfo, and CMS
12//! enveloped-data structures.
13//!
14//! `kyberlib-pkcs8` re-exports these from this module so the OID
15//! table has a single source of truth.
16
17/// ML-KEM-512: NIST security category 1, parameter rank `k = 2`.
18/// OID `2.16.840.1.101.3.4.4.1`.
19pub const ML_KEM_512: &str = "2.16.840.1.101.3.4.4.1";
20
21/// ML-KEM-768: NIST security category 3, parameter rank `k = 3`.
22/// OID `2.16.840.1.101.3.4.4.2`. The CNSA 2.0 default for TLS
23/// hybrid deployments.
24pub const ML_KEM_768: &str = "2.16.840.1.101.3.4.4.2";
25
26/// ML-KEM-1024: NIST security category 5, parameter rank `k = 4`.
27/// OID `2.16.840.1.101.3.4.4.3`. Required by CNSA 2.0 for NSS by
28/// 1 Jan 2027.
29pub const ML_KEM_1024: &str = "2.16.840.1.101.3.4.4.3";
30
31#[cfg(test)]
32mod tests {
33 use super::*;
34
35 #[test]
36 fn oid_format() {
37 for oid in [ML_KEM_512, ML_KEM_768, ML_KEM_1024] {
38 // Sanity-check: dotted-decimal, ASCII digits and dots only.
39 assert!(oid
40 .chars()
41 .all(|c| c.is_ascii_digit() || c == '.'));
42 assert!(oid.starts_with("2.16.840.1.101.3.4.4."));
43 }
44 }
45}