Add test case verifying no t= (timestamp) with x= (expiration) in signature
This commit is contained in:
@@ -62,6 +62,7 @@ class TestSignAndVerify(unittest.TestCase):
|
||||
self.message5 = read_test_data("rfc6376.signed.rsa.msg")
|
||||
self.message6 = read_test_data("test.message.baddomain")
|
||||
self.message7 = read_test_data("rfc6376.w1258.msg")
|
||||
self.message8 = read_test_data("rfc6376.signed.no_t.msg")
|
||||
self.key = read_test_data("test.private")
|
||||
self.rfckey = read_test_data("rfc8032_7_1.key")
|
||||
|
||||
@@ -250,6 +251,7 @@ b/mPfjC0QJTocVBq6Za/PlzfV+Py92VaCak19F4WrbVTK5Gg5tW220MCAwEAAQ=="""
|
||||
d = dkim.DKIM(self.message4)
|
||||
res = d.verify(dnsfunc=self.dnsfunc5)
|
||||
self.assertTrue(res)
|
||||
|
||||
def test_non_utf8(self):
|
||||
# A message with Windows-1258 encoding is signed and verifies.
|
||||
for header_algo in (b"simple", b"relaxed"):
|
||||
@@ -262,6 +264,13 @@ b/mPfjC0QJTocVBq6Za/PlzfV+Py92VaCak19F4WrbVTK5Gg5tW220MCAwEAAQ=="""
|
||||
# As of 1.1.0 this won't verify, but at least we don't crash. FIXME
|
||||
self.assertFalse(res)
|
||||
|
||||
def test_no_t(self):
|
||||
# Signature Timestamp is optional, so don't crash if it's missing.
|
||||
d = dkim.DKIM(self.message8)
|
||||
res = d.verify(dnsfunc=self.dnsfunc5)
|
||||
# Signature won't verify, but that's not what we are testing.
|
||||
self.assertFalse(res)
|
||||
|
||||
def test_catch_bad_key(self):
|
||||
# Raise correct error for defective public key.
|
||||
d = dkim.DKIM(self.message5)
|
||||
|
||||
Reference in New Issue
Block a user