
    9 j9                       d dl mZ d dlZd dlZd dlZd dlZd dlZej        dk     rd dlZej	        Z	nej	        Z	d dl
mZ ej        dk     r ed          Znej        Z ej        dd          Z ej        d	          Z ej        d
e	          Z ej        d           G d dej        eef                               Zej        Zej        Zd0dZd1dZd2dZd3dZd4d#Zd5d'Zd5d(Zej        dk     r7 ej        d)          d6d*            Z ej        d)          d6d+            Z n6 ej        d)          d6d,            Z ej        d)          d6d-            Z  ej        d           G d. d/ej        e                               Z!ej"        Z"ej#        j$        Z$ej#        j%        Z%ej&        Z&ej'        Z'ej(        Z(ej)        Z)ej*        Z*ej+        Z+ej,        Z-ej.        Z.dS )7    )annotationsN)      )declarative_asn1r   
   TT)	covariantUTag)bound)frozenc                  (    e Zd ZU dZded<   ded<   dS )Varianta  
    A tagged variant for CHOICE fields with the same underlying type.

    Use this when you have multiple CHOICE alternatives with the same type
    and need to distinguish between them:

        foo: (
            Annotated[Variant[int, typing.Literal["IntA"]], Implicit(0)]
            | Annotated[Variant[int, typing.Literal["IntB"]], Implicit(1)]
        )

    Usage:
        example = Example(foo=Variant(5, "IntA"))
        decoded.foo.value  # The int value
        decoded.foo.tag    # "IntA" or "IntB"
    r   valuestrtagN)__name__
__module____qualname____doc____annotations__     qC:\Users\Terasoftware\OneDrive\Desktop\faahhh\fyndo\fyndo\venv\Lib\site-packages\cryptography/hazmat/asn1/asn1.pyr   r       s.          " HHHHHHHHr   r   
field_typetypereturnboolc                    t          t          d          rt          j        t          j        fnt          j        f}t          j        |           |v S )N	UnionType)hasattrtypesr!   typingUnion
get_origin)r   union_typess     r   	_is_unionr(   ;   sH     5+&&	&,''l_ 
 Z((K77r   metadatatuple
field_namer   declarative_asn1.Annotationc                   d }d }d }| D ]}t          |t                    r|t          d| d          |j        }4t          |t          j                  r|t          d| d          |}ft          |t          j                  r|t          d| d          |}t          d|           t	          j        |||          S )Nz-multiple DEFAULT annotations found in field ''z7multiple IMPLICIT/EXPLICIT annotations found in field 'z*multiple SIZE annotations found in field 'zunsupported annotation: )defaultencodingsize)
isinstanceDefault	TypeErrorr   r   EncodingSize
Annotation)r)   r+   r/   r0   r1   raw_annotations         r   _extract_annotationr9   G   sE    GHD" I Ing.. 	I &"& & &   %*GG(8(ABB 	I &"& & &   &HH(8(=>> 	I NNNN   "DDG~GGHHH&(   r   
typing.Anydeclarative_asn1.AnnotatedTypec                N	   t          j        |           t           j        u r,t          | j                  }t          j        |           ^} }nt          j                    }|j        ft          j        |           t          j
        t          fvr?| t          j        t          j        t          t          t           fvrt#          d d          | t$          u rGt'          |j        t*                    rt#          d d          |j        t#          d d          t/          | d          r{| j        }t'          |t          j        j        t          j        j        f          st#          d|           t          j        t          j        t          j        |          |          S t=          |           rt          j        |           }t?          |          dk    rt@          |v r|d         tC          d           u r|d	         n|d         }|t$          u rt#          d
          tE          |          }|j#        $                                st#          d          |j        t#          d          t          j        %                    |          }nt'          |j        t*                    rt#          d          fd|D             }	|	d	         j&        d utO          fd|	D                       rt#          d          r;d |	D             }
t?          |	          t?          |
          k    rt#          d          t          j        (                    |	          }t@          |v rCt          j        %                    t          j        |t          j                                        n|}nt          j        |           t          j
        u rHtE          t          j        |           d	                   }t          j        )                    |          }nwt          j        |           t          u rHtE          t          j        |           d	                   }t          j                            |          }nt          j*        |           }t          j        ||          S )Nzfield 'z' has a SIZE annotation, but SIZE annotations are only supported for fields of types: [SEQUENCE OF, SET OF, BIT STRING, OCTET STRING, UTF8String, PrintableString, IA5String]zW' has an IMPLICIT annotation, but IMPLICIT annotations are not supported for TLV types.zT' has a DEFAULT annotation, but DEFAULT annotations are not supported for TLV types.__asn1_root__zunsupported root type:       r   z=optional TLV types (`TLV | None`) are not currently supportedzoptional (`X | None`) types cannot have `X` annotated: annotations must apply to the union (i.e: `Annotated[X | None, annotation]`)z@optional (`X | None`) types should not have a DEFAULT annotationzCCHOICE (`X | Y | ...`) types should not have an IMPLICIT annotationc                R    g | ]#}|t          d           ut          |          $S N)r   _type_to_variant).0argr+   s     r   
