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