31struct mbedtls_x509_crt;
51 using date_t = std::array<int32_t, 6>;
153 std::vector<uint8_t>
raw()
const;
190 mbedtls_x509_crt* x509_cert_ =
nullptr;
Main interface to parse PE binaries. In particular the static functions: Parser::parse should be used...
Definition PE/Parser.hpp:52
Object that wraps a RSA key.
Definition RsaInfo.hpp:29
Definition SignatureParser.hpp:37
Main interface for the PKCS #7 signature scheme.
Definition Signature.hpp:39
std::string issuer() const
Issuer informations.
date_t valid_from() const
Start time of certificate validity.
KEY_USAGE
Key usage as defined in RFC #5280 - section-4.2.1.3.
Definition x509.hpp:109
@ DECIPHER_ONLY
Definition x509.hpp:118
@ KEY_ENCIPHERMENT
Definition x509.hpp:112
@ CRL_SIGN
Definition x509.hpp:116
@ DIGITAL_SIGNATURE
Definition x509.hpp:110
@ ENCIPHER_ONLY
Definition x509.hpp:117
@ NON_REPUDIATION
Definition x509.hpp:111
@ KEY_AGREEMENT
Definition x509.hpp:114
@ KEY_CERT_SIGN
Definition x509.hpp:115
@ DATA_ENCIPHERMENT
Definition x509.hpp:113
std::vector< uint8_t > serial_number() const
Unique id for certificate issued by a specific CA.
std::vector< uint8_t > raw() const
The raw x509 bytes (DER encoded).
static certificates_t parse(const std::string &path)
Parse x509 certificate(s) from file path.
std::vector< uint8_t > signature() const
The signature of the certificate.
VERIFICATION_FLAGS verify(const x509 &ca) const
Verify that this certificate has been used to trust the given certificate.
friend class Signature
Definition x509.hpp:47
std::unique_ptr< RsaInfo > rsa_info() const
If the underlying public-key scheme is RSA, return the RSA information. Otherwise,...
void accept(Visitor &visitor) const override
x509 & operator=(x509 other)
std::string subject() const
Subject informations.
std::vector< KEY_USAGE > key_usage() const
Purpose of the key contained in the certificate.
static bool time_is_past(const date_t &to)
True if the given time is in the past according to the clock's system.
static bool check_time(const date_t &before, const date_t &after)
Return True if before is before than after. False otherwise.
std::vector< x509 > certificates_t
Definition x509.hpp:53
oid_t signature_algorithm() const
Signature algorithm (OID).
KEY_TYPES key_type() const
Return the underlying public-key scheme.
std::array< int32_t, 6 > date_t
Tuple (Year, Month, Day, Hour, Minute, Second).
Definition x509.hpp:51
friend class SignatureParser
Definition x509.hpp:46
x509(mbedtls_x509_crt *ca)
uint32_t version() const
X.509 version. (1=v1, 2=v2, 3=v3).
friend class Parser
Definition x509.hpp:45
bool check_signature(const std::vector< uint8_t > &hash, const std::vector< uint8_t > &signature, ALGORITHMS digest) const
Try to decrypt the given signature and check if it matches the given hash according to the hash algor...
VERIFICATION_FLAGS is_trusted_by(const std::vector< x509 > &ca) const
Verify that this certificate is trusted by the given CA list.
VERIFICATION_FLAGS
Mirror of mbedtls's X509 Verify codes: MBEDTLS_X509_XX.
Definition x509.hpp:84
@ BADCERT_FUTURE
Definition x509.hpp:95
@ BADCERT_BAD_KEY
Definition x509.hpp:102
@ BADCRL_BAD_KEY
Definition x509.hpp:105
@ BADCERT_NS_CERT_TYPE
Definition x509.hpp:99
@ BADCERT_BAD_MD
Definition x509.hpp:100
@ BADCERT_OTHER
Definition x509.hpp:94
@ BADCERT_BAD_PK
Definition x509.hpp:101
@ BADCERT_EXT_KEY_USAGE
Definition x509.hpp:98
@ BADCRL_BAD_PK
Definition x509.hpp:104
@ BADCRL_NOT_TRUSTED
Definition x509.hpp:90
@ BADCERT_SKIP_VERIFY
Definition x509.hpp:93
@ BADCERT_MISSING
Definition x509.hpp:92
@ BADCRL_BAD_MD
Definition x509.hpp:103
@ BADCERT_CN_MISMATCH
Definition x509.hpp:88
@ BADCERT_KEY_USAGE
Definition x509.hpp:97
@ BADCERT_NOT_TRUSTED
Definition x509.hpp:89
@ BADCERT_EXPIRED
Definition x509.hpp:86
@ BADCERT_REVOKED
Definition x509.hpp:87
@ OK
Definition x509.hpp:85
@ BADCRL_EXPIRED
Definition x509.hpp:91
@ BADCRL_FUTURE
Definition x509.hpp:96
KEY_TYPES
Public key scheme.
Definition x509.hpp:71
@ ECKEY_DH
Elliptic-curve Diffie-Hellman.
Definition x509.hpp:75
@ ECKEY
Elliptic-curve scheme.
Definition x509.hpp:74
@ RSA
RSA Scheme.
Definition x509.hpp:73
@ RSA_ALT
RSA scheme with an alternative implementation for signing and decrypting.
Definition x509.hpp:77
@ RSASSA_PSS
RSA Probabilistic signature scheme.
Definition x509.hpp:78
@ ECDSA
Elliptic-curve Digital Signature Algorithm.
Definition x509.hpp:76
@ NONE
Unknown scheme.
Definition x509.hpp:72
static bool time_is_future(const date_t &from)
True if the given time is in the future according to the clock's system.
std::vector< oid_t > ext_key_usage() const
Indicates one or more purposes for which the certified public key may be used (OID types).
static certificates_t parse(const std::vector< uint8_t > &content)
Parse x509 certificate(s) from raw blob.
std::vector< oid_t > certificate_policies() const
Policy information terms as OID (see RFC #5280).
date_t valid_to() const
End time of certificate validity.
friend std::ostream & operator<<(std::ostream &os, const x509 &x509_cert)
Definition Visitor.hpp:210
#define ENABLE_BITMASK_OPERATORS(X)
Definition enums.hpp:24
Namespace related to the LIEF's PE module.
Definition Abstract/Header.hpp:32
ALGORITHMS
Cryptography algorithms.
Definition PE/enums.hpp:28
std::string oid_t
Definition PE/signature/types.hpp:23
LIEF namespace.
Definition Abstract/Binary.hpp:40
Hash::value_type hash(const Object &v)
#define LIEF_API
Definition visibility.h:41