aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2019-08-27Add `SET ... WITH COMPONENTS ...` ASN.1 construct support (#171)Ilya Etingof
Added `WithComponentsConstraint` along with related `ComponentPresentConstraint` and `ComponentAbsentConstraint` classes to be used with `Sequence`/`Set` types representing `SET ... WITH COMPONENTS ...` like ASN.1 constructs.
2019-08-27Fix for Python 4 (#173)Hugo van Kemenade
2019-08-25Deprecate `sizeSpec` in favor of `subtypeSpec` (#172)Ilya Etingof
This commit deprecates `subtypeSpec` attributes and keyword argument. It is now recommended to pass `ValueSizeConstraint`, as well as all other constraints, to `subtypeSpec`. By way of the change mentioned above, this commit fixes a design bug in a way of how the items assigned to constructed types are verified. Now if `Asn1Type`-based object is assigned, its compatibility is verified based on having all tags and constraint objects as the type in field definition. When a bare Python value is assigned, then field type object is cloned and initialized with the bare value (constraints verificaton would run at this moment).
2019-08-25Add `isInconsistent` property hook to all constructed types (#170)Ilya Etingof
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.
2019-07-31Fix failing unit tests on Py25Ilya Etingof
2019-07-12Fix CER/DER encoders to respect open types (#167)Ilya Etingof
* Fix CER/DER encoders to respect open types Added a bunch of unit tests to CER/DER codecs covering open types.
2019-07-12Add `SequenceOf`/`SetOf` list-like slicing support (#168)Ilya Etingof
2019-07-06Add `SET|SEQUENCE OF ANY` encoding support (#165)Ilya Etingof
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.
2019-06-30Improve CER/DER encoding of GeneralizedTime (#164)Ilya Etingof
- Added support for subseconds CER/DER encoding edge cases in `GeneralizedTime` codec - Fixed 3-digit fractional seconds value CER/DER encoding of `GeneralizedTime`
2019-06-29Rename pyasn1 unicode exceptionsIlya Etingof
The new exception classes names are `PyAsn1UnicodeDecodeError` and `PyAsn1UnicodeEncodeError`. Also, unit tests added.
2019-06-28Fix `AnyDecoder` to accept `TagMap` as `asn1Spec` (#152)Ilya Etingof
Fixes `AnyDecoder` to accept `TagMap` as `asn1Spec`. The use-case is to make `AnyDecoder` operational when dumping raw value on error condition is enabled
2019-06-23SequenceOf/SetOf to remain a schema objects (#162)Ilya Etingof
* 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.
2018-12-29Release 0.4.5Ilya Etingof
Also extend copyright to the year 2019
2018-12-29Fix defaulted constructed SEQUENCE component initialization (#146)Ilya Etingof
When SEQUENCE has defaulted component of constructed type, recursively instantiate defaulted component and assign instantiated asn1 object to SEQUENCE field.
2018-07-29Fix some typos and prepare for 0.4.5Ilya Etingof
2018-05-23fix GenerlizedTime.asDateTime() operationIlya Etingof
2018-03-29copyright years extendedIlya Etingof
2018-03-21Prefer https:// URLs where available (#121)Jon Dufresne
2017-12-26sys.getsizeof() may raise TypeError (#117)Vincent Bernat
Not all implementations have to implement getsizeof() and may raise TypeError instead. Notably, Pypy will always raise TypeError (unless a default value is provided).
2017-11-23imports pep8'edIlya Etingof
2017-11-23relax open type field type check on assignment (#105)Ilya Etingof
2017-11-19Start `.prettyPrint` deprecation (#103)Ilya Etingof
* __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.
2017-11-18__repr__() of ASN.1 types reworked for better readability (#102)Ilya Etingof
At the same time __repr__() stopped being eval()-compliant
2017-11-16Add default to .getComponentBy*() (#100)Ilya Etingof
* `default` kwarg added to .getComponentBy*() methods
2017-11-14migrated docs and references from sourceforge.netIlya Etingof
2017-11-14serialization -> serialisation nitpicksIlya Etingof
2017-10-29Pickle protocol fixes (#99)Ilya Etingof
* do not blow up on pickle protocol attributes look up * added Pickle tests * More fixes to pickle protocol support * __slots__ lookup allowed at NoValue * SizedInteger moved from BitString scope to the univ module scope
2017-10-19Constructed types schema inspection (#87)Ilya Etingof
* the `instantiate=True` parameter added to constructed types .getComponentBy*() * Choice.clear() fixed to fully reset its internal state
2017-10-17fixed DER/CER encoders to respect ordering of tagged CHOICE (#93)Ilya Etingof
2017-10-17fixed encoder not to omit empty substrate for simple types (#92)Ilya Etingof
Fix to encoder to omit empty substrate only for constructed types
2017-10-16Remove None initializer support (#91)Ilya Etingof
* `None` legacy initializer support removed * Default value for `Null` removed
2017-10-04Refactored ASN.1 codecs (#83)Ilya Etingof
ASN.1 encoders can operate on pure-Python types Also, BitString decoder performance improvement
2017-09-26fixed ASN.1 time types deepcopy/pickle operationsIlya Etingof
2017-09-20fixed crash on exp tagged Sequence component encoding (#79)Ilya Etingof
Also EOO encoder call replaced with a constant outcome
2017-09-19Set/Sequence & SetOf/SequenceOf subscription to raise Key/IndexError (#73)Ilya Etingof
2017-09-17encoders refactored to take Python types + ASN.1 schemaIlya Etingof
2017-09-17Merge branch 'master' into open-types-supportIlya Etingof
2017-09-17wrong inheritance in test fixedIlya Etingof
2017-09-15run unit tests with full debugging enabled (and ignored)Ilya Etingof
Also fixed a couple of crashes in debug messages
2017-09-14Merge branch 'master' into open-types-supportIlya Etingof
2017-09-13ASN.1 codecs to silently enforce proper length/chunk modesIlya Etingof
2017-09-13refactored OpenType() into a mutable objectIlya Etingof
2017-09-10refer to open types by open types, not hole typesIlya Etingof
2017-09-10WIP: hole types implementationIlya Etingof
2017-09-09WIP: avoid coping values when encoding explicit ASN.1 tagsIlya Etingof
2017-09-03fix to get explicit tags from substrate to the recovered ASN.1 objectIlya Etingof
2017-09-01schema-less SET/SEQUENCE dict duck-typingIlya Etingof
2017-08-31fixed stray duplicate tags detection at NamedTypes.tagMapIlya Etingof
2017-08-29fixed crash at SEQUENCE/OF encoder, schemaless modeIlya Etingof
2017-08-28one more char instantiation test caseIlya Etingof