
    Ii                        S r SSKJrJrJrJr  SSKJr  SSKJ	r	  SSK
JrJr  SSKJrJrJrJrJrJrJrJr   " S S	\5      r " S
 S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r  " S S\5      r! " S S\5      r" " S  S!\\5      r# " S" S#\5      r$ " S$ S%\5      r% " S& S'\5      r& " S( S)\5      r' " S* S+\5      r( " S, S-\5      r) " S. S/\5      r* " S0 S1\5      r+ " S2 S3\5      r, " S4 S5\5      r- " S6 S7\5      r. " S8 S9\5      r/ " S: S;\5      r0 " S< S=\5      r1 " S> S?\5      r2 " S@ SA\5      r3 " SB SC\5      r4 " SD SE\\5      r5 " SF SG\5      r6 " SH SI\5      r7 " SJ SK\5      r8 " SL SM\5      r9\6\5Rt                  SN'    " SO SP\5      r; " SQ SR\\5      r<gS)Ta  
ASN.1 type classes for various algorithms using in various aspects of public
key cryptography. Exports the following items:

 - AlgorithmIdentifier()
 - AnyAlgorithmIdentifier()
 - DigestAlgorithm()
 - DigestInfo()
 - DSASignature()
 - EncryptionAlgorithm()
 - HmacAlgorithm()
 - KdfAlgorithm()
 - Pkcs5MacAlgorithm()
 - SignedDigestAlgorithm()

Other type classes are defined that help compose the types listed above.
    )unicode_literalsdivisionabsolute_importprint_function   )unwrap)
fill_width)int_from_bytesint_to_bytes)AnyChoiceIntegerNullObjectIdentifierOctetStringSequenceVoidc                   *    \ rS rSrS\4S\SS04/rSrg)AlgorithmIdentifier+   	algorithm
parametersoptionalT N)__name__
__module____qualname____firstlineno__r   r   _fields__static_attributes__r       6/venv/lib/python3.13/site-packages/asn1crypto/algos.pyr   r   +   s!    	&'	sZ./Gr!   r   c                   N   ^  \ rS rSrSr\" / SQ5      rS rS\0rU 4S jr	Sr
U =r$ )_ForceNullParameters2   z
Various structures based on AlgorithmIdentifier require that the parameters
field be core.Null() for certain OIDs. This mixin ensures that happens.
)
1.2.840.113549.1.1.11.2.840.113549.1.1.111.2.840.113549.1.1.121.2.840.113549.1.1.131.2.840.113549.1.1.141.3.14.3.2.262.16.840.1.101.3.4.2.42.16.840.1.101.3.4.2.12.16.840.1.101.3.4.2.22.16.840.1.101.3.4.2.3c                     U R                   S:X  a-  U S   R                  nXR                  ;   a  U R                  U   $ U S   R                  U R                  ;   a  [
        $ g )Nr   r   r   )	_oid_pairnative
