Changelogs » Pyasn1

PyUp Safety actively tracks 382,903 Python packages for vulnerabilities and notifies you when to upgrade.



  - License updated to vanilla BSD 2-Clause to ease package use
  - Test suite made discoverable by unittest/unittest2 discovery feature.
  - Fix to decoder working on indefinite length substrate -- end-of-octets
  marker is now detected by both tag and value. Otherwise zero values may
  interfere with end-of-octets marker.
  - Fix to decoder to fail in cases where tagFormat indicates inappropriate
  format for the type (e.g. BOOLEAN is always PRIMITIVE, SET is always
  CONSTRUCTED and OCTET STRING is either of the two)
  - Fix to REAL type encoder to force primitive encoding form encoding.
  - Fix to CHOICE decoder to handle explicitly tagged, indefinite length
  mode encoding
  - Fix to REAL type decoder to handle negative REAL values correctly. Test
  case added.


  - The compact (valueless) way of encoding zero INTEGERs introduced in
  0.1.5 seems to fail miserably as the world is filled with broken
  BER decoders. So we had to back off the *encoder* for a while.
  There's still the IntegerEncoder.supportCompactZero flag which
  enables compact encoding form whenever it evaluates to True.
  - Report package version on debugging code initialization.


  - Documentation updated and split into chapters to better match
  web-site contents.
  - Make prettyPrint() working for non-initialized pyasn1 data objects. It
  used to throw an exception.
  - Fix to encoder to produce empty-payload INTEGER values for zeros
  - Fix to decoder to support empty-payload INTEGER and REAL values
  - Fix to unit test suites imports to be able to run each from
  their current directory


  - Built-in codec debugging facility added
  - Added some more checks to ObjectIdentifier BER encoder catching
  posible 2^8 overflow condition by two leading sub-OIDs
  - Implementations overriding the AbstractDecoder.valueDecoder method
  changed to return the rest of substrate behind the item being processed
  rather than the unprocessed substrate within the item (which is usually
  - Decoder's recursiveFlag feature generalized as a user callback function
  which is passed an uninitialized object recovered from substrate and
  its uninterpreted payload.
  - Catch inappropriate substrate type passed to decoder.
  - Expose tagMap/typeMap/Decoder objects at DER decoder to uniform API.
  - Obsolete __init__.MajorVersionId replaced with __init__.__version__
  which is now in-sync with distutils.
  - Package classifiers updated.
  - The's made non-empty (rumors are that they may be optimized
  out by package managers).
  - Bail out gracefully whenever Python version is older than 2.4.
  - Fix to Real codec exponent encoding (should be in 2's complement form),
  some more test cases added.
  - Fix in Boolean truth testing built-in methods
  - Fix to substrate underrun error handling at ObjectIdentifier BER decoder
  - Fix to BER Boolean decoder that allows other pre-computed
  values besides 0 and 1
  - Fix to leading 0x80 octet handling in DER/CER/DER ObjectIdentifier decoder.


  - Include class name into asn1 value constraint violation exception.
  - Fix to OctetString.prettyOut() method that looses leading zero when
  building hex string.


  - Fix to __long__() to actually return longs on py2k
  - Fix to OctetString.__str__() workings of a non-initialized object.
  - Fix to quote initializer of OctetString.__repr__()
  - Minor fix towards ObjectIdentifier.prettyIn() reliability
  - ObjectIdentifier.__str__() is aliased to prettyPrint()
  - Exlicit repr() calls replaced with '%r'


  - Hex/bin string initializer to OctetString object reworked
  (in a backward-incompatible manner)
  - Fixed float() infinity compatibility issue (affects 2.5 and earlier)
  - Fixed a bug/typo at Boolean CER encoder.
  - Major overhawl for Python 2.4 -- 3.2 compatibility:
  + get rid of old-style types
  + drop string module usage
  + switch to rich comparation
  + drop explicit long integer type use
  + map()/filter() replaced with list comprehension
  + apply() replaced with \*/\*\*args
  + switched to use 'key' sort() callback function
  + support both __nonzero__() and __bool__() methods
  + modified not to use py3k-incompatible exception syntax
  + getslice() operator fully replaced with getitem()
  + dictionary operations made 2K/3K compatible
  + base type for encoding substrate and OctetString-based types
  is now 'bytes' when running py3k and 'str' otherwise
  + OctetString and derivatives now unicode compliant.
  + OctetString now supports two python-neutral getters: asOcts() & asInts()
  + print OctetString content in hex whenever it is not printable otherwise
  + in test suite, implicit relative import replaced with the absolute one
  + in test suite, string constants replaced with numerics


  - Fix to base10 normalization function that loops on univ.Real(0)


  - ASN.1 Real type is now supported properly.
  - Objects of Constructed types now support __setitem__()
  - Set/Sequence objects can now be addressed by their field names (string index)
  and position (integer index).
  - Typo fix to ber.SetDecoder code that prevented with schema decoding
  - Fix to explicitly tagged items decoding support.
  - Fix to OctetString.prettyPrint() to better handle non-printable content.
  - Fix to repr() workings of Choice objects.


  - Major codec re-design.
  - Documentation significantly improved.
  - ASN.1 Any type is now supported.
  - All example ASN.1 modules moved to separate pyasn1-modules package.
  - Fix to initial sub-OID overflow condition detection an encoder.
  - BitString initialization value verification improved.
  - The Set/Sequence.getNameByPosition() method implemented.
  - Fix to proper behaviour of PermittedAlphabetConstraint object.
  - Fix to improper Boolean substrate handling at CER/DER decoders.
  - Changes towards performance improvement:
  + all dict.has_key() & dict.get() invocations replaced with modern syntax
  (this breaks compatibility with Python 2.1 and older).
  + tag and tagset caches introduced to decoder
  + decoder code improved to prevent unnecessary pyasn1 objects creation
  + allow disabling components verification when setting components to
  structured types, this is used by decoder whilst running with schema
  + BER decoder for integer values now looks up a small set of pre-computed
  substrate values to save on decoding.
  + a few pre-computed values configured to ObjectIdentifier BER encoder.
  + ChoiceDecoder split-off SequenceOf one to save on unnecessary checks.
  + replace slow hasattr()/getattr() calls with isinstance() introspection.
  + track the number of initialized components of Constructed types to save
  on default/optional components initialization.
  + added a shortcut ObjectIdentifier.asTuple() to be used instead of
  __getitem__() in hotspots.
  + use Tag.asTuple() and pure integers at tag encoder.
  + introduce and use in decoder the baseTagSet attribute of the built-in
  ASN.1 types.


  - The individual tag/length/value processing methods of
  encoder.AbstractItemEncoder renamed (leading underscore stripped)
  to promote overloading in cases where partial substrate processing
  is required.
  - The, example scripts added.
  - Fix to univ.ObjectIdentifier input value handler to disallow negative


  - Decoder can now treat values of unknown types as opaque OctetString.
  - Fix to Set/SetOf type decoder to handle uninitialized scalar SetOf
  components correctly.


  - API versioning mechanics retired (pyasn1.v1 -> pyasn1) what makes
  it possible to zip-import pyasn1 sources (used by egg and py2exe).


  - Allow any non-zero values in Boolean type BER decoder, as it's in
  accordnance with the standard.


  - Integer.__index__() now supported (for Python 2.5+).
  - Fix to empty value encoding in BitString encoder, test case added.
  - Fix to SequenceOf decoder that prevents it skipping possible Choice
  typed inner component.
  - Choice.getName() method added for getting currently set component
  - OctetsString.prettyPrint() does a single str() against its value
  eliminating an extra quotes.


  - Large tags (>31) now supported by codecs.
  - Fix to encoder to properly handle explicitly tagged untagged items.
  - All possible value lengths (up to 256^126) now supported by encoders.
  - Fix to Tag class constructor to prevent negative IDs.


  - Make use of setuptools.
  - Constraints derivation verification (isSuperTypeOf()/isSubTypeOf()) fixed.
  - Fix to constraints comparation logic -- can't cmp() hash values as it
  may cause false positives due to hash conflicts.


  - Integer BER codec reworked fixing negative values encoding bug.
  - clone() and subtype() methods of Constructed ASN.1 classes now
  accept optional cloneValueFlag flag which controls original value
  inheritance. The default is *not* to inherit original value for
  performance reasons (this may affect backward compatibility).
  Performance penalty may be huge on deeply nested Constructed objects
  - Base ASN.1 types (pyasn1.type.univ.*) do not have default values
  anymore. They remain uninitialized acting as ASN.1 types. In
  this model, initialized ASN.1 types represent either types with
  default value installed or a type instance.
  - Decoders' prototypes are now class instances rather than classes.
  This is to simplify initial value installation to decoder's
  prototype value.
  - Bugfix to BitString BER decoder (trailing bits not regarded).
  - Bugfix to Constraints use as mapping keys.
  - Bugfix to Integer & BitString clone() methods
  - Bugix to the way to distinguish Set from SetOf at CER/DER SetOfEncoder
  - Adjustments to make it running on Python 1.5.
  - In tests, substrate constants converted from hex escaped literals into
  octals to overcome indefinite hex width issue occuring in young Python.
  - Minor performance optimization of TagSet.isSuperTagSetOf() method
  - examples/ added


  * Asn1Type.prettyPrinter() -> \*.prettyPrint()


  * Simple ASN1 objects now hash to their Python value and don't
  depend upon tag/constraints/etc.
  * prettyIn & prettyOut methods of SimplleAsn1Object become public
  * many syntax fixes


  * ConstraintsIntersection.isSuperTypeOf() and
  ConstraintsIntersection.hasConstraint() implemented
  * Bugfix to NamedValues initialization code
  * +/- operators added to NamedValues objects
  * Integer.__abs__() & Integer.subtype() added
  * ObjectIdentifier.prettyOut() fixes
  * Allow subclass components at SequenceAndSetBase
  * AbstractConstraint.__cmp__() dropped
  * error.Asn1Error replaced with error.PyAsn1Error


  * Initial public alpha release