From 3071152dd1dff00ec0c0b2d3435c0166dd7139ce Mon Sep 17 00:00:00 2001 From: Jake Moshenko Date: Thu, 14 Jan 2016 10:08:35 -0500 Subject: [PATCH] Fix the JWK to use base64 encoded bytes --- endpoints/web.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/endpoints/web.py b/endpoints/web.py index 8376cbeaf..c3a1136d9 100644 --- a/endpoints/web.py +++ b/endpoints/web.py @@ -1,7 +1,7 @@ import json import logging -from base64 import urlsafe_b64encode +from jwkest import long_to_base64 from cachetools import lru_cache from cryptography.x509 import load_pem_x509_certificate from cryptography.hazmat.backends import default_backend @@ -701,8 +701,8 @@ def jwk_set_uri(): 'kty': 'RSA', 'alg': 'RS256', 'use': 'sig', - 'n': urlsafe_b64encode(str(certificate.public_numbers().n)), - 'e': urlsafe_b64encode(str(certificate.public_numbers().e)), + 'n': long_to_base64(certificate.public_numbers().n), + 'e': long_to_base64(certificate.public_numbers().e), }], 'issuer': JWT_ISSUER, })