asn1tools
asn1tools copied to clipboard
Error when '_' is in the asn file
When I was using your asn1tools on python3.7.4, I found if there is a ‘_’ in the asn file, the IDLE will raise an error. I attach a script below, hoping for your help , thanks. new.zip
the python code is here:
import asn1tools
asn1tools.compile_files('new.asn','uper')
Thanks for the good description of the issue. I'm afraid that _
in enum and sequence member names are not allowed in ASN.1. Only -
is allowed.
Thanks for your kind reply, but when I put this asn file to the https://asn1.io/asn1playground/, it can pass the compiling and encoding, which seems the '_' is allowed in ASN.1. Could you just make another try on the website? Below are the asn file and the value of it, thanks.
World-Schema DEFINITIONS AUTOMATIC TAGS ::= BEGIN Asn1test ::= SEQUENCE { test Test OPTIONAL }
Test ::= SEQUENCE{
test1 INTEGER(0..200),
test2 Test2
}
Test2 ::= ENUMERATED{
test_De0 (0),
test_De1 (1),
test_De2 (2),
test_De3 (3),
test_De4 (4),
test_De5 (5),
test_De6 (6),
test_De7 (7)
}
END
value Asn1test ::= { test { test1 100 test2 test_De0 } }
Hi!
Please read the ASN.1 specification and tell me where is says that _
is allowed. Just because one implementation supports it doesn't mean it's according to specification. It very well may be allowed, but I've not read it anywhere.
Related/Duplicate of: #68 See also this pull request: #173