Skip to main content

decode_ec_pkcs8_der

Function decode_ec_pkcs8_der 

Source
pub fn decode_ec_pkcs8_der(der: &[u8]) -> Result<EcPrivateKey, Pkcs8Error>
Expand description

Decodes a PKCS#8 PrivateKeyInfo DER containing a P-256 or P-384 key.

The curve is taken from the AlgorithmIdentifier; when the inner SEC1 structure also carries a curve, both must agree.

Returns Pkcs8Error when the structure is malformed, the algorithm is not id-ecPublicKey, the curve is not P-256 or P-384, or the scalar is not a valid private key.