Skip to content

Commit

Permalink
Fixing issue pyca#798 (pyca#907)
Browse files Browse the repository at this point in the history
* Fixing issue pyca#798, thanks to @reaperhulk; removing undocumented '%s' option and getting the date in a more robust way

Co-authored-by: Joseba Alberdi <[email protected]>
Co-authored-by: Alex Gaynor <[email protected]>
  • Loading branch information
3 people authored Oct 18, 2020
1 parent 3db93f1 commit 669dcc3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/OpenSSL/crypto.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import calendar
import datetime

from base64 import b16encode
Expand Down Expand Up @@ -1672,7 +1673,9 @@ def set_time(self, vfy_time):
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):
Expand Down

0 comments on commit 669dcc3

Please sign in to comment.