_oid_specsdotted_null_algosr   )selfalgos     r"   _parameters_spec%_ForceNullParameters._parameters_specJ   sY    >>88$++D&t,,##t'7'77Kr!   r   c                    > [         [        U ]  X5      nUS:w  a  U$ U S   R                  U R                  ;  a  U$ U S   R
                  [        :w  a  U$ [        5       U S'   U$ )Nr   r   )superr$   __setitem__r5   r6   	__class__r   r   )r7   keyvalueresr>   s       r"   r=    _ForceNullParameters.__setitem___   si    ($;CG+J##4+;+;;J''4/J!V\
r!   r   )r   r   r   r   __doc__setr6   r9   _spec_callbacksr=   r    __classcell__)r>   s   @r"   r$   r$   2   s7       K	 	&O	 	r!   r$   c                   2    \ rS rSrSSSSSSSS	S
SSSS.rSrg)HmacAlgorithmIdk   des_macsha1sha224sha256sha384sha512
sha512_224
sha512_256sha3_224sha3_256sha3_384sha3_512)z1.3.14.3.2.10z1.2.840.113549.2.7z1.2.840.113549.2.8z1.2.840.113549.2.9z1.2.840.113549.2.10z1.2.840.113549.2.11z1.2.840.113549.2.12z1.2.840.113549.2.13z2.16.840.1.101.3.4.2.13z2.16.840.1.101.3.4.2.14z2.16.840.1.101.3.4.2.15z2.16.840.1.101.3.4.2.16r   Nr   r   r   r   _mapr    r   r!   r"   rH   rH   k   s-    "$&&''++#-#-#-#-Dr!   rH   c                   *    \ rS rSrS\4S\SS04/rSrg)HmacAlgorithm|   r   r   r   Tr   N)r   r   r   r   rH   r   r   r    r   r!   r"   rY   rY   |   s     	o&	sZ./Gr!   rY   c                   ~    \ rS rSr0 SS_SS_SS_SS	_S
S_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_S S!_S"S#_rS$rg%)&DigestAlgorithmId   z1.2.840.113549.2.2md2z1.2.840.113549.2.5md5r+   rK   r,   rL   r-   rM   r.   rN   r/   rO   z2.16.840.1.101.3.4.2.5rP   z2.16.840.1.101.3.4.2.6rQ   z2.16.840.1.101.3.4.2.7rR   z2.16.840.1.101.3.4.2.8rS   z2.16.840.1.101.3.4.2.9rT   z2.16.840.1.101.3.4.2.10rU   z2.16.840.1.101.3.4.2.11shake128z2.16.840.1.101.3.4.2.12shake256z2.16.840.1.101.3.4.2.17shake128_lenz2.16.840.1.101.3.4.2.18shake256_lenr   NrV   r   r!   r"   r\   r\      s    ee 	 	!(	
 	!( 	!( 	!( 	!, 	!, 	!* 	!* 	!* 	": 	": 	":  	">!" 	">#Dr!   r\   c                   *    \ rS rSrS\4S\SS04/rSrg)DigestAlgorithm   r   r   r   Tr   N)r   r   r   r   r\   r   r   r    r   r!   r"   re   re      s!    	'(	sZ./Gr!   re   c                   $    \ rS rSrS\4S\4/rSrg)
DigestInfo   digest_algorithmdigestr   N)r   r   r   r   re   r   r   r    r   r!   r"   rh   rh      s    	_-	;Gr!   rh   c                       \ rS rSrSS0rSrg)MaskGenAlgorithmId   z1.2.840.113549.1.1.8mgf1r   NrV   r   r!   r"   rm   rm      s    Dr!   rm   c                   6    \ rS rSrS\4S\SS04/rSrS\0r	Sr
g	)
MaskGenAlgorithm   r   r   r   Tr1   ro   r   N)r   r   r   r   rm   r   r   r2   re   r4   r    r   r!   r"   rq   rq      s4    	()	sZ./G
 ,IJr!   rq   c                       \ rS rSrSS0rSrg)TrailerField   r   trailer_field_bcr   NrV   r   r!   r"   rt   rt      s    	Dr!   rt   c                   ^    \ rS rSrS\SSS0S.4S\SS	SS0S
.S.4S\SSS.4S\SSS.4/rSr	g)RSASSAPSSParams   hash_algorithmr   r   rK   explicitdefaultmask_gen_algorithmr   ro   r1   salt_length      trailer_field   rv   r   N)
r   r   r   r   re   rq   r   rt   r   r    r   r!   r"   rx   rx      s{     '0	
 !!'#."7
	
 	
 -	
9$Gr!   rx   c                      \ rS rSr0 SS_SS_SS_SS_S	S_S
S_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS S!S"S#S$S%S&S'S(S)S*S+S,.Er0 S(S-_S)S._SS_SS	_S'S/_SS_SS_SS_SS
_SS_SS0_SS_SS_S S1_SS_S!S2_SS_S3SS4S5S6S7S8S9S:.ErS;rg<)=SignedDigestAlgorithmId   z1.3.14.3.2.3md5_rsaz1.3.14.3.2.29sha1_rsaz1.3.14.7.2.3.1md2_rsaz1.2.840.113549.1.1.2z1.2.840.113549.1.1.4z1.2.840.113549.1.1.5r*   
sha224_rsar'   
sha256_rsar(   
sha384_rsar)   
sha512_rsaz1.2.840.113549.1.1.10
rsassa_pssz1.2.840.10040.4.3sha1_dsaz1.3.14.3.2.13z1.3.14.3.2.27z2.16.840.1.101.3.4.3.1
sha224_dsaz2.16.840.1.101.3.4.3.2
sha256_dsaz1.2.840.10045.4.1
sha1_ecdsasha224_ecdsasha256_ecdsasha384_ecdsasha512_ecdsasha3_224_ecdsasha3_256_ecdsasha3_384_ecdsasha3_512_ecdsarsassa_pkcs1v15dsaecdsaed25519ed448)1.2.840.10045.4.3.11.2.840.10045.4.3.21.2.840.10045.4.3.31.2.840.10045.4.3.42.16.840.1.101.3.4.3.92.16.840.1.101.3.4.3.102.16.840.1.101.3.4.3.112.16.840.1.101.3.4.3.12r&   1.2.840.10040.4.11.2.840.10045.41.3.101.1121.3.101.113r   r   r&   r   r   r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r   N)r   r   r   r   rW   _reverse_mapr    r   r!   r"   r   r      s    !	!! 	)! 			!
 		! 	
! 	 ! 	 ! 	 ! 	 ! 	 ! 	Z! 	! 	! 	!,!  	!,!!" 	\#!$  .---"2#3#3#3 1"" A!DF"" 	) 	)	
 	1 	- 	' 	) 	* 	. 	- 	- 	. 	- 	-  	-!" 	-#$ .-2333 3Lr!   r   c                   V    \ rS rSrS\4S\SS04/rSrS\0r	\
S 5       r\
S	 5       rS
rg)SignedDigestAlgorithmi)  r   r   r   Tr1   r   c           
          U S   R                   n0 SS_SS_SS_SS_SS_SS_S	S_SS_S
S
_SS_SS_SS_SS_SS_SS_SS_SS_SSSSSSSSS.EnX;   a  X!   $ [        [        SU5      5      e)zl
:return:
    A unicode string of "rsassa_pkcs1v15", "rsassa_pss", "dsa",
    "ecdsa", "ed25519" or "ed448"
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   r   r   r   r   z>
            Signature algorithm not known for %s
            r3   
ValueErrorr   r7   r   algo_maps      r"   signature_algo$SignedDigestAlgorithm.signature_algo4  s9    %,,	
(
(
 )
 +	

 +
 +
 +
 0
 ,
 
 %
 %
 5
 '
 G
  G!
" G#
$ $%%%% 3
6  && 	
  	r!   c                     U S   R                   n0 SS_SS_SS_SS	_S
S_SS_SS_SS_SS	_SS_SS_SS	_SS_SS_SS_SS_SS_nX;   a  X!   $ US:X  a  U S   S   S   R                   $ [        [        SU5      5      e)z
:return:
    A unicode string of "md2", "md5", "sha1", "sha224", "sha256",
    "sha384", "sha512", "sha512_224", "sha512_256" or "shake256"
r   r   r^   r   r_   r   rK   r   rL   r   rM   r   rN   r   rO   r   r   r   r   r   r   r   r   r   r   ra   r   r   rz   z9
            Hash algorithm not known for %s
            r   r   s      r"   	hash_algoSignedDigestAlgorithm.hash_algoc  s6    %,,	
u
u
 
 (	

 (
 (
 (
 
 (
 (
 &
 H
 H
 H
 H
  x!
" Z#
&  &&$%&67DKKK 	
  	r!   r   N)r   r   r   r   r   r   r   r2   rx   r4   propertyr   r   r    r   r!   r"   r   r   )  s]    	-.	sZ./G
 ,IoJ , ,\ ' 'r!   r   c                   $    \ rS rSrS\4S\4/rSrg)
Pbkdf2Salti  	specifiedother_sourcer   N)r   r   r   r   r   r   _alternativesr    r   r!   r"   r   r     s    	k"	,-Mr!   r   c                   @    \ rS rSrS\4S\4S\SS04S\SS	S
004/rSrg)Pbkdf2Paramsi  saltiteration_count
key_lengthr   Tprfr}   r   rK   r   N)	r   r   r   r   r   r   rY   r   r    r   r!   r"   r   r     s<    		G$	wT 23		K+@AB	Gr!   r   c                       \ rS rSrSS0rSrg)KdfAlgorithmIdi  z1.2.840.113549.1.5.12pbkdf2r   NrV   r   r!   r"   r   r         Dr!   r   c                   6    \ rS rSrS\4S\SS04/rSrS\0r	Sr
g	)
KdfAlgorithmi  r   r   r   Tr1   r   r   N)r   r   r   r   r   r   r   r2   r   r4   r    r   r!   r"   r   r     s3    	n%	sZ./G ,I,Jr!   r   c                   4    \ rS rSrSrS\4S\4S\SS04/rSrg	)
DHParametersi  zb
Original Name: DHParameter
Source: ftp://ftp.rsasecurity.com/pub/pkcs/ascii/pkcs-3.asc section 9
pgprivate_value_lengthr   Tr   N)r   r   r   r   rC   r   r   r    r   r!   r"   r   r     s-     
g	g	:t*<=Gr!   r   c                       \ rS rSrSS0rSrg)KeyExchangeAlgorithmIdi  z1.2.840.113549.1.3.1dhr   NrV   r   r!   r"   r   r     s    Dr!   r   c                   6    \ rS rSrS\4S\SS04/rSrS\0r	Sr
g	)
KeyExchangeAlgorithmi  r   r   r   Tr1   r   r   N)r   r   r   r   r   r   r   r2   r   r4   r    r   r!   r"   r   r     s4    	,-	sZ./G ,IlJr!   r   c                   *    \ rS rSrS\SS04S\4/rSrg)	Rc2Paramsi  rc2_parameter_versionr   Tivr   N)r   r   r   r   r   r   r   r    r   r!   r"   r   r     s     	 'J+=>	{Gr!   r   c                       \ rS rSrSS0rSrg)Rc5ParamVersioni     zv1-0r   NrV   r   r!   r"   r   r     s    
FDr!   r   c                   6    \ rS rSrS\4S\4S\4S\SS04/rSrg	)
	Rc5Paramsi  versionroundsblock_size_in_bitsr   r   Tr   N)	r   r   r   r   r   r   r   r   r    r   r!   r"   r   r     s0    	O$	7	w'	{Z./	Gr!   r   c                   $    \ rS rSrS\4S\4/rSrg)Pbes1Paramsi  r   
