Exemplo n.º 1
0
 def test_zonemd_simple_absolute(self):
     zone = dns.zone.from_text(self.simple_example,
                               origin='example',
                               relativize=False)
     zone.verify_digest()
     zonemd = self._get_zonemd(zone)
     self.assertEqual(zonemd[0],
                      zone.compute_digest(zonemd[0].hash_algorithm))
Exemplo n.º 2
0
    def test_zonemd_multiple_digests(self):
        zone = dns.zone.from_text(self.multiple_digests_example,
                                  origin='example')
        zone.verify_digest()

        zonemd = self._get_zonemd(zone)
        for rr in zonemd:
            if rr.scheme == 1 and rr.hash_algorithm in (1, 2):
                zone.verify_digest(rr)
                self.assertEqual(rr, zone.compute_digest(rr.hash_algorithm))
            else:
                with self.assertRaises(dns.zone.DigestVerificationFailure):
                    zone.verify_digest(rr)
Exemplo n.º 3
0
 def test_zonemd_unknown_hash_algorithm(self):
     zone = dns.zone.from_text(self.simple_example, origin='example')
     with self.assertRaises(dns.zone.UnsupportedDigestHashAlgorithm):
         zone.compute_digest(5)
Exemplo n.º 4
0
 def test_zonemd_unknown_scheme(self):
     zone = dns.zone.from_text(self.simple_example, origin='example')
     with self.assertRaises(dns.zone.UnsupportedDigestScheme):
         zone.compute_digest(dns.zone.DigestHashAlgorithm.SHA384, 2)
Exemplo n.º 5
0
 def test_zonemd_complex(self):
     zone = dns.zone.from_text(self.complex_example, origin='example')
     zone.verify_digest()
     zonemd = self._get_zonemd(zone)
     self.assertEqual(zonemd[0],
                      zone.compute_digest(zonemd[0].hash_algorithm))