1
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
2
# See LICENSE for details.
5
A basic ASN.1 parser. Deprecated since Twisted 9.0 in favor of PyASN1.
7
Maintainer: Paul Swartz
11
from pyasn1.type import univ
12
from pyasn1.codec.ber import decoder, encoder
13
from twisted.python.deprecate import deprecated
14
from twisted.python import versions
16
Twisted9point0 = versions.Version('Twisted', 9, 0, 0)
19
return decoder.decode(data)[0]
21
parse = deprecated(Twisted9point0)(parse)
25
asn1Sequence = univ.Sequence()
26
for index, value in itertools.izip(itertools.count(), data):
28
valueAsInteger = univ.Integer(value)
30
raise ValueError("cannot pack %r" % (value,))
31
asn1Sequence.setComponentByPosition(index, univ.Integer(value))
32
return encoder.encode(asn1Sequence)
34
pack = deprecated(Twisted9point0)(pack)