Fix the JWK to use base64 encoded bytes

This commit is contained in:
Jake Moshenko 2016-01-14 10:08:35 -05:00
parent be789edcdd
commit 3071152dd1

View file

@ -1,7 +1,7 @@
import json import json
import logging import logging
from base64 import urlsafe_b64encode from jwkest import long_to_base64
from cachetools import lru_cache from cachetools import lru_cache
from cryptography.x509 import load_pem_x509_certificate from cryptography.x509 import load_pem_x509_certificate
from cryptography.hazmat.backends import default_backend from cryptography.hazmat.backends import default_backend
@ -701,8 +701,8 @@ def jwk_set_uri():
'kty': 'RSA', 'kty': 'RSA',
'alg': 'RS256', 'alg': 'RS256',
'use': 'sig', 'use': 'sig',
'n': urlsafe_b64encode(str(certificate.public_numbers().n)), 'n': long_to_base64(certificate.public_numbers().n),
'e': urlsafe_b64encode(str(certificate.public_numbers().e)), 'e': long_to_base64(certificate.public_numbers().e),
}], }],
'issuer': JWT_ISSUER, 'issuer': JWT_ISSUER,
}) })