From: Bob Halley Date: Mon, 1 Jun 2020 17:46:23 +0000 (-0700) Subject: RRSIG digestable might as well be right even if it is useless X-Git-Tag: v2.0.0rc1~131 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b687180391afc37c59eb57ae0fc5a77a2d894cc;p=thirdparty%2Fdnspython.git RRSIG digestable might as well be right even if it is useless --- diff --git a/dns/rdtypes/ANY/RRSIG.py b/dns/rdtypes/ANY/RRSIG.py index 09965ce8..c7b9e7a1 100644 --- a/dns/rdtypes/ANY/RRSIG.py +++ b/dns/rdtypes/ANY/RRSIG.py @@ -122,6 +122,14 @@ class RRSIG(dns.rdata.Rdata): self.signer.to_wire(file, None, origin) file.write(self.signature) + def to_digestable(self, origin=None): + return struct.pack('!HBBIIIH', self.type_covered, + self.algorithm, self.labels, + self.original_ttl, self.expiration, + self.inception, self.key_tag) + \ + self.signer.to_digestable(origin) + \ + self.signature + @classmethod def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin=None): header = struct.unpack('!HBBIIIH', wire[current: current + 18]) diff --git a/tests/test_rdata.py b/tests/test_rdata.py index a88b977d..ed2c3f3b 100644 --- a/tests/test_rdata.py +++ b/tests/test_rdata.py @@ -139,8 +139,6 @@ class RdataTestCase(unittest.TestCase): # # types that don't have names: HINFO # - # types where the canonical form isn't relevant: RRSIG - # cases = [ ('SOA', 'NAME NAME 1 2 3 4 5'), ('AFSDB', '0 NAME'), @@ -156,6 +154,8 @@ class RdataTestCase(unittest.TestCase): ('RP', 'NAME NAME'), ('RT', '0 NAME'), ('SRV', '0 0 0 NAME'), + ('RRSIG', + 'A 1 3 3600 20200701000000 20200601000000 1 NAME Ym9ndXM=') ] for rdtype, text in cases: upper_origin = dns.name.from_text('EXAMPLE')