可以通过openssl提供的库函数验证
生成的正式是否为selfsign
//check_cert.hpp
#include <string>
#include <memory>
#include <filesystem>
#include <openssl/pem.h>
using namespace std;
namespace fs = std::filesystem;
class CheckSelfsign{
public:
CheckSelfsign(const fs::path& filePath) : m_filePath(filePath) {}
public:
int doCheck()
{
if(m_filePath.string().length() > 0)
{
if(fs::exists(m_filePath))
{
shared_ptr<BIO> certBio(BIO_new_file(m_filePath.string().c_str(), "rb"), ::BIO_free);
if(certBio == nullptr)
{
return -2;
}