Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ssl 以PEM格式检索证书的到期时间_Ssl_Openssl_Ssl Certificate_X509_Pkix - Fatal编程技术网

Ssl 以PEM格式检索证书的到期时间

Ssl 以PEM格式检索证书的到期时间,ssl,openssl,ssl-certificate,x509,pkix,Ssl,Openssl,Ssl Certificate,X509,Pkix,我有一个要求,通知客户,他们的证书将在几天内到期,所以在此之前更新工作TLS加密,以正常工作 如何检索PEM格式证书的到期时间?将PEM证书的内容复制到此站点,它将显示ssl证书的详细信息,包括开始日期和到期日期 #if FROMFILE BIO* bio = BIO_new_file(filename, "rb"); if (bio == null) goto err; #else BIO* bio = BIO_new(BIO_s_mem()); BIO_write(bio, da

我有一个要求,通知客户,他们的证书将在几天内到期,所以在此之前更新工作TLS加密,以正常工作


如何检索PEM格式证书的到期时间?

将PEM证书的内容复制到此站点,它将显示ssl证书的详细信息,包括开始日期和到期日期

 #if FROMFILE
 BIO* bio = BIO_new_file(filename, "rb");
 if (bio == null) goto err;
 #else
 BIO* bio = BIO_new(BIO_s_mem());
 BIO_write(bio, data, dataLen);
 #endif

 X509* x509 = PEM_read_bio_X509(bio, NULL, NULL, NULL);
 if (x509 == null) goto err;

 #if OPENSSL_11
 ASN1_TIME* notBefore = X509_get0_notBefore(x509);
 #else
 ASN1_TIME* notBefore = x509->validity->notBefore;
 #endif

 // Choose a time representation and convert the ASN1_TIME to it.

 goto cleanup;

 err:
 // Exercise left to the reader.

 cleanup:
 // Don't free notBefore, since it was obtained via a get0 or interior pointer.
 if (x509) X509_free(x509);
 if (bio) BIO_free(bio);

可能存在的副本