Use the correct digest algorithm. (Fixes: #191)

This commit is contained in:
Adam Kelly 2020-08-19 13:33:58 +01:00
parent 9f894c1622
commit 1b2fb445ca

View file

@ -39,7 +39,7 @@ def make_signature(sender, destination, date, digest):
return ','.join('%s="%s"' % (k, v) for (k, v) in signature.items()) return ','.join('%s="%s"' % (k, v) for (k, v) in signature.items())
def make_digest(data): def make_digest(data):
return 'SHA-256=' + b64encode(hashlib.sha512(data).digest()).decode('utf-8') return 'SHA-256=' + b64encode(hashlib.sha256(data).digest()).decode('utf-8')
def verify_digest(request): def verify_digest(request):
algorithm, digest = request.headers['digest'].split('=', 1) algorithm, digest = request.headers['digest'].split('=', 1)