1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! ms-icpr — ICertPassage (MS-ICPR) / WCCE client with an ESC1 CSR-SAN
//! injection primitive.
//!
//! # Purpose
//!
//! Submit certificate requests to an AD-CS Enterprise CA over RPC and retrieve
//! the issued certificate. The offensive path this crate enables is ESC1:
//! against an `enrollee-supplies-subject` template, a low-privileged user
//! ships a CSR with a `SubjectAltName{otherName, userPrincipalName=...}`
//! extension and the CA emits a client-auth certificate bound to any UPN in
//! the domain (e.g. `administrator@corp.local`).
//!
//! # Status: 0.1.0-dev (pre-alpha)
//!
//! - `build_csr_with_upn_san` produces a valid, signed PKCS#10 CSR carrying
//! the UPN otherName SAN. Offline-testable, round-trip-verified.
//! - `IcprClient::submit_request` performs offline pre-flight checks
//! (schema version, `min_ra_signatures`, CSR shape), NDR-marshals the
//! `CertServerRequest` opnum-0 input stub, and hands it to the transport.
//! With [`rpc::StubTransport`] you get [`Error::LiveDcOnly`] after
//! preflight; with the default `network` feature you get
//! [`IcprClient::connect`] which speaks SMB2 → sealed `\PIPE\cert` →
//! `CertServerRequest` → decoded response.
//! - Two BIND auth paths:
//! * NTLMSSP sign+seal ([`IcprClient::connect`]) — end-to-end live.
//! * Kerberos (GSS-KRB5, `RPC_C_AUTHN_GSS_KERBEROS`) —
//! [`IcprClient::connect_kerberos`] does SMB2 `login_kerberos` + `IPC$`
//! tree connect and produces a client whose BIND PDU carries the caller's
//! `AP-REQ` (see [`kerberos::encode_kerberos_bind_pdu`]). The per-message
//! RFC 4121 wrap for `CertServerRequest` sealed calls is not implemented
//! yet — [`IcprClient::submit_request`] returns [`Error::LiveDcOnly`]
//! with a Kerberos-sealing hint. Consumers wanting relay flows plug in
//! their own transport via [`IcprTransport`] +
//! [`rpc::encode_cert_server_request`] / [`rpc::decode_cert_server_response`].
//!
//! # Example
//!
//! ```no_run
//! use ms_icpr::{build_csr_with_upn_san, IcprClient};
//! # let key_pem: &[u8] = b"";
//! # let template: ms_crtd::CertTemplate = unimplemented!();
//! let csr = build_csr_with_upn_san("recon", "administrator@corp.local", key_pem)?;
//! let mut client = IcprClient::stub("corp-CA");
//! // On a live DC this would issue the cert. Offline: Err(LiveDcOnly).
//! let _ = client.submit_request(&template, &csr);
//! # Ok::<(), ms_icpr::Error>(())
//! ```
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;