How can I decode a component of a BER-encoded PDU instead of decoding the entire PDU?

There are two examples to illustrates how you can do it. 

The decomp example is a very simple one and is tailored to handle a particular ASN.1 syntax, TAP3. It does not use the OSS IAAPI. See the comments in the decomp.c file to better understand what is done.

The parsedec example is more generic and can handle any raw BER data. It uses the OSS IAAPI. (Note that the IAAPI is meant for a very special purpose, where the application cannot know in advance which ASN.1 specification is being used and must be written in a generic manner. This would apply, by way of example, to a protocol analyzer.) First, the BER-encoder is called to create an encoded PDU. Then the OSS IAAPI is used to parse the raw BER-encoded PDU for both DEFINITE- and INDEFINITE-length cases. After a given tag sequence is found, the decoder is called to decode the component found as a stand-alone encoded PDU. See the comments in decodenested.c for more information. 

These examples are available as a Windows VC++ project zip file or as a UNIX project zip file. They can easily be run as is with some minor setting adjustments based on your installation of the OSS ASN.1 Tools.

If you target an operating system other than Windows or UNIX, you can also use either of these zip files and discard the Windows- or UNIX-specific files.

Click on any one of the following files below:

parsedec.windows.zip 8 KB 
parsedec.unix.zip 4 KB 
decomp.windows.zip 47 KB 
decomp.unix.zip 17 KB

 


The samples included with some of the Knowledge Center answers are meant for your general understanding of the OSS products. Different versions of the products might produce slightly different outputs. Consult the products documentation and samples for the most up-to-date products information and code examples.



Contact Support
contact Our office hours
24 hours/day, 7 days/week

  • Phone: 1-888-OSS-2761 (USA and Canada)
  • Phone: 1-732-302-9669 (International)
  • Fax: 1-732-302-0023
  • Email: support@oss.com
Free Trial
download

Test drive the OSS Nokalva ASN.1, 4G and XML Tools now! Your trial includes complete software, documentation, sample programs, free 24x7 technical support and more.




Learn ASN.1
Learn ASN.1

Our expert personnel can help you learn ASN.1!

We offer 4-day ASN.1 courses at our headquarters or your premises.