+
    io                        ^ RI Ht ^ RIt^ RIt^ RIt^ RIHt ^ RIHt	 ^ RI
HtHt ^ RIHt ^ RIHt  ! R R	]P$                  R
7      t]t]P+                  ]	P,                  P&                  4        ! R R]P$                  R
7      t]t]P+                  ]	P,                  P.                  4       ]	P,                  P2                  t]	P,                  P4                  tRR R lltR R ltR R ltR R ltR R ltR R lt R R lt!Rt"R R lt#R# )    )annotationsN)gcd)openssl)_serializationhashes)AsymmetricPadding)utilsc                  F   ] tR t^t]P
                  R R l4       t]]P
                  R R l4       4       t]P
                  R R l4       t	]P
                  R R l4       t
]P
                  R	 R
 l4       t]P
                  R R l4       t]P
                  R R l4       tRtR# )RSAPrivateKeyc               $    V ^8  d   QhRRRRRR/# )   
ciphertextbytespaddingr   return )formats   "t/home/wkmabra/.openclaw/workspace/venv/lib/python3.14/site-packages/cryptography/hazmat/primitives/asymmetric/rsa.py__annotate__RSAPrivateKey.__annotate__   s"      % 2C      c                    R# )z#
Decrypts the provided ciphertext.
Nr   )selfr   r   s   &&&r   decryptRSAPrivateKey.decrypt       r   c                   V ^8  d   QhRR/# r   r   intr   )r   s   "r   r   r            # r   c                    R# z'
The bit length of the public modulus.
Nr   r   s   &r   key_sizeRSAPrivateKey.key_size   r   r   c                   V ^8  d   QhRR/# r   r   RSAPublicKeyr   )r   s   "r   r   r   !   s      L r   c                    R# )z4
The RSAPublicKey associated with this private key.
Nr   r#   s   &r   
public_keyRSAPrivateKey.public_key    r   r   c               (    V ^8  d   QhRRRRRRRR/# )r   datar   r   r   	algorithm+asym_utils.Prehashed | hashes.HashAlgorithmr   r   )r   s   "r   r   r   '   s2       # ?	
 
r   c                    R# )z
Signs the data.
Nr   )r   r-   r   r.   s   &&&&r   signRSAPrivateKey.sign&   r   r   c                   V ^8  d   QhRR/# )r   r   RSAPrivateNumbersr   )r   s   "r   r   r   2   s      !2 r   c                    R# )z
Returns an RSAPrivateNumbers.
Nr   r#   s   &r   private_numbersRSAPrivateKey.private_numbers1   r   r   c               (    V ^8  d   QhRRRRRRRR/# )	r   encoding_serialization.Encodingr   z_serialization.PrivateFormatencryption_algorithmz)_serialization.KeySerializationEncryptionr   r   r   )r   s   "r   r   r   8   s3      ) - H	
 
r   c                    R# z&
Returns the key serialized as bytes.
Nr   )r   r9   r   r;   s   &&&&r   private_bytesRSAPrivateKey.private_bytes7   r   r   c                   V ^8  d   QhRR/# )r   r   r   r   )r   s   "r   r   r   C   s      - r   c                    R# z
Returns a copy.
Nr   r#   s   &r   __copy__RSAPrivateKey.__copy__B   r   r   r   N)__name__
__module____qualname____firstlineno__abcabstractmethodr   propertyr$   r*   r1   r6   r>   rC   __static_attributes__r   r   r   r   r      s     
   
 	 
 	  	 
 	  	 r   r   )	metaclassc                  p   ] tR t^Mt]P
                  R R l4       t]]P
                  R R l4       4       t]P
                  R R l4       t	]P
                  R R l4       t
]P
                  R	 R
 l4       t]P
                  R R l4       t]P
                  R R l4       t]P
                  R R l4       tRtR# )r(   c               $    V ^8  d   QhRRRRRR/# )r   	plaintextr   r   r   r   r   )r   s   "r   r   RSAPublicKey.__annotate__O   s"       1B u r   c                    R# )z
Encrypts the given plaintext.
Nr   )r   rP   r   s   &&&r   encryptRSAPublicKey.encryptN   r   r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   rQ   V   r    r   c                    R# r"   r   r#   s   &r   r$   RSAPublicKey.key_sizeT   r   r   c                   V ^8  d   QhRR/# )r   r   RSAPublicNumbersr   )r   s   "r   r   rQ   \   s       0 r   c                    R# )z
Returns an RSAPublicNumbers
Nr   r#   s   &r   public_numbersRSAPublicKey.public_numbers[   r   r   c               $    V ^8  d   QhRRRRRR/# )r   r9   r:   r   z_serialization.PublicFormatr   r   r   )r   s   "r   r   rQ   b   s(      ) , 
	r   c                    R# r=   r   )r   r9   r   s   &&&r   public_bytesRSAPublicKey.public_bytesa   r   r   c          
     ,    V ^8  d   QhRRRRRRRRRR	/# )
r   	signaturer   r-   r   r   r.   r/   r   Noner   )r   s   "r   r   rQ   l   s<     	 		 	 #		
 ?	 
	r   c                    R# )z%
Verifies the signature of the data.
Nr   )r   rb   r-   r   r.   s   &&&&&r   verifyRSAPublicKey.verifyk   r   r   c               (    V ^8  d   QhRRRRRRRR/# )r   rb   r   r   r   r.   zhashes.HashAlgorithm | Noner   r   )r   s   "r   r   rQ   x   s2       # /	
 
r   c                    R# )z0
Recovers the original data from the signature.
Nr   )r   rb   r   r.   s   &&&&r   recover_data_from_signature(RSAPublicKey.recover_data_from_signaturew   r   r   c                    V ^8  d   QhRRRR/# )r   otherobjectr   boolr   )r   s   "r   r   rQ      s      F t r   c                    R# )z
Checks equality.
Nr   )r   rl   s   &&r   __eq__RSAPublicKey.__eq__   r   r   c                   V ^8  d   QhRR/# r'   r   )r   s   "r   r   rQ      s      , r   c                    R# rB   r   r#   s   &r   rC   RSAPublicKey.__copy__   r   r   r   N)rE   rF   rG   rH   rI   rJ   rS   rK   r$   r[   r_   re   ri   rp   rC   rL   r   r   r   r(   r(   M   s     
   
 	 
 	  		 	 	  	 
 	 r   r(   c               (    V ^8  d   QhRRRRRRRR/# )r   public_exponentr   r$   backendz
typing.Anyr   r   r   )r   s   "r   r   r      s6     L LLL L 	Lr   c                V    \        W4       \        P                  P                  W4      # N)_verify_rsa_parametersrust_opensslrsagenerate_private_key)rv   r$   rw   s   &&&r   r}   r}      s#    
 ?500KKr   c               $    V ^8  d   QhRRRRRR/# )r   rv   r   r$   r   rc   r   )r   s   "r   r   r      s&     A AC A3 A4 Ar   c                N    V R9  d   \        R4      hVR8  d   \        R4      hR# )   zopublic_exponent must be either 3 (for legacy compatibility) or 65537. Almost everyone should choose 65537 here!i   z$key_size must be at least 1024-bits.N)r   i  
ValueError)rv   r$   s   &&r   rz   rz      s6    j(?
 	

 $?@@ r   c               $    V ^8  d   QhRRRRRR/# )r   er   mr   r   )r   s   "r   r   r      s!     
 
s 
s 
s 
r   c                t    ^^ r2YrTV^ 8  d&   \        WE4      w  rgW&V,          ,
          pWWW83w  rEr#K,  W!,          # )zG
Modular Multiplicative Inverse. Returns x such that: (x*e) mod m == 1
)divmod)	r   r   x1x2abqrxns	   &&       r   _modinvr      sC     q
a%a|b&[R|b"6Mr   c               $    V ^8  d   QhRRRRRR/# )r   pr   r   r   r   )r   s   "r   r   r      s!      C C C r   c                J    V ^8:  g   V^8:  d   \        R4      h\        W4      # )z>
Compute the CRT (q ** -1) % p value from RSA primes p and q.
Values can't be <= 1)r   r   )r   r   s   &&r   rsa_crt_iqmpr      s'     	Ava/001=r   c               $    V ^8  d   QhRRRRRR/# )r   private_exponentr   r   r   r   )r   s   "r   r   r      !     & &3 &3 &3 &r   c                R    V ^8:  g   V^8:  d   \        R4      hW^,
          ,          # )z[
Compute the CRT private_exponent % (p - 1) value from the RSA
private_exponent (d) and p.
r   r   )r   r   s   &&r   rsa_crt_dmp1r      +    
 1Q/001u%%r   c               $    V ^8  d   QhRRRRRR/# )r   r   r   r   r   r   )r   s   "r   r   r      r   r   c                R    V ^8:  g   V^8:  d   \        R4      hW^,
          ,          # )z[
