pub struct Signature {
pub config: SignatureConfig,
pub signed_hash_value: [u8; 2],
pub signature: Vec<Mpi>,
/* private fields */
}
Expand description
Signature Packet https://tools.ietf.org/html/rfc4880.html#section-5.2
Fields§
§config: SignatureConfig
§signed_hash_value: [u8; 2]
§signature: Vec<Mpi>
Implementations§
source§impl Signature
impl Signature
pub fn new( packet_version: Version, version: SignatureVersion, typ: SignatureType, pub_alg: PublicKeyAlgorithm, hash_alg: HashAlgorithm, signed_hash_value: [u8; 2], signature: Vec<Mpi>, hashed_subpackets: Vec<Subpacket>, unhashed_subpackets: Vec<Subpacket> ) -> Self
pub fn from_config( config: SignatureConfig, signed_hash_value: [u8; 2], signature: Vec<Mpi> ) -> Self
sourcepub fn typ(&self) -> SignatureType
pub fn typ(&self) -> SignatureType
Returns what kind of signature this is.
sourcepub fn verify<R>(&self, key: &impl PublicKeyTrait, data: R) -> Result<()>where
R: Read,
pub fn verify<R>(&self, key: &impl PublicKeyTrait, data: R) -> Result<()>where
R: Read,
Verify this signature.
sourcepub fn verify_certification(
&self,
key: &impl PublicKeyTrait,
tag: Tag,
id: &impl Serialize
) -> Result<()>
pub fn verify_certification( &self, key: &impl PublicKeyTrait, tag: Tag, id: &impl Serialize ) -> Result<()>
Verifies a certification signature type.
sourcepub fn verify_key_binding(
&self,
signing_key: &impl PublicKeyTrait,
key: &impl PublicKeyTrait
) -> Result<()>
pub fn verify_key_binding( &self, signing_key: &impl PublicKeyTrait, key: &impl PublicKeyTrait ) -> Result<()>
Verifies a key binding (which binds a subkey to the primary key).
“Subkey Binding Signature (type ID 0x18)”
sourcepub fn verify_backwards_key_binding(
&self,
signing_key: &impl PublicKeyTrait,
key: &impl PublicKeyTrait
) -> Result<()>
pub fn verify_backwards_key_binding( &self, signing_key: &impl PublicKeyTrait, key: &impl PublicKeyTrait ) -> Result<()>
Verifies a primary key binding signature, or “back signature” (which links the primary to a signing subkey).
“Primary Key Binding Signature (type ID 0x19)”
sourcepub fn verify_key(&self, key: &impl PublicKeyTrait) -> Result<()>
pub fn verify_key(&self, key: &impl PublicKeyTrait) -> Result<()>
Verifies a direct key signature or a revocation.
sourcepub fn is_certification(&self) -> bool
pub fn is_certification(&self) -> bool
Returns if the signature is a certification or not.
pub fn key_expiration_time(&self) -> Option<&Duration>
pub fn signature_expiration_time(&self) -> Option<&Duration>
pub fn created(&self) -> Option<&DateTime<Utc>>
pub fn issuer(&self) -> Vec<&KeyId>
pub fn issuer_fingerprint(&self) -> Vec<&[u8]>
pub fn preferred_symmetric_algs(&self) -> &[SymmetricKeyAlgorithm]
pub fn preferred_hash_algs(&self) -> &[HashAlgorithm]
pub fn preferred_compression_algs(&self) -> &[CompressionAlgorithm]
pub fn key_server_prefs(&self) -> &[u8] ⓘ
pub fn key_flags(&self) -> KeyFlags
pub fn features(&self) -> &[u8] ⓘ
pub fn revocation_reason_code(&self) -> Option<&RevocationCode>
pub fn revocation_reason_string(&self) -> Option<&BStr>
pub fn is_primary(&self) -> bool
pub fn is_revocable(&self) -> bool
pub fn embedded_signature(&self) -> Option<&Signature>
pub fn preferred_key_server(&self) -> Option<&str>
pub fn notations(&self) -> Vec<&Notation>
pub fn revocation_key(&self) -> Option<&RevocationKey>
sourcepub fn signers_userid(&self) -> Option<&BStr>
pub fn signers_userid(&self) -> Option<&BStr>
Gets the user id of the signer
Note that the user id may not be valid utf-8, if it was created using a different encoding. But since the RFC describes every text as utf-8 it is up to the caller whether to error on non utf-8 data.