
    M jX                       S SK Jr  S SKrS SKJr  S SKJr  S SKJr  S SKJr  S SKJ	r	  S SK
Jr   " S	 S
\R                  5      r " S S\R                  S9r " S S\5      r " S S\5      r " S S5      r " S S\5      rg)    )annotationsN)utils)Encoding)ParameterFormat)PrivateFormat)PublicFormat)HashAlgorithmc                      \ rS rSrSrSrSrg)PBES   z%PBESv1 using SHA1 and 3-Key TripleDESz)PBESv2 using SHA256 PBKDF2 and AES256 CBC N)__name__
__module____qualname____firstlineno__PBESv1SHA1And3KeyTripleDESCBCPBESv2SHA256AndAES256CBC__static_attributes__r       ~/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/cryptography/hazmat/primitives/_serialization.pyr   r      s    $K!Jr   r   c                      \ rS rSrSrg)KeySerializationEncryption   r   Nr   r   r   r   r   r   r   r   r   r          r   r   )	metaclassc                      \ rS rSrSS jrSrg)BestAvailableEncryption   c                n    [        U[        5      (       a  [        U5      S:X  a  [        S5      eXl        g )Nr   !Password must be 1 or more bytes.)
isinstancebyteslen
ValueErrorpasswordselfr&   s     r   __init__ BestAvailableEncryption.__init__    s+    (E**c(mq.@@AA r   )r&   N)r&   r#   r   r   r   r   r)   r   r   r   r   r   r      s    !r   r   c                      \ rS rSrSrg)NoEncryption'   r   Nr   r   r   r   r-   r-   '   r   r   r-   c                  t    \ rS rSrSSSS.         S
S jjrSS jr    SS jr    SS jrSS jrS	r	g)!KeySerializationEncryptionBuilder+   N_kdf_rounds
_hmac_hash_key_cert_algorithmc               4    Xl         X l        X0l        X@l        g N)_formatr3   r4   r5   )r(   formatr3   r4   r5   s        r   r)   *KeySerializationEncryptionBuilder.__init__,   s     &$#6 r   c                    U R                   b  [        S5      e[        U[        5      (       d  [	        S5      eUS:  a  [        S5      e[        U R                  UU R                  U R                  S9$ )Nzkdf_rounds already setzkdf_rounds must be an integer   z%kdf_rounds must be a positive integerr2   )	r3   r%   r"   int	TypeErrorr0   r8   r4   r5   )r(   roundss     r   
kdf_rounds,KeySerializationEncryptionBuilder.kdf_rounds:   sm    '566&#&&;<<A:DEE0LL $ 8 8	
 	
r   c                    U R                   [        R                  La  [        S5      eU R                  b  [        S5      e[        U R                   U R                  UU R                  S9$ )Nz2hmac_hash only supported with PrivateFormat.PKCS12zhmac_hash already setr2   )	r8   r   PKCS12r>   r4   r%   r0   r3   r5   r(   	algorithms     r   	hmac_hash+KeySerializationEncryptionBuilder.hmac_hashK   sg     <<}333D  ??&4550LL((  $ 8 8	
 	
r   c                    U R                   [        R                  La  [        S5      eU R                  b  [        S5      e[        U R                   U R                  U R                  US9$ )Nz;key_cert_algorithm only supported with PrivateFormat.PKCS12zkey_cert_algorithm already setr2   )	r8   r   rC   r>   r5   r%   r0   r3   r4   rD   s     r   key_cert_algorithm4KeySerializationEncryptionBuilder.key_cert_algorithm\   sg     <<}333M  ##/=>>0LL(( )	
 	
r   c                    [        U[        5      (       a  [        U5      S:X  a  [        S5      e[	        U R
                  UU R                  U R                  U R                  S9$ )Nr   r!   )r@   rF   rI   )	r"   r#   r$   r%   _KeySerializationEncryptionr8   r3   r4   r5   r'   s     r   build'KeySerializationEncryptionBuilder.buildl   sV    (E**c(mq.@@AA*LL''oo#77
 	
r   )r8   r4   r3   r5   )
r9   r   r3   
int | Noner4   HashAlgorithm | Noner5   PBES | NonereturnNone)r?   r=   rR   r0   )rE   r	   rR   r0   )rE   r   rR   r0   )r&   r#   rR   r   )
r   r   r   r   r)   r@   rF   rI   rM   r   r   r   r   r0   r0   +   sv    
 #'+/+/77  	7
 )7 )7 
7
"
&
	*
"

	*
 

r   r0   c                  2    \ rS rSr          SS jrSrg)rL   y   c               @    Xl         X l        X0l        X@l        XPl        g r7   )r8   r&   r3   r4   r5   )r(   r9   r&   r@   rF   rI   s         r   r)   $_KeySerializationEncryption.__init__z   s      %##5 r   )r8   r4   r3   r5   r&   N)
r9   r   r&   r#   r@   rO   rF   rP   rI   rQ   r+   r   r   r   rL   rL   y   s7    66 6
 6 (6 (6r   rL   )
__future__r   abccryptographyr   "cryptography.hazmat.bindings._rustr   r   r   r   %cryptography.hazmat.primitives.hashesr	   Enumr   ABCMetar   r   r-   r0   rL   r   r   r   <module>r_      sz   
 # 
  C N K ?K5:: K
	3;; 	!8 !	- 	K
 K
\6"< 6r   