From 181fd0954e2d7083c1410c553f9aae53c549e299 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Sat, 27 Jul 2019 15:31:08 +0200 Subject: [PATCH] fix: importing x5c in electron requires the input split --- lib/jwk/key/base.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jwk/key/base.js b/lib/jwk/key/base.js index e6e60874..ea4ea7c0 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`)