I'm currently implementing a decoder for X.509 certificates and thanks to asn1c this process was quite easy and efficient! I was able to extract all the relevant data from a certificate for further processing. So far so good.
But, to verify the signature of a certificate, I need access to the DER encoded TBSCertificate data, which is a sequence member of the Certificate itself:
Is there a way to get the start and end position of a PDU in the 'source' buffer? Or how could I find the sub-buffer designating the DER-encoded TBSCertificate PDU? Is there a helper function for this or can I get this information from the decoded Certificate structure?
Thanks a lot
Kind regards
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm currently implementing a decoder for X.509 certificates and thanks to asn1c this process was quite easy and efficient! I was able to extract all the relevant data from a certificate for further processing. So far so good.
But, to verify the signature of a certificate, I need access to the DER encoded TBSCertificate data, which is a sequence member of the Certificate itself:
Certificate ::= SEQUENCE {
tbsCertificate TBSCertificate,
signatureAlgorithm XAlgorithmIdentifier,
signature BIT STRING }
Is there a way to get the start and end position of a PDU in the 'source' buffer? Or how could I find the sub-buffer designating the DER-encoded TBSCertificate PDU? Is there a helper function for this or can I get this information from the decoded Certificate structure?
Thanks a lot
Kind regards
You can just der_encode() the tbsCertificate. That'll produce the same data.
works great, thanks for your help!