diff options
| author | Bob Halley <halley@nominum.com> | 2012-04-10 13:07:31 +0100 |
|---|---|---|
| committer | Bob Halley <halley@nominum.com> | 2012-04-10 13:07:31 +0100 |
| commit | 790cfe8283cfad38a21ee22d31b36ece173f266d (patch) | |
| tree | a22fc2297c5c6beae908d05541dc8df54ce7c726 | |
| parent | 8b1996ac8aa5cf9cccb80276facb7eefda90dc86 (diff) | |
| download | dnspython-790cfe8283cfad38a21ee22d31b36ece173f266d.tar.gz | |
Fix python3 port issues with RSA validation
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | dns/dnssec.py | 14 |
2 files changed, 12 insertions, 7 deletions
@@ -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) diff --git a/dns/dnssec.py b/dns/dnssec.py index 61f2410..bf3d9a3 100644 --- a/dns/dnssec.py +++ b/dns/dnssec.py @@ -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: |
