3

I am using openssl asn1parse tool over RHEL, I have my own ASN.1 abstract syntax file, called TestModule.asn1, when I am trying to parse a message using following command:

openssl asn1parse -inform DER -genconf TestModule.asn1 -in CDRMessage -out test.txt

I got the following error:

Error on line 1 of config file 'TestModule.asn1'
140411047393096:error:0E079065:configuration file routines:DEF_LOAD_BIO:missing equal sign:conf_def.c:362:line 1

Noting that I checked the config file, and it should be free of errors.

Update:

Here is a listing for the first 10 lines in the TestModule.asn1 file:

--      File : TestModule.asn1
--

CDRMSG_GA_1040 {iso(1) member-body(2) bsi(826) disc(0) vndr(1249)
Domain (0) charge (5) cDRMSG (1) asn1Module (0)}

DEFINITIONS IMPLICIT TAGS ::=

BEGIN

Any help would be highly appreciated.

  • 2
    Maybe you should list TestModule.asn1 in your question, or at least an extract around line 1? It would help considerably :-) – garethTheRed Feb 25 '16 at 7:51
  • Added to the question's body. – Eng7 Feb 25 '16 at 8:03
  • I don't think that file is formatted correctly - here's an example over on stackoverflow. – garethTheRed Feb 25 '16 at 8:27
4

That openssl command doesn't support ASN.1 schemas.

Looking at the openssl asn1parse man page the -genconf expects a file in a openssl specific serialization format:

-genstr string, -genconf file

generate encoded data based on string, file or both using ASN1_generate_nconf format. If file only is present then the string is obtained from the default section using the name asn1. The encoded data is passed through the ASN1 parser and printed out as though it came from a file, the contents can thus be examined and written to a file using the out option.

Also, -genconf isn't supposed to be used in combination with -in, cf. the man page examples:

openssl asn1parse -in file.pem

and:

openssl asn1parse -genconf asn1.cnf -noout -out asn1.der

Perhaps some of the confusion comes from different uses of terminology. In strict terms, ASN.1 is a schema language. An ASN.1 structure is thus a part of a schema. A schema specifies how valid documents are structured. With ASN.1 different document encodings are supported - i.e. the so called encoding rules (e.g. BER -> basic encoding rules, DER -> Distinguished Encoding Rules).

There are some people who don't make these distinctions. For example, they also call encoded files ASN.1 files. Or refer to an DER tag as an ASN.1 structure. Take for example the asn1parse man page:

The asn1parse command is a diagnostic utility that can parse ASN.1 structures

  • Thanks for the explanation, do you have any idea that help in decoding an ASN.1 message ? – Eng7 Feb 25 '16 at 8:44
  • 1
    @Eng7, you can use the unber command from the asn1c package. – maxschlepzig Feb 25 '16 at 8:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.