1

We have received a specifications document for CDR encoded in TLV from a vendor and we are trying to build a parser for it. According to them, their CDR is formatted as per ASN.1 BER encoding. However when asked for ASN.1 specification file, they said they didn't have it and that their document is all they had.

Although not that versed into ASN.1 syntax, I am trying to reverse engineer that specs into ASN.1 specifications.

Their tags and length can be coded either over 1 or 2 bytes.

Let me share the first few bytes of some sample records:

804e 8060 8002 805c 010100 02089999999999999999 ...
804e 8066 8002 8062 010101 02089999999999999999 ...

First of all, is this really compliant to BER ASN.1? Because after reading A Layman's Guide to a Subset of ASN.1, BER, and DER, for a tag to be 2-bytes (or more) the bits 5-1 of the first byte must be set to 1, and 804e and 8002 don't fit this.

Secondly, how can I convert the above format into an ASN.1 specification?

Thank you.

asked Feb 3, 2021 at 16:18

2 Answers 2

2

It's common for CDR data to consist of some non-ASN.1 data (file headers and record headers) along with ASN.1 data. For example, 3GPP TS 32.297.

You can parse BER only to a limited degree without the specification. If any implicit tagging is used (almost certainly it is), you won't know the actual types. You also won't know the semantics of any of the values you do know the types of.

You most certainly cannot infer the specification from a sample of encoded data, anymore than you can determine all legal English sentences by looking at one sentence. In particular, any use of a CHOICE type would be perplexing, to say the least.

Insist on receiving the ASN.1 specification or being told what standard is being used, if one is.

answered Feb 4, 2021 at 14:28
Sign up to request clarification or add additional context in comments.

Comments

1

First of all, is this really compliant to BER ASN.1?

You can use https://asn1.io/asn1playground/ (you don't need a specification to decode a BER value)

Secondly, how can I convert the above format into an ASN.1 specification?

No.

answered Feb 4, 2021 at 10:02

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.