Skip to main content

decode_pkcs8_der

Function decode_pkcs8_der 

Source
pub fn decode_pkcs8_der(
    policy: SecurityPolicy,
    der: &[u8],
) -> Result<AgileSecretKey>
Expand description

Decodes an RFC 9935 PKCS#8 DER ML-KEM private key (supports all three CHOICE forms: seed [0], expandedKey, and both), enforcing policy and consistency checks.

Strictly enforces RFC 5958 OneAsymmetricKey: version 0 MUST omit [1] publicKey, and version 1 MUST include [1] publicKey, which must equal the encapsulation key belonging to the decoded private key; otherwise the key is rejected. Well-formed [0] attributes are accepted and ignored. See crate::codec::pkcs8::parse for the exact rules.