Comments (8)
Hello Mourad,
I'm having trouble seeing the bigger picture. What do you suggest asn1ate is doing wrong?
Thanks!
from asn1ate.
Sorry I did the issue too quickly.
If ASN1 file define a variable with the terms : "fileID OCTET STRING (SIZE(2))"
That means,it has to be an octet string of length 2 Octets
eg: fileID = '0102'
or in the function ValueSizeConstraint (in constraint.py)
in line 106 we count the number of string characters and not octets
to day : line 106 : l = len(value)
I corrected by : line 106 : l = len(value)/2
to count the number of OCTETs and not the string characters
in my case it correct the problem
from asn1ate.
constraint.py
is part of pyasn1, not asn1ate.
But it could very well be that asn1ate is producing the wrong data for pyasn1, so I don't think you should modify pyasn1.
Can you create a reproducible example and run it by the pyasn1 mailing list (cc me), and maybe we can work out together where the problem is, and how it should be solved?
from asn1ate.
oh yes I'm quite lost in files :D
Yes for sure i will
from asn1ate.
Hi Kim,
In fact the probleme is not in pyasn1,
i was thinking that pyasn1 was expecting an hexa like 'FF0D'
but it wait for a b'\xFF\x0D', so the length in string is the double.
in asn1ate, a default Value 'FF0D'H is converted to 'FF0D'H (not a pretty python syntax) when it have to be converted by b'\xFF\x0D' to be pretty regarding to pyasn1
Sorry for the confusing issue :)
Mourad
from asn1ate.
I think I understand what the problem is now, but a small, contained example ASN.1 fragment would definitely help.
from asn1ate.
Here it is:
exctracted from the SimAlliance ASN1
ApplicationInstance ::= SEQUENCE {
applicationLoadPackageAID [APPLICATION 15] ApplicationIdentifier,
classAID [APPLICATION 15] ApplicationIdentifier,
instanceAID [APPLICATION 15] ApplicationIdentifier,
extraditeSecurityDomainAID [APPLICATION 15] ApplicationIdentifier OPTIONAL,
applicationPrivileges [2] OCTET STRING,
lifeCycleState [3] OCTET STRING (SIZE(1)) DEFAULT '07'H,
/* Coding according to GP Life Cycle State. */
applicationSpecificParametersC9 [PRIVATE 9] OCTET STRING,
systemSpecificParameters [PRIVATE 15] ApplicationSystemParameters OPTIONAL,
applicationParameters [PRIVATE 10] UICCApplicationParameters OPTIONAL,
processData SEQUENCE OF OCTET STRING OPTIONAL
}
The line lifeCycleState [3] OCTET STRING (SIZE(1)) DEFAULT '07'H, define a Default value to '07'H
or asn1ate will convert in python as '07'H (not python friendly)
it has to be b'\x07' or binascii.unhexlify('07')
but definitively not '07'H :)
Regards
from asn1ate.
Thanks, just what I needed. I'll try and look into this.
from asn1ate.
Related Issues (20)
- Fail to parse Kerberos ASN.1 HOT 17
- output missing size constaint HOT 6
- multi-module asn files don't work HOT 8
- default vales for enums need to be strings HOT 4
- Support for CLASS ... WITH SYNTAX ... HOT 6
- to support Brace value notation assignment HOT 4
- Emits invalid python for `BOOLEAN true` HOT 1
- Failure parsing minimal example with VisibleString HOT 3
- restricted_integer_type range constraint HOT 2
- Parsing Error: pyparsing.ParseException: Expected "DEFINITIONS" HOT 5
- resolve imported type declarations HOT 1
- KeyError: if the type is in another module. HOT 2
- single value and range constraint with both '..' and '|' HOT 3
- KeyError EXTERNAL HOT 6
- asn1ate generates incorrect code for DefaultedNamedType
- Feauture Request for 0.6.1: Parsing DEFAULT with structure HOT 1
- interdependent asn1 files to py files HOT 2
- asn1ate needs wheels HOT 9
- PyParsing issue (and work-around) HOT 4
- ParseException: Expected Keyword 'DEFINITIONS', found 'AUTOMATIC' HOT 1
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 asn1ate.