Skip to content

Commit

Permalink
Code format
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey Bonnell committed Jan 3, 2024
1 parent ce4d368 commit ccbe823
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![GitHub license](https://img.shields.io/pypi/l/pyasn1-fasder)](https://raw.githubusercontent.com/cbonnell/pyasn1-fasder/main/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.
encoding errors, and this behavior is unlikely to change.

## Installation

Expand All @@ -17,6 +17,18 @@ encoding errors, and this behavior is unlikely to change.

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`.

```python
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.
Expand Down

0 comments on commit ccbe823

Please sign in to comment.