We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 994d11b commit 1dc8b80Copy full SHA for 1dc8b80
src/saml2/s_utils.py
@@ -372,8 +372,16 @@ def factory(klass, **kwargs):
372
373
374
def signature(secret, parts):
375
- """Generates a signature.
+ """Generates a signature. All strings are assumed to be utf-8
376
"""
377
+ if not isinstance(secret, six.binary_type):
378
+ secret = secret.encode('utf-8')
379
+ newparts = []
380
+ for part in parts:
381
+ if not isinstance(part, six.binary_type):
382
+ part = part.encode('utf-8')
383
+ newparts.append(part)
384
+ parts = newparts
385
if sys.version_info >= (2, 5):
386
csum = hmac.new(secret, digestmod=hashlib.sha1)
387
else:
0 commit comments