[openssl-users] ASN1_TIME to time_t

Michael Wojcik Michael.Wojcik at microfocus.com
Wed Sep 6 15:00:26 UTC 2017


> From: openssl-users [mailto:openssl-users-bounces at openssl.org] On Behalf
> Of Dr. Stephen Henson
> Sent: Wednesday, September 06, 2017 10:26
> 
> No but there is a a round about way of achieving the same result. The
> ASN1_TIME_diff() function will determine the difference between two
> ASN1_TIME structures and return the result as a number of days and seconds.
> 
> So if you set one to the epoch time you can then calculate the time_t from
> the difference.

That's almost certainly a much better approach than the one I described in my previous email.

I assume ASN1_TIME_diff takes into account ASN.1 UTC Time versus Generalized Time, and timezone information. Though it wouldn't be hard to have a few different ASN1_TIME structures for the various permutations.

-- 
Michael Wojcik 
Distinguished Engineer, Micro Focus 





More information about the openssl-users mailing list