Compute the CRT private_exponent % (q - 1) value from the RSA
private_exponent (d) and q.
r   r   )r   r   s   &&r   rsa_crt_dmq1r      r   r   c               (    V ^8  d   QhRRRRRRRR/# )r   r   r   r   r   r   r   )r   s   "r   r   r      s(        C  C  C  C  r   c                    V ^8:  g   V^8:  g   V^8:  d   \        R4      hV^,
          V^,
          ,          \        V^,
          V^,
          4      ,          p\        W4      # )z
Compute the RSA private_exponent (d) given the public exponent (e)
and the RSA primes p and q.

This uses the Carmichael totient function to generate the
smallest possible working value of the private exponent.
r   )r   r   r   )r   r   r   lambda_ns   &&& r   rsa_recover_private_exponentr      sT    " 	Ava16/00A!a% CAq1u$55H1r   i  c               (    V ^8  d   QhRRRRRRRR/# )r   nr   r   dr   ztuple[int, int]r   )r   s   "r   r   r      s(     - - - - - -r   c                   V^8:  g   V^8:  d   \        R4      h^\        ^W,          V 4      8w  d   \        R4      hW!,          ^,
          pTpV^,          ^ 8X  d   V^,          pK  Rp^ pV'       g   V\        8  d   \        P                  ! ^V ^,
          4      pV^,          pTpW8  g   KD  \        WxV 4      p	V	^8w  d7   W^,
          8w  d*   \        V	^V 4      ^8X  d   \        V	^,           V 4      p
RpK  V^,          pK\  V'       g   \        R4      h\        V X
4      w  rV^ 8X  g   Q h\        W3RR7      w  rW3# )z
Compute factors p and q from the private exponent d. We assume that n has
no more than two factors. This function is adapted from code in PyCrypto.
zd, e can't be <= 1zn, d, e don't matchFTz2Unable to compute factors p and q from exponent d.)reverse)r   pow_MAX_RECOVERY_ATTEMPTSrandomrandintr   r   sorted)r   r   r   ktottspottedtriesr   kcandr   r   r   s   &&&          r   rsa_recover_prime_factorsr      s*    	Ava-..	SQUA.//519D 	A
a%1*F GE%"88NN1a!e$
hqQ<DqyT!e_T1aA1E q!$FAMNN!Q<DA6M61&$'DA6Mr   ry   )$
__future__r   rI   r   typingmathr   "cryptography.hazmat.bindings._rustr   r{   cryptography.hazmat.primitivesr   r   *cryptography.hazmat.primitives._asymmetricr   )cryptography.hazmat.primitives.asymmetricr	   
asym_utilsABCMetar   RSAPrivateKeyWithSerializationregisterr|   r(   RSAPublicKeyWithSerializationr4   rY   r}   rz   r   r   r   r   r   r   r   r   r   r   <module>r      s   
 # 
    F A H I4ckk 4n "/    |''55 6?S[[ ?D !-    l&&33 4 $$66 ##44 LA
&& 2  -r   