authenticode_parser_sys/
bindings.rs1#[repr(C)]
4#[derive(Debug, Copy, Clone)]
5pub struct ByteArray {
6 pub data: *mut u8,
7 pub len: ::std::os::raw::c_int,
8}
9
10#[repr(C)]
11#[derive(Debug, Copy, Clone)]
12pub struct Attributes {
13 pub country: ByteArray,
14 pub organization: ByteArray,
15 pub organizationalUnit: ByteArray,
16 pub nameQualifier: ByteArray,
17 pub state: ByteArray,
18 pub commonName: ByteArray,
19 pub serialNumber: ByteArray,
20 pub locality: ByteArray,
21 pub title: ByteArray,
22 pub surname: ByteArray,
23 pub givenName: ByteArray,
24 pub initials: ByteArray,
25 pub pseudonym: ByteArray,
26 pub generationQualifier: ByteArray,
27 pub emailAddress: ByteArray,
28}
29
30#[repr(C)]
31#[derive(Debug, Copy, Clone)]
32pub struct Certificate {
33 pub version: ::std::os::raw::c_long,
34 pub issuer: *mut ::std::os::raw::c_char,
35 pub subject: *mut ::std::os::raw::c_char,
36 pub serial: *mut ::std::os::raw::c_char,
37 pub sha1: ByteArray,
38 pub sha256: ByteArray,
39 pub key_alg: *mut ::std::os::raw::c_char,
40 pub sig_alg: *mut ::std::os::raw::c_char,
41 pub sig_alg_oid: *mut ::std::os::raw::c_char,
42 pub not_before: i64,
43 pub not_after: i64,
44 pub key: *mut ::std::os::raw::c_char,
45 pub issuer_attrs: Attributes,
46 pub subject_attrs: Attributes,
47}
48
49#[repr(C)]
50#[derive(Debug, Copy, Clone)]
51pub struct CertificateArray {
52 pub certs: *mut *mut Certificate,
53 pub count: usize,
54}
55
56#[repr(C)]
57#[derive(Debug, Copy, Clone)]
58pub struct Countersignature {
59 pub verify_flags: ::std::os::raw::c_int,
60 pub sign_time: i64,
61 pub digest_alg: *mut ::std::os::raw::c_char,
62 pub digest: ByteArray,
63 pub chain: *mut CertificateArray,
64 pub certs: *mut CertificateArray,
65}
66
67#[repr(C)]
68#[derive(Debug, Copy, Clone)]
69pub struct CountersignatureArray {
70 pub counters: *mut *mut Countersignature,
71 pub count: usize,
72}
73
74#[repr(C)]
75#[derive(Debug, Copy, Clone)]
76pub struct Signer {
77 pub digest: ByteArray,
78 pub digest_alg: *mut ::std::os::raw::c_char,
79 pub program_name: *mut ::std::os::raw::c_char,
80 pub chain: *mut CertificateArray,
81}
82
83#[repr(C)]
84#[derive(Debug, Copy, Clone)]
85pub struct Authenticode {
86 pub verify_flags: ::std::os::raw::c_int,
87 pub version: ::std::os::raw::c_int,
88 pub digest_alg: *mut ::std::os::raw::c_char,
89 pub digest: ByteArray,
90 pub file_digest: ByteArray,
91 pub signer: *mut Signer,
92 pub certs: *mut CertificateArray,
93 pub countersigs: *mut CountersignatureArray,
94}
95
96#[repr(C)]
97#[derive(Debug, Copy, Clone)]
98pub struct AuthenticodeArray {
99 pub signatures: *mut *mut Authenticode,
100 pub count: usize,
101}
102
103extern "C" {
104 #[doc = " @brief Initializes all globals OpenSSl objects we need for parsing, this is not thread-safe and\n needs to be called only once, before any multithreading environment\n https://github.com/openssl/openssl/issues/13524"]
105 pub fn initialize_authenticode_parser();
106
107 #[doc = " @brief Constructs AuthenticodeArray from PE file data. Authenticode can\n contains nested Authenticode signatures as its unsigned attribute,\n which can also contain nested signatures. For this reason the function returns\n an Array of parsed Authenticode signatures. Any field of the parsed out\n structures can be NULL, depending on the input data.\n Verification result is stored in verify_flags with the first verification error.\n\n @param pe_data PE binary data\n @param pe_len\n @return AuthenticodeArray*"]
108 pub fn parse_authenticode(pe_data: *const u8, pe_len: u64) -> *mut AuthenticodeArray;
109
110 #[doc = " @brief Constructs AuthenticodeArray from binary data containing Authenticode\n signature. Authenticode can contains nested Authenticode signatures\n as its unsigned attribute, which can also contain nested signatures.\n For this reason the function return an Array of parsed Authenticode signatures.\n Any field of the parsed out structures can be NULL, depending on the input data.\n WARNING: in case of this interface, the file and signature digest comparison is\n up to the library user, as there is no pe data to calculate file digest from.\n Verification result is stored in verify_flags with the first verification error\n\n @param data Binary data containing Authenticode signature\n @param len\n @return AuthenticodeArray*"]
111 pub fn authenticode_new(data: *const u8, len: i32) -> *mut AuthenticodeArray;
112
113 #[doc = " @brief Deallocates AuthenticodeArray and all it's allocated members\n\n @param auth"]
114 pub fn authenticode_array_free(auth: *mut AuthenticodeArray);
115}