Skip to main content

decode_pkcs8_der

Function decode_pkcs8_der 

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

Decodes an RFC 9881 PKCS#8 DER private key supporting seed (0x80), expandedKey (0x04), and both (0x30, with mandatory constant-time seed consistency check).

Strictly enforces RFC 5958 OneAsymmetricKey: version 0 MUST omit [1] publicKey, and version 1 MUST include [1] publicKey, which must belong to the private key; otherwise the key is rejected. For seed and both it must equal the verifying key derived from the seed. For expandedKey its hash must equal the stored tr and its rho the stored rho; the secret vectors of an expandedKey are not checked against it. Well-formed [0] attributes are accepted and ignored. See crate::codec::pkcs8::parse for the exact rules.