iterationsr   Nr   r   r   r   r   r   r   r    r   r!   r"   r   r     s    		wGr!   r   c                   $    \ rS rSrS\4S\4/rSrg)	CcmParamsi  	aes_nonce
aes_icvlenr   Nr   r   r!   r"   r   r     s     
k"	wGr!   r   c                       \ rS rSrSS0rSrg)PSourceAlgorithmIdi  z1.2.840.113549.1.1.9p_specifiedr   NrV   r   r!   r"   r   r     s    Dr!   r   c                   6    \ rS rSrS\4S\SS04/rSrS\0r	Sr
g	)
PSourceAlgorithmi  r   r   r   Tr1   r   r   N)r   r   r   r   r   r   r   r2   r   r4   r    r   r!   r"   r   r     s4    	()	sZ./G
 ,I{Jr!   r   c                   V    \ rS rSrS\SSS0S.4S\SS	SS0S
.S.4S\SSSS
.S.4/rSrg)RSAESOAEPParamsi  rz   r   r   rK   r{   r~   r   ro   r1   p_source_algorithmr   r   r!   r   N)	r   r   r   r   re   rq   r   r   r    r   r!   r"   r   r     sk     '0	
 !!'#."7
	
 !!."%
	
)Gr!   r   c                   >    \ rS rSrSrS\4S\4/r\S 5       rS r	Sr
g)	DSASignaturei(  z
An ASN.1 class for translating between the OS crypto library's
representation of an (EC)DSA signature and the ASN.1 structure that is part
of various RFCs.

Original Name: DSS-Sig-Value
Source: https://tools.ietf.org/html/rfc3279#section-2.2.2
rsc                 ~    [        US[        U5      S-   5      n[        U[        U5      S-  S 5      nU " X#S.5      $ )z
Reads a signature from a byte string encoding accordint to IEEE P1363,
which is used by Microsoft's BCryptSignHash() function.

:param data:
    A byte string from BCryptSignHash()

:return:
    A DSASignature object
r   r   N)r   r   )r
   len)clsdatar   r   s       r"   
from_p1363DSASignature.from_p13637  sD     4#d)q.124D	Q01#$$r!   c                     [        U S   R                  5      n[        U S   R                  5      n[        [        U5      [        U5      5      n[	        X5      n[	        X#5      nX-   $ )z
Dumps a signature to a byte string compatible with Microsoft's
BCryptVerifySignature() function.

:return:
    A byte string compatible with BCryptVerifySignature()
r   r   )r   r3   maxr   r	   )r7   r_bytess_bytesint_byte_lengths       r"   to_p1363DSASignature.to_p1363H  s]     tCy//0tCy//0c'lCL9W6W6  r!   r   N)r   r   r   r   rC   r   r   classmethodr   r   r    r   r!   r"   r   r   (  s7     
g	gG
 % % !r!   r   c                      \ rS rSr0 SS_SS_SS_SS	_S
S_SS_SS_SS_SS_SS_SS_SS_SS_SS_SS_S S!_S"S#_0 S$S%_S&S'_S(S)_S*S+_S,S-_S.S/_S0S1_S2S3_S4S5_S6S7_S8S9_S:S;_S<S=_S>S?_S@SA_SBSC_SDSE_ESFSGSHSISJSKSLSMSNSOSP.
ErSQrgR)SEncryptionAlgorithmIdi[  z1.3.14.3.2.7desz1.2.840.113549.3.7tripledes_3keyz1.2.840.113549.3.2rc2z1.2.840.113549.3.4rc4z1.2.840.113549.3.9rc5z2.16.840.1.101.3.4.1.1
aes128_ecbz2.16.840.1.101.3.4.1.2
aes128_cbcz2.16.840.1.101.3.4.1.3
aes128_ofbz2.16.840.1.101.3.4.1.4
aes128_cfbz2.16.840.1.101.3.4.1.5aes128_wrapz2.16.840.1.101.3.4.1.6
aes128_gcmz2.16.840.1.101.3.4.1.7
aes128_ccmz2.16.840.1.101.3.4.1.8aes128_wrap_padz2.16.840.1.101.3.4.1.21
aes192_ecbz2.16.840.1.101.3.4.1.22
aes192_cbcz2.16.840.1.101.3.4.1.23
aes192_ofbz2.16.840.1.101.3.4.1.24
aes192_cfbz2.16.840.1.101.3.4.1.25aes192_wrapz2.16.840.1.101.3.4.1.26
aes192_gcmz2.16.840.1.101.3.4.1.27
aes192_ccmz2.16.840.1.101.3.4.1.28aes192_wrap_padz2.16.840.1.101.3.4.1.41
aes256_ecbz2.16.840.1.101.3.4.1.42
aes256_cbcz2.16.840.1.101.3.4.1.43
aes256_ofbz2.16.840.1.101.3.4.1.44
aes256_cfbz2.16.840.1.101.3.4.1.45aes256_wrapz2.16.840.1.101.3.4.1.46
aes256_gcmz2.16.840.1.101.3.4.1.47
aes256_ccmz2.16.840.1.101.3.4.1.48aes256_wrap_padz1.2.840.113549.1.5.13pbes2z1.2.840.113549.1.5.1pbes1_md2_desz1.2.840.113549.1.5.3pbes1_md5_desz1.2.840.113549.1.5.4pbes1_md2_rc2z1.2.840.113549.1.5.6pbes1_md5_rc2pbes1_sha1_despbes1_sha1_rc2pkcs12_sha1_rc4_128pkcs12_sha1_rc4_40pkcs12_sha1_tripledes_3keypkcs12_sha1_tripledes_2keypkcs12_sha1_rc2_128pkcs12_sha1_rc2_40rsaes_pkcs1v15
rsaes_oaep)
z1.2.840.113549.1.5.10z1.2.840.113549.1.5.11z1.2.840.113549.1.12.1.1z1.2.840.113549.1.12.1.2z1.2.840.113549.1.12.1.3z1.2.840.113549.1.12.1.4z1.2.840.113549.1.12.1.5z1.2.840.113549.1.12.1.6r&   z1.2.840.113549.1.1.7r   NrV   r   r!   r"   r  r  [  s   11.1 	e1 	e	1
 	e1 	!,1 	!,1 	!,1 	!,1 	!-1 	!,1 	!,1 	!"31 	"<1  	"<!1" 	"<#1$ 	"<%1& 	"='1( 	"<)1* 	"<+1, 	"#4-1. 	"</10 	"<112 	"<314 	"<516 	"=718 	"<91: 	"<;1< 	"#4=1@ 	 A1B 	C1D 	E1F 	G1H 	I1J "2!1#8#7#?#?#8#7 0 ,a1Dr!   r  c                   @   \ rS rSrS\4S\SS04/rSr0 S\_S\_S	\	_S
