From 4ae483d7d5baf604f38dad8e5ace931612b85e2b Mon Sep 17 00:00:00 2001 From: Niels Klomp Date: Tue, 3 Dec 2024 04:50:45 +0100 Subject: [PATCH] chore: padding pem --- packages/x509-utils/src/x509/x509-validator.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/x509-utils/src/x509/x509-validator.ts b/packages/x509-utils/src/x509/x509-validator.ts index 902a2d22..9a2398b9 100644 --- a/packages/x509-utils/src/x509/x509-validator.ts +++ b/packages/x509-utils/src/x509/x509-validator.ts @@ -516,10 +516,10 @@ const getDNString = (typesAndValues: AttributeTypeAndValue[]): string => { export const getCertificateSubjectPublicKeyJWK = async (pemOrDerCert: string | Uint8Array | Certificate): Promise => { const pemOrDerStr = typeof pemOrDerCert === 'string' - ? pemOrDerCert + ? u8a.toString(u8a.fromString(pemOrDerCert, 'base64pad'), 'base64pad') : pemOrDerCert instanceof Uint8Array ? u8a.toString(pemOrDerCert, 'base64pad') - : pemOrDerCert.toString('base64') + : u8a.toString(u8a.fromString(pemOrDerCert.toString('base64'), 'base64pad'), 'base64pad') const pem = derToPEM(pemOrDerStr) const certificate = pemOrDerToX509Certificate(pem) var jwk: JWK | undefined