You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add utcnow() helper function to avoid datetime.utcnow() (#1229)
Using datetime.utcnow() triggers a deprecation warning in Python 3.12. This
leads to test failures in projects using PyOpenSSL (e.g. josepy).
I considered two possible approaches to solve this issue:
- compare tz-aware datetime instances (basically use `datetime.strptime(time_string, "%Y%m%d%H%M%S%z")`)
- strip `tzinfo` from a tz-aware "utcnow" (`datetime.now(timezone.utc).replace(tzinfo=None)`.
In the end I went with the second option because `self.get_notAfter()` returns
the "ASN.1 TIME" format which I think is supposed to always have a "Z" at the
end. If we use `%z` as a format string for `.strptime()` we would accept also
other formats.
0 commit comments