Skip to main content

A DER decoder for pyasn1 built to detect encoding errors

Project description

pyasn1-fasder

PyPI Python Versions Build status GitHub license

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 substrate TLV are not tolerated and will result in an exception being raised. In other words, the rest component of the tuple return value will always be an empty bytes object.
  • Schemaless decoding is not supported. In other words, a non-None asn1Spec must be passed to decode_der.
  • Sets with namedTypes are not supported. These are (almost?) never used in cryptography standards, but support can be added if there are valid use cases.
  • openTypes decoding 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

pyasn1_fasder-0.1.3.tar.gz (18.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyasn1_fasder-0.1.3-cp39-abi3-win_amd64.whl (145.8 kB view details)

Uploaded CPython 3.9+Windows x86-64

pyasn1_fasder-0.1.3-cp39-abi3-win32.whl (135.5 kB view details)

Uploaded CPython 3.9+Windows x86

pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (279.4 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (322.7 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ s390x

pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (316.2 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ppc64le

pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (289.3 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARMv7l

pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (286.9 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl (294.3 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.5+ i686

pyasn1_fasder-0.1.3-cp39-abi3-macosx_11_0_arm64.whl (241.4 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

pyasn1_fasder-0.1.3-cp39-abi3-macosx_10_12_x86_64.whl (249.5 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

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

Hashes for pyasn1_fasder-0.1.3.tar.gz
Algorithm Hash digest
SHA256 73fe744d7e856d98b59a4eb86d7c0533be6d78defc1b02fddf7531716add133d
MD5 1c28eca9fcdc31f80380b26bf7d39641
BLAKE2b-256 ebbc61a461783362a5c8a3f2095e02d3dcc2baa2dfab0f7ff71618a8ebbbbc1d

See more details on using hashes here.

File details

Details for the file pyasn1_fasder-0.1.3-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for pyasn1_fasder-0.1.3-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 752a5fbb41cb3cb126142e873babf10cd0c1b1cf8b2399517130dbe3a987339d
MD5 cefc51ce9390d88ef8c040b0496a0987
BLAKE2b-256 fd47cbb6e517cb49586c78b926752d79ab4bd92b3f00c063fc6cc300f2f15410

See more details on using hashes here.

File details

Details for the file pyasn1_fasder-0.1.3-cp39-abi3-win32.whl.

File metadata

File hashes

Hashes for pyasn1_fasder-0.1.3-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 6d55904e40bc213e7698efd36af428211e8e3a493231a5f66f3a29d42a85d4ba
MD5 4d448efdf49362a11f861fd2c87c2047
BLAKE2b-256 b80a58cc48ebff96d05665468b2250041d0f5bc300fb76157e77f08ede9d70a7

See more details on using hashes here.

File details

Details for the file pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2002e97834c836b9a1cb3098bcb319b57ab50fb2df92671dc7c45ddaee77034a
MD5 9d9f0e24047680f96549957bdb88576d
BLAKE2b-256 4744f27b073c961436c1d1a7f552065aaafa25a0bbd4e8efa875f5aad0db93fe

See more details on using hashes here.

File details

Details for the file pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 4506a06c1818e5ae94c48ecf406cac5d4517cf3808e44d5b8be75423d65fb21b
MD5 e89c03188f5344d2c8eb0224c405d1ff
BLAKE2b-256 9f2406a0a423539da205252f0a708102ee8efc8b559f83bddb2d163295896b01

See more details on using hashes here.

File details

Details for the file pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 a6a695c05bafa21b348123e326a2b05276e684fd6c5db8f6ccc72f402baa2216
MD5 12a53c334080778c78930e979319e103
BLAKE2b-256 8285d24788f4663f514a202d1a031f6053bf0124f486e5b4cdff7f73a58a6d03

See more details on using hashes here.

File details

Details for the file pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 5d019e4a3cd5ff33ed4e3b6fd7b7908869ce42fe4e20efd96915cbd577b9c255
MD5 89ecad64a1360e7c035a03a57f8e24a9
BLAKE2b-256 0d4cf321694fd954b852f56d3880f9da2e4929d2b39cf1743a28b4b5b37efe36

See more details on using hashes here.

File details

Details for the file pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 373f71d732b0ce9b4abd045e9a23ee694bd68457913500d24317465ee5d9b759
MD5 151fe6ed731cb45ec9ac64ec0cde8937
BLAKE2b-256 4bad180edc27854aee136538dabf535060f2b6cce8352083b1a47d4484df4728

See more details on using hashes here.

File details

Details for the file pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for pyasn1_fasder-0.1.3-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 60aead2322e199dcf234d31dcb4ba28e3a396a721c89ca2fe03aff9b2a5ba529
MD5 fdf335492b3aa4dbd0a975605403e661
BLAKE2b-256 6f118193a7c453143e25635286f9fd9393bb96a86d8f7d3d2a9a9c286fb01049

See more details on using hashes here.

File details

Details for the file pyasn1_fasder-0.1.3-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyasn1_fasder-0.1.3-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8f822f34da8558cf83bdd9bce2c063fe9b93c5444062477bf5619252b8302c21
MD5 e98f9e9f5a4fc73ae5f8fa54c8d870a3
BLAKE2b-256 84704a694ff2475f1b035fc5124c60a00f70cd3daae5c0eff87d85bfd0a489e3

See more details on using hashes here.

File details

Details for the file pyasn1_fasder-0.1.3-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pyasn1_fasder-0.1.3-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b7a4ac54b739a8c9003fed32990938c84ddc2586daeded1aad08825e759a623f
MD5 7890df1da3e13ee14c6ababddc04bf50
BLAKE2b-256 2e835e0fb9000c95e5f8dec4d8d3341f355a1a0663f1a37901673dc030944c8e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page