Skip to main content

decode_p256_pkcs8_der

Function decode_p256_pkcs8_der 

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

Decodes a P-256 secret key from PKCS#8 DER in the fixed 138-byte PrivateKeyInfo template produced by encode_p256_pkcs8_der.

The embedded public key is checked against the one derived from the private scalar.

Returns Pkcs8Error when the input is not exactly the expected template, when the private scalar is invalid, or when the embedded public key does not correspond to the private key (Pkcs8Error::InvalidPublicKeyMismatch).