How can I convert ASN1_TIME to time_t format? I wanted to convert the return value of X509_get_notAfter() to seconds.
How can I convert ASN1_TIME to time_t format? I wanted to convert the return
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Times are stored as a string internally, on the format
YYmmddHHMMSSorYYYYmmddHHMMSS.At the end of the string there is room for fractions of seconds and timezone, but let’s ignore that for now, and have some (untested) code.
Note: also see Bryan Olson’s answer below, which discusses the undefined behavior due to the
i++‘s. Also see Seak’s answer which removes the undefined behavior.