Struct pretty_good::SignaturePacket
[−]
[src]
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>, // some fields omitted }
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>
Methods
impl SignaturePacket
[src]
pub fn new(
sig_type: SignatureType,
pubkey_algo: PublicKeyAlgorithm,
hash_algo: HashAlgorithm
) -> Result<SignaturePacket, Error>
[src]
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.
pub fn contents(&self) -> Result<Signature, Error>
[src]
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
.
pub fn set_contents(&mut self, sig: Signature) -> Result<(), Error>
[src]
Set the contents of this signature.
pub fn timestamp(&self) -> Option<Duration>
[src]
Retrive the creation time of this signature.
pub fn set_timestamp(&mut self, timestamp: Duration)
[src]
Set the creation time of this signature.
pub fn signer(&self) -> Option<u64>
[src]
Retrieve the key ID of this signature's issuer.
pub fn set_signer(&mut self, signer: u64)
[src]
Set the key ID of this signature's issuer.
pub fn preferred_hash_algorithms(&self) -> Option<Vec<HashAlgorithm>>
[src]
Retrieve the preferred hash algorithms of this signature.
pub fn set_preferred_hash_algorithms<T: AsRef<[HashAlgorithm]>>(
&mut self,
algos: T,
hashed: bool
)
[src]
&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.
pub fn signable_payload<T: AsRef<[u8]>>(
&self,
payload: T
) -> Result<Vec<u8>, Error>
[src]
&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.
pub fn header(&self) -> Result<Vec<u8>, Error>
[src]
Retrieve the header for this signature, i.e. everything except the MPI contents of the signature.
pub fn to_bytes(&self) -> Result<Vec<u8>, Error>
[src]
Serialize this signature to bytes.
pub fn from_bytes(bytes: &[u8]) -> Result<SignaturePacket, Error>
[src]
Read in a signature from some bytes.
Trait Implementations
impl Clone for SignaturePacket
[src]
fn clone(&self) -> SignaturePacket
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more