A DER decoder for pyasn1 built to detect encoding errors
Project description
pyasn1-fasder
pyasn1-fasder is a DER decoder for pyasn1 with a focus on checking the correctness of encoding. This decoder is more pedantic than most other decoders in terms of flagging DER encoding errors, and this behavior is unlikely to change.
Installation
pip install pyasn1-fasder
Usage
pyasn1-fasder exposes a single function: decode_der. The signature and return type are the same as the pyasn1 decode function, as it is intended to be a drop-in replacement of pyasn1.codec.der.decoder.decode.
from pyasn1.type.char import PrintableString
from pyasn1_fasder import decode_der
substrate = b'\x13\x03\x41\x42\x43'
decoded, rest = decode_der(substrate, asn1Spec=PrintableString())
assert rest == b''
assert str(decoded) == 'ABC'
Limitations
- There is no encoding counterpart.
- Trailing octets present after the
substrateTLV are not tolerated and will result in an exception being raised. In other words, therestcomponent of the tuple return value will always be an emptybytesobject. - Schemaless decoding is not supported. In other words, a non-
Noneasn1Specmust be passed todecode_der. Sets withnamedTypesare not supported. These are (almost?) never used in cryptography standards, but support can be added if there are valid use cases.openTypesdecoding is currently not supported. This can be added if there is interest.- The pedantic checks for correctness of encoding cannot be disabled.
Bugs?
Please create a Github issue.
Contributing
Contributions for bug fixes and new features are welcome.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyasn1_fasder-0.1.3.tar.gz.
File metadata
- Download URL: pyasn1_fasder-0.1.3.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73fe744d7e856d98b59a4eb86d7c0533be6d78defc1b02fddf7531716add133d
|
|
| MD5 |
1c28eca9fcdc31f80380b26bf7d39641
|
|
| BLAKE2b-256 |
ebbc61a461783362a5c8a3f2095e02d3dcc2baa2dfab0f7ff71618a8ebbbbc1d
|
File details
Details for the file pyasn1_fasder-0.1.3-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: pyasn1_fasder-0.1.3-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 145.8 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
752a5fbb41cb3cb126142e873babf10cd0c1b1cf8b2399517130dbe3a987339d
|
|
| MD5 |
cefc51ce9390d88ef8c040b0496a0987
|
|
| BLAKE2b-256 |
fd47cbb6e517cb49586c78b926752d79ab4bd92b3f00c063fc6cc300f2f15410
|
File details
Details for the file pyasn1_fasder-0.1.3-cp39-abi3-win32.whl.
File metadata
- Download URL: pyasn1_fasder-0.1.3-cp39-abi3-win32.whl
- Upload date:
- Size: 135.5 kB
- Tags: CPython 3.9+, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d55904e40bc213e7698efd36af428211e8e3a493231a5f66f3a29d42a85d4ba
|
|
| MD5 |
4d448efdf49362a11f861fd2c87c2047
|
|
| BLAKE2b-256 |
b80a58cc48ebff96d05665468b2250041d0f5bc300fb76157e77f08ede9d70a7
|
File details
Details for the file pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 279.4 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2002e97834c836b9a1cb3098bcb319b57ab50fb2df92671dc7c45ddaee77034a
|
|
| MD5 |
9d9f0e24047680f96549957bdb88576d
|
|
| BLAKE2b-256 |
4744f27b073c961436c1d1a7f552065aaafa25a0bbd4e8efa875f5aad0db93fe
|
File details
Details for the file pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.
File metadata
- Download URL: pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
- Upload date:
- Size: 322.7 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ s390x
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4506a06c1818e5ae94c48ecf406cac5d4517cf3808e44d5b8be75423d65fb21b
|
|
| MD5 |
e89c03188f5344d2c8eb0224c405d1ff
|
|
| BLAKE2b-256 |
9f2406a0a423539da205252f0a708102ee8efc8b559f83bddb2d163295896b01
|
File details
Details for the file pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.
File metadata
- Download URL: pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
- Upload date:
- Size: 316.2 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ppc64le
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6a695c05bafa21b348123e326a2b05276e684fd6c5db8f6ccc72f402baa2216
|
|
| MD5 |
12a53c334080778c78930e979319e103
|
|
| BLAKE2b-256 |
8285d24788f4663f514a202d1a031f6053bf0124f486e5b4cdff7f73a58a6d03
|
File details
Details for the file pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.
File metadata
- Download URL: pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
- Upload date:
- Size: 289.3 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d019e4a3cd5ff33ed4e3b6fd7b7908869ce42fe4e20efd96915cbd577b9c255
|
|
| MD5 |
89ecad64a1360e7c035a03a57f8e24a9
|
|
| BLAKE2b-256 |
0d4cf321694fd954b852f56d3880f9da2e4929d2b39cf1743a28b4b5b37efe36
|
File details
Details for the file pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 286.9 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
373f71d732b0ce9b4abd045e9a23ee694bd68457913500d24317465ee5d9b759
|
|
| MD5 |
151fe6ed731cb45ec9ac64ec0cde8937
|
|
| BLAKE2b-256 |
4bad180edc27854aee136538dabf535060f2b6cce8352083b1a47d4484df4728
|
File details
Details for the file pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl.
File metadata
- Download URL: pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl
- Upload date:
- Size: 294.3 kB
- Tags: CPython 3.9+, manylinux: glibc 2.5+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60aead2322e199dcf234d31dcb4ba28e3a396a721c89ca2fe03aff9b2a5ba529
|
|
| MD5 |
fdf335492b3aa4dbd0a975605403e661
|
|
| BLAKE2b-256 |
6f118193a7c453143e25635286f9fd9393bb96a86d8f7d3d2a9a9c286fb01049
|
File details
Details for the file pyasn1_fasder-0.1.3-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyasn1_fasder-0.1.3-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 241.4 kB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f822f34da8558cf83bdd9bce2c063fe9b93c5444062477bf5619252b8302c21
|
|
| MD5 |
e98f9e9f5a4fc73ae5f8fa54c8d870a3
|
|
| BLAKE2b-256 |
84704a694ff2475f1b035fc5124c60a00f70cd3daae5c0eff87d85bfd0a489e3
|
File details
Details for the file pyasn1_fasder-0.1.3-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: pyasn1_fasder-0.1.3-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 249.5 kB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7a4ac54b739a8c9003fed32990938c84ddc2586daeded1aad08825e759a623f
|
|
| MD5 |
7890df1da3e13ee14c6ababddc04bf50
|
|
| BLAKE2b-256 |
2e835e0fb9000c95e5f8dec4d8d3341f355a1a0663f1a37901673dc030944c8e
|