Enum sequoia_openpgp::packet::key::SecretKeyMaterial [−][src]
pub enum SecretKeyMaterial { Unencrypted(Unencrypted), Encrypted(Encrypted), }
Expand description
Holds secret key material.
This type allows postponing the decryption of the secret key material until it is actually needed.
If the secret key material is not encrypted with a password, then we encrypt it in memory. This helps protect against heartbleed-style attacks where a buffer over-read allows an attacker to read from the process’s address space. This protection is less important for Rust programs, which are memory safe. However, it is essential when Sequoia is used via its FFI.
See crypto::mem::Encrypted
for details.
Variants
Unencrypted(Unencrypted)
Unencrypted secret key. Can be used as-is.
Encrypted(Encrypted)
The secret key is encrypted with a password.
Implementations
Decrypts the secret key material using password
.
The SecretKeyMaterial
type does not know what kind of key it
contains. So, in order to know how many MPIs to parse, the
public key algorithm needs to be provided explicitly.
This returns an error if the secret key material is not encrypted or the password is incorrect.
pub fn decrypt_in_place(
&mut self,
pk_algo: PublicKeyAlgorithm,
password: &Password
) -> Result<()>
[src]
pub fn decrypt_in_place(
&mut self,
pk_algo: PublicKeyAlgorithm,
password: &Password
) -> Result<()>
[src]Decrypts the secret key material using password
.
The SecretKeyMaterial
type does not know what kind of key it
contains. So, in order to know how many MPIs to parse, the
public key algorithm needs to be provided explicitly.
This returns an error if the secret key material is not encrypted or the password is incorrect.
Encrypts the secret key material using password
.
This returns an error if the secret key material is encrypted.
See Unencrypted::encrypt
for details.
Encrypts the secret key material using password
.
This returns an error if the secret key material is encrypted.
See Unencrypted::encrypt
for details.
Returns whether the secret key material is encrypted.
Trait Implementations
Performs the conversion.
Performs the conversion.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for SecretKeyMaterial
impl Send for SecretKeyMaterial
impl Sync for SecretKeyMaterial
impl Unpin for SecretKeyMaterial
impl UnwindSafe for SecretKeyMaterial
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self