This is a discussion on Re: does ASN1_UTCTIME_get() changes by local time zone settings - Openssl ; On Sat, Jan 28, 2006, Joe Gluck wrote: > Thank you for all tour replies but the gettimeofday I already use, but > it was not what I was asking in the original message. > > What I asked is ...
On Sat, Jan 28, 2006, Joe Gluck wrote:
> Thank you for all tour replies but the gettimeofday I already use, but
> it was not what I was asking in the original message.
> What I asked is how can I get the ASN1_integer into a time_t to be
> able to compare it with the current GMT time (which i can get with
> some system functions, on linux gettimeofday)? (See first message in
Actually you asked how to convert an ASN1_TIME to time_t. The answer in
general to that is "you can't" because an ASN1_TIME can express a wider range
of dates than a typical 32 bit time_t.
If you want to compare an ASN1_TIME to the current time that's a different
thing entirely. What OpenSSL does is to convert the time_t into an ASN1_TIME
and compares the two ASN1_TIME structures.
There is a function called X509_cmp_time() that does the conversion and
comparison. It can be fed either a pointer to a time_t with the time to
compare against or NULL which uses the current time.
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
OpenSSL Project http://www.openssl.org
Development Mailing List email@example.com
Automated List Manager firstname.lastname@example.org