Code Monkey home page Code Monkey logo

Comments (10)

URockMan avatar URockMan commented on July 29, 2024

I have tried using some generic example still both the encoded values are different using this library and asn1 play ground link.

ASN1 Structure:

Foo DEFINITIONS ::= BEGIN

    Question ::= SEQUENCE {
        id        INTEGER,
        question  Details
    }
	Details ::= CHOICE
	{
		name  [0] Freetext,
		place [1] Freetext
	}
	Freetext ::= IA5String (SIZE (1..256))
END

Input : question = {'id': 1, 'question': {'name':'TESTING'}}

Library encoded value : UPER:
Encoded: 010103d48b4ea499d1c0 (10 bytes)

ASN1 Playground link encoded value:
Encoded: 010103548B4EA499D1C0

Please correct me if im using the library in wrong way.

from asn1tools.

eerimoq avatar eerimoq commented on July 29, 2024

Your usage is perfectly fine. The issue is that SIZE constrains are not implemented for UPER IA5String.

I implemented basic support for it in 0.36.0 (latest on PyPI). Your example works with that version.

from asn1tools.

URockMan avatar URockMan commented on July 29, 2024

Thanks for working on the fix. But I'm very sorry to say this i still see issues by trying different examples. Can you please check below examples where i can see additional 00 in the encoded string from library where i don't see them from asn1 playground link.

Question to encode: {'aTCmessageheader': {'timestamp': {'timehours': 12, 'timeminutes': 7, 'timeseconds': 50}, 'msgreferencenumber': 1, 'msgidentificationnumber': 1}, 'aTCuplinkmsgelementid': {'uM163ICAOfacilitydesignationTp4table': {'tp4table': 'labelA', 'iCAOfacilitydesignation': 'GDTA'}}}
Encoded Reference value from Airsim:6082F9E8A906A9169D4933A380

UPER:
Encoded:
6082c1f2 a3008f12 a410 (10 bytes)
6082C1F2 A3 8F12 A410 (ASN1 Play Ground)
Decoded: {'aTCmessageheader': {'timestamp': {'timehours': 12L, 'timeminutes': 7L, 'timeseconds': 50L}, 'msgreferencenumber': 1L, 'msgidentificationnumber': 1L}, 'aTCuplinkmsgelementid': {'uM163ICAOfacilitydesignationTp4table': {'tp4table': 'labelA', 'iCAOfacilitydesignation': u'GDTA'}}}

Question to encode: {'aTCmessageheader': {'timestamp': {'timehours': 12, 'timeminutes': 7, 'timeseconds': 50}, 'msgreferencenumber': 1, 'msgidentificationnumber': 1}, 'aTCuplinkmsgelementid': {'uM160ICAOfacilitydesignation': 'GDTA'}}

UPER:
Encoded:
6082c1f2a0008f12a410 (10 bytes)
6082C1F2A 08F12A410 (ASN1 Play Ground)

Decoded: {'aTCmessageheader': {'timestamp': {'timehours': 12L, 'timeminutes': 7L, 'timeseconds': 50L}, 'msgreferencenumber': 1L, 'msgidentificationnumber': 1L}, 'aTCuplinkmsgelementid': {'uM160ICAOfacilitydesignation': u'GDTA'}}

from asn1tools.

eerimoq avatar eerimoq commented on July 29, 2024

Where can I find the ASN.1 specification? It's impossible to fix the issue without it.

By the way, I'm thankful for all issues you report as fixing them improves the quality of the library.

from asn1tools.

eerimoq avatar eerimoq commented on July 29, 2024

Fixed in 0.37.0. Let me know if there are more issues. I know there are as constraints are not fully implemented.

from asn1tools.

URockMan avatar URockMan commented on July 29, 2024

from asn1tools.

URockMan avatar URockMan commented on July 29, 2024

Thank you for the fix and updating the library. I have few more cases to execute. If i happen to find any issue will update in this thread.

Thanks again for continuous support.

from asn1tools.

URockMan avatar URockMan commented on July 29, 2024

If you look at the decoded text it is having trail character 'L' appended to each value and also the free text is having " u' " every time. Will it be possible to remove those extra characters.

Decoded: {'aTCmessageheader': {'timestamp': {'timehours': 13L, 'timeminutes': 20L, 'timeseconds': 20L}, 'msgreferencenumber': 1L, 'msgidentificationnumber': 1L}, 'aTCuplinkmsgelementid': {'uM169Freetext': u'TESTING'}}

from asn1tools.

eerimoq avatar eerimoq commented on July 29, 2024

L means long integer and u unicode. They are standard Python types. It's unlikely that I will change the integer behavious, and strings are hard to handle correctly in a portable way. I think I'll stick to the current behaviour for now.

from asn1tools.

eerimoq avatar eerimoq commented on July 29, 2024

I found a few more unsupported features/problems with string encoding and decoding in the UPER codec. Fixes are part of release 0.38.0.

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.