Skip to main content

Crate ms_pkca

Crate ms_pkca 

Source
Expand description

§ms-pkca (pre-alpha)

PKINIT (RFC 4556) client for AD CS abuse — PA-PK-AS-REQ construction, DH shared-secret derivation, PA-PK-AS-REP parsing, and the “UnPAC-the-hash” primitive.

STATUS: 0.1.0-dev — offline structural encode + partial DH/KDF/PAC primitives. No network I/O. Not yet wire-compatible against a real KDC; that work needs live-DC iteration (planned 0.2).

§Modules

  • dh — RFC 4556 §3.2.1 Modp1024/Modp2048 groups + keypair
  • kdf — RFC 4556 §3.2.3.1 octet-string-to-key
  • cms — minimal RFC 5652 SignedData/ContentInfo encoders
  • pkinit — AuthPack / PKAuthenticator / PA-PK-AS-REQ builder
  • pac — PAC_CREDENTIAL_INFO parse + NT-hash extraction
  • oid — PKINIT / CMS object identifiers
  • error — Error/Result

§Minimal example

use ms_pkca::{PkinitClient, AsRepResult};
let client = PkinitClient::new("EXAMPLE.COM", "dc01.example.com:88");
let cert_pem = std::fs::read("client.pem").unwrap();
let key_pem  = std::fs::read("client.key").unwrap();
// In 0.1.0-dev this returns a placeholder AsRepResult — no network is done.
let rep = client.request_tgt_with_cert(&cert_pem, &key_pem, "alice@example.com").unwrap();

Re-exports§

pub use error::Error;
pub use error::Result;

Modules§

cms
Minimal CMS SignedData (RFC 5652) construction for PKINIT PA-PK-AS-REQ.
dh
Diffie-Hellman groups for PKINIT — RFC 4556 §3.2.1 / RFC 2412 (Oakley).
enveloped
CMS EnvelopedData (RFC 5652 §6) decrypt for the PA-PK-AS-REP.encKeyPack path.
error
Error type for ms-pkca.
kdf
RFC 4556 §3.2.3.1 — Octet-String-to-Key derivation used by PKINIT DH mode.
network
Kerberos AS-REQ TCP send + AS-REP processing (RFC 4120 §7.2.2, RFC 4556 §3.2).
oid
OIDs used by PKINIT (RFC 4556) and CMS.
pac
PAC_CREDENTIAL_INFO parsing — the “UnPAC-the-hash” primitive.
pkinit
PKINIT PA-PK-AS-REQ / PA-PK-AS-REP structure builders (RFC 4556 §3.2).

Structs§

AsRepResult
Result of a (would-be) AS-REQ / AS-REP exchange.
PkinitClient
PKINIT client — realm + KDC endpoint.

Functions§

unpac_the_hash
UnPAC-the-hash — pull the NT hash out of a decrypted PAC_CREDENTIAL_DATA blob returned inside PA-PK-AS-REP.
unpac_the_hash_from_asrep
Convenience wrapper that operates on an AsRepResult — will succeed once the AS-REP parser + decryption is wired in 0.2. For now it forwards to unpac_the_hash using pac_credential_info as if it were already decrypted.