[][src]Enum sequoia_openpgp::packet::Signature

pub enum Signature {
    V4(Signature4),
    // some variants omitted
}

Holds a signature packet.

Signature packets are used both for certification purposes as well as for document signing purposes.

See Section 5.2 of RFC 4880 for details.

Note: This enum cannot be exhaustively matched to allow future extensions.

Variants

Signature packet version 4.

Implementations

impl Signature[src]

Hashing-related functionality.

pub fn hash_standalone<'a, S>(sig: S) -> Result<Vec<u8>> where
    S: Into<&'a Builder>, 
[src]

Computes the message digest of standalone signatures.

pub fn hash_timestamp<'a, S>(sig: S) -> Result<Vec<u8>> where
    S: Into<&'a Builder>, 
[src]

Computes the message digest of timestamp signatures.

pub fn hash_direct_key<'a, P, S>(
    sig: S,
    key: &Key<P, PrimaryRole>
) -> Result<Vec<u8>> where
    P: KeyParts,
    S: Into<&'a Builder>, 
[src]

Returns the message digest of the direct key signature over the specified primary key.

pub fn hash_subkey_binding<'a, P, Q, S>(
    sig: S,
    key: &Key<P, PrimaryRole>,
    subkey: &Key<Q, SubordinateRole>
) -> Result<Vec<u8>> where
    P: KeyParts,
    Q: KeyParts,
    S: Into<&'a Builder>, 
[src]

Returns the message digest of the subkey binding over the specified primary key and subkey.

pub fn hash_primary_key_binding<'a, P, Q, S>(
    sig: S,
    key: &Key<P, PrimaryRole>,
    subkey: &Key<Q, SubordinateRole>
) -> Result<Vec<u8>> where
    P: KeyParts,
    Q: KeyParts,
    S: Into<&'a Builder>, 
[src]

Returns the message digest of the primary key binding over the specified primary key and subkey.

pub fn hash_userid_binding<'a, P, S>(
    sig: S,
    key: &Key<P, PrimaryRole>,
    userid: &UserID
) -> Result<Vec<u8>> where
    P: KeyParts,
    S: Into<&'a Builder>, 
[src]

Returns the message digest of the user ID binding over the specified primary key, user ID, and signature.

pub fn hash_user_attribute_binding<'a, P, S>(
    sig: S,
    key: &Key<P, PrimaryRole>,
    ua: &UserAttribute
) -> Result<Vec<u8>> where
    P: KeyParts,
    S: Into<&'a Builder>, 
[src]

Returns the message digest of the user attribute binding over the specified primary key, user attribute, and signature.

impl Signature[src]

pub fn get_issuers(&self) -> Vec<KeyHandle>[src]

Collects all the issuers.

A signature can contain multiple hints as to who issued the signature.

pub fn normalize(&self) -> Self[src]

Normalizes the signature.

This function normalizes the unhashed signature subpackets. All but the following subpackets are removed:

  • SubpacketValue::Issuer is left in place, is added, or updated from the hashed signature subpackets, and
  • the first SubpacketValue::EmbeddedSignature is left in place.

pub fn verify_digest<P, R, D>(&self, key: &Key<P, R>, digest: D) -> Result<()> where
    P: KeyParts,
    R: KeyRole,
    D: AsRef<[u8]>, 
[src]

Verifies the signature against hash.

Note: Due to limited context, this only verifies the cryptographic signature and checks that the key predates the signature. Further constraints on the signature, like creation and expiration time, or signature revocations must be checked by the caller.

Likewise, this function does not check whether key can made valid signatures; it is up to the caller to make sure the key is not revoked, not expired, has a valid self-signature, has a subkey binding signature (if appropriate), has the signing capability, etc.

pub fn verify<P, R>(&self, key: &Key<P, R>) -> Result<()> where
    P: KeyParts,
    R: KeyRole
[src]

Verifies the signature over text or binary documents using key.

Note: Due to limited context, this only verifies the cryptographic signature, checks the signature's type, and checks that the key predates the signature. Further constraints on the signature, like creation and expiration time, or signature revocations must be checked by the caller.

Likewise, this function does not check whether key can make valid signatures; it is up to the caller to make sure the key is not revoked, not expired, has a valid self-signature, has a subkey binding signature (if appropriate), has the signing capability, etc.

pub fn verify_standalone<P, R>(&self, key: &Key<P, R>) -> Result<()> where
    P: KeyParts,
    R: KeyRole
[src]

Verifies the standalone signature using key.

Note: Due to limited context, this only verifies the cryptographic signature, checks the signature's type, and checks that the key predates the signature. Further constraints on the signature, like creation and expiration time, or signature revocations must be checked by the caller.

Likewise, this function does not check whether key can make valid signatures; it is up to the caller to make sure the key is not revoked, not expired, has a valid self-signature, has a subkey binding signature (if appropriate), has the signing capability, etc.

pub fn verify_timestamp<P, R>(&self, key: &Key<P, R>) -> Result<()> where
    P: KeyParts,
    R: KeyRole
[src]

Verifies the timestamp signature using key.

Note: Due to limited context, this only verifies the cryptographic signature, checks the signature's type, and checks that the key predates the signature. Further constraints on the signature, like creation and expiration time, or signature revocations must be checked by the caller.

Likewise, this function does not check whether key can make valid signatures; it is up to the caller to make sure the key is not revoked, not expired, has a valid self-signature, has a subkey binding signature (if appropriate), has the signing capability, etc.

pub fn verify_direct_key<P, Q, R>(
    &self,
    signer: &Key<P, R>,
    pk: &Key<Q, PrimaryRole>
) -> Result<()> where
    P: KeyParts,
    Q: KeyParts,
    R: KeyRole
[src]

Verifies the direct key signature.

self is the direct key signature, signer is the key that allegedly made the signature, and pk is the primary key.

For a self-signature, signer and pk will be the same.

Note: Due to limited context, this only verifies the cryptographic signature, checks the signature's type, and checks that the key predates the signature. Further constraints on the signature, like creation and expiration time, or signature revocations must be checked by the caller.

Likewise, this function does not check whether signer can made valid signatures; it is up to the caller to make sure the key is not revoked, not expired, has a valid self-signature, has a subkey binding signature (if appropriate), has the signing capability, etc.

pub fn verify_primary_key_revocation<P, Q, R>(
    &self,
    signer: &Key<P, R>,
    pk: &Key<Q, PrimaryRole>
) -> Result<()> where
    P: KeyParts,
    Q: KeyParts,
    R: KeyRole
[src]

Verifies the primary key revocation certificate.

self is the primary key revocation certificate, signer is the key that allegedly made the signature, and pk is the primary key,

For a self-signature, signer and pk will be the same.

Note: Due to limited context, this only verifies the cryptographic signature, checks the signature's type, and checks that the key predates the signature. Further constraints on the signature, like creation and expiration time, or signature revocations must be checked by the caller.

Likewise, this function does not check whether signer can made valid signatures; it is up to the caller to make sure the key is not revoked, not expired, has a valid self-signature, has a subkey binding signature (if appropriate), has the signing capability, etc.

pub fn verify_subkey_binding<P, Q, R, S>(
    &self,
    signer: &Key<P, R>,
    pk: &Key<Q, PrimaryRole>,
    subkey: &Key<S, SubordinateRole>
) -> Result<()> where
    P: KeyParts,
    Q: KeyParts,
    R: KeyRole,
    S: KeyParts
[src]

Verifies the subkey binding.

self is the subkey key binding signature, signer is the key that allegedly made the signature, pk is the primary key, and subkey is the subkey.

For a self-signature, signer and pk will be the same.

If the signature indicates that this is a Signing capable subkey, then the back signature is also verified. If it is missing or can't be verified, then this function returns false.

Note: Due to limited context, this only verifies the cryptographic signature, checks the signature's type, and checks that the key predates the signature. Further constraints on the signature, like creation and expiration time, or signature revocations must be checked by the caller.

Likewise, this function does not check whether signer can made valid signatures; it is up to the caller to make sure the key is not revoked, not expired, has a valid self-signature, has a subkey binding signature (if appropriate), has the signing capability, etc.

