pub struct SecretSubkey(/* private fields */);
Implementations§
Source§impl SecretSubkey
impl SecretSubkey
pub fn new(details: PublicSubkey, secret_params: SecretParams) -> Self
Sourcepub fn from_slice(packet_version: Version, input: &[u8]) -> Result<Self>
pub fn from_slice(packet_version: Version, input: &[u8]) -> Result<Self>
Parses a SecretSubkey
packet from the given slice.
pub fn secret_params(&self) -> &SecretParams
Sourcepub fn has_sha1_checksum(&self) -> bool
pub fn has_sha1_checksum(&self) -> bool
Checks if we should expect a SHA1 checksum in the encrypted part.
pub fn sign<R: CryptoRng + Rng, F>( &self, rng: R, key: &impl SecretKeyTrait, key_pw: F, ) -> Result<Signature>
Source§impl SecretSubkey
impl SecretSubkey
Sourcepub fn remove_password<P>(&mut self, password: P) -> Result<()>
pub fn remove_password<P>(&mut self, password: P) -> Result<()>
Remove the password protection of the private key material in this secret key packet. This permanently “unlocks” the secret key material.
If the Secret Key material in the packet is not locked, it is left unchanged.
The current locking password for this key must be provided in password
.
Sourcepub fn set_password<R, P>(&mut self, rng: R, password: P) -> Result<()>
pub fn set_password<R, P>(&mut self, rng: R, password: P) -> Result<()>
Set a password
that “locks” the private key material in this Secret Key packet.
This function uses the default S2K locking mechanism
(Cfb
with iterated and salted derivation of the password).
To change the password on a locked Secret Key packet, it needs to be unlocked using Self::remove_password before calling this function.
Sourcepub fn set_password_with_s2k<P>(
&mut self,
password: P,
s2k_params: S2kParams,
) -> Result<()>
pub fn set_password_with_s2k<P>( &mut self, password: P, s2k_params: S2kParams, ) -> Result<()>
Set a password
that “locks” the private key material in this Secret Key packet
using the mechanisms specified in s2k_params
.
To change the password on a locked Secret Key packet, it needs to be unlocked using Self::remove_password before calling this function.
Trait Implementations§
Source§impl Clone for SecretSubkey
impl Clone for SecretSubkey
Source§fn clone(&self) -> SecretSubkey
fn clone(&self) -> SecretSubkey
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for SecretSubkey
impl Debug for SecretSubkey
Source§impl Drop for SecretSubkey
impl Drop for SecretSubkey
Source§impl From<SecretSubkey> for Packet
impl From<SecretSubkey> for Packet
Source§fn from(other: SecretSubkey) -> Packet
fn from(other: SecretSubkey) -> Packet
Source§impl PacketTrait for SecretSubkey
impl PacketTrait for SecretSubkey
Source§impl PartialEq for SecretSubkey
impl PartialEq for SecretSubkey
Source§impl PublicKeyTrait for SecretSubkey
impl PublicKeyTrait for SecretSubkey
Source§fn verify_signature(
&self,
hash: HashAlgorithm,
hashed: &[u8],
sig: &SignatureBytes,
) -> Result<()>
fn verify_signature( &self, hash: HashAlgorithm, hashed: &[u8], sig: &SignatureBytes, ) -> Result<()>
hash
, before verifying.Source§fn encrypt<R: Rng + CryptoRng>(
&self,
rng: R,
plain: &[u8],
typ: EskType,
) -> Result<PkeskBytes>
fn encrypt<R: Rng + CryptoRng>( &self, rng: R, plain: &[u8], typ: EskType, ) -> Result<PkeskBytes>
plain
for this key.