Struct sequoia_openpgp::packet::key::Encrypted
source · pub struct Encrypted { /* private fields */ }
Expand description
Secret key material encrypted with a password.
This data structure is used by the SecretKeyMaterial
enum.
Implementations§
source§impl Encrypted
impl Encrypted
sourcepub fn new(
s2k: S2K,
algo: SymmetricAlgorithm,
checksum: Option<SecretKeyChecksum>,
ciphertext: Box<[u8]>,
) -> Self
pub fn new( s2k: S2K, algo: SymmetricAlgorithm, checksum: Option<SecretKeyChecksum>, ciphertext: Box<[u8]>, ) -> Self
Creates a new encrypted key object.
sourcepub fn algo(&self) -> SymmetricAlgorithm
pub fn algo(&self) -> SymmetricAlgorithm
Returns the symmetric algorithm used to encrypt the secret key material.
sourcepub fn checksum(&self) -> Option<SecretKeyChecksum>
pub fn checksum(&self) -> Option<SecretKeyChecksum>
Returns the checksum method used to protect the encrypted secret key material, if any.
sourcepub fn ciphertext(&self) -> Result<&[u8]>
pub fn ciphertext(&self) -> Result<&[u8]>
Returns the encrypted secret key material.
If the S2K
mechanism is not supported by Sequoia, this
function will fail. Note that the information is not lost,
but stored in the packet. If the packet is serialized again,
it is written out.
sourcepub fn decrypt(
&self,
pk_algo: PublicKeyAlgorithm,
password: &Password,
) -> Result<Unencrypted>
pub fn decrypt( &self, pk_algo: PublicKeyAlgorithm, password: &Password, ) -> Result<Unencrypted>
Decrypts the secret key material using password
.
The Encrypted
key does not know what kind of key it is, so
the public key algorithm is needed to parse the correct number
of MPIs.
Trait Implementations§
source§impl From<Encrypted> for SecretKeyMaterial
impl From<Encrypted> for SecretKeyMaterial
source§impl PartialEq for Encrypted
impl PartialEq for Encrypted
impl Eq for Encrypted
Auto Trait Implementations§
impl Freeze for Encrypted
impl RefUnwindSafe for Encrypted
impl Send for Encrypted
impl Sync for Encrypted
impl Unpin for Encrypted
impl UnwindSafe for Encrypted
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)