
    bi                         S 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r	 " S S	\R                  5      r " S
 S\R                  \R                  5      rg)z
RSA cryptography signer and verifier.

This file provides a shared wrapper, that defers to _python_rsa or _cryptography_rsa
for implmentations using different third party libraries
    )RSAPrivateKey)RSAPublicKey)_helpers)_cryptography_rsa)basezrsa.keyc                   r    \ rS rSrSrS r\R                  " \R                  5      S 5       r
\S 5       rSrg)RSAVerifier    ay  Verifies RSA cryptographic signatures using public keys.

Args:
    public_key (Union["rsa.key.PublicKey", cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey]):
        The public key used to verify signatures.
Raises:
    ImportError: if called with an rsa.key.PublicKey, when the rsa library is not installed
    ValueError: if an unrecognized public key is provided
c                    UR                   R                  n[        U[        5      (       a  [        nO:UR                  [        5      (       a	  SSKJn  UnO[        S[        U5       35      eUR                  U5      U l        g )Nr   _python_rsazunrecognized public key type: )	__class__
__module__
isinstancer   r   
startswithRSA_KEY_MODULE_PREFIXgoogle.auth.cryptr   
ValueErrortyper	   _impl)self
public_key
module_strimpl_libr   s        @/app/.venv/lib/python3.13/site-packages/google/auth/crypt/rsa.py__init__RSAVerifier.__init__+   sj    ))44
j,//(H""#8995"H=d:>N=OPQQ))*5
    c                 8    U R                   R                  X5      $ N)r   verify)r   message	signatures      r   r!   RSAVerifier.verify7   s    zz  44r   c                 p    U R                  U 5      n[        R                  R                  U5      Ul        U$ )aB  Construct a Verifier instance from a public key or public
certificate string.

Args:
    public_key (Union[str, bytes]): The public key in PEM format or the
        x509 public key certificate.

Returns:
    google.auth.crypt.Verifier: The constructed verifier.

Raises:
    ValueError: If the public_key can't be parsed.
)__new__r   r	   from_stringr   )clsr   instances      r   r'   RSAVerifier.from_string;   s/     ;;s#*66BB:Nr   r   N)__name__r   __qualname____firstlineno____doc__r   r   copy_docstringr   Verifierr!   classmethodr'   __static_attributes__ r   r   r	   r	       sC    
6 T]]+5 ,5  r   r	   c                       \ rS rSrSrS	S jr\\R                  " \	R                  5      S 5       5       r\R                  " \	R                  5      S 5       r\S	S j5       rSrg)
	RSASignerO   a  Signs messages with an RSA private key.

Args:
    private_key (Union["rsa.key.PrivateKey", cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey]):
        The private key to sign with.
    key_id (str): Optional key ID used to identify this private key. This
        can be useful to associate the private key with its associated
        public key or certificate.

Raises:
    ImportError: if called with an rsa.key.PrivateKey, when the rsa library is not installed
    ValueError: if an unrecognized public key is provided
Nc                    UR                   R                  n[        U[        5      (       a  [        nO:UR                  [        5      (       a	  SSKJn  UnO[        S[        U5       35      eUR                  XS9U l        g )Nr   r   zunrecognized private key type: key_id)r   r   r   r   r   r   r   r   r   r   r   r6   r   )r   private_keyr:   r   r   r   s         r   r   RSASigner.__init__^   sm     **55
k=11(H""#8995"H>tK?P>QRSS'''C
r   c                 .    U R                   R                  $ r    )r   r:   )r   s    r   r:   RSASigner.key_idj   s     zz   r   c                 8    U R                   R                  U5      $ r    )r   sign)r   r"   s     r   r@   RSASigner.signo   s    zzw''r   c                 l    U R                  U 5      n[        R                  R                  XS9Ul        U$ )aV  Construct a Signer instance from a private key in PEM format.

Args:
    key (str): Private key in PEM format.
    key_id (str): An optional key id used to identify the private key.

Returns:
    google.auth.crypt.Signer: The constructed signer.

Raises:
    ValueError: If the key cannot be parsed as PKCS#1 or PKCS#8 in
        PEM format.
r9   )r&   r   r6   r'   r   )r(   keyr:   r)   s       r   r'   RSASigner.from_strings   s2     ;;s#*44@@@Tr   r+   r    )r,   r   r-   r.   r/   r   propertyr   r0   r   Signerr:   r@   r2   r'   r3   r4   r   r   r6   r6   O   so    
D T[[)! * ! T[[)( *(  r   r6   N)r/   -cryptography.hazmat.primitives.asymmetric.rsar   r   google.authr   r   r   r   r   r1   r	   rF   FromServiceAccountMixinr6   r4   r   r   <module>rJ      sK    H F   / "! ,$-- ,^5T99 5r   