diff --git a/lib/jwk/key/base.js b/lib/jwk/key/base.js index e6e6087483..ea4ea7c01c 100644 --- a/lib/jwk/key/base.js +++ b/lib/jwk/key/base.js @@ -56,7 +56,7 @@ class Key { let publicKey try { publicKey = createPublicKey({ - key: `-----BEGIN CERTIFICATE-----\n${cert}\n-----END CERTIFICATE-----`, format: 'pem' + key: `-----BEGIN CERTIFICATE-----\n${cert.match(/.{1,64}/g).join('\n')}\n-----END CERTIFICATE-----`, format: 'pem' }) } catch (err) { throw new errors.JWKInvalid(`\`x5c\` member at index ${i} is not a valid base64-encoded DER PKIX certificate`)