ASN1_TIME 到 time_t 转换

2024-03-07

我怎样才能转换ASN1_TIME to time_t格式?我想转换返回值X509_get_notAfter()到秒。


从 openssl 代码来看,这似乎是一个坏主意:

/*
 * FIXME: mktime assumes the current timezone
 * instead of UTC, and unless we rewrite OpenSSL
 * in Lisp we cannot locally change the timezone
 * without possibly interfering with other parts
 * of the program. timegm, which uses UTC, is
 * non-standard.
 * Also time_t is inappropriate for general
 * UTC times because it may a 32 bit type.
 */

请注意,您可以使用ASN1_TIME_diff()获取两个 ASN1_TIME* 之间的天数/秒数。 如果将 NULL 作为 ASN1_TIME *from 传递,则可以获得与当前时间的差值。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ASN1_TIME 到 time_t 转换 的相关文章

随机推荐