]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Fix python3 port issues with RSA validation
authorBob Halley <halley@nominum.com>
Tue, 10 Apr 2012 12:07:31 +0000 (13:07 +0100)
committerBob Halley <halley@nominum.com>
Tue, 10 Apr 2012 12:07:31 +0000 (13:07 +0100)
ChangeLog
dns/dnssec.py

index 81650fed43de084b933205ab0ec4b43842d948c9..46609f5cdcf45fbf9bb3c4529026f4020eeed59c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-04-10  Bob Halley  <halley@dnspython.org>
+
+       * dns/dnssec.py (_validate_rrsig): Fix python3 port issues with
+         RSA validation.
+
 2012-04-08  Bob Halley  <halley@dnspython.org>
 
        * (Version 1.10.0 released)
index 61f2410a32364669af880320c0430470160cdafc..bf3d9a3c593dce135aba0f6c4101734f18a4f2f1 100644 (file)
@@ -241,13 +241,13 @@ def _validate_rrsig(rrset, rrsig, keys, origin=None, now=None):
 
     if _is_rsa(rrsig.algorithm):
         keyptr = key.key
-        (bytes,) = struct.unpack('!B', keyptr[0:1])
+        (count,) = struct.unpack('!B', keyptr[0:1])
         keyptr = keyptr[1:]
-        if bytes == 0:
-            (bytes,) = struct.unpack('!H', keyptr[0:2])
+        if count == 0:
+            (count,) = struct.unpack('!H', keyptr[0:2])
             keyptr = keyptr[2:]
-        rsa_e = keyptr[0:bytes]
-        rsa_n = keyptr[bytes:]
+        rsa_e = keyptr[0:count]
+        rsa_n = keyptr[count:]
         keylen = len(rsa_n) * 8
         pubkey = Crypto.PublicKey.RSA.construct(
             (Crypto.Util.number.bytes_to_long(rsa_n),
@@ -300,8 +300,8 @@ def _validate_rrsig(rrset, rrsig, keys, origin=None, now=None):
         # PKCS1 algorithm identifier goop
         digest = _make_algorithm_id(rrsig.algorithm) + digest
         padlen = keylen // 8 - len(digest) - 3
-        digest = bytes(0) + bytes(1) + bytes(0xFF) * padlen + bytes(0) + \
-                 digest
+        digest = bytes([0]) + bytes([1]) + bytes([0xFF]) * padlen + \
+                 bytes([0]) + digest
     elif _is_dsa(rrsig.algorithm):
         pass
     else: