logo
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.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.