Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pyasn1-fasder

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pyasn1-fasder

A DER decoder for pyasn1 built to detect encoding errors

  • 0.1.3
  • PyPI
  • Socket score

Maintainers
1

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.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc