asnkitrt 1.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- asnkitrt-1.0.1/LICENSE-RUNTIMES +22 -0
- asnkitrt-1.0.1/NOTICE +26 -0
- asnkitrt-1.0.1/PKG-INFO +63 -0
- asnkitrt-1.0.1/README.rst +42 -0
- asnkitrt-1.0.1/pyproject.toml +33 -0
- asnkitrt-1.0.1/pyproject.toml.orig +34 -0
- asnkitrt-1.0.1/src/asnkitrt/__init__.py +50 -0
- asnkitrt-1.0.1/src/asnkitrt/codecs/__init__.py +520 -0
- asnkitrt-1.0.1/src/asnkitrt/codecs/ber.py +2028 -0
- asnkitrt-1.0.1/src/asnkitrt/codecs/codec.py +23 -0
- asnkitrt-1.0.1/src/asnkitrt/codecs/compiler.py +1668 -0
- asnkitrt-1.0.1/src/asnkitrt/codecs/constraints_checker.py +758 -0
- asnkitrt-1.0.1/src/asnkitrt/codecs/der.py +733 -0
- asnkitrt-1.0.1/src/asnkitrt/codecs/duration.py +315 -0
- asnkitrt-1.0.1/src/asnkitrt/codecs/gser.py +550 -0
- asnkitrt-1.0.1/src/asnkitrt/codecs/jer.py +744 -0
- asnkitrt-1.0.1/src/asnkitrt/codecs/oer.py +1695 -0
- asnkitrt-1.0.1/src/asnkitrt/codecs/per.py +2511 -0
- asnkitrt-1.0.1/src/asnkitrt/codecs/permitted_alphabet.py +22 -0
- asnkitrt-1.0.1/src/asnkitrt/codecs/type_checker.py +327 -0
- asnkitrt-1.0.1/src/asnkitrt/codecs/uper.py +432 -0
- asnkitrt-1.0.1/src/asnkitrt/codecs/xer.py +983 -0
- asnkitrt-1.0.1/src/asnkitrt/constants.py +57 -0
- asnkitrt-1.0.1/src/asnkitrt/errors.py +30 -0
- asnkitrt-1.0.1/src/asnkitrt/py.typed +0 -0
- asnkitrt-1.0.1/src/asnkitrt/runtime.py +423 -0
- asnkitrt-1.0.1/src/asnkitrt/syntax/__init__.py +172 -0
- asnkitrt-1.0.1/src/asnkitrt/syntax/__main__.py +88 -0
- asnkitrt-1.0.1/src/asnkitrt/syntax/cbor.py +238 -0
- asnkitrt-1.0.1/src/asnkitrt/syntax/container.py +867 -0
- asnkitrt-1.0.1/src/asnkitrt/syntax/convert.py +1256 -0
- asnkitrt-1.0.1/src/asnkitrt/syntax/nodes.py +711 -0
- asnkitrt-1.0.1/src/asnkitrt/syntax/wire.py +536 -0
- asnkitrt-1.0.1/src/asnkitrt/version.py +5 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 BoxTheta
|
|
4
|
+
Copyright (c) 2017-2019 Erik Moqvist
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
asnkitrt-1.0.1/NOTICE
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
asnkit contains code from asn1tools by Erik Moqvist and its
|
|
2
|
+
contributors, which was released under the license below. That license
|
|
3
|
+
requires this notice to stay with the code, and it does.
|
|
4
|
+
|
|
5
|
+
The MIT License (MIT)
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2025 BoxTheta
|
|
8
|
+
Copyright (c) 2017-2019 Erik Moqvist
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
asnkitrt-1.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: asnkitrt
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: Encode and decode ASN.1 with compiled specifications
|
|
5
|
+
Author: xadaemon
|
|
6
|
+
Author-email: xadaemon <mxavier@boxtheta.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE-RUNTIMES
|
|
9
|
+
License-File: NOTICE
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
14
|
+
Requires-Dist: cryptography>=43 ; extra == 'encryption'
|
|
15
|
+
Requires-Dist: cryptography>=43 ; extra == 'signing'
|
|
16
|
+
Requires-Python: >=3.13
|
|
17
|
+
Project-URL: source, https://github.com/boxtheta/asnkit
|
|
18
|
+
Provides-Extra: encryption
|
|
19
|
+
Provides-Extra: signing
|
|
20
|
+
Description-Content-Type: text/x-rst
|
|
21
|
+
|
|
22
|
+
asnkitrt
|
|
23
|
+
========
|
|
24
|
+
|
|
25
|
+
Encodes and decodes ASN.1 using compiled specifications: ``.asni``
|
|
26
|
+
files produced by the `asnkitcc`_ compiler. It never parses ASN.1 and
|
|
27
|
+
has no dependencies.
|
|
28
|
+
|
|
29
|
+
.. code-block:: python
|
|
30
|
+
|
|
31
|
+
>>> import asnkitrt
|
|
32
|
+
>>> foo = asnkitrt.load_asni_file('foo.asni', 'uper')
|
|
33
|
+
>>> encoded = foo.encode('Question', {'id': 1, 'question': 'Is 1+1=3?'})
|
|
34
|
+
>>> foo.decode('Question', encoded)
|
|
35
|
+
{'id': 1, 'question': 'Is 1+1=3?'}
|
|
36
|
+
|
|
37
|
+
The supported codecs are BER, DER, GSER, JER, OER, PER, UPER and XER.
|
|
38
|
+
Each is imported only when used. A Rust runtime with the same behavior,
|
|
39
|
+
and a WebAssembly one for browsers and Node.js, live in the same
|
|
40
|
+
`repository`_, which also documents the formats and the known
|
|
41
|
+
limitations.
|
|
42
|
+
|
|
43
|
+
An ``.asni`` file can carry a nonce, be bound to a string, and be signed
|
|
44
|
+
and encrypted. Such a file only loads when the caller says what to
|
|
45
|
+
expect. Signed and encrypted files need the `cryptography`_ package,
|
|
46
|
+
which is an optional extra:
|
|
47
|
+
|
|
48
|
+
.. code-block:: text
|
|
49
|
+
|
|
50
|
+
pip install asnkitrt[signing]
|
|
51
|
+
pip install asnkitrt[encryption]
|
|
52
|
+
|
|
53
|
+
.. _asnkitcc: https://crates.io/crates/asnkitcc
|
|
54
|
+
|
|
55
|
+
.. _repository: https://github.com/boxtheta/asnkit
|
|
56
|
+
|
|
57
|
+
.. _cryptography: https://cryptography.io
|
|
58
|
+
|
|
59
|
+
License
|
|
60
|
+
-------
|
|
61
|
+
|
|
62
|
+
MIT. The compiler, ``asnkitcc``, is Apache-2.0, and an application that
|
|
63
|
+
only uses ``asnkitrt`` does not depend on it.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
asnkitrt
|
|
2
|
+
========
|
|
3
|
+
|
|
4
|
+
Encodes and decodes ASN.1 using compiled specifications: ``.asni``
|
|
5
|
+
files produced by the `asnkitcc`_ compiler. It never parses ASN.1 and
|
|
6
|
+
has no dependencies.
|
|
7
|
+
|
|
8
|
+
.. code-block:: python
|
|
9
|
+
|
|
10
|
+
>>> import asnkitrt
|
|
11
|
+
>>> foo = asnkitrt.load_asni_file('foo.asni', 'uper')
|
|
12
|
+
>>> encoded = foo.encode('Question', {'id': 1, 'question': 'Is 1+1=3?'})
|
|
13
|
+
>>> foo.decode('Question', encoded)
|
|
14
|
+
{'id': 1, 'question': 'Is 1+1=3?'}
|
|
15
|
+
|
|
16
|
+
The supported codecs are BER, DER, GSER, JER, OER, PER, UPER and XER.
|
|
17
|
+
Each is imported only when used. A Rust runtime with the same behavior,
|
|
18
|
+
and a WebAssembly one for browsers and Node.js, live in the same
|
|
19
|
+
`repository`_, which also documents the formats and the known
|
|
20
|
+
limitations.
|
|
21
|
+
|
|
22
|
+
An ``.asni`` file can carry a nonce, be bound to a string, and be signed
|
|
23
|
+
and encrypted. Such a file only loads when the caller says what to
|
|
24
|
+
expect. Signed and encrypted files need the `cryptography`_ package,
|
|
25
|
+
which is an optional extra:
|
|
26
|
+
|
|
27
|
+
.. code-block:: text
|
|
28
|
+
|
|
29
|
+
pip install asnkitrt[signing]
|
|
30
|
+
pip install asnkitrt[encryption]
|
|
31
|
+
|
|
32
|
+
.. _asnkitcc: https://crates.io/crates/asnkitcc
|
|
33
|
+
|
|
34
|
+
.. _repository: https://github.com/boxtheta/asnkit
|
|
35
|
+
|
|
36
|
+
.. _cryptography: https://cryptography.io
|
|
37
|
+
|
|
38
|
+
License
|
|
39
|
+
-------
|
|
40
|
+
|
|
41
|
+
MIT. The compiler, ``asnkitcc``, is Apache-2.0, and an application that
|
|
42
|
+
only uses ``asnkitrt`` does not depend on it.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "asnkitrt"
|
|
3
|
+
version = "1.0.1"
|
|
4
|
+
description = "Encode and decode ASN.1 with compiled specifications"
|
|
5
|
+
readme = "README.rst"
|
|
6
|
+
requires-python = ">=3.13"
|
|
7
|
+
dependencies = []
|
|
8
|
+
license = "MIT"
|
|
9
|
+
license-files = [
|
|
10
|
+
"LICENSE-RUNTIMES",
|
|
11
|
+
"NOTICE",
|
|
12
|
+
]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 5 - Production/Stable",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[[project.authors]]
|
|
21
|
+
name = "xadaemon"
|
|
22
|
+
email = "mxavier@boxtheta.com"
|
|
23
|
+
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
signing = ["cryptography>=43"]
|
|
26
|
+
encryption = ["cryptography>=43"]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
source = "https://github.com/boxtheta/asnkit"
|
|
30
|
+
|
|
31
|
+
[build-system]
|
|
32
|
+
requires = ["uv_build>=0.9.10,<0.13.0"]
|
|
33
|
+
build-backend = "uv_build"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "asnkitrt"
|
|
3
|
+
version = "1.0.1"
|
|
4
|
+
description = "Encode and decode ASN.1 with compiled specifications"
|
|
5
|
+
readme = "README.rst"
|
|
6
|
+
authors = [
|
|
7
|
+
{ name = "xadaemon", email = "mxavier@boxtheta.com" }
|
|
8
|
+
]
|
|
9
|
+
requires-python = ">=3.13"
|
|
10
|
+
dependencies = []
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE-RUNTIMES", "NOTICE"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 5 - Production/Stable",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[project.optional-dependencies]
|
|
21
|
+
# To load signed and encrypted .asni files. Nothing else needs it.
|
|
22
|
+
signing = [
|
|
23
|
+
"cryptography>=43",
|
|
24
|
+
]
|
|
25
|
+
encryption = [
|
|
26
|
+
"cryptography>=43",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
source = "https://github.com/boxtheta/asnkit"
|
|
31
|
+
|
|
32
|
+
[build-system]
|
|
33
|
+
requires = ["uv_build>=0.9.10,<0.13.0"]
|
|
34
|
+
build-backend = "uv_build"
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Copyright (c) 2025 BoxTheta
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
|
|
5
|
+
"""Encode and decode ASN.1 types of compiled specifications, which
|
|
6
|
+
are found in `.asni` files.
|
|
7
|
+
|
|
8
|
+
Nothing in this package parses ASN.1. That is what the compiler
|
|
9
|
+
`asnkitcc` does, which makes the `.asni` files.
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
>>> import asnkitrt
|
|
13
|
+
>>> foo = asnkitrt.load_asni_file('foo.asni', 'uper')
|
|
14
|
+
>>> foo.encode('Question', {'id': 1, 'question': 'Is 1+1=3?'})
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from . import codecs, constants, errors, runtime, syntax
|
|
20
|
+
from .errors import (
|
|
21
|
+
CompileError,
|
|
22
|
+
ConstraintsError,
|
|
23
|
+
DecodeError,
|
|
24
|
+
EncodeError,
|
|
25
|
+
Error,
|
|
26
|
+
ParseError,
|
|
27
|
+
)
|
|
28
|
+
from .runtime import Specification, load, load_asni, load_asni_file
|
|
29
|
+
from .version import __version__
|
|
30
|
+
|
|
31
|
+
__author__ = "BoxTheta"
|
|
32
|
+
|
|
33
|
+
__all__ = [
|
|
34
|
+
"CompileError",
|
|
35
|
+
"ConstraintsError",
|
|
36
|
+
"DecodeError",
|
|
37
|
+
"EncodeError",
|
|
38
|
+
"Error",
|
|
39
|
+
"ParseError",
|
|
40
|
+
"Specification",
|
|
41
|
+
"codecs",
|
|
42
|
+
"constants",
|
|
43
|
+
"errors",
|
|
44
|
+
"load",
|
|
45
|
+
"load_asni",
|
|
46
|
+
"load_asni_file",
|
|
47
|
+
"runtime",
|
|
48
|
+
"syntax",
|
|
49
|
+
"__version__",
|
|
50
|
+
]
|