From b81d91a0e769324370f692e9e61051ae9b8b2c4a Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Verschoore Date: Thu, 29 May 2014 22:32:42 +0200 Subject: [PATCH] [WSSE Authentication] using Python3.4, the wsse encrypted password was keeping the python style encapsulation of binary string (b' '). So it adds those 3 caracters in the HTTP Header and the server on the other side does not recognizes the token as a good one even if it is. I also added a ".decode('ascii')" at the end of the calculation to avoid this encapsulation. --- python3/httplib2/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python3/httplib2/__init__.py b/python3/httplib2/__init__.py index e01ddd7..1f6cfe7 100644 --- a/python3/httplib2/__init__.py +++ b/python3/httplib2/__init__.py @@ -402,7 +402,8 @@ def _cnonce(): return dig[:16] def _wsse_username_token(cnonce, iso_now, password): - return base64.b64encode(_sha(("%s%s%s" % (cnonce, iso_now, password)).encode('utf-8')).digest()).strip() + # added the ending .decode to avoid python binary string encapsulation (b'...') from the final header + return base64.b64encode(_sha(("%s%s%s" % (cnonce, iso_now, password)).encode('utf-8')).digest()).strip().decode('acsii') # For credentials we need two things, first