pub struct SignedSecretKey {
pub primary_key: SecretKey,
pub details: SignedKeyDetails,
pub public_subkeys: Vec<SignedPublicSubKey>,
pub secret_subkeys: Vec<SignedSecretSubKey>,
}
Expand description
Represents a secret signed PGP key.
Fields§
§primary_key: SecretKey
§details: SignedKeyDetails
§public_subkeys: Vec<SignedPublicSubKey>
§secret_subkeys: Vec<SignedSecretSubKey>
Implementations§
Source§impl SignedSecretKey
impl SignedSecretKey
pub fn new( primary_key: SecretKey, details: SignedKeyDetails, public_subkeys: Vec<SignedPublicSubKey>, secret_subkeys: Vec<SignedSecretSubKey>, ) -> Self
Sourcepub fn expires_at(&self) -> Option<DateTime<Utc>>
pub fn expires_at(&self) -> Option<DateTime<Utc>>
Get the secret key expiration as a date.
pub fn verify(&self) -> Result<()>
pub fn to_armored_writer( &self, writer: &mut impl Write, opts: ArmorOptions<'_>, ) -> Result<()>
pub fn to_armored_bytes(&self, opts: ArmorOptions<'_>) -> Result<Vec<u8>>
pub fn to_armored_string(&self, opts: ArmorOptions<'_>) -> Result<String>
pub fn encrypt<R: Rng + CryptoRng>( &self, rng: R, plain: &[u8], typ: EskType, ) -> Result<PkeskBytes>
pub fn public_key(&self) -> PublicKey
Sourcepub fn signed_public_key(&self) -> SignedPublicKey
pub fn signed_public_key(&self) -> SignedPublicKey
Drops the secret key material in both the primary key and all secret subkeys. All other components of the key remain as they are.
Sourcepub fn decrypt_session_key(
&self,
key_pw: &Password,
values: &PkeskBytes,
typ: EskType,
) -> Result<Result<PlainSessionKey>>
pub fn decrypt_session_key( &self, key_pw: &Password, values: &PkeskBytes, typ: EskType, ) -> Result<Result<PlainSessionKey>>
Decrypts session key using this key.
Methods from Deref<Target = SecretKey>§
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 unlock<G, T>(&self, pw: &Password, work: G) -> Result<Result<T>>
pub fn public_key(&self) -> &PublicKey
pub fn encrypt<R: Rng + CryptoRng>( &self, rng: R, plain: &[u8], typ: EskType, ) -> Result<PkeskBytes>
Trait Implementations§
Source§impl Clone for SignedSecretKey
impl Clone for SignedSecretKey
Source§fn clone(&self) -> SignedSecretKey
fn clone(&self) -> SignedSecretKey
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SignedSecretKey
impl Debug for SignedSecretKey
Source§impl Deref for SignedSecretKey
impl Deref for SignedSecretKey
Source§impl Deserializable for SignedSecretKey
impl Deserializable for SignedSecretKey
Source§fn from_packets<'a, I: Iterator<Item = Result<Packet>> + 'a>(
packets: Peekable<I>,
) -> Box<dyn Iterator<Item = Result<Self>> + 'a>
fn from_packets<'a, I: Iterator<Item = Result<Packet>> + 'a>( packets: Peekable<I>, ) -> Box<dyn Iterator<Item = Result<Self>> + 'a>
Parse a transferable key from packets. Ref: https://www.rfc-editor.org/rfc/rfc9580.html#name-transferable-secret-keys
Source§fn matches_block_type(typ: BlockType) -> bool
fn matches_block_type(typ: BlockType) -> bool
Check if the given typ is a valid block type for this type.
Source§fn from_bytes<R: BufRead>(bytes: R) -> Result<Self>
fn from_bytes<R: BufRead>(bytes: R) -> Result<Self>
Parse a single byte encoded composition.
Source§fn from_string(input: &str) -> Result<(Self, Headers)>
fn from_string(input: &str) -> Result<(Self, Headers)>
Parse a single armor encoded composition.
Source§fn from_string_many<'a>(
input: &'a str,
) -> Result<(Box<dyn Iterator<Item = Result<Self>> + 'a>, Headers)>
fn from_string_many<'a>( input: &'a str, ) -> Result<(Box<dyn Iterator<Item = Result<Self>> + 'a>, Headers)>
Parse an armor encoded list of compositions.
Source§fn from_armor_single_buf_with_options<R: BufRead>(
input: R,
opt: DearmorOptions,
) -> Result<(Self, Headers)>
fn from_armor_single_buf_with_options<R: BufRead>( input: R, opt: DearmorOptions, ) -> Result<(Self, Headers)>
Armored ascii data, with explicit options for dearmoring.
Source§fn from_armor_many<'a, R: Read + 'a>(
input: R,
) -> Result<(Box<dyn Iterator<Item = Result<Self>> + 'a>, Headers)>
fn from_armor_many<'a, R: Read + 'a>( input: R, ) -> Result<(Box<dyn Iterator<Item = Result<Self>> + 'a>, Headers)>
Armored ascii data.
Source§fn from_armor_many_buf<'a, R: BufRead + 'a>(
input: R,
) -> Result<(Box<dyn Iterator<Item = Result<Self>> + 'a>, Headers)>
fn from_armor_many_buf<'a, R: BufRead + 'a>( input: R, ) -> Result<(Box<dyn Iterator<Item = Result<Self>> + 'a>, Headers)>
Armored ascii data.
Source§fn from_armor_many_buf_with_options<'a, R: BufRead + 'a>(
input: R,
opt: DearmorOptions,
) -> Result<(Box<dyn Iterator<Item = Result<Self>> + 'a>, Headers)>
fn from_armor_many_buf_with_options<'a, R: BufRead + 'a>( input: R, opt: DearmorOptions, ) -> Result<(Box<dyn Iterator<Item = Result<Self>> + 'a>, Headers)>
Armored ascii data, with explicit options for dearmoring.
Source§fn from_bytes_many<'a, R: BufRead + 'a>(
bytes: R,
) -> Result<Box<dyn Iterator<Item = Result<Self>> + 'a>>
fn from_bytes_many<'a, R: BufRead + 'a>( bytes: R, ) -> Result<Box<dyn Iterator<Item = Result<Self>> + 'a>>
Parse a list of compositions in raw byte format.
Source§fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>
fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>
Parse a single binary encoded composition.
Source§fn from_armor_file<P: AsRef<Path>>(path: P) -> Result<(Self, Headers)>
fn from_armor_file<P: AsRef<Path>>(path: P) -> Result<(Self, Headers)>
Parse a single armor encoded composition.
Source§fn from_armor_file_many<P: AsRef<Path>>(
path: P,
) -> Result<(Box<dyn Iterator<Item = Result<Self>>>, Headers)>
fn from_armor_file_many<P: AsRef<Path>>( path: P, ) -> Result<(Box<dyn Iterator<Item = Result<Self>>>, Headers)>
Parse a single armor encoded composition.
Source§fn from_file_many<P: AsRef<Path>>(
path: P,
) -> Result<Box<dyn Iterator<Item = Result<Self>>>>
fn from_file_many<P: AsRef<Path>>( path: P, ) -> Result<Box<dyn Iterator<Item = Result<Self>>>>
Ready binary packets from the given file.
Source§fn from_reader_single<'a, R: Read + 'a>(
input: R,
) -> Result<(Self, Option<Headers>)>
fn from_reader_single<'a, R: Read + 'a>( input: R, ) -> Result<(Self, Option<Headers>)>
Parses a single composition, from either ASCII-armored or binary OpenPGP data. Read more
fn from_reader_single_buf<'a, R: BufRead + 'a>( input: R, ) -> Result<(Self, Option<Headers>)>
Source§impl From<SignedSecretKey> for SignedPublicKey
impl From<SignedSecretKey> for SignedPublicKey
Source§fn from(value: SignedSecretKey) -> Self
fn from(value: SignedSecretKey) -> Self
Converts to this type from the input type.
Source§impl Imprint for SignedSecretKey
impl Imprint for SignedSecretKey
Source§fn imprint<D: KnownDigest>(&self) -> Result<GenericArray<u8, D::OutputSize>>
fn imprint<D: KnownDigest>(&self) -> Result<GenericArray<u8, D::OutputSize>>
An imprint is a shorthand identifier for a key. Read more
Source§impl PartialEq for SignedSecretKey
impl PartialEq for SignedSecretKey
Source§impl Serialize for SignedSecretKey
impl Serialize for SignedSecretKey
Source§impl TryFrom<PublicOrSecret> for SignedSecretKey
impl TryFrom<PublicOrSecret> for SignedSecretKey
Source§type Error = TryFromPublicOrSecretError
type Error = TryFromPublicOrSecretError
The type returned in the event of a conversion error.
impl Eq for SignedSecretKey
impl StructuralPartialEq for SignedSecretKey
Auto Trait Implementations§
impl !Freeze for SignedSecretKey
impl RefUnwindSafe for SignedSecretKey
impl Send for SignedSecretKey
impl Sync for SignedSecretKey
impl Unpin for SignedSecretKey
impl UnwindSafe for SignedSecretKey
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§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self
, then passes self.deref()
into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref()
only in debug builds, and is erased in release
builds.