HEX
Server: LiteSpeed
System: Linux server.nevid-deploma.com 4.18.0-553.111.1.lve.el8.x86_64 #1 SMP Fri Mar 13 13:42:17 UTC 2026 x86_64
User: smilepac (1037)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/cppython/lib/python3.8/site-packages/oauth2client/__pycache__/_pycrypto_crypt.cpython-38.pyc
U

KD�g�@sddZddlmZddlmZddlmZddlmZddl	m
Z
Gdd�de�ZGd	d
�d
e�Z
dS)z2pyCrypto Crypto-related routines for oauth2client.�)�SHA256)�RSA)�
PKCS1_v1_5)�DerSequence)�_helpersc@s,eZdZdZdd�Zdd�Zedd��ZdS)	�PyCryptoVerifierz$Verifies the signature on a message.cCs
||_dS)z�Constructor.

        Args:
            pubkey: OpenSSL.crypto.PKey (or equiv), The public key to verify
            with.
        N)�_pubkey)�self�pubkey�r�I/opt/cppython/lib/python3.8/site-packages/oauth2client/_pycrypto_crypt.py�__init__szPyCryptoVerifier.__init__cCs(tj|dd�}t�|j��t�|�|�S)a�Verifies a message against a signature.

        Args:
            message: string or bytes, The message to verify. If string, will be
                     encoded to bytes as utf-8.
            signature: string or bytes, The signature on the message.

        Returns:
            True if message was signed by the private key associated with the
            public key that this object was constructed with.
        �utf-8��encoding)r�	_to_bytesr�newr�verifyr)r	�message�	signaturerrrr$s
�zPyCryptoVerifier.verifycCs||rjt�|�}|�dd���}t�d�|dd���}t�}|�|�t�}|�|d�t�	|d�}n
t�	|�}t
|�S)a@Construct a Verified instance from a string.

        Args:
            key_pem: string, public key in PEM format.
            is_x509_cert: bool, True if key_pem is an X509 cert, otherwise it
                          is expected to be an RSA key in PEM format.

        Returns:
            Verifier instance.
        � �����r�)rr�replace�splitZ_urlsafe_b64decode�joinr�decoder�	importKeyr)Zkey_pemZis_x509_certZpemLinesZcertDerZcertSeqZtbsSeqr
rrr�from_string4s


zPyCryptoVerifier.from_stringN)�__name__�
__module__�__qualname__�__doc__r
r�staticmethodr rrrrrs
	rc@s.eZdZdZdd�Zdd�Zed
dd��Zd	S)�PyCryptoSignerz"Signs messages with a private key.cCs
||_dS)ztConstructor.

        Args:
            pkey, OpenSSL.crypto.PKey (or equiv), The private key to sign with.
        N)�_key)r	�pkeyrrrr
QszPyCryptoSigner.__init__cCs&tj|dd�}t�|j��t�|��S)z�Signs a message.

        Args:
            message: string, Message to be signed.

        Returns:
            string, The signature of the message for the given key.
        rr)rrrrr'�signr)r	rrrrr)Ys	zPyCryptoSigner.sign�
notasecretcCs0t�t�|��}|r t�|�}ntd��t|�S)a_Construct a Signer instance from a string.

        Args:
            key: string, private key in PEM format.
            password: string, password for private key file. Unused for PEM
                      files.

        Returns:
            Signer instance.

        Raises:
            NotImplementedError if the key isn't in PEM format.
        zpNo key in PEM format was detected. This implementation can only use the PyCrypto library for keys in PEM format.)rZ_parse_pem_keyrrr�NotImplementedErrorr&)�key�passwordZparsed_pem_keyr(rrrr es�zPyCryptoSigner.from_stringN)r*)r!r"r#r$r
r)r%r rrrrr&Ns
r&N)r$ZCrypto.HashrZCrypto.PublicKeyrZCrypto.SignaturerZCrypto.Util.asn1rZoauth2clientr�objectrr&rrrr�<module>s6