Java ASN.1 Parser - 如何根据定义的结构解码信息

时间:2017-12-16 21:08:04

标签: asn.1 cdr

我尝试使用充气城堡库做一个简单的asn1解析器。我有3个文件 - 2个方案(或sequnce)和BAR文件。首先,我尝试从文件中读取模式,然后使用BER文件进行解密。

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

接下来我想按加载的模式读取/编码BER文件。

testcdr.ber:

   031512907038000€48790005968260060018293827‚1

我无法通过scheme / sequence找到任何读取对象的简单示例。有人可以告诉我如何开始吗?

0 个答案:

没有答案