pub struct SignaturePacket {
pub sig_type: SignatureType,
pub pubkey_algo: PublicKeyAlgorithm,
pub hash_algo: HashAlgorithm,
pub hashed_subpackets: Vec<Subpacket>,
pub unhashed_subpackets: Vec<Subpacket>,
/* private fields */
}Expand description
The contents of a PGP signature packet.
Fields§
§sig_type: SignatureType§pubkey_algo: PublicKeyAlgorithm§hash_algo: HashAlgorithm§hashed_subpackets: Vec<Subpacket>§unhashed_subpackets: Vec<Subpacket>Implementations§
Source§impl SignaturePacket
impl SignaturePacket
Sourcepub fn new(
sig_type: SignatureType,
pubkey_algo: PublicKeyAlgorithm,
hash_algo: HashAlgorithm,
) -> Result<SignaturePacket, Error>
pub fn new( sig_type: SignatureType, pubkey_algo: PublicKeyAlgorithm, hash_algo: HashAlgorithm, ) -> Result<SignaturePacket, Error>
Create a new signature with the given parameters. The new signature’s creation time will be set to the current system time, and the contents will be empty.
Sourcepub fn contents(&self) -> Result<Signature, Error>
pub fn contents(&self) -> Result<Signature, Error>
Retrieve the contents of this signature. For RSA signatures, this is a single
multiprecision integer representing m^d mod n; for DSA signatures this is two
multiprecision integers representing r and s.
Sourcepub fn set_contents(&mut self, sig: Signature) -> Result<(), Error>
pub fn set_contents(&mut self, sig: Signature) -> Result<(), Error>
Set the contents of this signature.
Sourcepub fn set_timestamp(&mut self, timestamp: Duration)
pub fn set_timestamp(&mut self, timestamp: Duration)
Set the creation time of this signature.
Sourcepub fn set_signer(&mut self, signer: u64)
pub fn set_signer(&mut self, signer: u64)
Set the key ID of this signature’s issuer.
Sourcepub fn preferred_hash_algorithms(&self) -> Option<Vec<HashAlgorithm>>
pub fn preferred_hash_algorithms(&self) -> Option<Vec<HashAlgorithm>>
Retrieve the preferred hash algorithms of this signature.
Sourcepub fn set_preferred_hash_algorithms<T: AsRef<[HashAlgorithm]>>(
&mut self,
algos: T,
hashed: bool,
)
pub fn set_preferred_hash_algorithms<T: AsRef<[HashAlgorithm]>>( &mut self, algos: T, hashed: bool, )
Set the preferred hash algorithms of this signature. If hashed is true, this subpacket
will be added as a hashed subpacket.
Sourcepub fn signable_payload<T: AsRef<[u8]>>(
&self,
payload: T,
) -> Result<Vec<u8>, Error>
pub fn signable_payload<T: AsRef<[u8]>>( &self, payload: T, ) -> Result<Vec<u8>, Error>
Build a payload suitable for signing.
Note that this payload must be placed in an ASN.1 DigestInfo structure prior to signing, which is outside the scope of this library.
Sourcepub fn header(&self) -> Result<Vec<u8>, Error>
pub fn header(&self) -> Result<Vec<u8>, Error>
Retrieve the header for this signature, i.e. everything except the MPI contents of the signature.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<SignaturePacket, Error>
pub fn from_bytes(bytes: &[u8]) -> Result<SignaturePacket, Error>
Read in a signature from some bytes.
Trait Implementations§
Source§impl Clone for SignaturePacket
impl Clone for SignaturePacket
Source§fn clone(&self) -> SignaturePacket
fn clone(&self) -> SignaturePacket
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more