Skip to content
Draft
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
10 changes: 8 additions & 2 deletions test/scapy/layers/tls/cert.uts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,13 @@ x.notAfter == (2026, 3, 30, 7, 38, 59, 0, 89, -1)

= Cert class : test remainingDays
assert abs(x.remainingDays("02/12/11")) > 5000
assert abs(x.remainingDays("Feb 12 10:00:00 2011 Paris, Madrid")) > 1
assert abs(x.remainingDays("Feb 12 10:00:00 2011 UTC")) > 5000

from unittest.mock import patch
import time

with patch('time.localtime', return_value=time.struct_time((2026, 3, 1, 0, 0, 0, 6, 60, 0))):
assert abs(x.remainingDays("Feb 12 10:00:00 2011 Paris, Madrid")) > 1
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having thought about this I think it would probably be better to fail in cases like this (but it wouldn't be backward-compatible). The test itself should probably be changed now that the date is fixed. I'd pin it to Apr 1, drop abs and check that remainingDays < 0 or something like that. I'll convert it to draft for now.

(that being said it should be fine to unblock downstream CI like pyca/cryptography#14563 and can be polished later. I'm not sure).


= Cert class : Checking RSA public key
assert type(x.pubkey) is PubKeyRSA
Expand Down Expand Up @@ -1104,4 +1110,4 @@ assert [x.buffer for x in aikOpaque.policyDigestList.digests] == [
b'\xc4\x13\xa8G\xb1\x11\x12\xb1\xcb\xdd\xd4\xec\xa4\xda\xaa\x15\xa1\x85,\x1c;\xbaWF\x1d%v\x05\xf3\xd5\xafS',
b'',
b'\x04\x8e\x9a:\xce\x08X?y\xf3D\xffx[\xbe\xa9\xf0z\xc7\xfa3%\xb3\xd4\x9a!\xddQ\x94\xc6XP',
]
]
Loading