Skip to content

Commit 9ac2ba1

Browse files
author
Joseba Alberdi
committed
Fixing issue pyca#798, thanks to @reaperhulk; removing undocumented '%s' option and getting the date in a more robust way
1 parent 98c57be commit 9ac2ba1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/OpenSSL/crypto.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1641,10 +1641,11 @@ def set_time(self, vfy_time):
16411641
:param datetime vfy_time: The verification time to set on this store.
16421642
:return: ``None`` if the verification time was successfully set.
16431643
"""
1644+
import calendar
16441645
param = _lib.X509_VERIFY_PARAM_new()
16451646
param = _ffi.gc(param, _lib.X509_VERIFY_PARAM_free)
16461647

1647-
_lib.X509_VERIFY_PARAM_set_time(param, int(vfy_time.strftime('%s')))
1648+
_lib.X509_VERIFY_PARAM_set_time(param, calendar.timegm(vfy_time.timetuple()))
16481649
_openssl_assert(_lib.X509_STORE_set1_param(self._store, param) != 0)
16491650

16501651

0 commit comments

Comments
 (0)