kjur / jsrsasign

The 'jsrsasign' (RSA-Sign JavaScript Library) is an opensource free cryptography library supporting RSA/RSAPSS/ECDSA/DSA signing/validation, ASN.1, PKCS#1/5/8 private/public key, X.509 certificate, CRL, OCSP, CMS SignedData, TimeStamp, CAdES and JSON Web Signature/Token in pure JavaScript.
https://kjur.github.io/jsrsasign
Other
3.25k stars 645 forks source link

Common Name returning null #545

Closed celli33 closed 2 years ago

celli33 commented 2 years ago

In a certificate when the CNAME contains the character: 'Ñ'. The CNAME returned is null. For example: I have a certificate and when I parsed it with OpenSSL I obtain this CNAME: [CN] => COMPAÑIA SANTA MARIA SA DE CV However when I use the function: parsed.getSubject(). I obtain: /CN=null/2.5.4.41=null/O=null/uniqueIdentifier=SMA0112284B2 \\/ GOCA741120HY0/serialNumber= \\/ GOCA741120HVZMNR00/OU=null.

kjur commented 2 years ago

Can you provide the certificate which is raising issue?

celli33 commented 2 years ago

where can I send you the certificate? . EDIT: You can download the certificate from this url: https://rdc.sat.gob.mx/rccf/000010/000004/13/05/37/00001000000413053762.cer

kjur commented 2 years ago

I took a look the certificate and found that most of subject RDNs are TeletexString not UTF8String. That's why subject CN are null. The issuer name of the certificate are in UTF8String. So issuer name will be displayed successfully. Thanks.

kjur commented 2 years ago

ISO 8859-1 latin1 of TeletexString supported since 10.5.12 release today. So 'Ñ' in TeletexString will also be displayed properly.

celli33 commented 2 years ago

Thanks, you are the best!