pub struct RecipientKey { /* private fields */ }Expand description
The recipient private key extract decrypts with, together with the
certificate that lets a RecipientInfo be recognised as naming it.
The key bytes never leave this type: it has no accessor for them, no
Debug that could print them, and every error raised while loading it is
a fixed string that quotes nothing.
Implementations§
Source§impl RecipientKey
impl RecipientKey
Sourcepub fn load(
key: &[u8],
passphrase: Option<&[u8]>,
certificate: Option<&[u8]>,
) -> Result<Self, Error>
pub fn load( key: &[u8], passphrase: Option<&[u8]>, certificate: Option<&[u8]>, ) -> Result<Self, Error>
Load a recipient key from PKCS#8 bytes and the certificate that identifies it.
key is PKCS#8 in DER or PEM, plain (PRIVATE KEY) or passphrase
protected (ENCRYPTED PRIVATE KEY). A PEM file may hold the
certificate alongside the key, in which case certificate may be
None. passphrase is only consulted for an encrypted key.
Errors carry a stable code and a fixed message. They never quote the key, the passphrase, the certificate, or anything derived from them, and they do not distinguish “wrong passphrase” from “not a PKCS#8 file”, because both are answered the same way: check the inputs.