Preferable way is to :ref:`download <download>` tarball with the
signature from `official website <http://pyderasn.cypherpunks.ru/>`__::
- $ [fetch|wget] http://pyderasn.cypherpunks.ru/pyderasn-6.3.tar.xz
- $ [fetch|wget] http://pyderasn.cypherpunks.ru/pyderasn-6.3.tar.xz.sig
- $ gpg --verify pyderasn-6.3.tar.xz.sig pyderasn-6.3.tar.xz
- $ xz --decompress --stdout pyderasn-6.3.tar.xz | tar xf -
- $ cd pyderasn-6.3
+ $ [fetch|wget] http://pyderasn.cypherpunks.ru/pyderasn-7.0.tar.xz
+ $ [fetch|wget] http://pyderasn.cypherpunks.ru/pyderasn-7.0.tar.xz.sig
+ $ gpg --verify pyderasn-7.0.tar.xz.sig pyderasn-7.0.tar.xz
+ $ xz --decompress --stdout pyderasn-7.0.tar.xz | tar xf -
+ $ cd pyderasn-7.0
$ python setup.py install
# or copy pyderasn.py (+six.py, possibly termcolor.py) to your PYTHONPATH
You could use pip (**no** OpenPGP authentication is performed!) with PyPI::
$ cat > requirements.txt <<EOF
- pyderasn==6.3 --hash=sha256:TO-BE-FILLED
+ pyderasn==7.0 --hash=sha256:TO-BE-FILLED
six==1.14.0 --hash=sha256:236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a
EOF
$ pip install --requirement requirements.txt
News
====
+.. _release7.0:
+
+7.0
+---
+* Fixed invalid behaviour where SET OF allowed multiple objects with the
+ same tag to be successfully decoded
+
.. _release6.3:
6.3
def colored(what, *args, **kwargs):
return what
-__version__ = "6.3"
+__version__ = "7.0"
__all__ = (
"Any",
v = b"".join(raws)
return b"".join((self.tag, len_encode(len(v)), v))
- def _specs_items(self):
- return iteritems(self.specs)
-
def _decode(self, tlv, offset, decode_path, ctx, tag_only):
try:
t, tlen, lv = tag_strip(tlv)
ctx_allow_default_values = ctx.get("allow_default_values", False)
ctx_allow_unordered_set = ctx.get("allow_unordered_set", False)
value_prev = memoryview(v[:0])
+ _specs_items = copy(self.specs)
while len(v) > 0:
if lenindef and v[:EOC_LEN].tobytes() == EOC:
break
- for name, spec in self._specs_items():
+ for name, spec in iteritems(_specs_items):
sub_decode_path = decode_path + (name,)
try:
spec.decode(
offset=sub_offset,
)
values[name] = value
+ del _specs_items[name]
value_prev = v[:value_len]
sub_offset += value_len
vlen += value_len
v = v_tail
+
obj = self.__class__(
schema=self.specs,
impl=self.tag,
tags,
)
+ def test_same_value_twice(self):
+ class Seq(Set):
+ schema = (
+ ("bool", Boolean()),
+ ("int", Integer()),
+ )
+
+ encoded = b"".join((
+ Integer(123).encode(),
+ Integer(234).encode(),
+ Boolean(True).encode(),
+ ))
+ encoded = Seq.tag_default + len_encode(len(encoded)) + encoded
+ with self.assertRaises(TagMismatch):
+ Seq().decod(encoded, ctx={"allow_unordered_set": True})
+
@composite
def seqof_values_strategy(draw, schema=None, do_expl=False):