<listcomp>z)_normalize_field_type.<locals>.<listcomp>   sD       d4jj( j11  r   c              3  2   K   | ]}|j         d uk    V  d S rA   tag_name)rC   vare_union_types_taggeds     r   	<genexpr>z(_normalize_field_type.<locals>.<genexpr>   sD         4',BB     r   zbWhen using `asn1.Variant` in a union, all the other types in the union must also be `asn1.Variant`c                    h | ]	}|j         
S r   rG   )rC   rI   s     r   	<setcomp>z(_normalize_field_type.<locals>.<setcomp>   s    555q
555r   zBWhen using `asn1.Variant` in a union, the tags used must be unique)+r$   r&   	Annotatedr9   __metadata__get_argsr   r7   r1   builtinslistSetOfbytesr   	BitString	IA5StringPrintableStringr4   TLVr2   r0   Implicitr/   r"   r=   TypeSequenceSetAnnotatedTypecastr(   lenNoneTyper   _normalize_field_type
annotationis_emptyOptionrH   anyChoice
SequenceOfnon_root_python_to_rust)r   r+   rb   _	root_type
union_argsoptional_typeannotated_typerust_field_typevariantstagsrust_choice_type
inner_typerJ   s    `           @r   ra   ra   j   s>   
 $$(88 3()@*MM
44
QQ%022
 
*%%hmU-CC
NL


 *j * * *
 
 	
 S 
j)844 		H* H H H    	G* G G G  
 z?++ `O,	"+-=-B-FG
 
 	C AiAABBB-K(-y99:
 
 	
 
:		 VO_Z00
z??a G	H
$: G	 ",A$t**!<O
1*Q-  # *   3=*MMN!,5577 ?   ! !  
 /3::>JJOO *-x88 !     %  H &.a[%9%E"    !       E  
 & 55H555x==CII- #)  
  04;;HEE z)& %,,$2(*:*E*G*G    & O 
	:	&	&(-	7 O*OJ''*J
 

 +/:::FF		:	&	&%	/ O*OJ''*J
 

 +/55jAA*B:NN)/:FFFr   tdeclarative_asn1.Variantc                   t          j        |           t           j        u }|rt          j        |           d         n| }t          j        |          t          u rt          j        |          \  }}t          j        |          t           j        urt          d          t          j        |          d         }t          |d          r|j        }nt          j
        |          }|r)t          j        |t          | j        |                    }n&t          j        |t          j                              }t          j        t          ||          S t          j        |t          | |          d           S )Nr   zWhen using `asn1.Variant` in a type annotation, the second type parameter must be a `typing.Literal` type. E.g: `Variant[int, typing.Literal["MyInt"]]`.r=   )r$   r&   rN   rP   r   Literalr4   r"   r=   r   rh   r]   r9   rO   r7   ra   )	rs   r+   is_annotatedrr   
value_typetag_literalrH   	rust_typeann_types	            r   rB   rB      sn    $Q''6+;;L*6=##A&&AJ $$/ !
"(/*"="=
K[))? 	;  
 ?;//2:// 	M"0II(@LLI 		'5#ANJ?? HH
 (5 +-- H
  '8DDD  '!!Z00
 
 	
r   
raw_fieldsdict[str, type])dict[str, declarative_asn1.AnnotatedType]c                h    i }|                                  D ]\  }}t          ||          }|||<   |S rA   )itemsra   )r|   fieldsr+   r   annotated_field_types        r   _annotate_fieldsr   %  sM     F","2"2"4"4 2 2
J  5ZLL1zMr   clstype[U]Nonec                    t          j        | d          }t          j                            | t          |                    }t          | d|           d S NT)include_extrasr=   )r$   get_type_hintsr   rZ   r[   r   setattrr   r|   roots      r   _register_asn1_sequencer   2  sP    &s4@@@J ))#/?
/K/KLLDC$'''''r   c                    t          j        | d          }t          j                            | t          |                    }t          | d|           d S r   )r$   r   r   rZ   r\   r   r   r   s      r   _register_asn1_setr   9  sP    &s4@@@J $$S*::*F*FGGDC$'''''r   )kw_only_defaultc                    t           j        dk    r" t          j        dddd          |           }n t          j        dd          |           }t	          |           |S Nr   FTrepreq
match_argskw_only)r   r   )sysversion_infodataclasses	dataclassr   r   dataclass_clss     r   sequencer   F  s     w& 		K1 ! 	 	 	 	 	MMK1    M 	 ...r   c                    t           j        dk    r" t          j        dddd          |           }n t          j        dd          |           }t	          |           |S r   )r   r   r   r   r   r   s     r   setr   ]  s     w& 		K1 ! 	 	 	 	 	MMK1    M 	=)))r   c                f     t          j        dddd          |           }t          |           |S NFTr   )r   r   r   r   s     r   r   r   v  sN    
-	
 
 

   	 ...r   c                f     t          j        dddd          |           }t          |           |S r   )r   r   r   r   s     r   r   r     sN    
-	
 
 

   	=)))r   c                      e Zd ZU ded<   dS )r3   r   r   N)r   r   r   r   r   r   r   r3   r3     s         HHHHHr   r3   )r   r   r   r   )r)   r*   r+   r   r   r,   )r   r:   r+   r   r   r;   )rs   r:   r+   r   r   rt   )r|   r}   r   r~   )r   r   r   r   )r   r   r   r   )/
__future__r   rQ   r   r   r#   r$   r   typing_extensionsLiteralString"cryptography.hazmat.bindings._rustr   r   r`   TypeVarr	   r   r   r   Genericr   
decode_der
encode_derr(   r9   ra   rB   r   r   r   dataclass_transformr   r   r3   rS   r5   ExplicitrY   r6   rW   rV   UTCTimeGeneralizedTimerU   TlvrX   Nullr   r   r   <module>r      sw  
 # " " " " "      



  g )%3MM(M ? ? ? ? ? ?g tDzzHH~HFN3$'''FN3fnU-000 d###    fnQV$   $#, (
(
	8 	8 	8 	8       FKG KG KG KG`(
 (
 (
 (
V
 
 
 
( ( ( (( ( ( ( g J**4@@@   A@, +*4@@@   A@ 0  V555
 
 
 65
  V555
 
 
 65
 d###    fnQ   $# 	$-$-"2&	

""2&	r   