Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when '_' is in the asn file #94

Open
chuanxiao258 opened this issue Oct 16, 2020 · 5 comments
Open

Error when '_' is in the asn file #94

chuanxiao258 opened this issue Oct 16, 2020 · 5 comments

Comments

@chuanxiao258
Copy link

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

@chuanxiao258
Copy link
Author

the python code is here:

import asn1tools

asn1tools.compile_files('new.asn','uper')

@eerimoq
Copy link
Owner

eerimoq commented Oct 16, 2020

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.

@chuanxiao258
Copy link
Author

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
}
}

@eerimoq
Copy link
Owner

eerimoq commented Oct 16, 2020

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.

@laf0rge
Copy link

laf0rge commented Dec 9, 2023

Related/Duplicate of: #68
See also this pull request: #173

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants