[openssl-users] How to access some simple conversion functions - asn1_time_to_tm

Dr. Stephen Henson steve at openssl.org
Mon Jan 18 22:51:04 UTC 2016


On Mon, Jan 18, 2016, Nounou Dadoun wrote:

> Hi folks,
> 
> I'm trying to do some simple conversions (I need to push some certificate data across a soap interface).
> 
> I'm trying to do an ASN1 time conversion to tm (and eventually time_t but tm would be fine).
> 

The equivalent of time_t is easier. If you use the function ASN1_TIME_diff you
can find the difference in days and seconds between two ASN1_TIME structures so
if you set one to the epoch you can then convert the result to time_t.
You have to be careful the result doesn't overflow the local time_t.

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org


More information about the openssl-users mailing list