- Fix cryptography deprecation sent to duncan.macleod@ligo.org igwn-auth-utils-cryptography-utc-deprecation.patch OBS-URL: https://build.opensuse.org/request/show/1152302 OBS-URL: https://build.opensuse.org/package/show/science/python-igwn-auth-utils?expand=0&rev=10
24 lines
867 B
Diff
24 lines
867 B
Diff
Index: igwn-auth-utils-1.1.0/igwn_auth_utils/x509.py
|
|
===================================================================
|
|
--- igwn-auth-utils-1.1.0.orig/igwn_auth_utils/x509.py
|
|
+++ igwn-auth-utils-1.1.0/igwn_auth_utils/x509.py
|
|
@@ -95,13 +95,12 @@ def is_valid_certificate(cert, timeleft=
|
|
def _timeleft(cert):
|
|
"""Returns the time remaining (in seconds) for a ``cert``
|
|
"""
|
|
- expiry = cert.not_valid_after
|
|
try:
|
|
- now = datetime.datetime.now(datetime.UTC)
|
|
- except AttributeError: # python < 3.11
|
|
- now = datetime.datetime.utcnow()
|
|
- else:
|
|
- expiry = expiry.astimezone(datetime.UTC)
|
|
+ expiry = cert.not_valid_after_utc
|
|
+ except AttributeError:
|
|
+ # cryptography < 42
|
|
+ expiry = cert.not_valid_after
|
|
+ now = datetime.datetime.now(datetime.timezone.utc)
|
|
return (expiry - now).total_seconds()
|
|
|
|
|