signed_dict = {
'msg': txt,
'salt': salt,
- }
+ }
+
if key_selector:
signed_dict["key_selector"] = key_selector
- message = salt + key_selector + txt
else:
- message = salt + txt
- signed_dict["hmac"] = utils.Sha1Hmac(key, message)
+ key_selector = ""
+
+ signed_dict["hmac"] = utils.Sha1Hmac(key, txt, salt=salt + key_selector)
return DumpJson(signed_dict, indent=False)
key_selector = ""
hmac_key = key
- if not utils.VerifySha1Hmac(hmac_key, salt + key_selector + msg, hmac_sign):
+ if not utils.VerifySha1Hmac(hmac_key, msg, hmac_sign,
+ salt=salt + key_selector):
raise errors.SignatureError('Invalid Signature')
return LoadJson(msg), salt