If I want to use only PER or only BER, why is the runtime library the same no matter which encoding rules I use?

Although a single library is used for BER, DER, PER, UPER, CER, CXER, XER, OER, COER, and JSON, the appropriate functions are extracted from the library based on the encoding rules that you select. For example, if you chose -per -ber, you will see that after linking the size of the resulting executable is quite different compared to your specifying just -ber or -per.

If size is a major concern, consider specifying the -minimize option. The effect of this option is that it suppresses use of all capabilities not critical to correctly encoding and decoding values (e.g., runtime strong constraint checking is suppressed.)

Another way to keep size to a minimum is to use the lean encoder/decoder library. Not only are the functions in this library (which was built specifically for embedded systems) much smaller and faster than the space-optimized library functions (SOED), it is possible for you to purchase the source for it and do your own custom builds. By default the library includes many capabilities, but if you purchase the source you will be able to #define constants which produce minimal builds that more closely meet your individual needs than the build that OSS does.

Caveat: The lean encoder/decoder library gets its minimal size and speed increase by selecting how ASN.1 types will be locally represented. If you have already written your application then there is a good chance that you will need to make code changes since the C representations that you are using may not be the same as those selected by the lean encoder/decoder. If you have not gotten far in your implementation then the lean encoder/decoder is more likely to be ideal for you.

For more information about the LEAN encoder/decoder, see the ASN.1 Lean Encoder/Decoder section.

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

Test drive the OSS Nokalva ASN.1, LTE, 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.