pub struct SignatureConfig {
pub typ: SignatureType,
pub pub_alg: PublicKeyAlgorithm,
pub hash_alg: HashAlgorithm,
pub unhashed_subpackets: Vec<Subpacket>,
pub hashed_subpackets: Vec<Subpacket>,
pub version_specific: SignatureVersionSpecific,
}
Fields§
§typ: SignatureType
§pub_alg: PublicKeyAlgorithm
§hash_alg: HashAlgorithm
§unhashed_subpackets: Vec<Subpacket>
§hashed_subpackets: Vec<Subpacket>
§version_specific: SignatureVersionSpecific
Implementations§
Source§impl SignatureConfig
impl SignatureConfig
Sourcepub fn v2(
typ: SignatureType,
pub_alg: PublicKeyAlgorithm,
hash_alg: HashAlgorithm,
created: DateTime<Utc>,
issuer: KeyId,
) -> Self
pub fn v2( typ: SignatureType, pub_alg: PublicKeyAlgorithm, hash_alg: HashAlgorithm, created: DateTime<Utc>, issuer: KeyId, ) -> Self
Constructor for a v2 SignatureConfig (which represents the data of a v2 OpenPGP signature packet)
OpenPGP v2 Signatures are historical and not used anymore.
Sourcepub fn v3(
typ: SignatureType,
pub_alg: PublicKeyAlgorithm,
hash_alg: HashAlgorithm,
created: DateTime<Utc>,
issuer: KeyId,
) -> Self
pub fn v3( typ: SignatureType, pub_alg: PublicKeyAlgorithm, hash_alg: HashAlgorithm, created: DateTime<Utc>, issuer: KeyId, ) -> Self
Constructor for a v3 SignatureConfig (which represents the data of a v3 OpenPGP signature packet)
OpenPGP v3 Signatures are historical and not used anymore.
Sourcepub fn v4(
typ: SignatureType,
pub_alg: PublicKeyAlgorithm,
hash_alg: HashAlgorithm,
) -> Self
pub fn v4( typ: SignatureType, pub_alg: PublicKeyAlgorithm, hash_alg: HashAlgorithm, ) -> Self
Constructor for a v4 SignatureConfig (which represents the data of a v4 OpenPGP signature packet)
OpenPGP v4 signatures were first specified in RFC 2440, and are commonly produced by OpenPGP v4 keys.
Sourcepub fn v6<R: CryptoRng + Rng>(
rng: R,
typ: SignatureType,
pub_alg: PublicKeyAlgorithm,
hash_alg: HashAlgorithm,
) -> Result<Self>
pub fn v6<R: CryptoRng + Rng>( rng: R, typ: SignatureType, pub_alg: PublicKeyAlgorithm, hash_alg: HashAlgorithm, ) -> Result<Self>
Constructor for a v6 SignatureConfig (which represents the data of a v6 OpenPGP signature packet).
Generates a new salt via rng
.
OpenPGP v6 signatures are specified in RFC 9580, they are produced by OpenPGP v6 keys.
Sourcepub fn v6_with_salt(
typ: SignatureType,
pub_alg: PublicKeyAlgorithm,
hash_alg: HashAlgorithm,
salt: Vec<u8>,
) -> Self
pub fn v6_with_salt( typ: SignatureType, pub_alg: PublicKeyAlgorithm, hash_alg: HashAlgorithm, salt: Vec<u8>, ) -> Self
Constructor for a v6 SignatureConfig (which represents the data of a v6 OpenPGP signature packet).
OpenPGP v6 signatures are specified in RFC 9580, they are produced by OpenPGP v6 keys.
pub fn version(&self) -> SignatureVersion
Sourcepub fn sign<F, R>(
self,
key: &impl SecretKeyTrait,
key_pw: F,
data: R,
) -> Result<Signature>
pub fn sign<F, R>( self, key: &impl SecretKeyTrait, key_pw: F, data: R, ) -> Result<Signature>
Sign the given data.
Sourcepub fn sign_certification<F>(
self,
key: &impl SecretKeyTrait,
key_pw: F,
tag: Tag,
id: &impl Serialize,
) -> Result<Signature>
pub fn sign_certification<F>( self, key: &impl SecretKeyTrait, key_pw: F, tag: Tag, id: &impl Serialize, ) -> Result<Signature>
Create a certification self-signature.
Sourcepub fn sign_certification_third_party<F>(
self,
signer: &impl SecretKeyTrait,
signer_pw: F,
signee: &impl PublicKeyTrait,
tag: Tag,
id: &impl Serialize,
) -> Result<Signature>
pub fn sign_certification_third_party<F>( self, signer: &impl SecretKeyTrait, signer_pw: F, signee: &impl PublicKeyTrait, tag: Tag, id: &impl Serialize, ) -> Result<Signature>
Create a certification third-party signature.
Sourcepub fn sign_key_binding<F>(
self,
signing_key: &impl SecretKeyTrait,
key_pw: F,
key: &impl PublicKeyTrait,
) -> Result<Signature>
pub fn sign_key_binding<F>( self, signing_key: &impl SecretKeyTrait, key_pw: F, key: &impl PublicKeyTrait, ) -> Result<Signature>
Sign a key binding.
Sourcepub fn sign_key<F>(
self,
signing_key: &impl SecretKeyTrait,
key_pw: F,
key: &impl PublicKeyTrait,
) -> Result<Signature>
pub fn sign_key<F>( self, signing_key: &impl SecretKeyTrait, key_pw: F, key: &impl PublicKeyTrait, ) -> Result<Signature>
Signs a direct key signature or a revocation.
Sourcepub fn typ(&self) -> SignatureType
pub fn typ(&self) -> SignatureType
Returns what kind of signature this is.
Sourcepub fn hash_signature_data(&self, hasher: &mut dyn Write) -> Result<usize>
pub fn hash_signature_data(&self, hasher: &mut dyn Write) -> Result<usize>
Calculate the serialized version of this packet, but only the part relevant for hashing.
pub fn hash_data_to_sign<R>(
&self,
hasher: &mut dyn Hasher,
data: R,
) -> Result<usize>where
R: Read,
pub fn trailer(&self, len: usize) -> Result<Vec<u8>>
Sourcepub fn subpackets(&self) -> impl Iterator<Item = &Subpacket>
👎Deprecated: Usually only hashed_subpackets should be used. unhashed_subpackets are only safe and useful to access in rare circumstances. When they are needed, unhashed_subpackets should be explicitly called.
pub fn subpackets(&self) -> impl Iterator<Item = &Subpacket>
Returns an iterator of all subpackets in the signature: all subpackets in the hashed area followed by all subpackets in the unhashed area.
Sourcepub fn hashed_subpackets(&self) -> impl Iterator<Item = &Subpacket>
pub fn hashed_subpackets(&self) -> impl Iterator<Item = &Subpacket>
Returns an iterator over the hashed subpackets of this signature.
Sourcepub fn unhashed_subpackets(&self) -> impl Iterator<Item = &Subpacket>
pub fn unhashed_subpackets(&self) -> impl Iterator<Item = &Subpacket>
Returns an iterator over the unhashed subpackets of this signature.
Sourcepub fn is_certification(&self) -> bool
pub fn is_certification(&self) -> bool
Returns if the signature is a certification or not.
Sourcepub fn created(&self) -> Option<&DateTime<Utc>>
pub fn created(&self) -> Option<&DateTime<Utc>>
Signature Creation Time.
The time the signature was made. MUST be present in the hashed area.
https://www.rfc-editor.org/rfc/rfc9580.html#name-signature-creation-time
Returns the first Signature Creation Time subpacket, only from the hashed area.
Sourcepub fn issuer(&self) -> Vec<&KeyId>
pub fn issuer(&self) -> Vec<&KeyId>
Issuer Key ID.
The OpenPGP Key ID of the key issuing the signature.
https://www.rfc-editor.org/rfc/rfc9580.html#name-issuer-key-id
Returns Issuer subpacket data from both the hashed and unhashed area.
Sourcepub fn issuer_fingerprint(&self) -> Vec<&Fingerprint>
pub fn issuer_fingerprint(&self) -> Vec<&Fingerprint>
Issuer Fingerprint.
The OpenPGP Key fingerprint of the key issuing the signature.
https://www.rfc-editor.org/rfc/rfc9580.html#name-issuer-fingerprint
Returns Issuer Fingerprint subpacket data from both the hashed and unhashed area.
Trait Implementations§
Source§impl Clone for SignatureConfig
impl Clone for SignatureConfig
Source§fn clone(&self) -> SignatureConfig
fn clone(&self) -> SignatureConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more