pub fn verify_primary_key_binding<P, Q>(
    &self,
    pk: &Key<P, PrimaryRole>,
    subkey: &Key<Q, SubordinateRole>
) -> Result<()> where
    P: KeyParts,
    Q: KeyParts
[src]

Verifies the primary key binding.

self is the primary key binding signature, pk is the primary key, and subkey is the subkey.

Note: Due to limited context, this only verifies the cryptographic signature, checks the signature's type, and checks that the key predates the signature. Further constraints on the signature, like creation and expiration time, or signature revocations must be checked by the caller.

Likewise, this function does not check whether subkey can made valid signatures; it is up to the caller to make sure the key is not revoked, not expired, has a valid self-signature, has a subkey binding signature (if appropriate), has the signing capability, etc.

pub fn verify_subkey_revocation<P, Q, R, S>(
    &self,
    signer: &Key<P, R>,
    pk: &Key<Q, PrimaryRole>,
    subkey: &Key<S, SubordinateRole>
) -> Result<()> where
    P: KeyParts,
    Q: KeyParts,
    R: KeyRole,
    S: KeyParts
[src]

Verifies the subkey revocation.

self is the subkey key revocation certificate, signer is the key that allegedly made the signature, pk is the primary key, and subkey is the subkey.

For a self-revocation, signer and pk will be the same.

Note: Due to limited context, this only verifies the cryptographic signature, checks the signature's type, and checks that the key predates the signature. Further constraints on the signature, like creation and expiration time, or signature revocations must be checked by the caller.

Likewise, this function does not check whether signer can made valid signatures; it is up to the caller to make sure the key is not revoked, not expired, has a valid self-signature, has a subkey binding signature (if appropriate), has the signing capability, etc.

pub fn verify_userid_binding<P, Q, R>(
    &self,
    signer: &Key<P, R>,
    pk: &Key<Q, PrimaryRole>,
    userid: &UserID
) -> Result<()> where
    P: KeyParts,
    Q: KeyParts,
    R: KeyRole
[src]

Verifies the user id binding.

self is the user id binding signature, signer is the key that allegedly made the signature, pk is the primary key, and userid is the user id.

For a self-signature, signer and pk will be the same.

Note: Due to limited context, this only verifies the cryptographic signature, checks the signature's type, and checks that the key predates the signature. Further constraints on the signature, like creation and expiration time, or signature revocations must be checked by the caller.

Likewise, this function does not check whether signer can made valid signatures; it is up to the caller to make sure the key is not revoked, not expired, has a valid self-signature, has a subkey binding signature (if appropriate), has the signing capability, etc.

pub fn verify_userid_revocation<P, Q, R>(
    &self,
    signer: &Key<P, R>,
    pk: &Key<Q, PrimaryRole>,
    userid: &UserID
) -> Result<()> where
    P: KeyParts,
    Q: KeyParts,
    R: KeyRole
[src]

Verifies the user id revocation certificate.

self is the revocation certificate, signer is the key that allegedly made the signature, pk is the primary key, and userid is the user id.

For a self-signature, signer and pk will be the same.

Note: Due to limited context, this only verifies the cryptographic signature, checks the signature's type, and checks that the key predates the signature. Further constraints on the signature, like creation and expiration time, or signature revocations must be checked by the caller.

Likewise, this function does not check whether signer can made valid signatures; it is up to the caller to make sure the key is not revoked, not expired, has a valid self-signature, has a subkey binding signature (if appropriate), has the signing capability, etc.

pub fn verify_user_attribute_binding<P, Q, R>(
    &self,
    signer: &Key<P, R>,
    pk: &Key<Q, PrimaryRole>,
    ua: &UserAttribute
) -> Result<()> where
    P: KeyParts,
    Q: KeyParts,
    R: KeyRole
[src]

Verifies the user attribute binding.

self is the user attribute binding signature, signer is the key that allegedly made the signature, pk is the primary key, and ua is the user attribute.

For a self-signature, signer and pk will be the same.

