https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /proc/self/root/usr/lib/python2.7/site-packages/asn1crypto/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/usr/lib/python2.7/site-packages/asn1crypto/core.pyc
�
y�\c@`s6dZddlmZmZmZmZddlmZmZddlZddl	Z	ddl
Z
ddlZddlZddl
mZddlmZddlmZdd	lmZmZmZmZmZdd
lmZmZddlmZmZmZm Z ej!dfkr;dd
l"m#Z$e%Z&e'Z(nddl)m$Z$e*Z(ej+�idd6dd6dd6dd6Z,idd6dd6dd6dd6dd6dd6dd6dd6Z-idd6dd6Z.ej/d�Z0iZ1e*d�Z2de3fd��YZ4dfd��YZ5de3fd��YZ6de3fd��YZ7d e4fd!��YZ8e8�Z9d"e4fd#��YZ:d$e4fd%��YZ;d&e3fd'��YZ<d(e4fd)��YZ=d*e7e=fd+��YZ>d,e=fd-��YZ?d.e=e5fd/��YZ@d0e7e6e=e5e3fd1��YZAd2e7e6e=fd3��YZBd4e7e6e=fd5��YZCd6e7e6e=fd7��YZDd8e7e6e=fd9��YZEd:e7e6e=fd;��YZFd<eFfd=��YZGd>e=fd?��YZHd@e=e5fdA��YZIdBe=fdC��YZJdDe=fdE��YZKdFe=fdG��YZLdHe@fdI��YZMdJe>fdK��YZNdLeIfdM��YZOdNe4fdO��YZPdPe4fdQ��YZQdRePfdS��YZRdTeQfdU��YZSdVePfdW��YZTdXe>fdY��YZUdZe>fd[��YZVd\e>fd]��YZWd^eDfd_��YZXd`e>fda��YZYdbe>fdc��YZZddeZfde��YZ[dfeZfdg��YZ\dhe>fdi��YZ]dje>fdk��YZ^dle>fdm��YZ_dne>fdo��YZ`dpe>fdq��YZadre>fds��YZbdt�Zcdu�Zddv�Zedw�Zfie?d6e@d6eAd6eDdx6eHdy6eIdz6eJd{6eKd|6eLd}6eMd~6eTd6eNd�6eOd�6ePd�6eRd�6eUd�6eVd�6eWd�6eXd�6eYd�6e[d�6e\d�6e]d�6e^d�6e_d�6e`d�6ead�6ebd�6Zgehehehd��Zidehehe*d��ZjdS(�u
ASN.1 type classes for universal types. Exports the following items:

 - load()
 - Any()
 - Asn1Value()
 - BitString()
 - BMPString()
 - Boolean()
 - CharacterString()
 - Choice()
 - EmbeddedPdv()
 - Enumerated()
 - GeneralizedTime()
 - GeneralString()
 - GraphicString()
 - IA5String()
 - InstanceOf()
 - Integer()
 - IntegerBitString()
 - IntegerOctetString()
 - Null()
 - NumericString()
 - ObjectDescriptor()
 - ObjectIdentifier()
 - OctetBitString()
 - OctetString()
 - PrintableString()
 - Real()
 - RelativeOid()
 - Sequence()
 - SequenceOf()
 - Set()
 - SetOf()
 - TeletexString()
 - UniversalString()
 - UTCTime()
 - UTF8String()
 - VideotexString()
 - VisibleString()
 - VOID
 - Void()

Other type classes are defined that help compose the types listed above.
i(tunicode_literalstdivisiontabsolute_importtprint_function(tdatetimet	timedeltaNi(t_teletex_codec(tunwrap(tOrderedDict(t	type_nametstr_clstbyte_clst	int_typestchr_cls(t_parset_dump_header(tint_to_bytestint_from_bytesttimezonetextended_datetimei(tStringIO(tBytesIOu	universaluapplicationucontextiuprivateu	primitiveuconstructedu
^\d+(\.\d+)*$cC`stj|d|�S(u5
    Loads a BER/DER-encoded byte string and construct a universal object based
    on the tag value:

     - 1: Boolean
     - 2: Integer
     - 3: BitString
     - 4: OctetString
     - 5: Null
     - 6: ObjectIdentifier
     - 7: ObjectDescriptor
     - 8: InstanceOf
     - 9: Real
     - 10: Enumerated
     - 11: EmbeddedPdv
     - 12: UTF8String
     - 13: RelativeOid
     - 16: Sequence,
     - 17: Set
     - 18: NumericString
     - 19: PrintableString
     - 20: TeletexString
     - 21: VideotexString
     - 22: IA5String
     - 23: UTCTime
     - 24: GeneralizedTime
     - 25: GraphicString
     - 26: VisibleString
     - 27: GeneralString
     - 28: UniversalString
     - 29: CharacterString
     - 30: BMPString

    :param encoded_data:
        A byte string of BER or DER-encoded data

    :param strict:
        A boolean indicating if trailing data should be forbidden - if so, a
        ValueError will be raised when trailing data exists

    :raises:
        ValueError - when strict is True and trailing data is present
        ValueError - when the encoded value tag a tag other than listed above
        ValueError - when the ASN.1 header length is longer than the data
        TypeError - when encoded_data is not a byte string

    :return:
        An instance of the one of the universal classes
    tstrict(t	Asn1Valuetload(tencoded_dataR((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRrs3Rc
B`s�eZdZdZdZdZdZeZ	dZ
dZdZdZ
dZeed��Zddeddddddd�	Zd�Zd�Zd�Zd�Zd�Zd	�Zd
�Zd�Zdd�Zd
�Zd�Zdd�Zed�ZRS(u'
    The basis of all ASN.1 values
    tcK`snt|t�s(tdt|���nd}|jdk	rF|}nt|d|d|d|�\}}|S(u�
        Loads a BER/DER-encoded byte string using the current class as the spec

        :param encoded_data:
            A byte string of BER or DER-encoded data

        :param strict:
            A boolean indicating if trailing data should be forbidden - if so, a
            ValueError will be raised when trailing data exists

        :return:
            An instance of the current class
        u*encoded_data must be a byte string, not %stspectspec_paramsRN(t
isinstanceRt	TypeErrorR	tNonettagt_parse_build(tclsRRtkwargsRtvaluet_((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�s	$c
C`s�y5|jtkr{|j}
|
jdk	rRt|
jdt�rR|
jf|
_nt|
d�rn|j�ntt|
<n|dk	r�t|t�r�|dkr�d}n||f}n|dkr�d}d}q�n|dk	r5t|t�r|dkrd}n||f}n|dkr5d}d}q5n|dk	r�|dkrVd}n|dkrq||f}q�|dkr�||f}q�t	t
dt|����n|dk	r�t|�dkr�t|dt�r�|f}nx|D]�\}}d}t|t�r'|t
krF|}qFn|tkr<|}nt|}|dk	rpt	t
d	t|����n|dk	r�t|t�s�tt
d
t|����q�n|jdkr�||ff|_q�|j||ff|_q�Wn�|dk	r�|\}}|tkr2t	t
dt|����n|dk	rnt|t�sntt
dt|����qnnt||_||_t|_n^|dk	r�|t
kr�t	t
d
t|����nt||_n|dk	r�||_n|rd|_n|	dk	r|	|_n|dk	r4|j|�nWnQt	tfk
r�}|jd}
|jddt|�f|
|_|�nXdS(u�
        The optional parameter is not used, but rather included so we don't
        have to delete it from the parameter dictionary when passing as keyword
        args

        :param explicit:
            An int tag number for explicit tagging, or a 2-element tuple of
            class and tag.

        :param implicit:
            An int tag number for implicit tagging, or a 2-element tuple of
            class and tag.

        :param no_explicit:
            If explicit tagging info should be removed from this instance.
            Used internally to allow contructing the underlying value that
            has been wrapped in an explicit tag.

        :param tag_type:
            None for normal values, or one of "implicit", "explicit" for tagged
            values. Deprecated in favor of explicit and implicit params.

        :param class_:
            The class for the value - defaults to "universal" if tag_type is
            None, otherwise defaults to "context". Valid values include:
             - "universal"
             - "application"
             - "context"
             - "private"
            Deprecated in favor of explicit and implicit params.

        :param tag:
            The integer tag to override - usually this is used with tag_type or
            class_. Deprecated in favor of explicit and implicit params.

        :param optional:
            Dummy parameter that allows "optional" key in spec param dicts

        :param default:
            The default value to use if the value is currently None

        :param contents:
            A byte string of the encoded contents of the value

        :raises:
            ValueError - when implicit, explicit, tag_type, class_ or tag are invalid values
        iu_setupucontextuexplicituimplicituh
                        tag_type must be one of "implicit", "explicit", not %s
                        iiu�
                            explicit class must be one of "universal", "application",
                            "context", "private", not %s
                            ui
                                explicit tag must be an integer, not %s
                                u�
                        implicit class must be one of "universal", "application",
                        "context", "private", not %s
                        ua
                            implicit tag must be an integer, not %s
                            u�
                            class_ must be one of "universal", "application",
                            "context", "private", not %s
                            u
    while constructing %sN(t	__class__t_SETUP_CLASSEStexplicitRRRthasattrt_setuptTruet
ValueErrorRtreprtlentCLASS_NUM_TO_NAME_MAPtCLASS_NAME_TO_NUM_MAPRR	tclass_R timplicittcontentstsettargs(tselfR(R2tno_explicitttag_typeR1R toptionaltdefaultR3R"t
invalid_classteR5((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyt__init__�s�2	%

			%	
 
	
%cC`str|j�S|j�SdS(u�
        Since str is different in Python 2 and 3, this calls the appropriate
        method, __unicode__() or __bytes__()

        :return:
            A unicode string
        N(t_PY2t	__bytes__t__unicode__(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyt__str__�s	
cC`s\tr/dt|�t|�t|j��fSdt|�t|�t|j��fSdS(u7
        :return:
            A unicode string
        u<%s %s b%s>u
<%s %s %s>N(R>R	tidR-tdump(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyt__repr__�s)cC`s|j�jd�S(u�
        A fall-back method for print() in Python 2

        :return:
            A byte string of the output of repr()
        uutf-8(RDtencode(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR?�scC`s
|j�S(u�
        A fall-back method for print() in Python 3

        :return:
            A unicode string of the output of repr()
        (RD(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR@�scC`s@|j�}|j|_|j|_|j|_|j|_|S(u�
        Constructs a new copy of the current object, preserving any tagging

        :return:
            An Asn1Value object
        (R&R1R R2R((R6tnew_obj((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyt
_new_instance�scC`s#|j�}|j|tj�|S(u�
        Implements the copy.copy() interface

        :return:
            A new shallow copy of the current Asn1Value object
        (RGt_copytcopy(R6RF((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyt__copy__�scC`s3|j�}||t|�<|j|tj�|S(u�
        Implements the copy.deepcopy() interface

        :param memo:
            A dict for memoization

        :return:
            A new deep copy of the current Asn1Value object
        (RGRBRHRItdeepcopy(R6tmemoRF((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyt__deepcopy__�scC`s
tj|�S(u}
        Copies the object, preserving any special tagging from it

        :return:
            An Asn1Value object
        (RIRK(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRI�scC`s`t|t�si||6}n|jd|jd�d|jd��}|j|tj�|S(u}
        Copies the object, applying a new tagging to it

        :param tagging:
            A dict containing the keys "explicit" and "implicit". Legacy
            API allows a unicode string of "implicit" or "explicit".

        :param tag:
            A integer tag number. Only used when tagging is a unicode string.

        :return:
            An Asn1Value object
        R(uexplicitR2uimplicit(RtdictR&tgetRHRIRK(R6ttaggingR RF((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pytretags
*cC`s#|j�}|j|tj�|S(u{
        Copies the object, removing any special tagging from it

        :return:
            An Asn1Value object
        (R&RHRIRK(R6RF((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pytuntagscC`s[|j|jkr9ttdt|�t|����n|j|_||j�|_dS(u!
        Copies the contents of another Asn1Value object to itself

        :param object:
            Another instance of the same class

        :param copy_func:
            An reference of copy.copy() or copy.deepcopy() to use when copying
            lists, dicts and objects
        uQ
                Can not copy values from %s object to %s object
                N(R&RRR	R3t_native(R6tothert	copy_func((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRH"s	icC`s�d|}t|d�}t||�|rC|jj|d�nut|d�ri|jj|d�nOtr�t|jt�r�t	d|t
|j�f�nt	d||jf�dS(uJ
        Show the binary data and parsed data in a tree structure
        u  uparsediuchosenu%s    Native: b%su%s    Native: %sN(R)t_basic_debugtparsedtdebugtchosenR>RtnativeRtprintR-(R6t
nest_leveltprefixt
has_parsed((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRX:s

 c	C`s�|j}|jdks|r�t|t�rB|jrBd|_nt|j|j|j	|j�}|j
dk	r�x:|j
D],\}}t|d|||j�|}q|Wn||_d|_n|j|S(u
        Encodes the value using DER

        :param force:
            If the encoded contents already exist, clear them and regenerate
            to ensure they are in DER format instead of BER format

        :return:
            A byte string of the DER-encoded value
        iiRN(R3t_headerRRt
Constructablet_indefinitetmethodRR1R R(t_trailer(R6tforceR3theaderR1R ((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRCPs	!'	N(t__name__t
__module__t__doc__RRbR1R t_bad_tagtFalseR2R(R_R3RcRStclassmethodRR=RARDR?R@RGRJRMRIRQRRRHRXRC(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�s8�			
	
				
		tValueMapcB`s#eZdZdZdZd�ZRS(ul
    Basic functionality that allows for mapping values from ints or OIDs to
    python unicode strings
    cC`se|j}|jdks'|jdk	r+dSi|_x*|jj�D]\}}||j|<qDWdS(u2
        Generates _reverse_map from _map
        N(R&t_mapRt_reverse_maptitems(R6R"tkeyR$((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR*|s		N(RfRgRhRRmRnR*(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRlnstCastablecB`seZdZd�ZRS(u�
    A mixin to handle converting an object between different classes that
    represent the same encoded value, but with different rules for converting
    to and from native Python values
    cC`s�|j|jjkrKttdt|�t|�|j|jj���n|�}|j|_|j|_|j|_|j|_|j	|_	|j
|_
t|t�r�|j
|_
|j|_n|S(u+
        Converts the current object into an object of a different class. The
        new class must use the ASN.1 encoding for the value.

        :param other_class:
            The class to instantiate the new object from

        :return:
            An instance of the type other_class
        u�
                Can not covert a value from %s object to %s object since they
                use different tags: %d versus %d
                (R R&RRR	R1R2R(R_R3RcRR`RbRa(R6tother_classRF((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pytcast�s$			(RfRgRhRs(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRq�sR`cB`s5eZdZeZdZd�Zd�Zd�ZRS(u�
    A mixin to handle string types that may be constructed from chunks
    contained within an indefinite length BER-encoded container
    icC`s�|js|j�S|j}t|j�}d}x\||kr�t|j|d|j�\}}|dkr||j�}q4||j�7}q4W|dkr�|j�S|S(uc
        :return:
            A concatenation of the native values of the contained chunks
        RN(	Rat	_as_chunkt_chunks_offsetR.R3RR!R&t
_merge_chunks(R6tpointertcontents_lentoutputt	sub_value((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRv�s	
	!
cC`s$|jdkr|jS|j|jS(u
        A method to return a chunk of data that can be combined for
        constructed method values

        :return:
            A native Python value that can be added together. Examples include
            byte strings, unicode strings or tuples.
        i(RuR3(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRt�s
cC`s5tt|�j||�|j|_|j|_dS(u%
        Copies the contents of another Constructable object to itself

        :param object:
            Another instance of the same class

        :param copy_func:
            An reference of copy.copy() or copy.deepcopy() to use when copying
            lists, dicts and objects
        N(tsuperR`RHRbRa(R6RTRU((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRH�s(	RfRgRhRjRaRuRvRtRH(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR`�s		tVoidcB`sSeZdZdZd�Zd�Zd�Zd�Zed��Z	e
d�ZRS(u�
    A representation of an optional value that is not present. Has .native
    property and .dump() method to be compatible with other value classes.
    RcC`s|j|jkS(uu
        :param other:
            The other Primitive to compare to

        :return:
            A boolean
        (R&(R6RT((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyt__eq__s	cC`stS(N(Rj(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyt__nonzero__scC`sdS(Ni((R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyt__len__scC`s
td�S(N((titer(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyt__iter__scC`sdS(un
        The a native Python datatype representation of this value

        :return:
            None
        N(R(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRZs	cC`sdS(u
        Encodes the value using DER

        :param force:
            If the encoded contents already exist, clear them and regenerate
            to ensure they are in DER format instead of BER format

        :return:
            A byte string of the DER-encoded value
        R((R6Rd((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRC#s(RfRgRhR3R}R~RR�tpropertyRZRjRC(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR|�s				tAnycB`sbeZdZdZdd�Zed��Zed��Zddd�Z	d�Z
ed�ZRS(u�
    A value class that can contain any value, and allows for easy parsing of
    the underlying encoded value using a spec. This is normally contained in
    a Structure that has an ObjectIdentifier field and _oid_pair and _oid_specs
    defined.
    cK`s�tj||�yd|dk	rst|t�sLttdt|����n||jdf|_|j	�|_
nWnQttfk
r�}|jd}|jddt|�f||_|�nXdS(u�
        Sets the value of the object before passing to Asn1Value.__init__()

        :param value:
            An Asn1Value object that will be set as the parsed value
        u`
                        value must be an instance of Asn1Value, not %s
                        iiu
    while constructing %sN(
RR=RRRRR	R&t_parsedRCR3R,R5(R6R$R#R<R5((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR=@s
%cC`s*|jdkr|j�n|jdjS(u�
        The a native Python datatype representation of this value

        :return:
            The .native value from the parsed value object
        iN(R�RtparseRZ(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRZ\s	
cC`s'|jdkr|j�n|jdS(uw
        Returns the parsed object from .parse()

        :return:
            The object returned by .parse()
        iN(R�RR�(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRWjs	
c	C`sg|jd	ks+|jdd!||fkr\y�|p7i}t|�|jd	k	r�d|krw|j|d|d<q�|j|d<n|j|j|j}t|d|d|�\}}|||f|_d	|_d	|_t	|_
d|_||_d|_Wq\ttfk
rX}|j
d}|j
ddt|�f||_
|�q\Xn|jdS(
uv
        Parses the contents generically, or using a spec with optional params

        :param spec:
            A class derived from Asn1Value that defines what class_ and tag the
            value should have, and the semantics of the encoded value. The
            return value will be of this type. If omitted, the encoded value
            will be decoded using the standard universal tag based on the
            encoded tag number.

        :param spec_params:
            A dict of params to pass to the spec object

        :return:
            An object of the type spec, or if not present, a child of Asn1Value
        iiuexplicitRRRiu
    while parsing %sN(R�Rt_tag_type_to_explicit_implicitR(R_R3RcR!R RjR2R,RR5R	(	R6RRt
passed_paramsR3tparsed_valueR%R<R5((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�xs2+
					

%
cC`s/tt|�j||�||j�|_dS(u
        Copies the contents of another Any object to itself

        :param object:
            Another instance of the same class

        :param copy_func:
            An reference of copy.copy() or copy.deepcopy() to use when copying
            lists, dicts and objects
        N(R{R�RHR�(R6RTRU((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRH�scC`s3|jdkr|j�n|jdjd|�S(u
        Encodes the value using DER

        :param force:
            If the encoded contents already exist, clear them and regenerate
            to ensure they are in DER format instead of BER format

        :return:
            A byte string of the DER-encoded value
        iRdN(R�RR�RC(R6Rd((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRC�s
N(
RfRgRhRR�R=R�RZRWR�RHRjRC(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�5s2	tChoicecB`s�eZdZdZdZdZdZdZdZ	e
ed��Zd�Z
ddd�Zed��Zd�Zed��Zed��Zd�Zd	�Zd
�Zed�ZRS(
uF
    A class to handle when a value may be one of several options
    cK`sPt|t�s(tdt|���nt|d|d|d|�\}}|S(u�
        Loads a BER/DER-encoded byte string using the current class as the spec

        :param encoded_data:
            A byte string of BER or DER encoded data

        :param strict:
            A boolean indicating if trailing data should be forbidden - if so, a
            ValueError will be raised when trailing data exists

        :return:
            A instance of the current class
        u*encoded_data must be a byte string, not %sRRR(RRRR	R!(R"RRR#R$R%((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�s$cC`s�|j}i|_i|_x�t|j�D]p\}}t|�dkrf|if}||j|<nt|d|d�}||j|<||j|d<q+WdS(uS
        Generates _id_map from _alternatives to allow validating contents
        iiiiN(R&t_id_mapt	_name_mapt	enumeratet
_alternativesR.t_build_id_tuple(R6R"tindextinfotid_((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR*s			

c	K`st|�tj||�y�|jd�d
k	rGttd���n|d
k	r�t|t�r�t	|�dkr�ttdt
|�t	|����nt|j��d\}}nt|t
�rt	|�dkrttdt
|�t	|����n|d}|d}n||jkrIttd|t
|����n|j||_|j|j\}}}t||�s�|||�}nt||�}||_nWnQttfk
r}|jd}|jdd	t
|�f||_|�nXd
S(uu
        Checks to ensure implicit tagging is not being used since it is
        incompatible with Choice, then forwards on to Asn1Value.__init__()

        :param name:
            The name of the alternative to be set - used with value.
            Alternatively this may be a dict with a single key being the name
            and the value being the value, or a two-element tuple of the the
            name and the value.

        :param value:
            The alternative value to set - used with name

        :raises:
            ValueError - when implicit param is passed (or legacy tag_type param is "implicit")
        uimplicitu�
                    The Choice type can not be implicitly tagged even if in an
                    implicit module - due to its nature any tagging must be
                    explicit
                    iu�
                            When passing a dict as the "name" argument to %s,
                            it must have a single key/value - however %d were
                            present
                            iiu�
                            When passing a tuple as the "name" argument to %s,
                            it must have two elements, the name and value -
                            however %d were present
                            u�
                        The name specified, "%s", is not a valid alternative
                        for %s
                        u
    while constructing %sN(R�RR=RORR,RRRNR.R	tlistRottupleR�t_choiceR�t_fix_taggingR�RR5(	R6tnameR$R#R%RtparamsR<R5((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR=sJ
		


%cC`s*|js#|j|jd|_n|jS(uc
        :return:
            A unicode string of the field name of the chosen alternative
        i(t_nameR�R�(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�ds	cC`s�|jdk	r|jSyA|j|j\}}}t|jd|d|�\|_}WnQttfk
r�}|jd}|jddt	|�f||_|�nXdS(u}
        Parses the detected alternative

        :return:
            An Asn1Value object of the chosen alternative
        RRiiu
    while parsing %sN(
R�RR�R�R!R3R,RR5R	(R6R%RR�R<R5((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�ns(
%cC`s
|j�S(uT
        :return:
            An Asn1Value object of the chosen alternative
        (R�(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRY�scC`s
|jjS(u�
        The a native Python datatype representation of this value

        :return:
            The .native value from the contained value object
        (RYRZ(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRZ�s	c	C`s�||f}|jdk	r�|jd|krLttdt|����nt|t|��\\}}}}}}}||f}n||jkr�|j||_dS|j	dk	r$|j
dk	r$t|j�dkr�ttdt|����n||j	|j
fkr$d|_dSn|j||�}g|jD] }|j|d|d�^q@}ttd|t|�dj
|����dS(	u�
        Ensures that the class and tag specified exist as an alternative

        :param class_:
            The integer class_ from the encoded value header

        :param tag:
            The integer tag from the encoded value header

        :param contents:
            A byte string of the contents of the value - used when the object
            is explicitly tagged

        :raises:
            ValueError - when value is not a valid alternative
        i����u�
                    %s was explicitly tagged, but the value provided does not
                    match the class and tag
                    Niu|
                    %s was implicitly tagged, but more than one alternative
                    exists
                    ius
            Value %s did not match the class and tag of any of the alternatives
            in %s: %s
            u, (R(RR,RR	RR.R�R�R1R R�t_format_class_tagtjoin(	R6R1R R3R�R%tasn1tpairtasn1s((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pytvalidate�s4-	0	cC`sdt|j�|fS(uo
        :return:
            A unicode string of a human-friendly representation of the class and tag
        u[%s %s](R/tupper(R6R1R ((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��scC`sGtt|�j||�|j|_|j|_||j�|_dS(u
        Copies the contents of another Choice object to itself

        :param object:
            Another instance of the same class

        :param copy_func:
            An reference of copy.copy() or copy.deepcopy() to use when copying
            lists, dicts and objects
        N(R{R�RHR�R�R�(R6RTRU((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRH�scC`s�|jjd|�|_|jdks-|r�d|_|jdk	r�xC|jD]5\}}t|d||j|j�|j|_qOWq�n|j|jS(u
        Encodes the value using DER

        :param force:
            If the encoded contents already exist, clear them and regenerate
            to ensure they are in DER format instead of BER format

        :return:
            A byte string of the DER-encoded value
        RdRiN(RYRCR3R_RR(R(R6RdR1R ((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRC�s	3N(RfRgRhRR�R�R�R�R�R�RkRjRR*R=R�R�R�RYRZR�R�RHRC(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��s&	T
			@		tConcatcB`s�eZdZdZdZeed��Zdded�Z	d�Z
d�Zd�Zd�Z
d�Zd�Zd	�Zd
�Zdd�Zed
�Zed��Zd�Zd�Zd�Zd�ZRS(u
    A class that contains two or more encoded child values concatentated
    together. THIS IS NOT PART OF THE ASN.1 SPECIFICATION! This exists to handle
    the x509.TrustedCertificate() class for OpenSSL certificates containing
    extra information.
    cC`s|d|d|�S(u�
        Loads a BER/DER-encoded byte string using the current class as the spec

        :param encoded_data:
            A byte string of BER or DER encoded data

        :param strict:
            A boolean indicating if trailing data should be forbidden - if so, a
            ValueError will be raised when trailing data exists

        :return:
            A Concat object
        R3R((R"RR((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRsc
C`sv|dk	ry�t|�}g|_d}xW|jD]L}||krgt|d|d|�\}}n	|�}|jj|�q4W|r�||kr�||}td|��nWqttfk
r}	|	jd}
|	jddt	|�f|
|	_|	�qXn|dk	rr|jdkrBdgt|j�|_nx-t
|�D]\}}|j||�qOWndS(u
        :param value:
            A native Python datatype to initialize the object value with

        :param contents:
            A byte string of the encoded contents of the value

        :param strict:
            A boolean indicating if trailing data should be forbidden - if so, a
            ValueError will be raised when trailing data exists in contents

        :raises:
            ValueError - when an error occurs with one of the children
            TypeError - when an error occurs with one of the children
        iRwRu4Extra data - %d bytes of trailing data were providediu
    while constructing %sN(RR.t	_childrent_child_specsR!tappendR,RR5R	R�t__setitem__(
R6R$R3RRxtoffsetRtchild_valuetextra_bytesR<R5R�tdata((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR="s,	!	

%
cC`str|j�S|j�SdS(u�
        Since str is different in Python 2 and 3, this calls the appropriate
        method, __unicode__() or __bytes__()

        :return:
            A unicode string
        N(R>R?R@(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRAOs	
cC`s
|j�S(u;
        A byte string of the DER-encoded contents
        (RC(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR?]scC`s
t|�S(u7
        :return:
            A unicode string
        (R-(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR@dscC`s)dt|�t|�t|j��fS(u7
        :return:
            A unicode string
        u
<%s %s %s>(R	RBR-RC(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRDlscC`s#|j�}|j|tj�|S(u|
        Implements the copy.copy() interface

        :return:
            A new shallow copy of the Concat object
        (R&RHRI(R6RF((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRJtscC`s3|j�}||t|�<|j|tj�|S(u�
        Implements the copy.deepcopy() interface

        :param memo:
            A dict for memoization

        :return:
            A new deep copy of the Concat object and all child objects
        (R&RBRHRIRK(R6RLRF((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRM�scC`s
tj|�S(uQ
        Copies the object

        :return:
            A Concat object
        (RIRK(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRI�scC`sO|j|jkr9ttdt|�t|����n||j�|_dS(u
        Copies the contents of another Concat object to itself

        :param object:
            Another instance of the same class

        :param copy_func:
            An reference of copy.copy() or copy.deepcopy() to use when copying
            lists, dicts and objects
        uQ
                Can not copy values from %s object to %s object
                N(R&RRR	R�(R6RTRU((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRH�s	icC`sgd|}td|t|�t|�f�td|f�x"|jD]}|j|d�qHWdS(uJ
        Show the binary data and parsed data in a tree structure
        u  u%s%s Object #%su
%s  Children:iN(R[R	RBR�RX(R6R\R]tchild((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRX�s

#cC`s4d}x'|jD]}||jd|�7}qW|S(u
        Encodes the value using DER

        :param force:
            If the encoded contents already exist, clear them and regenerate
            to ensure they are in DER format instead of BER format

        :return:
            A byte string of the DER-encoded value
        RRd(R�RC(R6RdR3R�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRC�scC`s
|j�S(u`
        :return:
            A byte string of the DER-encoded contents of the children
        (RC(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR3�scC`s
t|j�S(u.
        :return:
            Integer
        (R.R�(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�scC`sQ|t|j�dks%|dkrFttd|t|����n|j|S(u�
        Allows accessing children by index

        :param key:
            An integer of the child index

        :raises:
            KeyError - when an index is invalid

        :return:
            The Asn1Value object of the child specified
        iiuN
                No child is definition for position %d of %s
                (R.R�tKeyErrorRR	R�(R6Rp((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyt__getitem__�s%cC`s�|t|j�dks%|dkrFttd|t|����nt|t�svttd|t|����n||j|<dS(uG
        Allows settings children by index

        :param key:
            An integer of the child index

        :param value:
            An Asn1Value object to set the child to

        :raises:
            KeyError - when an index is invalid
            ValueError - when the value is not an instance of Asn1Value
        iiuK
                No child is defined for position %d of %s
                uz
                Value for child %s of %s is not an instance of
                asn1crypto.core.Asn1Value
                N(	R.R�R�RR	RRR,R�(R6RpR$((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��s%cC`s
t|j�S(uB
        :return:
            An iterator of child values
        (R�R�(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�sN(RfRgRhRR�R�RkRjRR=RAR?R@RDRJRMRIRHRXRCR�R3RR�R�R�(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�s*-							
					$t	PrimitivecB`sSeZdZdZdZdddd�Zd�Zed�Z	d�Z
d�ZRS(uO
    Sets the class_ and method attributes for primitive, universal values
    icK`s�tj||�yT|dk	r+||_n8|dk	rG|j|�n|dk	rc|j|�nWnQttfk
r�}|jd}|jddt|�f||_|�nXdS(u^
        Sets the value of the object before passing to Asn1Value.__init__()

        :param value:
            A native Python datatype to initialize the object value with

        :param default:
            The default value if no value is specified

        :param contents:
            A byte string of the encoded contents of the value
        iiu
    while constructing %sN(	RR=RR3R4R,RR5R	(R6R$R:R3R#R<R5((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR=-s
%cC`spt|t�s6ttdt|�t|����n||_||_d|_|j	dkrld|_	ndS(u_
        Sets the value of the object

        :param value:
            A byte string
        uH
                %s value must be a byte string, not %s
                RN(
RRRRR	RSR3RR_Rc(R6R$((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR4Ls				cC`s5|r(|j}d|_|j|�ntj|�S(u
        Encodes the value using DER

        :param force:
            If the encoded contents already exist, clear them and regenerate
            to ensure they are in DER format instead of BER format

        :return:
            A byte string of the DER-encoded value
        N(RZRR3R4RRC(R6RdRZ((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRCcs
		cC`s||kS(N((R6RT((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyt__ne__vscC`sMt|t�stS|j|jkr)tS|jj|jjkrEtS|j|jkrm|j|jkrmtSt|jj�t|jg�Btt	tt
g�}t|jj�t|jg�Btt	tt
g�}||Br�|j|jkS|js|js|js|jr7|j
�j�|j
�j�kS|j�|j�kS(uu
        :param other:
            The other Primitive to compare to

        :return:
            A boolean
        (RR�RjR3R&R R+R4t	__bases__RRlR2R(RRRC(R6RTt
self_basestother_bases((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR}ys	$55
$"N(RfRgRhR1RbRR=R4RjRCR�R}(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�$s		tAbstractStringcB`sDeZdZdZdZd�Zd�Zd�Ze	d��Z
RS(u�
    A base class for all strings that have a known encoding. In general, we do
    not worry ourselves with confirming that the decoded values match a specific
    set of characters, only that they are decoded into a Python unicode string
    ulatin1cC`s�t|t�s6ttdt|�t|����n||_|j|j�|_d|_
|jr{t|_d|_
n|jdkr�d|_ndS(ub
        Sets the value of the string

        :param value:
            A unicode string
        uK
                %s value must be a unicode string, not %s
                iRN(RR
RRR	t_unicodeREt	_encodingR3RR_RaRjRbRc(R6R$((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR4�s					cC`sG|jdkrdS|jdkr@|j�j|j�|_n|jS(u7
        :return:
            A unicode string
        uN(R3RR�RvtdecodeR�(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR@�s
cC`s)tt|�j||�|j|_dS(u&
        Copies the contents of another AbstractString object to itself

        :param object:
            Another instance of the same class

        :param copy_func:
            An reference of copy.copy() or copy.deepcopy() to use when copying
            lists, dicts and objects
        N(R{R�RHR�(R6RTRU((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRH�scC`s|jdkrdS|j�S(u�
        The a native Python datatype representation of this value

        :return:
            A unicode string or None
        N(R3RR@(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRZ�s	N(RfRgRhR�RR�R4R@RHR�RZ(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��s			tBooleancB`s>eZdZdZd�Zd�Zd�Zed��ZRS(u7
    Represents a boolean in both ASN.1 and Python
    icC`sLt|�|_|sdnd|_d|_|jdkrHd|_ndS(u�
        Sets the value of the object

        :param value:
            True, False or another value that works with bool()
        ts�RN(tboolRSR3RR_Rc(R6R$((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR4�s
	cC`s
|j�S(u4
        :return:
            True or False
        (t__bool__(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR~scC`s
|jdkS(u4
        :return:
            True or False
        R�(R3(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�
scC`s;|jdkrdS|jdkr4|j�|_n|jS(u}
        The a native Python datatype representation of this value

        :return:
            True, False or None
        N(R3RRSR�(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRZs
	(	RfRgRhR R4R~R�R�RZ(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��s			tIntegercB`s5eZdZdZd�Zd�Zed��ZRS(u8
    Represents an integer in both ASN.1 and Python
    icC`st|t�r||jdkr<ttdt|����n||jkrlttdt|�|���n|j|}n6t|t�s�t	tdt|�t|����n|jr�||jkr�|j|n||_
t|dt�|_
d|_|jdkrd|_ndS(u�
        Sets the value of the object

        :param value:
            An integer, or a unicode string if _map is set

        :raises:
            ValueError - when an invalid value is passed
        u\
                    %s value is a unicode string, but no _map provided
                    uR
                    %s value, %s, is not present in the _map
                    u�
                %s value must be an integer or unicode string when a name_map
                is provided, not %s
                tsignedRN(RR
RmRR,RR	RnRRRSRR+R3R_Rc(R6R$((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR4,s*		.	cC`st|jdt�S(u1
        :return:
            An integer
        R�(RR3R+(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyt__int__\scC`sr|jdkrdS|jdkrk|j�|_|jdk	rk|j|jkrk|j|j|_qkn|jS(u|
        The a native Python datatype representation of this value

        :return:
            An integer or None
        N(R3RRSR�Rm(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRZcs	!(RfRgRhR R4R�R�RZ(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�%s
	0	t	BitStringcB`sbeZdZdZd	Zd	ZdZd�Zd�Z	d�Z
d�Zd�Ze
d��ZRS(
uK
    Represents a bit string from ASN.1 as a Python tuple of 1s and 0s
    iicC`sHtj|�|j}|jdk	rDt|jj��d|_ndS(u2
        Generates _reverse_map from _map
        iN(RlR*R&RmRtmaxtkeyst_size(R6R"((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR*�s
	c
C`st|t�r�|jdkr<ttdt|����ndg|j}||_xWt	d|j�D]C}|jj
|�}|dkr�qhn||krhd||<qhqhWdjtt
|��}n�|jtkrf|jdkr�||_nWt�|_xHt|�D]:\}}|r
|jj
||�}|jj|�q
q
Wdjtt
|��}n$ttdt|�t|����d|_|jdk	r�t|�|jkr�ttdt|�|jt|����n|jd�}nt|�}|d}d}	|dkr9d|}	|d|	7}nttj|d��}
|	rgt|	�}nd	}|dkr�d
}ntt|d��}t|�|
kr�d	|
t|�|}n|||_d|_|jr�t|_d|_n|jd
krd
|_ndS(
u�
        Sets the value of the object

        :param value:
            An integer or a tuple of integers 0 and 1

        :raises:
            ValueError - when an invalid value is passed
        uF
                    %s._map has not been defined
                    iiuu�
                %s value must be a tuple of ones and zeros or a set of unicode
                strings, not %s
                uf
                    %s value must be at most %s bits long, specified was %s long
                    u0iR�RiN( RR4RmRR,RR	R�RStrangeROR�tmapR
R&R�R�taddRt_chunkR.trstriptinttmathtceilRR3R_RaRjRbRc(
R6R$tbitsR�RptbitR�tsizetsize_modt
extra_bitst
size_in_bytestextra_bits_bytetvalue_bytes((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR4�st				

	
			cC`s�t|t�}|sxt|jt�sEttdt|����n||jkrxttdt|�|���qxn|jdkr�|j
n|jdkr�t|j�|dkr�t|j|�St
S|r�|jj||�}n||jkS(uG
        Retrieves a boolean version of one of the bits based on a name from the
        _map

        :param key:
            The unicode string of one of the bit names

        :raises:
            ValueError - when _map is not set or the key name is invalid

        :return:
            A boolean if the bit is set
        uF
                    %s._map has not been defined
                    uT
                    %s._map does not contain an entry for "%s"
                    iN(RRRmRNR,RR	RnRSRRZR.R�RjRO(R6Rptis_int((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��s(	
cC`s�t|t�}|su|jdkrBttdt|����n||jkruttdt|�|���qun|jdkr�|j	n|jdkrt
|j�}t|�d}||kr�|jdg||�n|r�dnd||<t
|�|_nk|r)|jj||�}n|rT||jkrv|jj|�qvn"||jkrv|jj|�n|j|j�dS(u
        Sets one of the bits based on a name from the _map

        :param key:
            The unicode string of one of the bit names

        :param value:
            A boolean value

        :raises:
            ValueError - when _map is not set or the key name is invalid
        uF
                    %s._map has not been defined
                    uT
                    %s._map does not contain an entry for "%s"
                    iiN(RRRmRR,RR	RnRSRZR�R.textendR�ROR�tremoveR4(R6RpR$R�t
new_nativetmax_key((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�!s8	
cC`s�t|jdd!�}djt|jd��}t|jd�}t|�}|d}|dkr�dd||}t|�}n|d|kr�||d}dd||}n|dkr�|dd|!}ntttt|���S(ur
        Allows reconstructing indefinite length values

        :return:
            A tuple of integers
        iiu{0:b}iu0(RR3tformatR.R�R�R�(R6R�t
bit_stringtbyte_lentbit_lentmod_bit_lent
missing_bytes((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRtZs
cC`s�|jdkrA|jdkr.|jd�qA|jt��n|jdkr�|j�}|jr�t�|_xTt|�D]:\}}|r~|jj||�}|jj|�q~q~Wq�||_n|jS(u�
        The a native Python datatype representation of this value

        :return:
            If a _map is set, a set of names, or if no _map is set, a tuple of
            integers 1 and 0. None if no value.
        N((	R3RRmR4RSRvR�ROR�(R6R�R�R�R�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRZxs	N(RfRgRhR RR�R�RuR*R4R�R�RtR�RZ(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�vs		d	/	9	tOctetBitStringcB`sJeZdZdZdZdZd�Zd�Zd�Z	e
d��ZRS(uB
    Represents a bit string in ASN.1 as a Python byte string
    iicC`s�t|t�s6ttdt|�t|����n||_d||_d|_|j	rst
|_	d|_n|jdkr�d|_ndS(u�
        Sets the value of the object

        :param value:
            A byte string

        :raises:
            ValueError - when an invalid value is passed
        uH
                %s value must be a byte string, not %s
                R�iRN(
RRRRR	t_bytesR3RR_RaRjRbRc(R6R$((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR4�s		
			cC`s;|jdkrdS|jdkr4|j�|_n|jS(u4
        :return:
            A byte string
        RN(R3RR�Rv(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR?�s
cC`s)tt|�j||�|j|_dS(u&
        Copies the contents of another OctetBitString object to itself

        :param object:
            Another instance of the same class

        :param copy_func:
            An reference of copy.copy() or copy.deepcopy() to use when copying
            lists, dicts and objects
        N(R{R�RHR�(R6RTRU((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRH�scC`s|jdkrdS|j�S(u
        The a native Python datatype representation of this value

        :return:
            A byte string or None
        N(R3RR?(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRZ�s	N(RfRgRhR RuRR�R4R?RHR�RZ(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��s			tIntegerBitStringcB`s;eZdZdZdZd�Zd�Zed��ZRS(u>
    Represents a bit string in ASN.1 as a Python integer
    iicC`s�t|t�s6ttdt|�t|����n||_dt|dt�|_d|_
|jrt|_d|_
n|jdkr�d|_ndS(u�
        Sets the value of the object

        :param value:
            An integer

        :raises:
            ValueError - when an invalid value is passed
        uE
                %s value must be an integer, not %s
                R�R�iRN(RRRRR	RSRR+R3RR_RaRjRbRc(R6R$((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR4�s					cC`s�t|jdd!�}djt|jd��}t|�d}|dkrcdd||}n|dkr~|dd|!S|S(u�
        Allows reconstructing indefinite length values

        :return:
            A unicode string of bits - 1s and 0s
        iiu{0:b}iu0(RR3R�R.(R6R�R�R�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRt	scC`s�|jdkrdS|jdkr�t|jdd!�}|jrg|dkrgt|jd�|_q�|jr�|dkr�td��nt|j�d�|_n|jS(u|
        The a native Python datatype representation of this value

        :return:
            An integer or None
        iiu=Constructed bit string has extra bits on indefinite containeriN(R3RRSRRaR,R�Rv(R6R�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRZ*	s	(	RfRgRhR RuR4RtR�RZ(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��s		tOctetStringcB`sDeZdZdZdZd�Zd�Zd�Ze	d��Z
RS(u;
    Represents a byte string in both ASN.1 and Python
    icC`s�t|t�s6ttdt|�t|����n||_||_d|_|j	rot
|_	d|_n|jdkr�d|_ndS(u_
        Sets the value of the object

        :param value:
            A byte string
        uH
                %s value must be a byte string, not %s
                iRN(
RRRRR	R�R3RR_RaRjRbRc(R6R$((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR4L	s						cC`s;|jdkrdS|jdkr4|j�|_n|jS(u4
        :return:
            A byte string
        RN(R3RR�Rv(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR?f	s
cC`s)tt|�j||�|j|_dS(u#
        Copies the contents of another OctetString object to itself

        :param object:
            Another instance of the same class

        :param copy_func:
            An reference of copy.copy() or copy.deepcopy() to use when copying
            lists, dicts and objects
        N(R{R�RHR�(R6RTRU((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRHr	scC`s|jdkrdS|j�S(u
        The a native Python datatype representation of this value

        :return:
            A byte string or None
        N(R3RR?(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRZ�	s	N(RfRgRhR RR�R4R?RHR�RZ(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�B	s			tIntegerOctetStringcB`s,eZdZdZd�Zed��ZRS(u?
    Represents a byte string in ASN.1 as a Python integer
    icC`s�t|t�s6ttdt|�t|����n||_t|dt�|_d|_
|jr{t|_d|_n|j
dkr�d|_
ndS(u�
        Sets the value of the object

        :param value:
            An integer

        :raises:
            ValueError - when an invalid value is passed
        uE
                %s value must be an integer, not %s
                R�iRN(RRRRR	RSRRjR3RR_RaRbRc(R6R$((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR4�	s					cC`sA|jdkrdS|jdkr:t|j��|_n|jS(u|
        The a native Python datatype representation of this value

        :return:
            An integer or None
        N(R3RRSRRv(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRZ�	s
	(RfRgRhR R4R�RZ(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��	s	tParsableOctetStringcB`s}eZdZd	Zd	Zd	d	d�Zd�Zd	d	d�Zd�Z	d�Z
ed��Zed��Z
ed�ZRS(
icK`szt}|dkrB|dk	rBt|t�rB|j�}t}ntj|d||�|rv||jdf|_	ndS(u�
        Allows providing a parsed object that will be serialized to get the
        byte string value

        :param value:
            A native Python datatype to initialize the object value with

        :param parsed:
            If value is None and this is an Asn1Value object, this will be
            set as the parsed value, and the value will be obtained by calling
            .dump() on this object.
        R$N(
RjRRRRCR+R�R=R&R�(R6R$RWR#t
set_parsed((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR=�	s'	cC`s�t|t�s6ttdt|�t|����n||_||_d|_|j	rot
|_	d|_n|jdkr�d|_ndS(u_
        Sets the value of the object

        :param value:
            A byte string
        uH
                %s value must be a byte string, not %s
                iRN(
RRRRR	R�R3RR_RaRjRbRc(R6R$((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR4�	s						cC`so|jdks+|jdd!||fkrdt|j�d|d|�\}}|||f|_n|jdS(uv
        Parses the contents generically, or using a spec with optional params

        :param spec:
            A class derived from Asn1Value that defines what class_ and tag the
            value should have, and the semantics of the encoded value. The
            return value will be of this type. If omitted, the encoded value
            will be decoded using the standard universal tag based on the
            encoded tag number.

        :param spec_params:
            A dict of params to pass to the spec object

        :return:
            An object of the type spec, or if not present, a child of Asn1Value
        iiRRiN(R�RR!R?(R6RRR�R%((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�
s+$cC`s;|jdkrdS|jdkr4|j�|_n|jS(u4
        :return:
            A byte string
        RN(R3RR�Rv(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR?
s
cC`s;tt|�j||�|j|_||j�|_dS(u+
        Copies the contents of another ParsableOctetString object to itself

        :param object:
            Another instance of the same class

        :param copy_func:
            An reference of copy.copy() or copy.deepcopy() to use when copying
            lists, dicts and objects
        N(R{R�RHR�R�(R6RTRU((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRH#
scC`s>|jdkrdS|jdk	r0|jdjS|j�SdS(u
        The a native Python datatype representation of this value

        :return:
            A byte string or None
        iN(R3RR�RZR?(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRZ3
s
	cC`s'|jdkr|j�n|jdS(uw
        Returns the parsed object from .parse()

        :return:
            The object returned by .parse()
        iN(R�RR�(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRWD
s	
cC`s\|rO|jdk	r-|jjd|�}n	|j}d|_|j|�ntj|�S(u
        Encodes the value using DER

        :param force:
            If the encoded contents already exist, clear them and regenerate
            to ensure they are in DER format instead of BER format

        :return:
            A byte string of the DER-encoded value
        RdN(R�RRWRCRZR3R4R(R6RdRZ((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRCR
s		N(RfRgR RR�R�R=R4R�R?RHR�RZRWRjRC(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��	s			tParsableOctetBitStringcB`seZdZdZd�ZRS(iicC`s�t|t�s6ttdt|�t|����n||_d||_d|_|j	rst
|_	d|_n|jdkr�d|_ndS(u�
        Sets the value of the object

        :param value:
            A byte string

        :raises:
            ValueError - when an invalid value is passed
        uH
                %s value must be a byte string, not %s
                R�iRN(
RRRRR	R�R3RR_RaRjRbRc(R6R$((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR4s
s		
			(RfRgR RuR4(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�i
stNullcB`s2eZdZdZdZd�Zed��ZRS(u<
    Represents a null value in ASN.1 as None in Python
    iRcC`s
d|_dS(uV
        Sets the value of the object

        :param value:
            None
        RN(R3(R6R$((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR4�
scC`sdS(un
        The a native Python datatype representation of this value

        :return:
            None
        N(R(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRZ�
s	(RfRgRhR R3R4R�RZ(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��
s
	
tObjectIdentifiercB`sheZdZdZdZed��Zed��Zd�Z	d�Z
ed��Zed��Z
RS(	u`
    Represents an object identifier in ASN.1 as a Python unicode dotted
    integer string
    icC`sm|jdkr-ttdt|����nt|t�sZttdt|����n|jj||�S(u^
        Converts a dotted unicode string OID into a mapped unicode string

        :param value:
            A dotted unicode string OID

        :raises:
            ValueError - when no _map dict has been defined on the class
            TypeError - when value is not a unicode string

        :return:
            A mapped unicode string
        u>
                %s._map has not been defined
                uH
                value must be a unicode string, not %s
                N(	RmRR,RR	RR
RRO(R"R$((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��
scC`s�|tkr&|�j�tt|<n|jdkrSttdt|����nt|t	�s�t
tdt|����n||jkr�|j|Stj
|�s�ttdt|�|���n|S(u�
        Converts a mapped unicode string value into a dotted unicode string OID

        :param value:
            A mapped unicode string OR dotted unicode string OID

        :raises:
            ValueError - when no _map dict has been defined on the class or the value can't be unmapped
            TypeError - when value is not a unicode string

        :return:
            A dotted unicode string OID
        u>
                %s._map has not been defined
                uH
                value must be a unicode string, not %s
                uL
                %s._map does not contain an entry for "%s"
                N(R'R*R+RmRR,RR	RR
RRnt_OID_REtmatch(R"R$((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pytunmap�
s&

	cC`slt|t�s6ttdt|�t|����n||_|jd
k	rp||jkrp|j|}qpnd|_	d
}x�t
|jd��D]�\}}t|�}|dkr�|}q�n|dkr�|d|}nt
d|@�}|d?}x2|dkr0t
d	d|@B�|}|d?}q�W|j	|7_	q�Wd
|_|jdkrhd|_nd
S(u
        Sets the value of the object

        :param value:
            A unicode string. May be a dotted integer string, or if _map is
            provided, one of the mapped values.

        :raises:
            ValueError - when an invalid value is passed
        uK
                %s value must be a unicode string, not %s
                Ru.iii(iii�N(RR
RRR	RSRmRRnR3R�tsplitR�R
R_Rc(R6R$tfirstR�tparttencoded_part((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR4s6			"
	cC`s|jS(u7
        :return:
            A unicode string
        (tdotted(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR@BscC`s�|jdkr�g}d}x�|jD]�}tr@t|�}n|d}||d@7}|d@dkr%t|�dkr�|jt|d��|jt|d��n|jt|��d}q%q%Wdj|�|_n|jS(u�
        :return:
            A unicode string of the object identifier in dotted notation, thus
            ignoring any mapped value
        ii�ii(u.N(	t_dottedRR3R>tordR.R�R
R�(R6RyR�tbyte((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�Js 

cC`so|jdkrdS|jdkrh|j|_|jdk	rh|j|jkrh|j|j|_qhn|jS(uE
        The a native Python datatype representation of this value

        :return:
            A unicode string or None. If _map is not defined, the unicode string
            is a string of dotted integers. If _map is defined and the dotted
            string is present in the _map, the mapped value is returned.
        N(R3RRSR�Rm(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRZgs!N(RfRgRhR RR�RkR�R�R4R@R�R�RZ(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��
s"2	2	tObjectDescriptorcB`seZdZdZRS(uO
    Represents an object descriptor from ASN.1 - no Python implementation
    i(RfRgRhR (((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�|st
InstanceOfcB`seZdZdZRS(uF
    Represents an instance from ASN.1 - no Python implementation
    i(RfRgRhR (((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��stRealcB`seZdZdZRS(uH
    Represents a real number from ASN.1 - no Python implementation
    i	(RfRgRhR (((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��st
EnumeratedcB`s,eZdZdZd�Zed��ZRS(u\
    Represents a enumerated list of integers from ASN.1 as a Python
    unicode string
    i
cC`s�t|t�rGt|t�rGttdt|�t|����nt|t�r�||jkr�ttdt|�|���n|j|}n0||jkr�ttdt|�|���nt	j
||�dS(u�
        Sets the value of the object

        :param value:
            An integer or a unicode string from _map

        :raises:
            ValueError - when an invalid value is passed
        uY
                %s value must be an integer or a unicode string, not %s
                uL
                    %s value "%s" is not a valid value
                    uB
                %s value %s is not a valid value
                N(RRR
RRR	RnR,RmR�R4(R6R$((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR4�s$ 			cC`sB|jdkrdS|jdkr;|j|j�|_n|jS(u�
        The a native Python datatype representation of this value

        :return:
            A unicode string or None
        N(R3RRSRmR�(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRZ�s
	(RfRgRhR R4R�RZ(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��s	+t
UTF8StringcB`seZdZdZdZRS(uI
    Represents a UTF-8 string from ASN.1 as a Python unicode string
    iuutf-8(RfRgRhR R�(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��stRelativeOidcB`seZdZdZRS(u`
    Represents an object identifier in ASN.1 as a Python unicode dotted
    integer string
    i
(RfRgRhR (((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��stSequencecB`s=eZdZdZdZdZdZdZe	Z
gZdZdZ
dZdZdZdZdZddd�Zed��Zejd��Zd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Ze	d�Zd�Zd�Z d�Z!e	d�Z"d�Z#ed��Z$d�Z%dd�Z&e	d�Z'RS(uf
    Represents a sequence of fields from ASN.1 as a Python object with a
    dict-like interface
    iiic	K`stj||�t}|dkrq|dk	rqt}|jdkrh|jdkr[t}qh|j�n|}n|dk	ry=|jr�g|jD]}|d^q�}t	|j
��}n|j
�}t	|�}x�|D]�}|rC|j|}	|	t|j�krC|j|	t
k	rC||kr�|j|�q�q�qCn||kr�|j|||�|j|�q�q�Wt|�r�ttdt|�djtt|������nWqttfk
r
}
|
jd}|
jddt|�f||
_|
�qXndS(u"
        Allows setting field values before passing everything else along to
        Asn1Value.__init__()

        :param value:
            A native Python datatype to initialize the object value with

        :param default:
            The default value if no value is specified
        iu�
                        One or more unknown fields was passed to the constructor
                        of %s: %s
                        u, iu
    while constructing %sN(RR=RjRR+tchildrenR3t_parse_childrent_fieldsR4R�t
_field_mapR.tVOIDR�R�R,RR	R�tsortedR�RR5(R6R$R:R#tcheck_existingR�R�tunused_keysRpR�R<R5((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR=#sF	
		 

(		(
%cC`s6|jdkr|jS|j�r/|j�n|jS(u`
        :return:
            A byte string of the DER-encoded contents of the sequence
        N(R�Rt	_contentst_is_mutatedt
_set_contents(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR3ds

cC`s
||_dS(ue
        :param value:
            A byte string of the DER-encoded contents of the sequence
        N(R�(R6R$((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR3sscC`sf|j}|jdk	rbxG|jD]9}t|t�sFt|t�r"|pU|j�}q"q"Wn|S(u~
        :return:
            A boolean - if the sequence or any children (recursively) have been
            mutated
        N(t_mutatedR�RRR�t
SequenceOfR(R6tmutatedR�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR|s	cC`s:|j|}|jtkr6t|�}|j|<n|S(u]
        Builds a child object if the child has only been parsed into a tuple so far
        (R�R&R�t_build(R6R�R�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyt_lazy_child�s
cC`s)|jdkr|j�nt|j�S(u.
        :return:
            Integer
        N(R�RR�R.(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�s
cC`s
|jdkr|j�nt|t�sk||jkr[ttd|t|����n|j|}n|t	|j�kr�ttd|t|����ny|j
|�SWnQttfk
r}|j
d}|j
ddt|�f||_
|�nXdS(u9
        Allows accessing fields by name or index

        :param key:
            A unicode string of the field name, or an integer of the field index

        :raises:
            KeyError - when a field name or index is invalid

        :return:
            The Asn1Value object of the field specified
        uL
                    No field named "%s" defined for %s
                    uL
                No field numbered %s is present in this %s
                iiu
    while parsing %sN(R�RR�RRR�R�RR	R.RR,RR5(R6RpR<R5((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��s(

%c
C`ss|jdkr|j�nt|t�sk||jkr[ttd|t|����n|j|}n|j	|�\}}}}}|j
|||||�}t}	t|t�r�|j
dk}	n3t|t�r�|jjdk}	n|jdk}	|	r%ttd|t|����n||j|<|jdk	rf|j|j|j|j|d<nt|_dS(u�
        Allows settings fields by name or index

        :param key:
            A unicode string of the field name, or an integer of the field index

        :param value:
            A native Python datatype to set the field value to. This method will
            construct the appropriate Asn1Value object from _fields.

        :raises:
            ValueError - when a field name or index is invalid
        uL
                    No field named "%s" defined for %s
                    uG
                Value for field "%s" of %s is not set
                iN(R�RR�RRR�R�RR	t_determine_spect_make_valueRjR�RWR�RYR3R,RSRZR�R+R(
R6RpR$t
field_namet
field_spect
value_spectfield_paramsR%t	new_valuet
invalid_value((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��s4

%cC`s|jdkr|j�nt|t�sk||jkr[ttd|t|����n|j|}n|j	|\}}}|s�d|kr�d|kr�t
td|t|����nd|kr�t|j|<|jdk	rd|j|<qn|j
|d�t|_dS(u/
        Allows deleting optional or default fields by name or index

        :param key:
            A unicode string of the field name, or an integer of the field index

        :raises:
            ValueError - when a field name or index is invalid, or the field is not optional or defaulted
        uL
                    No field named "%s" defined for %s
                    udefaultuoptionalu�
                Can not delete the value for the field "%s" of %s since it is
                not optional or defaulted
                N(R�RR�RRR�R�RR	R�R,R�RSR�R+R(R6RpR�R%R�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyt__delitem__
s*

cc`s!x|jD]}|dVq
WdS(uE
        :return:
            An iterator of field key names
        iN(R�(R6R�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�4
scC`sV|jd	kr|j�nt�}x�t|j�D]�\}}|j|}|d	krcd}nb|jtkr�|r�|j|�j	d|�}q�|d|d|d}n|j	d|�}|drd|dkr|d|d�}|j	�|krq5qn|j
|�q5W|j�|_d	|_
|jdkrRd|_nd	S(
u
        Updates the .contents attribute of the value with the encoded value of
        all of the child objects

        :param force:
            Ensure all contents are in DER format instead of possibly using
            cached BER-encoded data
        RRdiiiiudefaultiN(R�RR�RR�R�R&R�RRCtwritetgetvalueR�R_Rc(R6RdR3R�R�R�t
child_dumpt
default_value((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR=
s*

	
			c
C`s�|j}i|_g|_g|_x~t|j�D]m\}}t|�dkro|if}||j|<n||j|d<|jjt|d|d��q4W|j	dk	r�|j|j	d|j|j	df|_nx�t|j�D]�\}}|jdk	o|d|jk}|jdk	o?|jd|k}|sN|ra|jjd�q�|jj|d|d|d|ddf�q�WdS(uS
        Generates _field_map, _field_ids and _oid_nums for use in parsing
        iiiiN(
R&R�t
_field_idst_precomputed_specsR�R�R.R�R�t	_oid_pairRt	_oid_numst_spec_callbacks(R6R"R�tfieldthas_callbackt
is_mapped_oid((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR*b
s$				
%.""c	C`sM|j|\}}}|}d}|jdk	r�||jkr�|j|}||�}|r:|jtkr�t|�dkr�|\}}|dkr�|}d}q�q�|dkr�|}|}d}q�|}q:nc|jdk	r:|jd|kr:|j|jd�j}||j	kr:|j	|}|}q:n|||||fS(u
        Determine how a value for a field should be constructed

        :param index:
            The field number

        :return:
            A tuple containing the following elements:
             - unicode string of the field name
             - Asn1Value class of the field spec
             - Asn1Value class of the value spec
             - None or dict of params to pass to the field spec
             - None or Asn1Value class indicating the value spec was derived from an OID or a spec callback
        iiiN(
R�RRR&R�R.RRRZt
_oid_specs(	R6R�R�R
RRt
spec_overridetcallbacktoid((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR}
s.
!	"
c
C`s�|dkrd|krtS||k}t|t�}t|t�r�t|t�svttd|t	|����nt||�s�|�}|j
|j|j|j
�||_|}	q�|}	n�t||�r�|}	|r�|	j|�q�n�|s|r"t||�r"|||�}	ngt||�r:|}	n||�}	|r�|r�|d|	j�|�}|	|	jdf|_|}	nt|	|�}	|	S(u&
        Contructs an appropriate Asn1Value object for a field

        :param field_name:
            A unicode string of the field name

        :param field_spec:
            An Asn1Value class that is the field spec

        :param value_spec:
            An Asn1Value class that is the vaue spec

        :param field_params:
            None or a dict of params for the field spec

        :param value:
            The value to construct an Asn1Value object from

        :return:
            An instance of a child class of Asn1Value
        uoptionalu�
                    Can not set a native python value to %s, which has the
                    choice type of %s - value must be an instance of Asn1Value
                    R$N(RR�t
issubclassR�R�RRR,RR	R�R1R R3R�R�RCR&R�(
R6R	R
RRR$tspecs_differenttis_anytwrapperR
((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�
s>					
	c
C`sy|j}|jdkr�|jr�tgt|j�|_x�t|j�D]�\}\}}}d|krJ|j|r�|j|\}}}}	}n|j	|�\}}}}	}|j
||||	d�|j|<qJqJWndSy<g|_t|j�}
d}d}t|j�}
d}||
k}xU|r�|dkrct|j|
d|�\}}n||
k}||
kr|j|p�|j	|�\}}}}	}|	r�d|	ks�d|	kr�|j||d|dfkr�|t
kr�t}t|t�rRy5||	�}|j|d|d|d�t}WqRtk
rNqRXn|s�d|	krw|jjt�n|jj||	��|d7}t}q0q�q�n|dks�|r�t|t
�r�|}d}n|r�|||	|f}q$|||	f}n|
dkr|d|
krg}|d}xq|dkr�|j|}t|�d	krfPnd|dks�d|dkr�|j|d�n|d8}q7Wt|�dkr�d
nd}dj|�}ttd
|dtj|d�tj|d�|d||���n|}|rat|�}t|ttf�ra|jdt�qan|jj|�|d7}d}q0Wt|j�}x�||
kr|j|\}}}	d|	kr�|jj||	��n4d|	kr�|jjt�nttd|���|d7}q�WWnQttfk
rt}|j d}|j ddt!|�f||_ |�nXdS(uQ
        Parses the contents and generates Asn1Value objects based on the
        definitions from _fields.

        :param recurse:
            If child objects that are Sequence or SequenceOf objects should
            be recursively parsed

        :raises:
            ValueError - when an error occurs parsing child objects
        udefaultNiRwuoptionaliiiiusuu, u�
                        Data for field %s (%s class, %s method, tag %s) does
                        not match the field definition%s of %s
                        trecurseuV
                        Field "%s" is missing from structure
                        u
    while parsing %s("R&R�RR�R�R.R�R�RRRRRR�RjR R�R�R+R,R�R�RR/ROtMETHOD_NUM_TO_NAME_MAPRRR�RR�RR5R	(R6R$R"R�R%R�R	R
RRtcontents_lengtht
child_pointerRt	field_lentpartstagainRtchoice_matchttesterR�t
missed_fieldst
prev_fieldtprev_field_infotpluraltmissed_field_namesR�R<R5((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��
s�
		%
,		!+-


!	

 


%cC`s�t|t�s-ttdt|����n|jdkrcttdt|�t|����n|j	|}|j
|�}|dS(u
        Determines the spec to use for the field specified. Depending on how
        the spec is determined (_oid_pair or _spec_callbacks), it may be
        necessary to set preceding field values before calling this. Usually
        specs, if dynamic, are controlled by a preceding ObjectIdentifier
        field.

        :param field_name:
            A unicode string of the field name to get the spec for

        :return:
            A child class of asn1crypto.core.Asn1Value that the field must be
            encoded using
        uM
                field_name must be a unicode string, not %s
                u�
                Unable to retrieve spec for field %s in the class %s because
                _fields has not been set
                iN(RR
RRR	R�RR,R-R�R(R6R	R�R�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR|s	
cC`sB|jdkrdS|jdkr;|jdkrD|jdt�ny�t�|_x�t|j�D]|\}}|jt	kr�t
|�}||j|<ny|j|d}Wntk
r�t
|�}nX|j|j|<qcWWq;ttfk
r7}|jd}|jddt|�f||_|�q;Xn|jS(u�
        The a native Python datatype representation of this value

        :return:
            An OrderedDict or None. If an OrderedDict, all child values are
            recursively converted to native representation also.
        R$iiu
    while parsing %sN(R3RRSR�R�R+RR�R&R�RR�t
IndexErrorR
RZR,RR5R	(R6R�R�R�R<R5((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRZ�s*


%
cC`s�tt|�j||�|jdk	r�g|_xL|jD]>}|jtkrc|jj|�q;|jj|j��q;WndS(u 
        Copies the contents of another Sequence object to itself

        :param object:
            Another instance of the same class

        :param copy_func:
            An reference of copy.copy() or copy.deepcopy() to use when copying
            lists, dicts and objects
        N(	R{R�RHR�RR&R�R�RI(R6RTRUR�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRH�s	cC`s�|jdkr|j�nd|}t||�xX|D]P}|j|j|�}|tk	r:td||f�|j|d�q:q:WdS(uJ
        Show the binary data and parsed data in a tree structure
        u  u%s    Field "%s"iN(	R�RR�RVRR�R�R[RX(R6R\R]R	R�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRX�s



cC`s�|r|jd|�n|jr�|jdk	r�xut|j�D]a\}\}}}|j|tk	roqAnd|ksAd|kr�qAnttd|���qAWntj	|�S(u
        Encodes the value using DER

        :param force:
            If the encoded contents already exist, clear them and regenerate
            to ensure they are in DER format instead of BER format

        :return:
            A byte string of the DER-encoded value
        RdudefaultuoptionaluN
                    Field "%s" is missing from structure
                    N(
RR�R�RR�R�R,RRRC(R6RdR�R	R%R�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRC�s%N((RfRgRhR R1RbRR�R�RjRR�RR�RRRRRR=R�R3tsetterRRRR�R�RR�RR*RRR�RRZRHRXRC(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��sFA			
		.	9	-		%		/	I�	'!	RcB`seZdZdZdZdZdZdZe	Z
dZddddd�Ze
d��Zejd��Zd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Ze	d�Ze	d�Zd�Ze
d��Zd�Zdd�Ze	d�Z RS(u�
    Represents a sequence (ordered) of a single type of values from ASN.1 as a
    Python object with a list-like interface
    iiic
K`s|r||_ntj||�y�|dk	r=||_ny|dkr^|dk	r^|}n|dk	r�x*t|�D]\}}|j||�qwW|jdkr�|j�q�nWnQtt	fk
r
}|j
d}	|j
ddt|�f|	|_
|�nXdS(u
        Allows setting child objects and the _child_spec via the spec parameter
        before passing everything else along to Asn1Value.__init__()

        :param value:
            A native Python datatype to initialize the object value with

        :param default:
            The default value if no value is specified

        :param contents:
            A byte string of the encoded contents of the value

        :param spec:
            A class derived from Asn1Value to use to parse children
        iiu
    while constructing %sN(t_child_specRR=RR3R�R�RR,RR5R	(
R6R$R:R3RR#R�R�R<R5((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR= s"	
%cC`s6|jdkr|jS|j�r/|j�n|jS(u`
        :return:
            A byte string of the DER-encoded contents of the sequence
        N(R�RR�RR(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR3Ks

cC`s
||_dS(ue
        :param value:
            A byte string of the DER-encoded contents of the sequence
        N(R�(R6R$((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR3ZscC`sf|j}|jdk	rbxG|jD]9}t|t�sFt|t�r"|pU|j�}q"q"Wn|S(u~
        :return:
            A boolean - if the sequence or any children (recursively) have been
            mutated
        N(RR�RRR�RR(R6RR�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRcs	cC`s<|j|}|jtkr8t|�}||j|<n|S(u]
        Builds a child object if the child has only been parsed into a tuple so far
        (R�R&R�R(R6R�R�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRrs

cC`smt||j�r|}n�t|jt�rct|t�rE|}qttdt|����n�t|jt�rt|t�s�ttdt|�|jj	���nt||j�s�|j�}|j
|j|j|j
�||_|}n|}n|jd|�Si}|jjr5|jj|d<n|jjr`|jj|jjf|d<nt||�S(u
        Constructs a _child_spec value from a native Python data type, or
        an appropriate Asn1Value object

        :param value:
            A native Python value, or some child of Asn1Value

        :return:
            An object of type _child_spec
        u�
                    Can not set a native python value to %s where the
                    _child_spec is Any - value must be an instance of Asn1Value
                    u�
                    Can not set a native python value to %s where the
                    _child_spec is the choice type %s - value must be an
                    instance of Asn1Value
                    R$uexplicituimplicit(RR4R R�RR,RR	R�RfR�R1R R3R�R(R2R�(R6R$R
R#R�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR}s6						cC`s)|jdkr|j�nt|j�S(u1
        :return:
            An integer
        N(R�RR�R.(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�s
cC`s)|jdkr|j�n|j|�S(um
        Allows accessing children via index

        :param key:
            Integer index of child
        N(R�RR�R(R6Rp((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��s	
cC`s�|jdkr|j�n|j|�}|t|j�kru|jjd�|jdk	ru|jjd�qun||j|<|jdk	r�|j|j|j|<nt|_	dS(u�
        Allows overriding a child via index

        :param key:
            Integer index of child

        :param value:
            Native python datatype that will be passed to _child_spec to create
            new child object
        N(
R�RR�RR.R�RSRZR+R(R6RpR$R
((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��s


cC`s[|jdkr|j�n|jj|�|jdk	rN|jj|�nt|_dS(uk
        Allows removing a child via index

        :param key:
            Integer index of child
        N(R�RR�tpopRSR+R(R6Rp((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�s	
cc`sQ|jdkr|j�nx.tdt|j��D]}|j|�Vq5WdS(uA
        :return:
            An iter() of child objects
        iN(R�RR�R�R.R(R6R�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��s
cC`s�|dks|tkrtSt||j�sattdt|�t|j�t|����nx|D]}||krhtSqhWtS(u�
        :param item:
            An object of the type cls._child_spec

        :return:
            A boolean if the item is contained in this SequenceOf
        uy
                Checking membership in %s is only available for instances of
                %s, not %s
                N(	RR�RjRR4RRR	R+(R6titemR�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyt__contains__s		
cC`sn|jdkr|j�n|jj|j|��|jdk	ra|jj|jdj�nt|_dS(u�
        Allows adding a child to the end of the sequence

        :param value:
            Native python datatype that will be passed to _child_spec to create
            new child object
        i����N(	R�RR�R�RRSRZR+R(R6R$((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�(s

cC`s�|jdkr|j�nt�}x'|D]}|j|jd|��q,W|j�|_d|_|j	dkr�d|_	ndS(u�
        Encodes all child objects into the contents for this object

        :param force:
            Ensure all contents are in DER format instead of possibly using
            cached BER-encoded data
        RdRN(
R�RR�RRRCRR�R_Rc(R6RdR3R�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR<s	
	
	cC`s-y�g|_|jdkrdSt|j�}d}x�||kr�t|j|d|�\}}|jr}||jf}n|}|r�t|�}t|tt	f�r�|j
dt�q�n|jj|�q7WWnQt
tfk
r(}|jd}|jddt|�f||_|�nXdS(uU
        Parses the contents and generates Asn1Value objects based on the
        definitions from _child_spec.

        :param recurse:
            If child objects that are Sequence or SequenceOf objects should
            be recursively parsed

        :raises:
            ValueError - when an error occurs parsing child objects
        NiRwR$iu
    while parsing %s(R�R�RR.RR4RRR�RR�R+R�R,RR5R	(R6R$R&R'R)R�R<R5((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�Ps(
		
%cC`s|jS(u�
        Determines the spec to use for child values.

        :return:
            A child class of asn1crypto.core.Asn1Value that child values must be
            encoded using
        (R4(R6((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRss	cC`s�|jdkrdS|jdkr�|jdkrD|jdt�ny#g|D]}|j^qN|_Wq�ttfk
r�}|j	d}|j	ddt
|�f||_	|�q�Xn|jS(u�
        The a native Python datatype representation of this value

        :return:
            A list or None. If a list, all child values are recursively
            converted to native representation also.
        R$iiu
    while parsing %sN(R3RRSR�R�R+RZR,RR5R	(R6R�R<R5((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRZ~s
#
%
cC`s�tt|�j||�|jdk	r�g|_xL|jD]>}|jtkrc|jj|�q;|jj|j��q;WndS(u"
        Copies the contents of another SequenceOf object to itself

        :param object:
            Another instance of the same class

        :param copy_func:
            An reference of copy.copy() or copy.deepcopy() to use when copying
            lists, dicts and objects
        N(	R{RRHR�RR&R�R�RI(R6RTRUR�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRH�s	cC`sY|jdkr|j�nd|}t||�x|D]}|j|d�q:WdS(uJ
        Show the binary data and parsed data in a tree structure
        u  iN(R�RR�RVRX(R6R\R]R�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRX�s



cC`s&|r|jd|�ntj|�S(u
        Encodes the value using DER

        :param force:
            If the encoded contents already exist, clear them and regenerate
            to ensure they are in DER format instead of BER format

        :return:
            A byte string of the DER-encoded value
        Rd(RRRC(R6Rd((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRC�sN(!RfRgRhR R1RbRR�R�RjRR4R=R�R3R3RRRRR�R�RR�R7R�RR�RRZRHRXRC(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRs8+				7					
		#		
tSetcB`sGeZdZdZdZdZdZd�Ze	d�Z
e	d�ZRS(um
    Represents a set of fields (unordered) from ASN.1 as a Python object with a
    dict-like interface
    iiic
C`s�|j}i|_i|_g|_x{t|j�D]j\}}t|�dkro|if}||j|<n||j|d<||jt|d|d�<q4W|jdk	r�|j|jd|j|jdf|_
nx�t|j�D]�\}}|jdk	o|d|jk}|j
dk	o<|j
d|k}|sK|r^|jjd�q�|jj|d|d|d|ddf�q�WdS(uS
        Generates _field_map, _field_ids and _oid_nums for use in parsing
        iiiiN(
R&R�RRR�R�R.R�RRRRR�(R6R"R�RRR((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR*�s$				
".""cC`s>|j}|jdkr�|jr�tgt|j�|_x�t|j�D]�\}\}}}d|krJ|j|r�|j|\}}}}	}n|j	|�\}}}}	}|j
||||	d�|j|<qJqJWndSyi}
t|j�}d}d}
xw||kr�t|j|d|�\}}|d|df}|j
j|�}|dkr�ttd|
tj|d�tj|d�|d���n|j|p�|j	|�\}}}}	}|dks�|rt|t�r|}d}n|r|||	|f}n|||	f}|rkt|�}t|ttf�rk|jdt�qkn||
|<|
d7}
qWt|j�}xtd|�D]}||
kr�q�n|j|p�|j	|�\}}}}	}|dks|rt|t�r|}d}nt}|	s*t}nYd	|	krKd|	krKt}n8d	|	krdt|
|<nd|	kr�||	�|
|<n|r�ttd
|t|����q�q�Wg|_x+td|�D]}|jj|
|�q�WWnQttfk
r9}|j d}|j ddt|�f||_ |�nXdS(uQ
        Parses the contents and generates Asn1Value objects based on the
        definitions from _fields.

        :param recurse:
            If child objects that are Sequence or SequenceOf objects should
            be recursively parsed

        :raises:
            ValueError - when an error occurs parsing child objects
        udefaultNiRwiu�
                        Data for field %s (%s class, %s method, tag %s) does
                        not match any of the field definitions
                        iR$uoptionaluU
                        Missing required field "%s" from %s
                        u
    while parsing %s(!R&R�RR�R�R.R�R�RRRR3RRROR,RR/R%R R�RRR�RR�R+R�RjR	R�RR5(R6R$R"R�R%R�R	R
RRt	child_mapR&R't
seen_fieldR)R�RRR�ttotal_fieldsR�tmissingR<R5((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��s�
		%
,+!	
+!			
	
%c
C`s|jdkr|j�ng}x�t|j�D]w\}}|jd|�}|j|\}}}d|kr�||�j�|kr�q2q�n|j|j|f�q2W|jdd��dj	g|D]}	|	d^q��|_
d|_|jdkr
d|_ndS(uc
        Encodes all child objects into the contents for this object.

        This method is overridden because a Set needs to be encoded by
        removing defaulted fields and then sorting the fields by tag.

        :param force:
            Ensure all contents are in DER format instead of possibly using
            cached BER-encoded data
        RdudefaultRpcS`s|dS(Ni((tct((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyt<lambda>|sRiN(
R�RR�R�RCR�R�R tsortR�R�R_Rc(
R6Rdtchild_tag_encodingsR�R�tchild_encodingR�RRR=((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRbs
	)	N(RfRgRhRbR1R RRR*RjR�R(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR8�s	otSetOfcB`s eZdZdZed�ZRS(u~
    Represents a set (unordered) of a single type of values from ASN.1 as a
    Python object with a list-like interface
    icC`s�|jdkr|j�ng}x'|D]}|j|jd|��q)Wdjt|��|_d|_|j	dkr�d|_	ndS(uD
        Encodes all child objects into the contents for this object.

        This method is overridden because a SetOf needs to be encoded by
        sorting the child encodings.

        :param force:
            Ensure all contents are in DER format instead of possibly using
            cached BER-encoded data
        RdRN(
R�RR�R�RCR�R�R�R_Rc(R6Rdtchild_encodingsR�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�s

	(RfRgRhR RjR(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRB�stEmbeddedPdvcB`seZdZdZRS(u
    A sequence structure
    i(RfRgRhR (((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRD�st
NumericStringcB`seZdZdZdZRS(uK
    Represents a numeric string from ASN.1 as a Python unicode string
    iulatin1(RfRgRhR R�(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRE�stPrintableStringcB`seZdZdZdZRS(uM
    Represents a printable string from ASN.1 as a Python unicode string
    iulatin1(RfRgRhR R�(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRF�st
TeletexStringcB`seZdZdZdZRS(uK
    Represents a teletex string from ASN.1 as a Python unicode string
    iuteletex(RfRgRhR R�(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRG�stVideotexStringcB`seZdZdZRS(uI
    Represents a videotex string from ASN.1 as a Python byte string
    i(RfRgRhR (((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRH�st	IA5StringcB`seZdZdZdZRS(uH
    Represents an IA5 string from ASN.1 as a Python unicode string
    iuascii(RfRgRhR R�(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRI�stAbstractTimecB`seZdZed��ZRS(uK
    Represents a time from ASN.1 as a Python datetime.datetime object
    cC`s|jd
krd
S|jd
krt|�}tjd|�}|s|jd�}|j|�}|jdt	j
�|_q|j|dd!�}t|dd!�}t|d�}tdt
|�d	|�}|dkr�||8}n
||7}|jdt	j
�|_n|jS(u�
        The a native Python datatype representation of this value

        :return:
            A datetime.datetime object in the UTC timezone or None
        u[-\+]uZttzinfoii����i����i����thourstminutesN(R3RRSR
tretsearchR�t_date_by_lentreplaceRtutcR�Rtabs(R6tstringthas_timezonetdateRLRMtdelta((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRZ�s$	

(RfRgRhR�RZ(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRJ�stUTCTimecB`s&eZdZdZd�Zd�ZRS(uV
    Represents a UTC time from ASN.1 as a Python datetime.datetime object in UTC
    icC`sVt|t�r9|jd�}tr9|jd�}q9ntj||�d|_dS(u�
        Sets the value of the object

        :param value:
            A unicode string or a datetime.datetime object

        :raises:
            ValueError - when an invalid value is passed
        u
%y%m%d%H%M%SZuasciiN(	RRtstrftimeR>R�R�R4RRS(R6R$((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR4scC`s~t|�}t|dd!�}|dkr4d}nd}|dkrZtj||d�S|dkrztj||d	�S|S(
u�
        Parses a date from a string based on its length

        :param string:
            A unicode string to parse

        :return:
            A datetime.datetime object or a unicode string
        iii2u20u19i
u
%Y%m%d%H%Miu%Y%m%d%H%M%S(R.R�Rtstrptime(R6RTtstrlentyear_numR]((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRP#s	(RfRgRhR R4RP(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRXs	tGeneralizedTimecB`s&eZdZdZd�Zd�ZRS(u�
    Represents a generalized time from ASN.1 as a Python datetime.datetime
    object or asn1crypto.util.extended_datetime object in UTC
    icC`s\t|ttf�r?|jd�}tr?|jd�}q?ntj||�d|_	dS(u
        Sets the value of the object

        :param value:
            A unicode string, a datetime.datetime object or an
            asn1crypto.util.extended_datetime object

        :raises:
            ValueError - when an invalid value is passed
        u
%Y%m%d%H%M%SZuasciiN(
RRRRYR>R�R�R4RRS(R6R$((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR4Gsc
C`s�t|�}d
}|dkr'd}n?|dkr<d}n*|dkrQd}n|dkrfd}n|r�t|�d	kr�|d
d	!dkr�tjd|d	|�}td
|j|j|j|j|j	|j
|j�Stj||�S|S(u
        Parses a date from a string based on its length

        :param string:
            A unicode string to parse

        :return:
            A datetime.datetime object, asn1crypto.util.extended_datetime object or
            a unicode string
        i
u%Y%m%d%Hiu
%Y%m%d%H%Miu%Y%m%d%H%M%Siu%Y%m%d%H%M%S.%fiiu0000u2000N(R.RRRZRtmonthtdaythourtminutetsecondtmicrosecondRK(R6RTR[tdate_formattt((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRP]s0				%
(RfRgRhR R4RP(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR]?s	t
GraphicStringcB`seZdZdZdZRS(uK
    Represents a graphic string from ASN.1 as a Python unicode string
    iulatin1(RfRgRhR R�(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRf�st
VisibleStringcB`seZdZdZdZRS(uK
    Represents a visible string from ASN.1 as a Python unicode string
    iulatin1(RfRgRhR R�(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRg�st
GeneralStringcB`seZdZdZdZRS(uK
    Represents a general string from ASN.1 as a Python unicode string
    iulatin1(RfRgRhR R�(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRh�stUniversalStringcB`seZdZdZdZRS(uM
    Represents a universal string from ASN.1 as a Python unicode string
    iu	utf-32-be(RfRgRhR R�(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRi�stCharacterStringcB`seZdZdZdZRS(uM
    Represents a character string from ASN.1 as a Python unicode string
    iulatin1(RfRgRhR R�(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRj�st	BMPStringcB`seZdZdZdZRS(uG
    Represents a BMP string from ASN.1 as a Python unicode string
    iu	utf-16-be(RfRgRhR R�(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRk�sc	C`s�td|t|�t|�f�|jr^td|tj|jpGd�jd�f�n|jd
k	o�|j	d
k	o�|j
d
k	}|r�tj|j�}t
j|j	�}n|jd
k	r*x7|jD],\}}td|t
j|�|f�q�W|r�td||||j
f�q�nX|jr\|r�td||||j
f�q�n&|r�td||||j
f�ntd	|tj|jp�d�jd�f�d
S(u7
    Prints out basic information about an Asn1Value object. Extracted for reuse
    among different classes that customize the debug information.

    :param prefix:
        A unicode string of spaces to prefix output line with

    :param self:
        The object to print the debugging information about
    u%s%s Object #%su%s  Header: 0x%sRuutf-8u#%s    %s tag %s (explicitly tagged)u%s      %s %s %su&%s    %s %s tag %s (implicitly tagged)u%s    %s %s tag %su%s  Data: 0x%sN(R[R	RBR_tbinasciithexlifyR�RbRR1R R%ROR/R(R2R3(R]R6t
has_headertmethod_namet
class_nameR1R ((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRV�s,#	2-#	# cC`s�d|kr�|ddkr?|jdd�|df|d<n3|ddkrr|jdd�|df|d<n|d=|d=d|kr�|d=q�ndS(u�
    Converts old-style "tag_type" and "tag" params to "explicit" and "implicit"

    :param params:
        A dict of parameters to convert from tag_type/tag to explicit/implicit
    utag_typeuexplicituclassiutaguimplicitN(RO(R�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR��s##cC`s�t|�t}d|kr7|jtk	r�t}q�nyt|dt�r]|d\}}n|d}d}|jtkr�t}n+|jt|ks�|j|kr�t}n|j	d�|j
kr�t}n|r�|j|�S|S(u�
    Checks if a value is properly tagged based on the spec, and re/untags as
    necessary

    :param value:
        An Asn1Value object

    :param params:
        A dict of spec params

    :return:
        An Asn1Value that is properly tagged
    uimplicitucontextuexplicit(R�RjR2R+RR�R1R0R ROR(RQ(R$R�RQR1R ((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�s$

	"		
cC`s
|dkrdS|j}|j}t|�d|krqt|dt�r^|d\}}q�d}|d}nEd|kr�t|dt�r�|d\}}q�d}|d}n|dk	r�t|t�r�t|}n|jd|�}|jd|�}||fS(uP
    Builds a 2-element tuple used to identify fields by grabbing the class_
    and tag from an Asn1Value class and the params dict being passed to it

    :param params:
        A dict of params to pass to spec

    :param spec:
        An Asn1Value class

    :return:
        A 2-element integer tuple in the form (class_, tag)
    uexplicitiuimplicituclass_utagN(NN(	RR1R R�RR�RR0RO(R�Rtrequired_classtrequired_tag((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR�(s(		



iiiiii	i
iii
iiiiiiiiiiiiiiic	C`su|dk	rt|�n|dkr)tSt}	|dk	r.|oJd|k}
|
r'|jso|r'd|kr'|r�||�}n	|�}|j}t|�}
|}|}|}|}|}|p�d}x|
D]
\}}||kr$ttdt|�t	j
|�t	j
||����n|dkrittdt|�tj
d�tj
||����n||kr�ttdt|�||���nt|t
|��\}}|\}}}}}}||7}||}q�Wtd|d	itd6|�}||_||_||_t}	q�|rB|d
||�}n|d
|�}|tkr`q�t|t�r�|j|||�y$||j|_d}|j�Wq+ttfk
r�}|jd}|jddt|�f||_|�q+Xq�||jkrHttd
t|�t	j
|j�t	j
||����n||jkr�|dko{|jdko{|dk}|s�t|t�r�ttdt|�tj
|j�tj
||����q�||_t|_n||jkr�||jkr�ttdt|�|j|���q�n�|r-d|kr-t d
||�}|j}|}|}|ppd}xat|�D]S\}}t|t
|��\}}|\}}}}}}||7}||}q�Wtd|d	itd6|�}||j|_|j|pd7_||_t}	n�|t!krittdt	j
|�tj
|�|���nt!|}|d
|d|�}|dko�|jdko�|dk}|r�t|t�r�t|_n||_|	s�||_|p�d|_nd|_"|rqy|j|�Wqqttfk
rm}|jd}|jddt|�f||_|�qqXn|S(u
    Builds an Asn1Value object generically, or using a spec with optional params

    :param class_:
        An integer representing the ASN.1 class

    :param method:
        An integer representing the ASN.1 method

    :param tag:
        An integer representing the ASN.1 tag

    :param header:
        A byte string of the ASN.1 header (class, method, tag, length)

    :param contents:
        A byte string of the ASN.1 value

    :param trailer:
        A byte string of any ASN.1 trailer (only used by indefinite length encodings)

    :param spec:
        A class derived from Asn1Value that defines what class_ and tag the
        value should have, and the semantics of the encoded value. The
        return value will be of this type. If omitted, the encoded value
        will be decoded using the standard universal tag based on the
        encoded tag number.

    :param spec_params:
        A dict of params to pass to the spec object

    :param nested_spec:
        For certain Asn1Value classes (such as OctetString and BitString), the
        contents can be further parsed and interpreted as another Asn1Value.
        This parameter controls the spec for that sub-parsing.

    :return:
        An object of the type spec, or if not specified, a child of Asn1Value
    uno_explicituexplicitRu�
                        Error parsing %s - explicitly-tagged class should have been
                        %s, but %s was found
                        iu�
                        Error parsing %s - explicitly-tagged method should have
                        been %s, but %s was found
                        u�
                        Error parsing %s - explicitly-tagged tag should have been
                        %s, but %s was found
                        RRR3iu
    while parsing %su�
                        Error parsing %s - class should have been %s, but %s was
                        found
                        tuy
                            Error parsing %s - method should have been %s, but %s was found
                            un
                        Error parsing %s - tag should have been %s, but %s was found
                        uO
                Unknown element - %s class, %s method, tag %s
                R1N(#RR�R�RjR(treversedR,RR	R/ROR%RR.RR+R_RcR�RR�R�R3R�RR5R1RbR`RaR RiRt_UNIVERSAL_SPECSRS(R1RbR ReR3ttrailerRRtnested_spect
header_setR7R$toriginal_explicitt
explicit_infotparsed_classt
parsed_methodt
parsed_tagtto_parsetexplicit_headertexplicit_trailertexpected_classtexpected_tagR�R%t
parsed_headertparsed_trailerR<R5t	ber_indeftoriginal_value((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyRus�)
"					
				
%
	'				
		
'			
%
c	C`swt|�}t|||�\}}|r[|||kr[|||}td|��ntd|d||�|fS(u�
    Parses a byte string generically, or using a spec with optional params

    :param encoded_data:
        A byte string that contains BER-encoded data

    :param pointer:
        The index in the byte string to parse from

    :param spec:
        A class derived from Asn1Value that defines what class_ and tag the
        value should have, and the semantics of the encoded value. The
        return value will be of this type. If omitted, the encoded value
        will be decoded using the standard universal tag based on the
        encoded tag number.

    :param spec_params:
        A dict of params to pass to the spec object

    :param strict:
        A boolean indicating if trailing data should be forbidden - if so, a
        ValueError will be raised when trailing data exists

    :return:
        A 2-element tuple:
         - 0: An object of the type spec, or if not specified, a child of Asn1Value
         - 1: An integer indicating how many bytes were consumed
    u4Extra data - %d bytes of trailing data were providedRR(R.RR,R(	RRwRRRtencoded_lenR�tnew_pointerR�((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyR!Ws(kRht
__future__RRRRRRRlRIR�RNtsysRRt_errorsRt_ordereddictRt_typesR	R
RRR
tparserRRtutilRRRRtversion_infot	cStringIORRtxrangeR�R+R>tioRjtregisterR/R0R%tcompileR�R'RtobjectRRlRqR`R|R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�RR8RBRDRERFRGRHRIRJRXR]RfRgRhRiRjRkRVR�R�R�RuRRR!(((s5/tmp/pip-install-A1qMVe/asn1crypto/asn1crypto/core.pyt<module>/s"("	



6��,G6	��9�"{Q5Q"�!XTN5�)�D		���!���!				.8I
	
	
		,		(	-
�

https://t.me/AnonymousX5 - 2025