Topic: ASN1 Encoding and Decoding with wolfssl


I am developing a communication interface which transmits asn1 encoded messages. For some other things i already use the wolfSSL and now im wondering if the wolfSSL supports asn1 encoding and decoding. So that it would be possible to encode a given asn1 structure in a bit stream and then deocde it again?

Thanks for the help!


Re: ASN1 Encoding and Decoding with wolfssl

Hello Lars,

That is an interesting use case. The library actually has a new ASN parser that can be enabled using

./configure --enable-asn=template

There are other options that can be enabled with the defines documented
in … /src/asn.c

 * WOLFSSL_ASN_TEMPLATE: Encoding and decoding using a template.
 * WOLFSSL_DEBUG_ASN_TEMPLATE: Enables debugging output when using ASN.1
 * WOLFSSL_ASN_TEMPLATE_TYPE_CHECK: Use ASN functions to better test compiler
    type issues for testing
 * CRLDP_VALIDATE_DATA: For ASN template only, validates the reason data

Mostly the ASN1 handling in the library is in the context of certificate handling, but maybe you'll find this extension callback example useful: … callback.c

Let us know if there are questions.

Eric @ wolfSSL Support