Add another RFC data based test
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
DKIM-Signature: v=1; a=ed25519-sha256; c=simple/simple;
|
||||
d=football.example.com; i=@football.example.com;
|
||||
q=dns/txt; s=brisbane; t=1518460054; h=from : to :
|
||||
subject : date : message-id : from : subject : date;
|
||||
bh=4bLNXImK9drULnmePzZNEBleUanJCX5PIsDIFoH4KTQ=;
|
||||
b=9/dsDChY0YMTtD5Eyw3wx7x22BlSJP7M5ECbJ7GWrR45nXlTCGb8l0YB
|
||||
o0wBLR++X5LqmsxXaOYLLJe46l10AQ==
|
||||
From: Joe SixPack <joe@football.example.com>
|
||||
To: Suzie Q <suzie@shopping.example.net>
|
||||
Subject: Is dinner ready?
|
||||
Date: Fri, 11 Jul 2003 21:00:37 -0700 (PDT)
|
||||
Message-ID: <20030712040037.46341.5F8J@football.example.com>
|
||||
|
||||
Hi.
|
||||
|
||||
We lost the game. Are you hungry yet?
|
||||
|
||||
Joe.
|
||||
|
||||
@@ -55,6 +55,7 @@ class TestSignAndVerify(unittest.TestCase):
|
||||
self.message = read_test_data("ed25519test.msg")
|
||||
self.message2 = read_test_data("ed25519test2.msg")
|
||||
self.message3 = read_test_data("rfc6376.msg")
|
||||
self.message4 = read_test_data("rfc6376.signed.msg")
|
||||
self.key = read_test_data("ed25519test.key")
|
||||
self.rfckey = read_test_data("rfc8032_7_1.key")
|
||||
|
||||
@@ -98,6 +99,19 @@ p=11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo="""
|
||||
res = dkim.verify(sig + self.message3, dnsfunc=self.dnsfunc)
|
||||
self.assertTrue(res)
|
||||
|
||||
def test_rfc8032_previous_verifies(self):
|
||||
# A message previously signed using RFC 8032 sample keys verifies after being signed.
|
||||
for header_algo in (b"simple", b"relaxed"):
|
||||
for body_algo in (b"simple", b"relaxed"):
|
||||
sig = dkim.sign(
|
||||
self.message3, b"brisbane", b"football.example.com", self.rfckey,
|
||||
canonicalize=(header_algo, body_algo), signature_algorithm=b'ed25519-sha256')
|
||||
print(header_algo, body_algo)
|
||||
print(sig)
|
||||
d = dkim.DKIM(self.message4)
|
||||
res = d.verify(dnsfunc=self.dnsfunc)
|
||||
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"):
|
||||
|
||||
Reference in New Issue
Block a user