Struct pgp::composed::signed_key::secret::SignedSecretKey
source · [−]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
sourceimpl 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,
headers: Option<&BTreeMap<String, String>>
) -> Result<()>
pub fn to_armored_bytes(
&self,
headers: Option<&BTreeMap<String, String>>
) -> Result<Vec<u8>>
pub fn to_armored_string(
&self,
headers: Option<&BTreeMap<String, String>>
) -> Result<String>
Trait Implementations
sourceimpl Clone for SignedSecretKey
impl Clone for SignedSecretKey
sourcefn clone(&self) -> SignedSecretKey
fn clone(&self) -> SignedSecretKey
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for SignedSecretKey
impl Debug for SignedSecretKey
sourceimpl Deserializable for SignedSecretKey
impl Deserializable for SignedSecretKey
sourcefn from_packets<'a>(
packets: impl Iterator<Item = Packet> + 'a
) -> Box<dyn Iterator<Item = Result<Self>> + 'a>
fn from_packets<'a>(
packets: impl Iterator<Item = Packet> + 'a
) -> Box<dyn Iterator<Item = Result<Self>> + 'a>
Parse a transferable key from packets. Ref: https://tools.ietf.org/html/rfc4880.html#section-11.1
sourcefn from_bytes(bytes: impl Read) -> Result<Self>
fn from_bytes(bytes: impl Read) -> Result<Self>
Parse a single byte encoded composition.
sourcefn from_string(input: &str) -> Result<(Self, BTreeMap<String, String>)>
fn from_string(input: &str) -> Result<(Self, BTreeMap<String, String>)>
Parse a single armor encoded composition.
sourcefn from_string_many<'a>(
input: &'a str
) -> Result<(Box<dyn Iterator<Item = Result<Self>> + 'a>, BTreeMap<String, String>)>
fn from_string_many<'a>(
input: &'a str
) -> Result<(Box<dyn Iterator<Item = Result<Self>> + 'a>, BTreeMap<String, String>)>
Parse an armor encoded list of compositions.
sourcefn from_armor_single<R: Read + Seek>(
input: R
) -> Result<(Self, BTreeMap<String, String>)>
fn from_armor_single<R: Read + Seek>(
input: R
) -> Result<(Self, BTreeMap<String, String>)>
Armored ascii data.
sourceimpl KeyTrait for SignedSecretKey
impl KeyTrait for SignedSecretKey
sourcefn fingerprint(&self) -> Vec<u8>
fn fingerprint(&self) -> Vec<u8>
Returns the fingerprint of the associated primary key.
fn algorithm(&self) -> PublicKeyAlgorithm
fn is_signing_key(&self) -> bool
fn is_encryption_key(&self) -> bool
sourceimpl PartialEq<SignedSecretKey> for SignedSecretKey
impl PartialEq<SignedSecretKey> for SignedSecretKey
sourcefn eq(&self, other: &SignedSecretKey) -> bool
fn eq(&self, other: &SignedSecretKey) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &SignedSecretKey) -> bool
fn ne(&self, other: &SignedSecretKey) -> bool
This method tests for !=
.
sourceimpl PublicKeyTrait for SignedSecretKey
impl PublicKeyTrait for SignedSecretKey
sourcefn verify_signature(
&self,
hash: HashAlgorithm,
data: &[u8],
sig: &[Mpi]
) -> Result<()>
fn verify_signature(
&self,
hash: HashAlgorithm,
data: &[u8],
sig: &[Mpi]
) -> Result<()>
Verify a signed message.
Data will be hashed using hash
, before verifying. Read more
sourcefn encrypt<R: Rng + CryptoRng>(
&self,
rng: &mut R,
plain: &[u8]
) -> Result<Vec<Mpi>>
fn encrypt<R: Rng + CryptoRng>(
&self,
rng: &mut R,
plain: &[u8]
) -> Result<Vec<Mpi>>
Encrypt the given plain
for this key.
sourcefn to_writer_old(&self, writer: &mut impl Write) -> Result<()>
fn to_writer_old(&self, writer: &mut impl Write) -> Result<()>
This is the data used for hashing in a signature. Only uses the public portion of the key.
sourceimpl SecretKeyTrait for SignedSecretKey
impl SecretKeyTrait for SignedSecretKey
type PublicKey = PublicKey
fn unlock<F, G>(&self, pw: F, work: G) -> Result<()> where
F: FnOnce() -> String,
G: FnOnce(&SecretKeyRepr) -> Result<()>,
fn create_signature<F>(
&self,
key_pw: F,
hash: HashAlgorithm,
data: &[u8]
) -> Result<Vec<Mpi>> where
F: FnOnce() -> String,
fn public_key(&self) -> Self::PublicKey
sourceimpl Serialize for SignedSecretKey
impl Serialize for SignedSecretKey
impl Eq for SignedSecretKey
impl StructuralEq for SignedSecretKey
impl StructuralPartialEq for SignedSecretKey
Auto Trait Implementations
impl RefUnwindSafe for SignedSecretKey
impl Send for SignedSecretKey
impl Sync for SignedSecretKey
impl Unpin for SignedSecretKey
impl UnwindSafe for SignedSecretKey
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more