[−][src]Struct sequoia_openpgp::TSK
A transferable secret key (TSK).
A TSK (see RFC 4880, section 11.2) can be used to create signatures and decrypt data.
Methods
impl TSK
[src]
pub fn from_packet_parser<'a>(ppr: PacketParserResult<'a>) -> Result<Self>
[src]
Initializes a TSK
from a PacketParser
.
pub fn from_reader<'a, R: 'a + Read>(reader: R) -> Result<Self>
[src]
Initializes a TSK
from a Read
er.
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>
[src]
Initializes a TSK
from a File
.
pub fn from_bytes<'a>(data: &'a [u8]) -> Result<Self>
[src]
Initializes a TSK
from a byte string.
pub fn new<'a, O: Into<Option<Cow<'a, str>>>>(
primary_uid: O
) -> Result<(TSK, Signature)>
[src]
primary_uid: O
) -> Result<(TSK, Signature)>
Generates a new key OpenPGP key. The key will be capable of encryption and signing. If no user id is given the primary self signature will be a direct key signature.
pub fn tpk<'a>(&'a self) -> &'a TPK
[src]
Returns a reference to the corresponding TPK.
pub fn into_tpk(self) -> TPK
[src]
Converts to a TPK.
Methods from Deref<Target = TPK>
pub fn primary(&self) -> &Key
[src]
Returns a reference to the primary key.
pub fn primary_key_signature_full(
&self
) -> Option<(Option<&UserIDBinding>, &Signature)>
[src]
&self
) -> Option<(Option<&UserIDBinding>, &Signature)>
Returns the primary key's current self-signature and, if it
belong to a user id, a reference to the UserIDBinding
.
Normally, the primary key's current self-signature is the primary user id's newest, non-revoked self-signature. However, if all user ids are revoked and there is a direct signature, that is returned. If there is no direct signature, then we return the newest self-signature on the most recently revoked user id (i.e., the binding signature that was last valid). If there are no user ids at all and no direct signatures, then we return None.
pub fn primary_key_signature(&self) -> Option<&Signature>
[src]
Returns the primary key's current self-signature.
This function is identical to
TPK::primary_key_signature_full()
, but it doesn't return the
UserIDBinding
.
pub fn revoked(&self) -> RevocationStatus
[src]
Returns the TPK's revocation status.
Note: this only returns whether the TPK is revoked. If you want to know whether a subkey, user id, etc., is revoked, then you need to query them separately.
pub fn revoke(
&self,
code: ReasonForRevocation,
reason: &[u8]
) -> Result<Signature>
[src]
&self,
code: ReasonForRevocation,
reason: &[u8]
) -> Result<Signature>
Returns a revocation certificate for the TPK.
pub fn expired(&self) -> bool
[src]
Returns whether or not the TPK has expired.
pub fn expired_at(&self, tm: Tm) -> bool
[src]
Returns whether or not the key is expired at the given time.
pub fn userids(&self) -> UserIDBindingIter
[src]
Returns an iterator over the TPK's valid UserIDBinding
s.
The primary user id is returned first. A valid
UserIDBinding
has at least one good self-signature.
pub fn user_attributes(&self) -> UserAttributeBindingIter
[src]
Returns an iterator over the TPK's valid UserAttributeBinding
s.
A valid UserIDAttributeBinding
has at least one good
self-signature.
pub fn subkeys(&self) -> SubkeyBindingIter
[src]
Returns an iterator over the TPK's valid subkeys.
A valid SubkeyBinding
has at least one good self-signature.
pub fn keys(&self) -> KeyIter
[src]
Returns an iterator over all of the TPK's valid keys.
That is, this returns an iterator over the primary key and any subkeys, along with the corresponding signatures.
Note: since a primary key is different from a binding, the
iterator is over Key
s and not SubkeyBindings
.
Furthermore, the primary key has no binding signature. Here,
the signature carrying the primary key's key flags is
returned. There are corner cases where no such signature
exists (e.g. partial TPKs), therefore this iterator may return
None
for the primary key's signature.
A valid Key
has at least one good self-signature.
pub fn fingerprint(&self) -> Fingerprint
[src]
Returns the TPK's fingerprint.
pub fn is_tsk(&self) -> bool
[src]
Returns whether at least one of the keys includes a secret part.
Trait Implementations
impl Debug for TSK
[src]
impl Deref for TSK
[src]
impl DerefMut for TSK
[src]
impl PartialEq<TSK> for TSK
[src]
impl Serialize for TSK
[src]
fn serialize<W: Write>(&self, o: &mut W) -> Result<()>
[src]
Serializes the TSK.
fn to_vec(&self) -> Result<Vec<u8>>
[src]
impl StructuralPartialEq for TSK
[src]
Auto Trait Implementations
impl !RefUnwindSafe for TSK
impl Send for TSK
impl !Sync for TSK
impl Unpin for TSK
impl UnwindSafe for TSK
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,