[−][src]Enum sequoia_openpgp::packet::Signature
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.
Variants
V4(Signature4)
Signature packet version 4.
Implementations
impl Signature
[src]
Hashing-related functionality.
pub fn standalone_hash<'a, S>(sig: S) -> Result<Vec<u8>> where
S: Into<&'a Builder>,
[src]
S: Into<&'a Builder>,
Computes the message digest of standalone signatures.
pub fn timestamp_hash<'a, S>(sig: S) -> Result<Vec<u8>> where
S: Into<&'a Builder>,
[src]
S: Into<&'a Builder>,
Computes the message digest of timestamp signatures.
pub fn primary_key_binding_hash<'a, S>(
sig: S,
key: &PublicKey
) -> Result<Vec<u8>> where
S: Into<&'a Builder>,
[src]
sig: S,
key: &PublicKey
) -> Result<Vec<u8>> where
S: Into<&'a Builder>,
Returns the message digest of the primary key binding over the specified primary key.
pub fn subkey_binding_hash<'a, S>(
sig: S,
key: &PublicKey,
subkey: &PublicSubkey
) -> Result<Vec<u8>> where
S: Into<&'a Builder>,
[src]
sig: S,
key: &PublicKey,
subkey: &PublicSubkey
) -> Result<Vec<u8>> where
S: Into<&'a Builder>,
Returns the message digest of the subkey binding over the specified primary key and subkey.
pub fn userid_binding_hash<'a, S>(
sig: S,
key: &PublicKey,
userid: &UserID
) -> Result<Vec<u8>> where
S: Into<&'a Builder>,
[src]
sig: S,
key: &PublicKey,
userid: &UserID
) -> Result<Vec<u8>> where
S: Into<&'a Builder>,
Returns the message digest of the user ID binding over the specified primary key, user ID, and signature.
pub fn user_attribute_binding_hash<'a, S>(
sig: S,
key: &PublicKey,
ua: &UserAttribute
) -> Result<Vec<u8>> where
S: Into<&'a Builder>,
[src]
sig: S,
key: &PublicKey,
ua: &UserAttribute
) -> Result<Vec<u8>> where
S: Into<&'a Builder>,
Returns the message digest of the user attribute binding over the specified primary key, user attribute, and signature.
impl Signature
[src]
Methods from Deref<Target = Signature4>
pub fn version(&self) -> u8
[src]
We'd like to implement Deref for Signature4 for both signature::Builder and SubpacketArea. Unfortunately, it is only possible to implement Deref for one of them. Since SubpacketArea has more methods with much more documentation, implement deref for that, and write provider forwarders for signature::Builder. 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 hash_prefix(&self) -> &[u8; 2]
[src]
Gets the hash prefix.
pub fn set_hash_prefix(&mut self, prefix: [u8; 2]) -> [u8; 2]
[src]
Sets the hash prefix.
pub fn mpis(&self) -> &Signature
[src]
Gets the signature packet's MPIs.
pub fn set_mpis(&mut self, mpis: Signature) -> Signature
[src]
Sets the signature packet's MPIs.
pub fn computed_hash(&self) -> Option<&(HashAlgorithm, Vec<u8>)>
[src]
Gets the computed hash value.
pub fn set_computed_hash(
&mut self,
hash: Option<(HashAlgorithm, Vec<u8>)>
) -> Option<(HashAlgorithm, Vec<u8>)>
[src]
&mut self,
hash: Option<(HashAlgorithm, Vec<u8>)>
) -> Option<(HashAlgorithm, Vec<u8>)>
Sets 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 set_level(&mut self, level: usize) -> usize
[src]
Sets 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 get_issuer(&self) -> Option<KeyID>
[src]
Gets the issuer.
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_hash<R>(
&self,
key: &Key<PublicParts, R>,
hash_algo: HashAlgorithm,
hash: &[u8]
) -> Result<bool> where
R: KeyRole,
[src]
&self,
key: &Key<PublicParts, R>,
hash_algo: HashAlgorithm,
hash: &[u8]
) -> Result<bool> where
R: KeyRole,
Verifies the signature against hash
.
Note: This only verifies the cryptographic signature. 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<R>(&self, key: &Key<PublicParts, R>) -> Result<bool> where
R: KeyRole,
[src]
R: KeyRole,
Verifies the signature over text or binary documents using
key
.
Note: This only verifies the cryptographic signature. 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<R>(&self, key: &Key<PublicParts, R>) -> Result<bool> where
R: KeyRole,
[src]
R: KeyRole,
Verifies the standalone signature using key
.
Note: This only verifies the cryptographic signature. 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<R>(&self, key: &Key<PublicParts, R>) -> Result<bool> where
R: KeyRole,
[src]
R: KeyRole,
Verifies the timestamp signature using key
.
Note: This only verifies the cryptographic signature. 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_primary_key_binding<R>(
&self,
signer: &Key<PublicParts, R>,
pk: &PublicKey
) -> Result<bool> where
R: KeyRole,
[src]
&self,
signer: &Key<PublicParts, R>,
pk: &PublicKey
) -> Result<bool> where
R: KeyRole,
Verifies the primary key binding.
self
is the primary key binding 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: This only verifies the cryptographic signature. 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<R>(
&self,
signer: &Key<PublicParts, R>,
pk: &PublicKey
) -> Result<bool> where
R: KeyRole,
[src]
&self,
signer: &Key<PublicParts, R>,
pk: &PublicKey
) -> Result<bool> where
R: KeyRole,
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: This only verifies the cryptographic signature. 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<R>(
&self,
signer: &Key<PublicParts, R>,
pk: &PublicKey,
subkey: &PublicSubkey
) -> Result<bool> where
R: KeyRole,
[src]
&self,
signer: &Key<PublicParts, R>,
pk: &PublicKey,
subkey: &PublicSubkey
) -> Result<bool> where
R: KeyRole,
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: This only verifies the cryptographic signature. 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_revocation<R>(
&self,
signer: &Key<PublicParts, R>,
pk: &PublicKey,
subkey: &PublicSubkey
) -> Result<bool> where
R: KeyRole,
[src]
&self,
signer: &Key<PublicParts, R>,
pk: &PublicKey,
subkey: &PublicSubkey
) -> Result<bool> where
R: KeyRole,
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: This only verifies the cryptographic signature. 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<R>(
&self,
signer: &Key<PublicParts, R>,
pk: &PublicKey,
userid: &UserID
) -> Result<bool> where
R: KeyRole,
[src]
&self,
signer: &Key<PublicParts, R>,
pk: &PublicKey,
userid: &UserID
) -> Result<bool> where
R: KeyRole,
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: This only verifies the cryptographic signature. 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<R>(
&self,
signer: &Key<PublicParts, R>,
pk: &PublicKey,
userid: &UserID
) -> Result<bool> where
R: KeyRole,
[src]
&self,
signer: &Key<PublicParts, R>,
pk: &PublicKey,
userid: &UserID
) -> Result<bool> where
R: KeyRole,
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: This only verifies the cryptographic signature. 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<R>(
&self,
signer: &Key<PublicParts, R>,
pk: &PublicKey,
ua: &UserAttribute
) -> Result<bool> where
R: KeyRole,
[src]
&self,
signer: &Key<PublicParts, R>,
pk: &PublicKey,
ua: &UserAttribute
) -> Result<bool> where
R: KeyRole,
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: This only verifies the cryptographic signature. 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<R>(
&self,
signer: &Key<PublicParts, R>,
pk: &PublicKey,
ua: &UserAttribute
) -> Result<bool> where
R: KeyRole,
[src]
&self,
signer: &Key<PublicParts, R>,
pk: &PublicKey,
ua: &UserAttribute
) -> Result<bool> where
R: KeyRole,
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: This only verifies the cryptographic signature. 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<R>(
&self,
signer: &Key<PublicParts, R>,
msg: &[u8]
) -> Result<bool> where
R: KeyRole,
[src]
&self,
signer: &Key<PublicParts, R>,
msg: &[u8]
) -> Result<bool> where
R: KeyRole,
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: This only verifies the cryptographic signature. 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.
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.
fn deref(&self) -> &Self::Target
[src]
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]
fn from(s: Signature4) -> Self
[src]
impl Hash for Signature
[src]
impl Hash for Signature
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'a> Parse<'a, Signature> for Signature
[src]
fn from_reader<R: 'a + Read>(reader: R) -> Result<Self>
[src]
fn from_file<P: AsRef<Path>>(path: P) -> Result<T>
[src]
fn from_bytes<D: AsRef<[u8]> + ?Sized>(data: &'a D) -> Result<T>
[src]
impl PartialEq<Signature> for Signature
[src]
impl Serialize for Signature
[src]
fn serialize(&self, o: &mut dyn Write) -> Result<()>
[src]
fn export(&self, o: &mut dyn Write) -> Result<()>
[src]
impl SerializeInto for Signature
[src]
fn serialized_len(&self) -> usize
[src]
fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>
[src]
fn export_into(&self, buf: &mut [u8]) -> Result<usize>
[src]
fn export_to_vec(&self) -> Result<Vec<u8>>
[src]
fn to_vec(&self) -> Result<Vec<u8>>
[src]
impl StructuralEq for Signature
[src]
impl StructuralPartialEq for Signature
[src]
impl<'a> TryFrom<&'a Signature> for OnePassSig3
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Signature
impl Send for Signature
impl Sync for Signature
impl Unpin for Signature
impl !UnwindSafe for Signature
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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,