libressl-X509_cmp_time3
Asn.1 time utilities
Usage
Crypto Library (libcrypto, -lcrypto)
#include <openssl/x509.h>
int
X509_cmp_time(const ASN1_TIME *asn1_time, time_t *cmp_time);
int
X509_cmp_current_time(const ASN1_TIME *asn1_time);
ASN1_TIME *
X509_time_adj_ex(ASN1_TIME *out_time, int offset_day, long offset_sec, time_t *in_time);
ASN1_TIME *
X509_time_adj(ASN1_TIME *out_time, long offset_sec, time_t *in_time);
ASN1_TIME *
X509_gmtime_adj(ASN1_TIME *out_time, long offset_sec);
Overview
X509_cmp_time() parses asn1_time and compares it to cmp_time, or to the current time if cmp_time is NULL. X509_cmp_current_time() compares it to the current time.
X509_time_adj_ex() sets out_time to a time offset_day and offset_sec later than in_time. The values of offset_day and offset_sec can be negative to set a time before in_time. The offset_sec value can also exceed the number of seconds in a day. If in_time is NULL, the current time is used instead. If out_time is NULL, a new ASN1_TIME structure is allocated and returned.
X509_time_adj() does the same with a 0 day offset.
X509_gmtime_adj() does the same using the current time instead of in_time, that is, it sets out_time to a time offset_sec seconds later than the current time.
Return values
X509_cmp_time() and X509_cmp_current_time() return -1 if asn1_time is earlier than or equal to cmp_time, 1 if it is later, or 0 on error.
X509_time_adj_ex(), X509_time_adj(), and X509_gmtime_adj() return a pointer to the updated or newly allocated ASN1_TIME structure or NULL on error.