I intend to parse BER-TLV format from smart card response to interpret the data.
it similar like JACCAL, but in Objective-C or C++
Can anyone give reference any open source project or any reference to do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here is a project decode the ASN.1 BER format.
https://github.com/chrisridd/asn1-dump/
main logic located in this file:
https://github.com/chrisridd/asn1-dump/blob/master/berd.m
And if have enough time, it’s not hard to write you own decoder after you read the standard:
http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf
http://luca.ntop.org/Teaching/Appunti/asn1.html
decode flow is like this:
read in Tag, Length, Value sequence.
From Tag you will get
and context-specific (to distinguish different field with same type).
because constructed type can contains Primitive or Constructed type.
maybe need recursive decoding.
Length:
Value: the real value to read in current TLV level.
if this is a constructed data(like sequence), the Value will contains internal level of TLV.
In the end of standard (http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf) there is an image shows multiple level TLV, maybe can better help you to understand BER.
After you read the standards, the best way is:
1) find some GUI viewer to look some BER Certificate file, to get familar with it. google “ASN.1 viewer” to find.
2) start to look the code https://github.com/chrisridd/asn1-dump/blob/master/berd.m