Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sros2/sros2/_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def build_key_and_cert(subject_name, *, ca=False, ca_key=None, issuer_name=''):
else:
extension = x509.BasicConstraints(ca=False, path_length=None)

utcnow = datetime.datetime.utcnow()
utcnow = datetime.datetime.now(datetime.UTC)
builder = x509.CertificateBuilder(
).issuer_name(
issuer_name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def check_common_name(entity, expected_value):

def _datetimes_are_close(actual, expected):
# We can't check exact times, but an hour's resolution is fine for testing purposes
actual = actual.replace(tzinfo=datetime.timezone.utc)
expected = expected.replace(tzinfo=datetime.timezone.utc)
return actual <= expected and actual >= (expected - datetime.timedelta(hours=1))


Expand Down Expand Up @@ -122,7 +124,7 @@ def test_cert_pem(enclave_keys_dir):
assert isinstance(cert.signature_hash_algorithm, hashes.SHA256)

# Verify the cert is valid for the expected timespan
utcnow = datetime.datetime.utcnow()
utcnow = datetime.datetime.now(datetime.UTC)

# Using a day earlier here to prevent Connext (5.3.1) from complaining
# when extracting it from the permissions file and thinking it's in the future
Expand Down
Loading