\
_S\_S\_S\_S\_S\_S\_S\_S\_S\_S\_S\_S\_S\_\\\\\\\\\S.	Er\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S  5       r\S! 5       rS"rg#)$EncryptionAlgorithmi  r   r   r   Tr1   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.  r0  c                 B   U S   R                   nUS:X  a  U S   S   S   R                   $ UR                  S5      S:X  aL  UR                  S5      S:w  a"  UR                  SS5      u  pUS	:X  a  g
US:X  a  g[        [	        SU5      5      e[        [	        SU5      5      e)z
Returns the name of the key derivation function to use.

:return:
    A unicode from of one of the following: "pbkdf1", "pbkdf2",
    "pkcs12_kdf"
r   r"  r   key_derivation_func._r   pbes1pbkdf1pkcs12
pkcs12_kdf~
                Encryption algorithm "%s" does not have a registered key
                derivation function
                zw
            Unrecognized encryption algorithm "%s", can not determine key
            derivation function
            r3   findsplitr   r   )r7   encryption_algor7  s      r"   kdfEncryptionAlgorithm.kdf  s     {+22g%%&;<[IPPP$*##C(B.%4%:%:3%B""g-#"h.'V      
  	r!   c                 8   U S   R                   nUS:X  a  U S   S   S   S   S   R                   $ UR                  S5      S:X  aA  UR                  S5      S:w  a  UR                  SS	5      u  p#nU$ [        [	        S
U5      5      e[        [	        SU5      5      e)z
Returns the HMAC algorithm to use with the KDF.

:return:
    A unicode string of one of the following: "md2", "md5", "sha1",
    "sha224", "sha256", "sha384", "sha512"
r   r"  r   r4  r   r5  r6  r7  r   r<  z}
            Unrecognized encryption algorithm "%s", can not determine key
            derivation hmac algorithm
            r=  )r7   r@  r7  	hmac_algos       r"   kdf_hmacEncryptionAlgorithm.kdf_hmac  s     {+22g%%&;<\J5QR]^eee$*##C(B."1"7"7Q"?a  V      
  	r!   c                 t   U S   R                   nUS:X  a>  U S   S   S   S   nUR                  S:X  a  [        [        S5      5      eUR                   $ UR	                  S5      S	:X  a<  UR	                  S
5      S	:w  a  U S   S   R                   $ [        [        SU5      5      e[        [        SU5      5      e)zU
Returns the byte string to use as the salt for the KDF.

:return:
    A byte string
r   r"  r   r4  r   r   z
                    Can not determine key derivation salt - the
                    reserved-for-future-use other source salt choice was
                    specified in the PBKDF2 params structure
                    r5  r6  r7  r<  zs
            Unrecognized encryption algorithm "%s", can not determine key
            derivation salt
            )r3   namer   r   r>  )r7   r@  r   s      r"   kdf_saltEncryptionAlgorithm.kdf_salt  s     {+22g%%&;<\J6RDyyN* "   ;;$*##C(B.L)&1888V      
  	r!   c                 (   U S   R                   nUS:X  a  U S   S   S   S   R                   $ UR                  S5      S:X  a<  UR                  S5      S:w  a  U S   S	   R                   $ [        [        S
U5      5      e[        [        SU5      5      e)z[
Returns the number of iterations that should be run via the KDF.

:return:
    An integer
r   r"  r   r4  r   r5  r6  r7  r   r<  zy
            Unrecognized encryption algorithm "%s", can not determine key
            derivation iterations
            )r3   r>  r   r   r7   r@  s     r"   kdf_iterations"EncryptionAlgorithm.kdf_iterations2  s     {+22g%%&;<\JK\]ddd$*##C(B.L),7>>>V      
  	r!   c                    U S   R                   nUSS S:X  a  SSSS.USS	    $ S
SS.nX;   a  X!   $ US:X  aA  U S   S   R                   nSS
SS.nX4;   a  XC   $ US:  a  U$ Uc  g[        [        S5      5      eUS:X  a/  U S   S   S   S   R                   nUb  U$ U S   S   R                  $ UR	                  S5      S:X  a  S
S
S
S
S
S
SSSSSSS.U   $ [        [        SU5      5      e)a  
Returns the key length to pass to the cipher/kdf. The PKCS#5 spec does
not specify a way to store the RC5 key length, however this tends not
to be a problem since OpenSSL does not support RC5 in PKCS#8 and OS X
does not provide an RC5 cipher for use in the Security Transforms
library.

:raises:
    ValueError - when the key length can not be determined

:return:
    An integer representing the length in bytes
r   r   r   aesr          aes128_aes192_aes256_      )r  r  r  r   r      )   x   :         zw
                Invalid RC2 parameter version found in EncryptionAlgorithm
                parameters
                r"  r4  r   encryption_schemer5  r6  r#  r$  r%  r&  r'  r(  r)  r*  r+  r,  r-  r.  @
            Unrecognized encryption algorithm "%s"
            )r3   r   r   r   r>  )r7   r@  cipher_lengthsr   encoded_key_bits_mapr   s         r"   r   EncryptionAlgorithm.key_lengthT  s     {+221Q5( a"	$ $  

 ,!22e#$($67N$O$V$V!
 $  %<+BB$+,,$,V   g%l+,AB<PQ]^eeJ%!! %&9:EEE$*!"!"!"!""#"#')&'.0.0')&'    	
  	r!   c                     U S   R                   nUSS [        / SQ5      ;   a  USS $ USS S:X  a  gUSS S	:X  a  gU[        / S
Q5      ;   a  gUS:X  a  U S   S   R                  $ [        [	        SU5      5      e)z
Returns the name of the encryption mode to use.

:return:
    A unicode string from one of the following: "cbc", "ecb", "ofb",
    "cfb", "wrap", "gcm", "ccm", "wrap_pad"
r   r   rW  rS  N   pbes1_cbcpkcs12_)r  r  r  r	  r"  r   r_  ra  )r3   rD   encryption_moder   r   rL  s     r"   rj  #EncryptionAlgorithm.encryption_mode  s     {+221Q3'H#II"12&&1Q8+1Q9,c"IJJg%%&9:JJJ 	
  	r!   c                 &   U S   R                   nUSS [        / SQ5      ;   a  gU[        / SQ5      ;   a  U$ US:X  a  gUS	:X  a  U S
   S   R                  $ UR                  S5      S:X  a  SSSSSSSSSSSSS.U   $ [	        [        SU5      5      e)a4  
Returns the name of the symmetric encryption cipher to use. The key
length can be retrieved via the .key_length property to disabiguate
between different variations of TripleDES, AES, and the RC* ciphers.

:return:
    A unicode string from one of the following: "rc2", "rc5", "des",
    "tripledes", "aes"
r   r   rW  rS  rP  )r  r  r	  r  	tripledesr"  r   r_  r5  r6  r  r  r  r`  ra  )r3   rD   encryption_cipherr>  r   r   rL  s     r"   rn  %EncryptionAlgorithm.encryption_cipher  s     {+221Q3'H#IIc"788""..g%%&9:LLL$*!&!&!&!&"'"'',&+.9.9',&+    	
  	r!   c                 F   U S   R                   nUSS [        / SQ5      ;   a  gSSSS.nX;   a  X!   $ US:X  a  U S	   S
   R                   S-  $ US:X  a  U S	   S   R                  $ UR                  S5      S:X  a  SSSSSSSSSSSSS.U   $ [	        [        SU5      5      e)zu
Returns the block size of the encryption cipher, in bytes.

:return:
    An integer that is the block size in bytes
r   r   rW  rS  r   rX  )r  r  r  r	  r   r   r"  r_  r5  r6  r`  ra  )r3   rD   encryption_block_sizer>  r   r   )r7   r@  
cipher_maps      r"   rq  )EncryptionAlgorithm.encryption_block_size  s     {+221Q3'H#II 


 (..e#%&:;BBaGGg%%&9:PPP$*!"!"!"!""#"#'(&'././'(&'    	
  	r!   c                 .   U S   R                   nU[        SS/5      ;   a  U S   S   R                   $ [        / SQ5      nX;   a  U S   R                   $ US:X  a  U S   S   R                  $ UR                  S	5      S
:X  a  g[	        [        SU5      5      e)z
Returns the byte string of the initialization vector for the encryption
scheme. Only the PBES2 stores the IV in the params. For PBES1, the IV
is derived from the KDF and this property will return None.

:return:
    A byte string or None
r   r  r	  r   r   )r  r  r  r  r  r  r  r  r"  r_  r5  r6  Nra  )r3   rD   encryption_ivr>  r   r   )r7   r@  octet_string_iv_oidss      r"   ru  !EncryptionAlgorithm.encryption_iv9  s     {+22c5%.11%d+222  # 	$
 	  2%,,,g%%&9:HHH $* 	
  	r!   r   N)r   r   r   r   r  r   r   r2   r   r   r   r   r   r   r4   r   rA  rE  rI  rM  r   rj  rn  rq  ru  r    r   r!   r"   r2  r2    s   	+,	sZ./G
 ,I{+ 	y 	y	
 	k 	k 	k 	k 	k 	k 	i 	i 	i  	!" 	#$ 	%& 	'( &%*)&1&1*)%=JB & &P ! !F * *X  B \ \|  B . .` 0 0d - -r!   r2  c                   $    \ rS rSrS\4S\4/rSrg)Pbes2Paramsij  r4  r_  r   N)r   r   r   r   r   r2  r   r    r   r!   r"   ry  ry  j  s    	-	12Gr!   ry  c                   $    \ rS rSrS\4S\4/rSrg)Pbmac1Paramsiq  r4  message_auth_schemer   N)r   r   r   r   r   rY   r   r    r   r!   r"   r{  r{  q  s    	-	.Gr!   r{  c                       \ rS rSrSS0rSrg)
Pkcs5MacIdix  z1.2.840.113549.1.5.14pbmac1r   NrV   r   r!   r"   r~  r~  x  r   r!   r~  c                   0    \ rS rSrS\4S\4/rSrS\0r	Sr
g)Pkcs5MacAlgorithmi~  r   r   r1   r  r   N)r   r   r   r   r~  r   r   r2   r{  r4   r    r   r!   r"   r  r  ~  s,    	j!	sG
 ,I,Jr!   r  r"  c                       \ rS rSr0 rS rSrg)AnyAlgorithmIdi  c                     U R                   R                  n[        [        [        4 H*  nUR                  R                  5        H	  u  p4XAU'   M     M,     g N)r>   rW   r  r   r\   items)r7   rW   	other_clsoidrH  s        r"   _setupAnyAlgorithmId._setup  sE    ~~""/1HJ[\I&^^113	 S	 4 ]r!   r   N)r   r   r   r   rW   r  r    r   r!   r"   r  r    s    D!r!   r  c                   8    \ rS rSrS\4S\SS04/rSr0 rS r	Sr
g	)
AnyAlgorithmIdentifieri  r   r   r   Tr1   c                     [         R                  " U 5        U R                  R                  n[        [
        4 H*  nUR                  R                  5        H	  u  p4XAU'   M     M,     g r  )r   r  r>   r4   r2  r   r  )r7   specsr  r  specs        r"   r  AnyAlgorithmIdentifier._setup  sP    ))-/DEI&11779	!c
 : Fr!   r   N)r   r   r   r   r  r   r   r2   r4   r  r    r   r!   r"   r  r    s1    	n%	sZ./G
 ,IJ"r!   r  N)=rC   
__future__r   r   r   r   _errorsr   _intr	   utilr
   r   corer   r   r   r   r   r   r   r   r   objectr$   rH   rY   r\   re   rh   rm   rq   rt   rx   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r2  ry  r{  r~  r  r4   r  r  r   r!   r"   <module>r     s  $ S R   .	 	 	"( 66 6r& "H ( ,*H  ) 	x 	7 %h %P>. >Bb0( bJ 8 % 8 
8 
- 8  g  (  ) 	x 	 h  F0!8 0!f2, 2jW. Wt( 8 ! 	 	 +6   w '!% !"18 "r!   