/docs/man3.0/man3/X509_verify.html (openssl.org)

提供了方法用于通过ca证书public key验证证书签名

//verify_cert.hpp
#include <string>
#include <memory>
#include <filesystem>
#include <openssl/pem.h>
 
using namespace std;
namespace fs = std::filesystem;
 
class CertVerify{
public:
    CertVerify(const fs::path& certFilePath, const fs::path& caFilePath) : m_certFilePath(certFilePath), m_caFilePath(caFilePath) {}
 
public:
    int doVerify()
    {
        if(m_certFilePath.string().length() == 0 || m_caFilePath.string().length() == 0)
        {
            return -1;
        }
        if(!fs::exists(m_certFilePath) || !fs::exists(m_caFilePath))
        {
            return -2;
        }
        shared_ptr<BIO&gt; certBio(BIO_new_fil

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注