OXIESEC PANEL
- Current Dir:
/
/
opt
/
gsutil
/
gslib
/
vendored
/
oauth2client
/
oauth2client
/
__pycache__
Server IP: 2a02:4780:11:1594:0:ef5:22d7:a
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/11/2025 08:19:48 AM
rwxr-xr-x
📄
__init__.cpython-39.pyc
585 bytes
02/11/2025 08:19:48 AM
rw-r--r--
📄
_helpers.cpython-39.pyc
9.94 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
_openssl_crypt.cpython-39.pyc
4.16 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
_pkce.cpython-39.pyc
1.68 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
_pure_python_crypt.cpython-39.pyc
5.97 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
_pycrypto_crypt.cpython-39.pyc
3.91 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
client.cpython-39.pyc
66.44 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
clientsecrets.cpython-39.pyc
4.07 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
crypt.cpython-39.pyc
6.15 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
service_account.cpython-39.pyc
21.45 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
tools.cpython-39.pyc
7.86 KB
02/11/2025 08:19:48 AM
rw-r--r--
📄
transport.cpython-39.pyc
7.8 KB
02/11/2025 08:19:48 AM
rw-r--r--
Editing: _openssl_crypt.cpython-39.pyc
Close
a ��a� � @ sH d Z ddlmZ ddlmZ G dd� de�ZG dd� de�Zdd � Zd S )z1OpenSSL Crypto-related routines for oauth2client.� )�crypto)�_helpersc @ s, e Zd ZdZdd� Zdd� Zedd� �ZdS ) �OpenSSLVerifierz$Verifies the signature on a message.c C s || _ dS )zlConstructor. Args: pubkey: OpenSSL.crypto.PKey, The public key to verify with. N)�_pubkey)�self�pubkey� r �F/opt/gsutil/gslib/vendored/oauth2client/oauth2client/_openssl_crypt.py�__init__ s zOpenSSLVerifier.__init__c C sP t j|dd�}t j|dd�}zt�| j||d� W dS tjyJ Y dS 0 dS )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� signaturer r r r s zOpenSSLVerifier.verifyc C s4 t �| �} |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. )r r r Zload_certificate�FILETYPE_PEM�load_privatekeyr )�key_pem�is_x509_certr r r r �from_string5 s zOpenSSLVerifier.from_stringN)�__name__� __module__�__qualname__�__doc__r r �staticmethodr r r r r r s r c @ s. e Zd ZdZdd� Zdd� Zed dd��Zd S )� OpenSSLSignerz"Signs messages with a private key.c C s || _ dS )ztConstructor. Args: pkey: OpenSSL.crypto.PKey (or equiv), The private key to sign with. N)�_key)r �pkeyr r r r O s zOpenSSLSigner.__init__c C s t j|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. r r r )r r r �signr )r r r r r r! W s zOpenSSLSigner.sign� notasecretc C sN t �| �} t �| �}|r(t�tj|�}nt j|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. r r ) r r �_parse_pem_keyr r r �load_pkcs12�get_privatekeyr )�key�passwordZparsed_pem_keyr r r r r c s zOpenSSLSigner.from_stringN)r"