mirror of
https://github.com/QuasarApp/LIEF.git
synced 2025-04-26 12:24:32 +00:00
Add authenticode example
This commit is contained in:
parent
9b49d5d4ab
commit
8511b606d2
@ -10,6 +10,7 @@ set(LIEF_ELF_CPP_EXAMPLES
|
||||
set(LIEF_PE_CPP_EXAMPLES
|
||||
pe_builder.cpp
|
||||
pe_reader.cpp
|
||||
pe_authenticode_check.cpp
|
||||
)
|
||||
|
||||
set(LIEF_MACHO_CPP_EXAMPLES
|
||||
|
22
examples/cpp/pe_authenticode_check.cpp
Normal file
22
examples/cpp/pe_authenticode_check.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
#include <LIEF/PE.hpp>
|
||||
#include <LIEF/logging.hpp>
|
||||
|
||||
using namespace LIEF::PE;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argc != 2) {
|
||||
std::cerr << "Usage: " << argv[0] << " <PE binary>" << "\n";
|
||||
return 1;
|
||||
}
|
||||
std::unique_ptr<const Binary> binary{Parser::parse(argv[1])};
|
||||
if (binary->verify_signature() != Signature::VERIFICATION_FLAGS::OK) {
|
||||
std::cerr << "Signature failed!\n";
|
||||
return 1;
|
||||
}
|
||||
std::cout << "Signature ok!\n";
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user