Mar-06-2020, 12:18 PM
Hi I am trying to decode ASN.1 BER file using python library asn1 using the ASN1 Schema in XML or JSON. But i am not able to do so.
ASN1 SCHEMA SAMPLE:-
Code snippet
ASN1 SCHEMA SAMPLE:-
Output: -- ASN.1 Formal Description
AIROUTPUTCDR {iso(1) member-body(2) bsi(826) disc(0)
ericsson(1249) mobileDomain (0) charging (5)
aIROUTPUTCDR (1) asn1Module (0)}
DEFINITIONS IMPLICIT TAGS ::=
BEGIN
EXPORTS DetailOutputRecord;
DetailOutputRecord ::= CHOICE {
-- tags [0] reserved
-- tags [1] reserved
-- tags [2] reserved
-- tags [3] reserved
adjustmentRecordV2 [4] AdjustmentRecordV2,
offlinepromotionRecordV2 [5] OfflinePromotionRecordV2,
refillRecordV2 [6] RefillRecordV2,
errorRecordV2 [7] ErrorRecordV2,
communicationIDChangeRecord [8] CommunicationIDChangeRecord,
-- PC:15605
cdrFileControlBlock [9] CDRFileControlBlock
-- end PC:15605
}......
I also have the BER File. I want to write python code for parsing the BER file as the sample ASN1 shared above. Do we have any python library that accepts the schema and BER and gives output in XML or JSON or CSV format. I am not able to find any such library. I am trying with asn1 python library but documentation is limited and i am stuck. Please help.Code snippet
1 2 3 4 5 6 7 |
import asn1 import future decoder = asn1.Decoder() output = decoder.start( "C:/asn/log.ber" ) #print(output) tag, value = decoder.read() print (tag,value) |