Expand description
Cross platform library for verifying Authenticode signed files.
This library can be used to verify the Authenticode signature of a PE file on both Windows and Linux.
§Example
use cross_authenticode::{AuthenticodeInfo, ToHex, Algorithm};
use std::fs::File;
use std::path::PathBuf;
let pe_path = PathBuf::from("test-pe/test-signed-64.bin");
let pe_file = std::fs::read(pe_path).unwrap();
let ai = AuthenticodeInfo::try_from(&pe_file).unwrap();
// Check thumbprints of the first two certificates
assert_eq!(ai.certificates[0].sha1.to_hex(), "f55115d2439ce0a7529ffaaea654be2c71dce955");
assert_eq!(ai.certificates[1].sha1.to_hex(), "580a6f4cc4e4b669b9ebdc1b2b3e087b80d0678d");
// Check the Authenticode algorithm
assert_eq!(ai.digest.algorithm, Algorithm::Sha256);
// Verify the the Authenticode signature
assert!(ai.verify().unwrap());
// Verify the Authenticode signature manually
assert_eq!(ai.authenticode_sha256().unwrap(), ai.digest.hash);
Structs§
- Authenticode
Info - Contains information about the Authenticode signature of a PE file.
- Digest
Info - Information about the digest of the PE file. The information includes the algorithm used and the hash, which are taken from the PE file itself.
Enums§
- Algorithm
- The hash algorithm used to sign the PE file.
Traits§
- ToHex
- Extension trait to convert byte slices and byte vectors to hex strings.