Expose the raw bytes backing each PE Authenticode cert (#320)

This commit is contained in:
Andrew Williams 2019-07-26 13:26:13 -04:00 committed by Romain
parent 1b1a616ac7
commit fcb9c76be6
3 changed files with 9 additions and 0 deletions

View File

@ -72,6 +72,9 @@ void create<x509>(py::module& m) {
},
"Subject informations")
.def_property_readonly("raw",
&x509::raw,
"The raw bytes associated with this x509 cert (DER encoded)")
.def("__str__",
[] (const x509& x509_crt)

View File

@ -65,6 +65,9 @@ class LIEF_API x509 : public Object {
//! @brief Subject informations
std::string subject(void) const;
//! @brief The raw x509 bytes (DER encoded)
std::vector<uint8_t> raw(void) const;
virtual void accept(Visitor& visitor) const override;
virtual ~x509(void);

View File

@ -108,6 +108,9 @@ std::string x509::subject(void) const {
return {buffer};
}
std::vector<uint8_t> x509::raw(void) const {
return {this->x509_cert_->raw.p, this->x509_cert_->raw.p + this->x509_cert_->raw.len};
}
void x509::accept(Visitor& visitor) const {
visitor.visit(*this);