Struct SignatureConfig

Source
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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn version(&self) -> SignatureVersion

Source

pub fn sign<F, R>( self, key: &impl SecretKeyTrait, key_pw: F, data: R, ) -> Result<Signature>
where F: FnOnce() -> String, R: Read,

Sign the given data.

Source

pub fn sign_certification<F>( self, key: &impl SecretKeyTrait, key_pw: F, tag: Tag, id: &impl Serialize, ) -> Result<Signature>
where F: FnOnce() -> String,

Create a certification self-signature.

Source

pub fn sign_certification_third_party<F>( self, signer: &impl SecretKeyTrait, signer_pw: F, signee: &impl PublicKeyTrait, tag: Tag, id: &impl Serialize, ) -> Result<Signature>
where F: FnOnce() -> String,

Create a certification third-party signature.

Source

pub fn sign_key_binding<F>( self, signing_key: &impl SecretKeyTrait, key_pw: F, key: &impl PublicKeyTrait, ) -> Result<Signature>
where F: FnOnce() -> String,

Sign a key binding.

Source

pub fn sign_key<F>( self, signing_key: &impl SecretKeyTrait, key_pw: F, key: &impl PublicKeyTrait, ) -> Result<Signature>
where F: FnOnce() -> String,

Signs a direct key signature or a revocation.

Source

pub fn typ(&self) -> SignatureType

Returns what kind of signature this is.

Source

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.

Source

pub fn hash_data_to_sign<R>( &self, hasher: &mut dyn Hasher, data: R, ) -> Result<usize>
where R: Read,

Source

pub fn trailer(&self, len: usize) -> Result<Vec<u8>>

Source

pub 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.

Returns an iterator of all subpackets in the signature: all subpackets in the hashed area followed by all subpackets in the unhashed area.

Source

pub fn hashed_subpackets(&self) -> impl Iterator<Item = &Subpacket>

Returns an iterator over the hashed subpackets of this signature.

Source

pub fn unhashed_subpackets(&self) -> impl Iterator<Item = &Subpacket>

Returns an iterator over the unhashed subpackets of this signature.

Source

pub fn is_certification(&self) -> bool

Returns if the signature is a certification or not.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> SignatureConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SignatureConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for SignatureConfig

Source§

fn eq(&self, other: &SignatureConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for SignatureConfig

Source§

impl StructuralPartialEq for SignatureConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V