pub struct PeSign {
pub signed_data: SignedData,
pub authenticode_digest: String,
pub authenticode_digest_algorithm: Algorithm,
/* private fields */
}
Expand description
Obtaining a PE file’s signature
This includes all the information in the PE signature: certificate list, signer information, and Authenticode.
You can retrieve the signature data from a specified PE file path using PeSign::from_pe_path
, or parse it
from an exported signature byte array using PeSign::from_certificate_table_buf
.
Example:
use pesign::PeSign;
let pesign = PeSign::from_pe_path("test.exe").unwrap().unwrap();
println!("{}", pesign.signed_data.signer_info);
Fields§
§signed_data: SignedData
§authenticode_digest: String
§authenticode_digest_algorithm: Algorithm
Implementations§
Source§impl<'a> PeSign
impl<'a> PeSign
pub fn from_reader<R: Reader<'a>>(decoder: &mut R) -> Result<Self, PeSignError>
Sourcepub fn from_certificate_table_buf(bin: &[u8]) -> Result<Self, PeSignError>
pub fn from_certificate_table_buf(bin: &[u8]) -> Result<Self, PeSignError>
Extract signature information from the exported certificate.
Sourcepub fn from_pe_path<P: AsRef<Path>>(
filename: P,
) -> Result<Option<Self>, PeSignError>
pub fn from_pe_path<P: AsRef<Path>>( filename: P, ) -> Result<Option<Self>, PeSignError>
Extract signature information from a disk file.
Sourcepub fn from_pe_data(bin: &[u8]) -> Result<Option<Self>, PeSignError>
pub fn from_pe_data(bin: &[u8]) -> Result<Option<Self>, PeSignError>
Extract signature information from a memory pe data.
Sourcepub fn from_pe_image(image: &mut PE<'_>) -> Result<Option<Self>, PeSignError>
pub fn from_pe_image(image: &mut PE<'_>) -> Result<Option<Self>, PeSignError>
Extract signature information from PE
.
Sourcepub fn verify(&self, option: &VerifyOption) -> Result<PeSignStatus, PeSignError>
pub fn verify(&self, option: &VerifyOption) -> Result<PeSignStatus, PeSignError>
Verify the validity of the certificate.
Sourcepub fn verify_pe_path<P: AsRef<Path>>(
&self,
filename: P,
option: &VerifyOption,
) -> Result<PeSignStatus, PeSignError>
pub fn verify_pe_path<P: AsRef<Path>>( &self, filename: P, option: &VerifyOption, ) -> Result<PeSignStatus, PeSignError>
Verify the validity of the certificate.
Sourcepub fn verify_pe_data(
&self,
bin: &[u8],
option: &VerifyOption,
) -> Result<PeSignStatus, PeSignError>
pub fn verify_pe_data( &self, bin: &[u8], option: &VerifyOption, ) -> Result<PeSignStatus, PeSignError>
Verify the validity of the certificate.
Sourcepub fn verify_pe_image(
&self,
image: &mut PE<'_>,
option: &VerifyOption,
) -> Result<PeSignStatus, PeSignError>
pub fn verify_pe_image( &self, image: &mut PE<'_>, option: &VerifyOption, ) -> Result<PeSignStatus, PeSignError>
Verify the validity of the certificate.
Sourcepub fn export_der(&self) -> Result<Vec<u8>, PeSignError>
pub fn export_der(&self) -> Result<Vec<u8>, PeSignError>
Export as DER.
Sourcepub fn export_pem(&self) -> Result<String, PeSignError>
pub fn export_pem(&self) -> Result<String, PeSignError>
Export as PEM.
Trait Implementations§
Source§impl Encode for PeSign
impl Encode for PeSign
Source§fn encoded_len(&self) -> Result<Length>
fn encoded_len(&self) -> Result<Length>
Compute the length of this value in bytes when encoded as ASN.1 DER.
Source§fn encode(&self, encoder: &mut impl Writer) -> Result<()>
fn encode(&self, encoder: &mut impl Writer) -> Result<()>
Encode this value as ASN.1 DER using the provided
Writer
.Source§fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
Encode this value to the provided byte slice, returning a sub-slice
containing the encoded message.
impl Eq for PeSign
impl StructuralPartialEq for PeSign
Auto Trait Implementations§
impl Freeze for PeSign
impl RefUnwindSafe for PeSign
impl Send for PeSign
impl Sync for PeSign
impl Unpin for PeSign
impl UnwindSafe for PeSign
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more