1

I try to do a simple asn1 parser using bouncy castle library. I got 3 files - 2 scheme (or sequnce) and BAR file. Firstly i try to read a schema from files and next to use BER file to decrypt.

CDR-HLR.asn :

CDR-HLR-Version3 DEFINITIONS IMPLICIT TAGS ::=
BEGIN
EXPORTS
CDR-HLR-VERSION3
;

IMPORTS
Timestamp,
IMSI,
CdrType,
ISDN-AddressString 
FROM DataTypes
;


CDR-HLR-VERSION3 ::= 
SEQUENCE {
timestamp  Timestamp,
type       CdrType,
msisdn  [0] ISDN-AddressString OPTIONAL,
imsi    [1] IMSI,
vlr     [2] ISDN-AddressString
}
END

DataTypes.txt

DataTypes DEFINITIONS IMPLICIT TAGS ::=
BEGIN

EXPORTS
AddressString,
ISDN-AddressString,
Timestamp,
IMSI,
CdrType
;

AddressString        ::= OCTET STRING (SIZE (0..maxAddressLength))
ISDN-AddressString   ::= AddressString (SIZE (1..maxISDN-AddressLength))
Timestamp   ::= OCTET STRING
IMSI        ::= TBCDSTRING (SIZE (3..8))
CdrType ::= ENUMERATED {updateLocation(2), cancelLocation(3)}

END

And next i want to read/encode BER file by loaded schema.

testcdr.ber:

   031512907038000€48790005968260060018293827‚1

I cant find any simple example for read objects by scheme/sequence. Can somebody tell me how to start?

Błażej Rejnowski
  • 239
  • 1
  • 2
  • 8

0 Answers0