help-libtasn1
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Decoding DER with recursive CHOICE option


From: Bukuli Norbert
Subject: Decoding DER with recursive CHOICE option
Date: Fri, 13 Nov 2015 14:47:41 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

Hi List,

First of all, I am new with libtasn1, so if I ask noob questions
please let me know that.

TL;DR: Is is somehow possible to parse DER encoded data which contains
recursive data types?

In more details: I have tied to use libtasn1 to parse IEC61850 GOOSE
packages, which contains DER encoded PDU-s in the following way:

1) creating an empty loading the grammar with asn1_array2tree(...)
2) creating an empty node with asn1_create_element(...)
3) decoding the incoming GOOSE packet payload with asn1_der_decoding2(...)

The relevant part of the IEC61850 GOOSE ASN.1 is that:
IECGoosePdu ::= SEQUENCE {
-- Irrelevant types here
allData  [11]   IMPLICIT SEQUENCE OF Data,
-- Irrelevant types here, too
}


Data ::= CHOICE {
array    [1] IMPLICIT SEQUENCE OF Data,
sequence [2] IMPLICIT SEQUENCE OF Data,
boolean  [3] IMPLICIT BOOLEAN,
-- More basic types
}

Everything works well if I omit the Data.array and Data.sequence
possibilities. (Comment out the corresponding lines in the asn grammar.)
However, if I tried to create with asn1_create_element(...) in case of
turned on Data.array and Data.section choices, the function went into
an infinite loop. Correspondingly I was not able to parse the incoming
DER message with recursive data.

Could you please tell me some proposals about this situation? Is
libtasn1 able to handle recursive choices in some way?

Thank you all in advance!

-- 
Best regards
Norbert Bukuli

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]