]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Convert TSIG other data into a binary type if needed.
authorBob Halley <halley@dnspython.org>
Wed, 1 Jun 2016 13:48:56 +0000 (06:48 -0700)
committerBob Halley <halley@dnspython.org>
Wed, 1 Jun 2016 13:48:56 +0000 (06:48 -0700)
dns/tsig.py

index 92ce86039f72d0d978e96bc11ee44f46922bfaa1..38fe31ebef3d3871b0184f453f4f8b66f36b421a 100644 (file)
@@ -23,7 +23,7 @@ import dns.exception
 import dns.hash
 import dns.rdataclass
 import dns.name
-from ._compat import long, string_types
+from ._compat import long, string_types, text_type
 
 class BadTime(dns.exception.DNSException):
 
@@ -96,6 +96,8 @@ def sign(wire, keyname, secret, time, fudge, original_id, error,
     @raises NotImplementedError: I{algorithm} is not supported
     """
 
+    if isinstance(other_data, text_type):
+        other_data = other_data.encode()
     (algorithm_name, digestmod) = get_algorithm(algorithm)
     if first:
         ctx = hmac.new(secret, digestmod=digestmod)