Skip to content

ASN1 syntax error #21

@mateipopp

Description

@mateipopp

Hello,
I'm trying to decode a ANS1 encoded with BER, I edited your example and i get some output, but after some line i got a error.
This is the output:
[C] 0x15
[C] 0x0: 0x13
[C] BIT STRING: 0x01803809006312F5
[C] OCTET STRING
[C] 0x0: 0x01000002

This is the error:
File "test.py", line 133, in pretty_print
pretty_print(input_stream, output_stream, indent + 2)
File "test.py", line 126, in pretty_print
tag, value = input_stream.read()
File "Documents\ANS1\asn1.py", line 421, in read
value = self._read_value(tag.nr, length)
File "Documents\ANS1\asn1.py", line 516, in _read_value
value = self._decode_null(bytes_data)
File "Documents\ANS1\asn1.py", line 598, in _decode_null
raise Error('ASN1 syntax error')
asn1.Error: ASN1 syntax error

I have tried to use a online decoder. https://lapo.it/asn1js/
and the output is:

[21] (24 elem)
[0] (1 byte) 13
[3] (8 byte) 01803809006312F5
[4] (1 elem)
[0] (4 byte) 01000002
[5] (5 byte) 0087B31F73
[6] (1 elem)
[0] (4 byte) 01000001
[7] test.test.se
[8] (2 byte) 0121
Offset: 53
Length: 2+2
Value:
(2 byte)
0121
[9] (1 elem)
[0] (1 elem)
[0] (4 byte) 0AD88204
[11] (1 byte) 01
[12] (1 elem)
SEQUENCE (6 elem)
[2] (12 byte) 0223621F9396405874631040
[3] (1 byte) 00
[4] (1 byte) 00
[5] (1 byte) 02
[6] (9 byte) 1709150029542B0000
[8] (8 byte) 0022F210006D188F
[13] (9 byte) 1709142329542B0000
[14] (2 byte) 0E10
[15] (1 byte) 00
[17] (1 byte) 01
[18] DCP2GGSN1
[21] (1 byte) 00
[22] (9 byte) 9123770050605303F0
[23] (2 byte) 0000
[24] (1 byte) 00
[27] (3 byte) 22F210
[29] (8 byte) 5393297058824310
[30] (1 byte) 02
[31] (2 byte) 8001
[32] (8 byte) 0022F210006D188F

The ANS1 content i'm trying to decode is:
tYHKgAETgwgBgDgJAGMS9aQGgAQBAAAChQUAh7Mfc6YGgAQBAAABhwx0ZXN0LnRlc3Quc2WIAgEhqQig
BoAECtiCBIsBAawuMCyCDAIjYh+TlkBYdGMQQIMBAIQBAIUBAoYJFwkVAClUKwAAiAgAIvIQAG0Yj40J
FwkUIylUKwAAjgIOEI8BAJEBAZIJRENQMkdHU04xlQEAlgmRI3cAUGBTA/CXAgAAmAEAmwMi8hCdCFOT
KXBYgkMQngECnx8CgAGfIAgAIvIQAG0Yjw==

thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions