pub fn decode_pkcs8_der(
policy: SecurityPolicy,
der: &[u8],
) -> Result<AgileSigningKey>Expand description
Decodes an RFC 9909 PKCS#8 DER private key while enforcing policy.
Accepts both direct raw 4n-byte privateKey content (RFC 9909 standard) and an inner
OCTET STRING-wrapped 4n-byte payload for interoperability with legacy encoders.
Strictly enforces RFC 5958 OneAsymmetricKey: version 0 MUST omit [1] publicKey, and
version 1 MUST include [1] publicKey, which must equal the public key PK.seed || PK.root
that FIPS 205 stores in the second half of the private key; otherwise the key is rejected.
(PK.root is compared, not recomputed from SK.seed, matching how the private key itself is
imported.) Well-formed [0] attributes are accepted and ignored. See
crate::codec::pkcs8::parse for the exact rules.