From 669dcc3488a4803b2c321218def6554805940c48 Mon Sep 17 00:00:00 2001 From: jalberdi004 Date: Sun, 18 Oct 2020 17:55:40 +0200 Subject: Fixing issue #798 (#907) * Fixing issue #798, thanks to @reaperhulk; removing undocumented '%s' option and getting the date in a more robust way Co-authored-by: Joseba Alberdi Co-authored-by: Alex Gaynor --- src/OpenSSL/crypto.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/OpenSSL/crypto.py b/src/OpenSSL/crypto.py index 673da3f..11be813 100644 --- a/src/OpenSSL/crypto.py +++ b/src/OpenSSL/crypto.py @@ -1,3 +1,4 @@ +import calendar import datetime from base64 import b16encode @@ -1672,7 +1673,9 @@ class X509Store(object): param = _lib.X509_VERIFY_PARAM_new() param = _ffi.gc(param, _lib.X509_VERIFY_PARAM_free) - _lib.X509_VERIFY_PARAM_set_time(param, int(vfy_time.strftime("%s"))) + _lib.X509_VERIFY_PARAM_set_time( + param, calendar.timegm(vfy_time.timetuple()) + ) _openssl_assert(_lib.X509_STORE_set1_param(self._store, param) != 0) def load_locations(self, cafile, capath=None): -- cgit v1.2.1