Comments (4)
I can modufy the ASN.1 source to replace the DEFAULT { 00000000000'H, '000000000000'H, ... }
clause with a simple DEFAULT 00000000000'H
. Then asn1tools is able to parse the ASN.1 snyatx, and also parse actual (DER encoded) data in-line with the syntax.
However, (obviously) when the related field is not set and one expects the default value to be used during encode, there is an exception:
File "/usr/local/lib/python3.11/dist-packages/asn1tools/compiler.py", line 137, in encode
type_.check_types(data)
File "/usr/local/lib/python3.11/dist-packages/asn1tools/codecs/compiler.py", line 102, in check_types
return self.type_checker.encode(data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/asn1tools/codecs/type_checker.py", line 311, in encode
raise e
File "/usr/local/lib/python3.11/dist-packages/asn1tools/codecs/type_checker.py", line 307, in encode
self._type.encode(data)
File "/usr/local/lib/python3.11/dist-packages/asn1tools/codecs/type_checker.py", line 247, in encode
raise e
File "/usr/local/lib/python3.11/dist-packages/asn1tools/codecs/type_checker.py", line 243, in encode
member.encode(data[1])
File "/usr/local/lib/python3.11/dist-packages/asn1tools/codecs/type_checker.py", line 142, in encode
self.encode_members(data)
File "/usr/local/lib/python3.11/dist-packages/asn1tools/codecs/type_checker.py", line 154, in encode_members
raise e
File "/usr/local/lib/python3.11/dist-packages/asn1tools/codecs/type_checker.py", line 150, in encode_members
member.encode(data[name])
File "/usr/local/lib/python3.11/dist-packages/asn1tools/codecs/type_checker.py", line 166, in encode
super(List, self).encode(data)
File "/usr/local/lib/python3.11/dist-packages/asn1tools/codecs/type_checker.py", line 45, in encode
raise EncodeError(
asn1tools.codecs.EncodeError: ProfileElement.akaParameter.sqnInit: Expected data of type list, but got 0x000000000000.
Obviously the encoder is correct: It doesn't make sense to have a single value as a default for a "SEQUENCE OF", where one would need a list of values. So it looks a bit like the problem is just the parser which doesn't parse that construct?
The full ASN.1 syntax of the spec I'm working with can be found at https://gitea.osmocom.org/laforge/simalliance-tca-interoperable-format-asn1/src/branch/master/asn1/PEDefinitions.asn
from asn1tools.
Sorry, but I'm not very active in maintaining this project anymore :(
from asn1tools.
Sorry, but I'm not very active in maintaining this project anymore :(
I noticed, and that's all fine. It still is in my opinion the most powerful/complete python framework for ASN.1. I tried to look at debugging the specific problem further, but given I know very little about parser theory and have no idea about pyparsing, so I sadly didn't get very far :( If I should solve it, I'd for sure send a related PR.
Seeing that there are sponsoring opportunities avaialable: Would you consider debugging this in a paid/freelance capacity?
from asn1tools.
I've other projects to work on that are far more interesting to me, so no.
from asn1tools.
Related Issues (20)
- Unsupported type 'BIT STRING' error in generate C source uper HOT 3
- python asn1tools BitString uper encoded wrong value HOT 1
- Objects set members are not parsed at all HOT 2
- ASN1Tools Fails to Compile 3GPP Release 16 ASN.1 HOT 3
- Expected enumeration index 0, 1 or 2, but got 3
- Generated C OER decoder fails to decode fixed-length sequences with lengths of more than 255
- Decode successfully ignores extra bytes HOT 2
- encode_message() fails to validate ASN.1 BIT STRING SIZE constraints
- how to parse the "CONTAING SEQUENCE" msg immediately HOT 1
- Compile nrppa using PER fail
- How to view encoded values
- Test failures with pyparsing 3.1.1 HOT 4
- oer c code generation fails when addition contains a sequence with enums (type error) HOT 2
- decoding erros HOT 9
- SEQUENCE OF has no maximum length HOT 1
- How to encode a complex json object ?
- ParseError when compile the ASN1 schema file
- OpenType does not exist for xer
- Changing `numeric_enums` parameter has no effect when `cache_dir` is set and cache previously created
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asn1tools.