本文整理汇总了C++中reference::GetDigest方法的典型用法代码示例。如果您正苦于以下问题:C++ reference::GetDigest方法的具体用法?C++ reference::GetDigest怎么用?C++ reference::GetDigest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reference
的用法示例。
在下文中一共展示了reference::GetDigest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VerifyCertificate
void VerifyCertificate()
{
X509* cert;
ssl_cert* certinfo = new ssl_cert;
this->certificate = certinfo;
unsigned int n;
unsigned char md[EVP_MAX_MD_SIZE];
cert = SSL_get_peer_certificate(sess);
if (!cert)
{
certinfo->error = "Could not get peer certificate: "+std::string(get_error());
return;
}
certinfo->invalid = (SSL_get_verify_result(sess) != X509_V_OK);
if (!SelfSigned)
{
certinfo->unknownsigner = false;
certinfo->trusted = true;
}
else
{
certinfo->unknownsigner = true;
certinfo->trusted = false;
}
char buf[512];
X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf));
certinfo->dn = buf;
X509_NAME_oneline(X509_get_issuer_name(cert), buf, sizeof(buf));
certinfo->issuer = buf;
if (!X509_digest(cert, profile->GetDigest(), md, &n))
{
certinfo->error = "Out of memory generating fingerprint";
}
else
{
certinfo->fingerprint = BinToHex(md, n);
}
if ((ASN1_UTCTIME_cmp_time_t(X509_get_notAfter(cert), ServerInstance->Time()) == -1) || (ASN1_UTCTIME_cmp_time_t(X509_get_notBefore(cert), ServerInstance->Time()) == 0))
{
certinfo->error = "Not activated, or expired certificate";
}
X509_free(cert);
}