Giter VIP home page Giter VIP logo

Comments (4)

laf0rge avatar laf0rge commented on July 22, 2024

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.

eerimoq avatar eerimoq commented on July 22, 2024

Sorry, but I'm not very active in maintaining this project anymore :(

from asn1tools.

laf0rge avatar laf0rge commented on July 22, 2024

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.

eerimoq avatar eerimoq commented on July 22, 2024

I've other projects to work on that are far more interesting to me, so no.

from asn1tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.