From: Fredrik Tolf Date: Fri, 28 Jul 2023 10:03:19 +0000 (+0200) Subject: acmecert: Fix cryptography bugs. X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=HEAD;hp=0756cac45415c20db394f851107411afe1448996;p=utils.git acmecert: Fix cryptography bugs. --- diff --git a/acmecert b/acmecert index 84c212a..14d0f00 100755 --- a/acmecert +++ b/acmecert @@ -462,8 +462,9 @@ def mkorder(acct, csr): def httptoken(acct, ch): from cryptography.hazmat.primitives import hashes - jwk = {"kty": "RSA", "e": ebignum(acct.key.e), "n": ebignum(acct.key.n)} - dig = hashes.Hash(hashes.SHA256()) + pub = acct.key.public_key().public_numbers() + jwk = {"kty": "RSA", "e": ebignum(pub.e), "n": ebignum(pub.n)} + dig = hashes.Hash(hashes.SHA256(), backend=cryptobke()) dig.update(json.dumps(jwk, separators=(',', ':'), sort_keys=True).encode("us-ascii")) khash = base64url(dig.finalize()) return ch["token"], ("%s.%s" % (ch["token"], khash))