•   almost 12 years ago

MintChip Message: Annotation

I am looking over the MintChip message structure and see that the Annotation can be <256 characters, but there is no length octet for the annotation. Is the annotation a NULL terminated string? If so, the documentation should be updated to state this to avoid confusion.

  • 3 comments

  •   •   almost 12 years ago

    Reading further I see that you use ASN.1 Distinguished Encoding Rules (DER). I shall look into this further.

  •   •   almost 12 years ago

    Looking at the ANS.1 specification for MintChip, I see that annotation is a IA5String. Looking this up on WikiPedia, I still cannot see if this is a NULL terminated string or not.

    I would apprciate clarification on this issue. Thank you.

  •   •   almost 12 years ago

    I could be wrong but I believe the DER rules indicate length for each element. So when decoding a IA5String, it would already contain the length and thus being NULL terminated is moot.

    IIRC, the first byte contains information on WHAT the element is. The second byte if less than 0x80 is the length and if greater than 0x80 the length is taken from the next n bytes where 0x80 + n.

    tldr; DER/BER encoding encode the length in front of the string making NULL termination unneeded.

    Visit http://en.wikipedia.org/wiki/Basic_Encoding_Rules for more details. (DER is derived from BER and thus most BER rules apply.)

Comments are closed.