ms_crtd/lib.rs
1//! ms-crtd — AD-CS certificate template parser and ESC1-ESC15 static analyser.
2//!
3//! # Scope
4//!
5//! Parses the LDAP attributes of `pKICertificateTemplate` and
6//! `pKIEnrollmentService` objects (as read by the caller) into typed Rust
7//! values, then runs template-shape checks corresponding to the
8//! Certified Pre-Owned ESC taxonomy.
9//!
10//! This crate performs NO network I/O — consumers pass the raw attribute
11//! byte lists in via `parse_template_ldap` / `parse_enrollment_service_ldap`.
12//!
13//! # Status: 0.1.0-dev (pre-alpha)
14//!
15//! - ESC1, ESC2, ESC3, ESC6, ESC9, ESC15: implemented against template shape.
16//! - ESC13: partial — flag emitted only when the OID→group map is provided
17//! by the caller (which we don't yet accept). See `known_gaps` in README.
18//! - Security-descriptor DACL parsing: deferred. `raw_security_descriptor`
19//! is exposed as bytes.
20//!
21//! # Example
22//!
23//! ```ignore
24//! use std::collections::BTreeMap;
25//! use ms_crtd::{parse_template_ldap, detect_esc};
26//!
27//! let mut attrs: BTreeMap<String, Vec<Vec<u8>>> = BTreeMap::new();
28//! attrs.insert("cn".into(), vec![b"User".to_vec()]);
29//! attrs.insert("mspki-cert-template-oid".into(),
30//! vec![b"1.3.6.1.4.1.311.21.8.1.2".to_vec()]);
31//! attrs.insert("mspki-template-schema-version".into(), vec![b"2".to_vec()]);
32//! let t = parse_template_ldap(&attrs).unwrap();
33//! let findings = detect_esc(&t);
34//! ```
35
36pub mod error;
37pub mod esc;
38pub mod flags;
39pub mod model;
40pub mod oid;
41pub mod parse;
42
43pub use error::{Error, Result};
44pub use esc::{detect_esc, detect_esc6, EscFinding};
45pub use flags::{CaEditFlag, EnrollmentFlag, NameFlag, PrivateKeyFlag};
46pub use model::{CertTemplate, EnrollmentService};
47pub use oid::Oid;
48pub use parse::{parse_enrollment_service_ldap, parse_template_ldap, Attrs};