MINOR: ssl: add function to extract X509 notBefore date in time_t
Add x509_get_notbefore_time_t() which returns the notBefore date in time_t format.
This commit is contained in:
parent
8a4b3216f9
commit
626de9538e
@ -50,6 +50,7 @@ const char *x509_get_notafter(X509 *cert);
|
||||
#ifdef HAVE_ASN1_TIME_TO_TM
|
||||
time_t ASN1_to_time_t(ASN1_TIME *asn1_time);
|
||||
time_t x509_get_notafter_time_t(X509 *cert);
|
||||
time_t x509_get_notbefore_time_t(X509 *cert);
|
||||
#endif
|
||||
int curves2nid(const char *curve);
|
||||
const char *nid2nist(int nid);
|
||||
|
@ -779,6 +779,21 @@ time_t x509_get_notafter_time_t(X509 *cert)
|
||||
|
||||
ret = ASN1_to_time_t(asn1_time);
|
||||
|
||||
error:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* return the notBefore date of a X509 certificate in a time_t format */
|
||||
time_t x509_get_notbefore_time_t(X509 *cert)
|
||||
{
|
||||
time_t ret = -1;
|
||||
ASN1_TIME *asn1_time;
|
||||
|
||||
if ((asn1_time = X509_getm_notBefore(cert)) == NULL)
|
||||
goto error;
|
||||
|
||||
ret = ASN1_to_time_t(asn1_time);
|
||||
|
||||
error:
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user