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__/_openssl_crypt.cpython-38.pyc
U

KD�g��@sHdZddlmZddlmZGdd�de�ZGdd�de�Zdd	�Zd
S)z1OpenSSL Crypto-related routines for oauth2client.�)�crypto)�_helpersc@s,eZdZdZdd�Zdd�Zedd��ZdS)	�OpenSSLVerifierz$Verifies the signature on a message.cCs
||_dS)zlConstructor.

        Args:
            pubkey: OpenSSL.crypto.PKey, The public key to verify with.
        N)�_pubkey)�self�pubkey�r�H/opt/cppython/lib/python3.8/site-packages/oauth2client/_openssl_crypt.py�__init__szOpenSSLVerifier.__init__cCsRtj|dd�}tj|dd�}zt�|j||d�WdStjk
rLYdSXdS)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. If string,
                   will be encoded to bytes as utf-8.

        Returns:
            True if message was signed by the private key associated with the
            public key that this object was constructed with.
        �utf-8��encoding�sha256TFN)r�	_to_bytesr�verifyr�Error)r�message�	signaturerrr	r s
zOpenSSLVerifier.verifycCs4t�|�}|rt�tj|�}nt�tj|�}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.

        Raises:
            OpenSSL.crypto.Error: if the key_pem can't be parsed.
        )rrrZload_certificate�FILETYPE_PEM�load_privatekeyr)Zkey_pemZis_x509_certrrrr	�from_string5s

zOpenSSLVerifier.from_stringN)�__name__�
__module__�__qualname__�__doc__r
r�staticmethodrrrrr	rs
rc@s.eZdZdZdd�Zdd�Zed
dd��Zd	S)�
OpenSSLSignerz"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
OszOpenSSLSigner.__init__cCstj|dd�}t�|j|d�S)z�Signs a message.

        Args:
            message: bytes, Message to be signed.

        Returns:
            string, The signature of the message for the given key.
        rrr)rrr�signr)rrrrr	rWs	zOpenSSLSigner.sign�
notasecretcCsNt�|�}t�|�}|r(t�tj|�}ntj|dd�}t�||���}t|�S)a>Construct a Signer instance from a string.

        Args:
            key: string, private key in PKCS12 or PEM format.
            password: string, password for the private key file.

        Returns:
            Signer instance.

        Raises:
            OpenSSL.crypto.Error if the key can't be parsed.
        rr)	rrZ_parse_pem_keyrrr�load_pkcs12�get_privatekeyr)�key�passwordZparsed_pem_keyrrrr	rcs

zOpenSSLSigner.from_stringN)r )rrrrr
rrrrrrr	rLs
rcCs(t�|�}t�||�}t�tj|���S)aConvert the contents of a PKCS#12 key to PEM using pyOpenSSL.

    Args:
        private_key_bytes: Bytes. PKCS#12 key in DER format.
        private_key_password: String. Password for PKCS#12 key.

    Returns:
        String. PEM contents of ``private_key_bytes``.
    )rrrr!Zdump_privatekeyrr")Zprivate_key_bytesZprivate_key_passwordZpkcs12rrr	�pkcs12_key_as_pem{s


�r%N)	rZOpenSSLrZoauth2clientr�objectrrr%rrrr	�<module>s
7/