tags:

views:

181

answers:

0

I'm writing a small utility to manually decode and extract an RSA public key from an X.509 certificate. It seems to have worked fine so far, but recently failed for a test certificate. Here's why: While decoding the ASN.1 OID, I'm expecting '2a 86 48 86 f7 0d 01 01 01', which decodes to 1.2.840.113549.1.1.1 (rsaEncryption).

The certificate that failed has this OID: '2a 86 48 86 f7 0a 01 01 01' (note the '0a' instead of '0d'), which decodes to 1.2.840.113546.1.1.1

The perplexing part is that other tools like OpenSSL, online certificate decoders and other ASN.1 decoders seem perfectly happy with this OID and report it to be 1.2.840.113549.1.1.1

Could someone please help me figure out why it works with the other tools and how I could fix my utility? Thanks!