Menu

Start, End position of PDU in buffer

Help
reet
2012-10-30
2013-03-19
  • reet

    reet - 2012-10-30

    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

     
  • Lev Walkin

    Lev Walkin - 2012-10-30

    You can just der_encode() the tbsCertificate. That'll produce the same data.

     
  • reet

    reet - 2012-10-31

    works great, thanks for your help!

     

Log in to post a comment.