]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
DS: support mnemonic format from RFC 4034 section 5.3 511/head
authorPetr Špaček <petr.spacek@nic.cz>
Thu, 18 Jun 2020 09:24:10 +0000 (11:24 +0200)
committerPetr Špaček <petr.spacek@nic.cz>
Thu, 18 Jun 2020 09:24:10 +0000 (11:24 +0200)
dns/rdtypes/dsbase.py
tests/test_dnssec.py

index 4f082c7f3218b11d585322d7fd82b25984f3b503..59f6e83468265994519fdfda679476fd06afc774 100644 (file)
@@ -46,7 +46,7 @@ class DSBase(dns.rdata.Rdata):
     def from_text(cls, rdclass, rdtype, tok, origin=None, relativize=True,
                   relativize_to=None):
         key_tag = tok.get_uint16()
-        algorithm = tok.get_uint8()
+        algorithm = dns.dnssec.algorithm_from_text(tok.get_string())
         digest_type = tok.get_uint8()
         chunks = []
         while 1:
index c10becd178e55057e159160e4288b2e684886fee..71d081e972149a884d03c45ed14f404f60140990 100644 (file)
@@ -193,6 +193,11 @@ abs_ed448_mx_rrsig_2 = dns.rrset.from_text('example.com.', 3600, 'IN', 'RRSIG',
 
 when5 = 1440021600
 
+class DNSSECMakeDSTestCase(unittest.TestCase):
+    def testMnemonicParser(self):
+        good_ds_mnemonic = dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.DS,
+                              '57349 RSASHA1 2 53A79A3E7488AB44FFC56B2D1109F0699D1796DD977E72108B841F96 E47D7013')
+        self.assertEqual(good_ds, good_ds_mnemonic)
 
 @unittest.skipUnless(dns.dnssec._have_pyca,
                      "Python Cryptography cannot be imported")