Note: Due to limited context, this only verifies the cryptographic signature, checks the signature's type, and checks that the key predates the signature. Further constraints on the signature, like creation and expiration time, or signature revocations must be checked by the caller.

Likewise, this function does not check whether signer can made valid signatures; it is up to the caller to make sure the key is not revoked, not expired, has a valid self-signature, has a subkey binding signature (if appropriate), has the signing capability, etc.

pub fn verify_user_attribute_revocation<P, Q, R>(
    &self,
    signer: &Key<P, R>,
    pk: &Key<Q, PrimaryRole>,
    ua: &UserAttribute
) -> Result<()> where
    P: KeyParts,
    Q: KeyParts,
    R: KeyRole
[src]

Verifies the user attribute revocation certificate.

self is the user attribute binding signature, signer is the key that allegedly made the signature, pk is the primary key, and ua is the user attribute.

For a self-signature, signer and pk will be the same.

Note: Due to limited context, this only verifies the cryptographic signature, checks the signature's type, and checks that the key predates the signature. Further constraints on the signature, like creation and expiration time, or signature revocations must be checked by the caller.

Likewise, this function does not check whether signer can made valid signatures; it is up to the caller to make sure the key is not revoked, not expired, has a valid self-signature, has a subkey binding signature (if appropriate), has the signing capability, etc.

pub fn verify_message<M, P, R>(&self, signer: &Key<P, R>, msg: M) -> Result<()> where
    M: AsRef<[u8]>,
    P: KeyParts,
    R: KeyRole
[src]

Verifies a signature of a message.

self is the message signature, signer is the key that allegedly made the signature and msg is the message.

This function is for short messages, if you want to verify larger files use Verifier.

Note: Due to limited context, this only verifies the cryptographic signature, checks the signature's type, and checks that the key predates the signature. Further constraints on the signature, like creation and expiration time, or signature revocations must be checked by the caller.

Likewise, this function does not check whether signer can made valid signatures; it is up to the caller to make sure the key is not revoked, not expired, has a valid self-signature, has a subkey binding signature (if appropriate), has the signing capability, etc.

impl Signature[src]

pub fn version(&self) -> u8[src]

Gets the version.

Methods from Deref<Target = Signature4>

pub fn version(&self) -> u8[src]

Gets the version.

pub fn typ(&self) -> SignatureType[src]

Gets the signature type.

pub fn pk_algo(&self) -> PublicKeyAlgorithm[src]

Gets the public key algorithm.

pub fn hash_algo(&self) -> HashAlgorithm[src]

Gets the hash algorithm.

pub fn digest_prefix(&self) -> &[u8; 2][src]

Gets the hash prefix.

pub fn mpis(&self) -> &Signature[src]

Gets the signature packet's MPIs.

pub fn computed_digest(&self) -> Option<&[u8]>[src]

Gets the computed hash value.

pub fn level(&self) -> usize[src]

Gets the signature level.

A level of 0 indicates that the signature is directly over the data, a level of 1 means that the signature is a notarization over all level 0 signatures and the data, and so on.

pub fn exportable(&self) -> Result<()>[src]

Tests whether or not this signature is exportable.

Trait Implementations

impl Clone for Signature[src]

impl Debug for Signature[src]

impl Deref for Signature[src]

type Target = Signature4

The resulting type after dereferencing.

impl DerefMut for Signature[src]

impl Eq for Signature[src]

impl<'a> From<&'a Signature> for &'a Builder[src]

impl From<Signature> for Builder[src]

impl From<Signature> for Packet[src]

impl From<Signature4> for Signature[src]

impl Hash for Signature[src]

fn hash(&self, hash: &mut Context)[src]

Adds the Signature to the provided hash context.

impl Hash for Signature[src]

impl Marshal for Signature[src]

impl MarshalInto for Signature[src]

impl<'a> Parse<'a, Signature> for Signature[src]

impl PartialEq<Signature> for Signature[src]

impl StructuralEq for Signature[src]

impl StructuralPartialEq for Signature[src]

impl<'a> TryFrom<&'a Signature> for OnePassSig3[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,