asn1tools | ASN.1 parsing | TLS library
kandi X-RAY | asn1tools Summary
kandi X-RAY | asn1tools Summary
ASN.1 parsing, encoding and decoding.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Generate fuzzer
- Return a canonical name
- Convert CamelCase to snake_case
- Generate fuzzer source
- Generates an instance of UserType
- Generate the declaration for this node
- Indent a list of lines
- Generate type declaration
- Set the restriction to a given range
- Encode members in data
- Decode a member
- Generates a processor for a type declaration
- Decode asn1crypto core
- Runs the conversion functions
- Encode pycrate
- Decode the given data
- Decode this Field as a binary value
- Encode the given data
- Format the given type
- Encode the given member into the given encoder
- Convert a parameterized object to a Python object
- Encodes data into the encoder
- Encode asn1 encoding
- Generate c source
- Encodes data into a byte string
- Run asn1tools
asn1tools Key Features
asn1tools Examples and Code Snippets
Community Discussions
Trending Discussions on asn1tools
QUESTION
I’m trying to use the asn1tools
Python library to decode and encode BER messages conforming to the Ember+ standard.
That standard’s DTD uses ASN.1’s RELATIVE-OID
type in some places. However, asn1tools
doesn’t know about this type, probably because the underlying pyasn1
library doesn’t implement it (not yet, there’s a pull request). Which is why I can’t use that DTD in my Python program. But I really have to.
My options, as I see them, are to either create a patched version of pyasn1
with the RELATIVE-OID
PR included and make asn1tools
work with it, or to somehow build a workaround in the DTD.
I’ve already tried adding RELATIVE-OID ::= [UNIVERSAL 13] OCTET STRING
to the DTD, but now asn1tools
responds with Expected RELATIVE-OID with tag '2d' at offset 10, but got '0d'.
Basically it seems to accept my definition, but makes it “universal constructed 13” while the message tags it as “universal primitive 13”.
Is there a way for me to work around this?
Here are my constraints:
- I basically have to use
asn1tools
, my code is already heavily depending on it. - I have to be able to parse and create messages compatible to other third-party clients that tag these fields as
0d
. - I can edit around in the DTD as I please, for example adding a type that defines
RELATIVE-OID
(but in what way?) or replacing every occurrence ofRELATIVE-OID
with something else, as long as it will still work with the messages that tag the fields as0d
. - I’m totally okay with getting the
RELATIVE-OID
value as an opaque blob ofbytes
or something, which is why I’ve tried theOCTET STRING
workaround in the first place.
My ASN.1 knowledge is limited and I’m not proficient in writing DTDs. Maybe there’s a way to force the type to being “primitive”? I’m happy for any suggestions. If you’d like to try it out for yourself, use the DTD linked above. Then, use the following Python code:
...ANSWER
Answered 2020-Nov-09 at 20:05Try
QUESTION
I'm trying to compile the 3GPP 38.331 ASN.1 specification here - which was extracted from the spec document
...ANSWER
Answered 2020-Jan-20 at 08:55It is very likely your compiler does not support parameterized types.
You can write the specification a different way (keeping it compatible)
Consider removing this from your spec ...
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install asn1tools
You can use asn1tools like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page