//cert_parse.hpp
#include <string>
#include <filesystem>
#include <vector>
namespace fs = std::filesystem;
enum class CertParseRes{
ok = 0,
invalidFile,
invalidCert,
invalidPemStr,
createCertObjFailed,
loadCertFailed,
loadPemFailed,
readX509CertFailed,
};
class CertParse{
public:
CertParse(const fs::path& filePath) : m_filePath(filePath) {}
CertParse(const std::string& pemStr) : m_certPemStr(pemStr) {}
CertParse() = delete;
CertParse(const CertParse&) = delete;
CertParse(CertParse&&) = delete;
CertParse& operator=(const CertParse&) = delete;
CertParse& operator=(CertParse&&) = delete;
~CertParse() = default;
public:
CertParseRes doParse();
std::string pErr(CertParseRes res);
void print();
public:
int m_version{0};
std::string m_issue;
std::string m_issuerCommonName;
openssl:解析证书
于 2023-10-20 13:49:22 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)