summaryrefslogtreecommitdiff
path: root/pyasn1/codec/ber/decoder.py
Commit message (Collapse)AuthorAgeFilesLines
* Advance copyright statement to year 2020Ilya Etingof2020-03-081-1/+1
|
* Pass `tagMap` and `typeMap` to decoder instanceIlya Etingof2019-11-161-12/+13
| | | | | This change should simplify decoder specialization by means of parameterization in addition to subclassing.
* Refactor codec classes linkageIlya Etingof2019-11-161-5/+9
| | | | Make it looking more uniform and easier to override if needed.
* Fix Integer decoder to handle empty payloadIlya Etingof2019-11-151-3/+4
|
* Reuse `SingleItemDecoder` object in `StreamingDecoder`Ilya Etingof2019-11-151-5/+2
| | | | Try to reuse `SingleItemDecoder` object to leverage its caches.
* Add minor performance optimising changesIlya Etingof2019-11-151-2/+4
|
* Optimize `streaming` objects access for performanceIlya Etingof2019-11-151-35/+35
|
* Refactor BER decoder into a suspendable coroutineIlya Etingof2019-11-151-524/+721
| | | | | | | | | | | | | | | | | | | | The goal of this change is to make the decoder stopping on input data starvation and resuming from where it stopped whenever the caller decides to try again (hopefully making sure that some more input becomes available). This change makes it possible for the decoder to operate on streams of data (meaning that the entire DER blob might not be immediately available on input). On top of that, the decoder yields partially reconstructed ASN.1 object on input starvation making it possible for the caller to inspect what has been decoded so far and possibly consume partial ASN.1 data. All these new feature are natively available through `StreamingDecoder` class. Previously published API is implemented as a thin wrapper on top of that ensuring backward compatibility.
* CachingStreamWrapperTestCaseJan Pipek2019-11-151-1/+1
|
* Simplify _CachingStreamWrapperJan Pipek2019-11-151-8/+17
|
* Hide other auxiliary functions.Jan Pipek2019-11-151-4/+4
|
* Address several pull requests comments + hide asSeekableStreamJan Pipek2019-11-151-38/+36
|
* Implement _CachedStreamWrapperJan Pipek2019-11-151-7/+64
|
* Docstrings in requested format.Jan Pipek2019-11-151-8/+38
|
* Trivial changes from the MR.Jan Pipek2019-11-151-3/+3
|
* UnsupportedSubstrateErrorJan Pipek2019-11-151-5/+8
|
* Fail with unseekable streams.Jan Pipek2019-11-151-5/+5
|
* API that work with pyasn1-modulesJan Pipek2019-11-151-3/+3
|
* Prepare for streamsJan Pipek2019-11-151-174/+259
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rewrite Decoder in terms of BytesIO BER Decoders implemented with BytesIO but for the most complex BER UniversalConstructedTypeDecoder in terms of BytesIO BER Decoder (stream-based) suggestion Fixed some of the failing tests Fixed several failed tests Fix all remaining tests but the non-implemented Any Implement untagged Any with back-seek Fix cer and der to work with streams Simplify unnecessary added complexity Make use of IOBase hierarchy (properly?) - in progress Tests failing Fixed most failing tests 1 remaining Severaů small optimizations Fix logging Note: As we do not want to read the whole stream, explicit output of remaining bytes is not used. Rename and document utility functions for BER decoder Fixed ínverted condition in BitStringDecoder.valueDecoder Fixed wrongly acquired fullPosition in AnyDecoder.indefLenValueDecoder Fixed logging None length endOfStream(BytesIO) working in 2.7 Microoptimizations for endOfStream (not using it) Test for checking binary files as substrate Python 2.7 BytesIO wrapper for `file`s Refactor keep API compatibility with original version
* Improve open maps debugging in decoderIlya Etingof2019-09-071-2/+30
|
* Add `isInconsistent` property hook to all constructed types (#170)Ilya Etingof2019-08-251-2/+6
| | | | | | | Added `isInconsistent` property to all constructed types. This property conceptually replaces `verifySizeSpec` method to serve a more general purpose e.g. ensuring all required fields are in a good shape. By default this check invokes subtype constraints verification and is run by codecs on value de/serialisation.
* Add exception classes documentationIlya Etingof2019-07-131-1/+1
| | | | Also fix references to exception objects in other docstrings.
* Fix to pass decoder `options` to open type decoderIlya Etingof2019-07-121-5/+6
| | | | | Prior to this fix, recursively encoded open types won't get fully decoded all the way.
* Add `SET|SEQUENCE OF ANY` encoding support (#165)Ilya Etingof2019-07-061-12/+44
| | | | | | | | | | | | | | | | | | | | | | | | | For example: AttributeTypeAndValues ::= SEQUENCE { type OBJECT IDENTIFIER, values SET OF ANY DEFINED BY type } This patch adds support of the above ASN.1 syntax to BER/DER/CER codecs. It appears that to implement this feature properly, `SetOf`/`SequenceOf` pyasn1 types need to have `.componentType` wrapped into something similar to `NamedType` that `Set`/`Sequence` have. That additional layer would then carry the open type meta information. Without it, `Sequence`/`Set` codec needs to signal `SetOf`/`SequenceOf` codec of the open type being processed, which is a slight hack. A other inconvenience is that when `SetOf`/`SequenceOf` deal with an open type component, they should not verify types on component assignment. Without open type property in `SetOf`/`SequenceOf`, the code checks for `Any` component type which is another hack. The above shortcomings should be addressed in the follow up patch.
* Fix `AnyDecoder` to accept `TagMap` as `asn1Spec` (#152)Ilya Etingof2019-06-281-4/+24
| | | | | | Fixes `AnyDecoder` to accept `TagMap` as `asn1Spec`. The use-case is to make `AnyDecoder` operational when dumping raw value on error condition is enabled
* SequenceOf/SetOf to remain a schema objects (#162)Ilya Etingof2019-06-231-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | * Add `omitEmptyOptionals` encoder option Added `omitEmptyOptionals` option which is respected by `Sequence` and `Set` encoders. When `omitEmptyOptionals` is set to `True`, empty initialized optional components are not encoded. Default is `False`. * Change `SequenceOf`/`SetOf` behaviour - New elements to `SequenceOf`/`SetOf` objects can now be added at any position - the requirement for the new elements to reside at the end of the existing ones (i.e. s[len(s)] = 123) is removed. - Removed default initializer from `SequenceOf`/`SetOf` types to ensure consistent behaviour with the rest of ASN.1 types. Before this change, `SequenceOf`/`SetOf` instances immediately become value objects behaving like an empty list. With this change, `SequenceOf`/`SetOf` objects remain schema objects unless a component is added or `.clear()` is called. - Added `.reset()` method to all constructed types to turn value object into a schema object.
* Release 0.4.5v0.4.5Ilya Etingof2018-12-291-1/+1
| | | | Also extend copyright to the year 2019
* Add more debug logging to *ER codecs (#139)Ilya Etingof2018-08-041-12/+225
| | | | | | | | | | More debug logging added to BER family of codecs to ease encoding problems troubleshooting. Also: * code layout made a bit more sparse * potential bug in open type decoding in indefinite mode fixed
* Refactor debug logging (#138)Ilya Etingof2018-08-031-39/+36
| | | | | | | | Debug logging refactored for more efficiency when disabled and for more functionality when in use. Specifically, the global LOG object can easily be used from any function/method, not just from codec main loop as it used to be.
* Fix some typos and prepare for 0.4.5Ilya Etingof2018-07-291-0/+4
|
* copyright years extendedIlya Etingof2018-03-291-1/+1
|
* Prefer https:// URLs where available (#121)Jon Dufresne2018-03-211-1/+1
|
* imports pep8'edIlya Etingof2017-11-231-4/+9
|
* relax open type field type check on assignment (#105)Ilya Etingof2017-11-231-10/+2
|
* Start `.prettyPrint` deprecation (#103)Ilya Etingof2017-11-191-2/+2
| | | | | | | * __str__() of ASN.1 types reworked to serve instead of .prettyPrint() Related changes: `str()` on enumerations and boolean will return a string label rather than a number.
* fixed Sequence/SequenceOf decoding heuristicsIlya Etingof2017-11-141-4/+3
|
* fixed openType decoding in indef modeIlya Etingof2017-11-141-1/+1
|
* migrated docs and references from sourceforge.netIlya Etingof2017-11-141-1/+1
|
* added example code snippets to the docstrings (#101)Ilya Etingof2017-11-141-0/+22
|
* Add more content to docs (#96)Ilya Etingof2017-10-211-2/+4
| | | | | | * minor fixes to RsT docstrings * more explanations in the docs, better linkage * cosmetic fixes to NamedValues() docstring
* Ditched unnecessary .clone/.subtype overrides (#94)Ilya Etingof2017-10-191-1/+1
| | | | * rearranged `.clone()` and `.subtype()` docstrings * legacy Asn1ItemBase.prettyPrinter() method removed
* fix to Null decoder to initialize decoded value to ''Ilya Etingof2017-10-191-1/+1
|
* Remove None initializer support (#91)Ilya Etingof2017-10-161-1/+1
| | | | | * `None` legacy initializer support removed * Default value for `Null` removed
* do not attempt to decode optional open typesIlya Etingof2017-10-101-0/+6
|
* Refactored ASN.1 codecs (#83)Ilya Etingof2017-10-041-58/+117
| | | | | | ASN.1 encoders can operate on pure-Python types Also, BitString decoder performance improvement
* Merge branch 'master' into open-types-supportopen-types-supportIlya Etingof2017-09-171-3/+4
|\
| * run unit tests with full debugging enabled (and ignored)Ilya Etingof2017-09-151-1/+1
| | | | | | | | Also fixed a couple of crashes in debug messages
| * minor PEP8 editsIlya Etingof2017-09-141-2/+3
| |
* | refactored OpenType() into a mutable objectIlya Etingof2017-09-131-40/+61
| |
* | fixes to debug message interpolationIlya Etingof2017-09-101-1/+3
| |