Add test case for verification when should headers are signed (thanks to Geoffrey Lehée for the patch)
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
UNRELEASED Version 0.6.2
|
UNRELEASED Version 0.6.2
|
||||||
- Fixed python3.4 string interpolation issue
|
- Fixed python3.4 string interpolation issue
|
||||||
- Fix some byte casting issues & typos
|
- Fix some byte casting issues & typos
|
||||||
|
- Add test case for verification when should headers are signed
|
||||||
|
|
||||||
2017-01-27 Version 0.6.1
|
2017-01-27 Version 0.6.1
|
||||||
- Fixed python3 dns lookup issue
|
- Fixed python3 dns lookup issue
|
||||||
|
|||||||
@@ -87,6 +87,17 @@ Y+vtSBczUiKERHv1yRbcaQtZFh5wtiRrN04BLUTD21MycBX5jYchHjPY/wIDAQAB"""
|
|||||||
res = dkim.verify(sig + self.message, dnsfunc=self.dnsfunc)
|
res = dkim.verify(sig + self.message, dnsfunc=self.dnsfunc)
|
||||||
self.assertTrue(res)
|
self.assertTrue(res)
|
||||||
|
|
||||||
|
def test_simple_signature(self):
|
||||||
|
# A message verifies after being signed with SHOULD headers
|
||||||
|
for header_algo in (b"simple", b"relaxed"):
|
||||||
|
for body_algo in (b"simple", b"relaxed"):
|
||||||
|
sig = dkim.sign(
|
||||||
|
self.message, b"test", b"example.com", self.key,
|
||||||
|
canonicalize=(header_algo, body_algo),
|
||||||
|
include_headers=(b'from',) + dkim.DKIM.SHOULD)
|
||||||
|
res = dkim.verify(sig + self.message, dnsfunc=self.dnsfunc)
|
||||||
|
self.assertTrue(res)
|
||||||
|
|
||||||
def test_altered_body_fails(self):
|
def test_altered_body_fails(self):
|
||||||
# An altered body fails verification.
|
# An altered body fails verification.
|
||||||
for header_algo in (b"simple", b"relaxed"):
|
for header_algo in (b"simple", b"relaxed"):
|
||||||
|
|||||||
Reference in New Issue
Block a user