1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//! 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
//! ```rust
//! 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);
//! ```
pub use Algorithm;
pub use ;
pub use ToHex;