diff --git a/lib/piston/forms.py b/lib/piston/forms.py index 351df7c..28b3af3 100644 --- a/lib/piston/forms.py +++ b/lib/piston/forms.py @@ -50,6 +50,7 @@ class OAuthAuthenticationForm(forms.Form): @staticmethod def get_csrf_signature(key, token): # Check signature... + key.encode('ascii') try: import hashlib # 2.5 hashed = hmac.new(key, token, hashlib.sha1) diff --git a/lib/piston/oauth.py b/lib/piston/oauth.py index 3a42e20..62bece7 100644 --- a/lib/piston/oauth.py +++ b/lib/piston/oauth.py @@ -620,6 +620,7 @@ class OAuthSignatureMethod_HMAC_SHA1(OAuthSignatureMethod): key, raw = self.build_signature_base_string(oauth_request, consumer, token) + key.encode('ascii') # HMAC object. try: import hashlib # 2.5 @@ -647,4 +648,4 @@ class OAuthSignatureMethod_PLAINTEXT(OAuthSignatureMethod): def build_signature(self, oauth_request, consumer, token): key, raw = self.build_signature_base_string(oauth_request, consumer, token) - return key \ No newline at end of file + return key