You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had the same problem trying to make PKCS#7 encryption.
My solution was after loading the certificate loop through issuer fields, read it as ASCII and write it back as UTF-8 like that: certificate.issuer.attributes.forEach(element => { element.value = Buffer.from(Buffer.from(element.value, 'ASCII')).toString('utf-8'); });
The problem with certificateFromPem() function is that it uses the obsolete method of reading base64 see: var msg = { type: type, procType: null, contentDomain: null, dekInfo: null, headers: [], body: forge.util.decode64(match[3]) };
Description
I found that
forge
has an inconsistent behaviour betweencrypto
when parsing a certificate, which has a chinese character in subject value.The
crypto
library is able to return the correct value, butforge
can not.The proof of concept code shows as follows.
Proof of Concept
Current output
Expected output
Environment
The text was updated successfully, but these errors were encountered: