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))