What is an ASN file and how to use it?

I am trying to work with a communication protocol (specific S1AP) and I am trying to identify messages for testing.

The LTE 36.413 specification describes this protocol in detail and also gives the definition of the ASN.1 file at the bottom of the pdf. I saw the ASN files that are used in the dissector for WireShark, and I assume that I can use it to generate messages according to the specification.

I was wondering how you use ASN.1 files. I studied and found information about ASN.1 compilers and other related information, but all the information left me very confused as no one explained how to use it. Can someone help me figure out how to use it?

+7
networking packet packet-capture lte
source share
2 answers

After many hunts, I found out what ASN.1 files are.

These ASN.1 files essentially contain a protocol description and a package description. Using these ASN.1 files, you can generate .c and .h files that will be used in some applications for which you want to use them. This is really convenient because you do not need to create your own message database. You just need to compile the ASN.1 files and the C files will be compiled for your use.

Now you should be wondering how can I compile this? Well, you usually need some kind of ASN.1 compiler. You have to pay for some, but I was able to find an open source source that works with Linux and Windows. It is likely that it can work on MAC as well, since it is based on UNIX, if you have the necessary dependencies. In any case, there is a link to this web page. I will not explain how to use it, because I think this web page does a great job of documenting usage. Hope this helps someone as much as me.

Check out the compiler here http://lionet.info/asn1c/blog/

If this link doesn’t work for you, you may have to try a commercial one, such as the OSS compiler Nocklava ASN1.C, or if the money bothers, then it may be advisable to create your own database, despite the fact that it will take time.

All the best.

+8
source share
  • ASN is a data description language. As you said, the found ASN file definition indicates the representation of your message data in accordance with the encoding and decoding in accordance with the S1AP protocol.

  • The ASN file must be compiled. The compilation result will give you some code specification and body (in most cases, an .h and .c file) for automatically serializing / deserializing any message data into an S1AP data model, regardless of the platform encoded and sent.

  • To quickly test and learn how to use the ASN.1 scheme, you can use this service: http://asn1-playground.oss.com/

  • In addition, for a more detailed and detailed explanation of what makes ASN.1 powerful, please read the following: https://www.thanassis.space/asn1.html . The author also shares the open-source ASN.1 compiler, developed under the guidance of the European Space Agency.

  • As a side note, it might be worth exploring the use of protocol buffers as it is a very similar technology, complemented by perhaps more advanced features, such as compatibility and reflection of reverse / forward data descriptions: https://developers.google.com/ protocol-buffers / docs / cpptutorial

+5
source share

All Articles