noloader / cryptopp-pem

PEM parsing of keys and parameters for Crypto++ project
38 stars 31 forks source link

Trying to parse X509 extension, shows chunk of bytes but not able to parse. #14

Closed swanandb2 closed 2 years ago

swanandb2 commented 2 years ago

Hello,

I did try to use this lib with crypto++, I was able to parse x509 certificate. When it come to parse custom extension, it shows chunk of byes. How can I decode those bytes. I did try to use BERDecode it throws exception. I would like to know, Is there any possibility to parse custom ASN1 extension? How we can do it?

noloader commented 2 years ago

@swanandb2,

When it come to parse custom extension, it shows chunk of byes

Yeah, that sounds about right.

How can I decode those bytes.

I recommend taking a look at how Subject Alt Names (SAN) are parsed. SANs are a good example because they are identified by an OID. Once the OID is recognized, then the various types of names are parsed and interpreted.

You can find the code to parse a SAN at https://github.com/noloader/cryptopp-pem/blob/master/x509cert.cpp#L1718.

If you provide a sample certificate, I may be able to help you.

swanandb2 commented 2 years ago

Sorry for delayed reply. Thanks for response, i will look into it and revert.

swanandb2 commented 2 years ago

Sorry to move off topic, but I would like to know if Crypto++ is FIPS-140 certified? As per my understanding it had but long time ago. Is there any update on certification status? I love interfaces but as per customer need we need FIPS certified libs only.