Comments (10)
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.
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.
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.
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.
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.
from asn1tools.
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.
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.
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.
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)
- 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
- parser claims "syntax error" for `SEQUENCE (SIZE (32)) OF OCTET STRING (SIZE (6))` with `DEFAULT` HOT 4
- 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
- Example for ETSI CAM-ASN1 to Json Command
- Decode hangs when decoding the output of encode if ASN.1 contains a SEQUENCE of CHOICE of SEQUENCE
- Hello eerimoq
- Error Decoding Indefinite Length ASN.1 Elements Containing Extension Marker HOT 1
- Type 'SetupRelease' not found in module 'EUTRA-RRC-Definitions'.
- UnicodeDecodeError: 'ascii' codec can't decode byte 0x90 in position 3: ordinal not in range(128)
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.