[openssl-dev] Getting raw ASN1 data from X509 certificate

Kurt Roeckx kurt at roeckx.be
Tue Apr 26 17:19:13 UTC 2016


Hi,

I'm working on a tool that checks various things related to X509
certificates.  I want to check that the encoding is actually
correct DER.  With things like ASN1_TIME is seems easy to get to
the raw data, it just seems to contain it.  But when I try it with
an ASN1_INTEGER it doesn't seem to contain all the data.  For
instance, if it's a number that starts with a byte >= 0x80, the
encoding should have a 0x00 in front of it.  But in the
ASN1_INTEGER it already seems to have removed that 0x00.

Is there a way I can get to raw encoding?  Or do I need to write
my own parser (or use an other existing one) to be able to get to
it?


Kurt



More information about the openssl-dev mailing list