This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM2634: X.509 Certificate Size

Part Number: AM2634


Hi,

I would like to extract X.509 certificate size info from the SBL *.tiimage binary. How could I get it? I noticed the certificate size is always 0x6C9 after comparing a few different SBL bin files and tiimage files. Is the X.509 certificate size a fixed value for specific version of OpenSSL?

I was also wondering if I search the pattern "18F09FE5" I would know it is the beginning of the image blob?

Thanks,

Wenkai

  • Hi Wenkai,

    As you can see in the below snapshot from TRM Initialization chapter, X.509 certificate has some optional fields depending on which size will vary.

    Also, size depends on the OpenSSL version too.

    You are seeing fixed size in our SBL bin files as these fields remain same (i.e. certificate size won't vary based on app size) 

    Regards,

    Prasad

  • Thanks for confirming the certificate size is not a constant value. Now the key question is: how do I get the size of the certificate by checking the tiimage binary?

  • Hi Wenkai,

    The ROM follows the ISO 8825-1 | ITU-T X.690 (09/2015): Information technology - ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER) - http://handle.itu.int/11.1002/1000/12483

    1. Position of Length Octet -

    Second Octet is the length octet.

    2. The certificate length can be stored in long form or short form. If its the short form, the length of the certificate is identified by remaining bits.

    If its the long form, then like this -

    Please find the reference to documentation available in X.690-201508 available in the provided link above.

    Hope this helps.

    Best Regards,
    Aakash

  • Thanks, Aakash, it really helps.