From 9c66d72779c0e8f9e346c1159e3991bfc39b8720 Mon Sep 17 00:00:00 2001 From: Adrian Hutchinson Date: Mon, 17 Feb 2020 09:25:14 -0800 Subject: [PATCH] MDL-67988 mod_lti: remove padding from JWS base64url encoding --- mod/lti/certs.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mod/lti/certs.php b/mod/lti/certs.php index 4618aa1167b..7afbbe68440 100644 --- a/mod/lti/certs.php +++ b/mod/lti/certs.php @@ -37,8 +37,8 @@ $jwk = array(); $jwk['kty'] = 'RSA'; $jwk['alg'] = 'RS256'; $jwk['kid'] = get_config('mod_lti', 'kid'); -$jwk['e'] = strtr(base64_encode($details['rsa']['e']), '+/', '-_'); -$jwk['n'] = strtr(base64_encode($details['rsa']['n']), '+/', '-_'); +$jwk['e'] = rtrim(strtr(base64_encode($details['rsa']['e']), '+/', '-_'), '='); +$jwk['n'] = rtrim(strtr(base64_encode($details['rsa']['n']), '+/', '-_'), '='); $jwk['use'] = 'sig'; $jwks['keys'][] = $jwk;