X.509 time manipulation -- SSLeay 0.9.0b -- January 1999

NAME

X509_cmp_current_time, X509_gmtime_adj -- X.509 time manipulations

SYNOPSIS

#include "x509.h"

int X509_cmp_current_time(s);
ASN1_UTCTIME *s;

ASN1_UTCTIME *X509_gmtime_adj();
ASN1_UTCTIME *s;
long adj;

DESCRIPTION

These routines might be used if you are working with the notBefore and notAfter fields of an X.509 certificate.

X509_cmp_current_time returns an integer less than or greater than zero depending on whether s represents a time earlier than or later than the current time. All times are converted to GMT before comaprison so don't worry about time zones. Note that this function will never return 0 for equality; if the times were the same then in a second they won't be; the current time will be later :-)

This function returns 0 on error (a badly formatted UTCTIME element).

X509_gmtime_adj gets the current time, adds adj seconds to it, and then sets s to reflect this time. One way you might use this is if you are trying to determine if a certificate is expired or not. If you parse the notAfter string and find a GMT offset, you could then call this function to get the current time in the same form, so that you could do a comparison. Or you could call X509_cmp_current_time, described above :-)

This function returns s if successful or NULL on error.