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: _pure_python_crypt.cpython-39.pyc
Close
a ��a� � @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl Z ddl Z ddlmZ dZ d Zd ZdZe� Zdd � ZG dd� de�ZG dd� de�ZdS )z�Pure Python crypto-related routines for oauth2client. Uses the ``rsa``, ``pyasn1`` and ``pyasn1_modules`` packages to parse PEM files storing PKCS#1 or PKCS#8 keys as well as certificates. � )�decoder)�pem)�Certificate)�PrivateKeyInfoN)�_helpersz�\ PKCS12 format is not supported by the RSA library. Either install PyOpenSSL, or please convert .p12 format to .pem format: $ cat key.p12 | \ > openssl pkcs12 -nodes -nocerts -passin pass:notasecret | \ > openssl rsa > key.pem )� �@ � � � � � � )z-----BEGIN RSA PRIVATE KEY-----z-----END RSA PRIVATE KEY-----)z-----BEGIN PRIVATE KEY-----z-----END PRIVATE KEY-----c C s^ t | �}t� }tj�d|d�D ]6}| ||d � }tdd� tt|�D ��}|�|� qt |�S )z�Converts an iterable of 1's and 0's to bytes. Combines the list 8 at a time, treating each group of 8 bits as a single byte. r r c s s | ]\}}|| V qd S �N� )�.0�val�digitr r �J/opt/gsutil/gslib/vendored/oauth2client/oauth2client/_pure_python_crypt.py� <genexpr>; s �z%_bit_list_to_bytes.<locals>.<genexpr>) �len� bytearray�six�moves�xrange�sum�zip�_POW2�append�bytes)Zbit_listZnum_bitsZ byte_vals�startZ curr_bitsZchar_valr r r �_bit_list_to_bytes1 s �r! c @ s, e Zd ZdZdd� Zdd� Zedd� �ZdS ) �RsaVerifierz�Verifies the signature on a message. Args: pubkey: rsa.key.PublicKey (or equiv), The public key to verify with. c C s || _ d S r )�_pubkey)�self�pubkeyr r r �__init__H s zRsaVerifier.__init__c C sD t j|dd�}ztj�||| j�W S ttjjfy> 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��encodingFN)r � _to_bytes�rsa�pkcs1�verifyr# � ValueErrorZVerificationError)r$ �message� signaturer r r r- K s zRsaVerifier.verifyc C s� t �|�}|rjtj�|d�}tj|t� d�\}}|dkrBtd|��|d d }t |d �}tj �|d�}ntj �|d �}| |�S ) a� Construct an RsaVerifier 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: RsaVerifier instance. Raises: ValueError: if the key_pem can't be parsed. In either case, error will begin with 'No PEM start marker'. If ``is_x509_cert`` is True, will fail to find the "-----BEGIN CERTIFICATE-----" error, otherwise fails to find "-----BEGIN RSA PUBLIC KEY-----". �CERTIFICATE�Zasn1Spec� �Unused bytesZtbsCertificateZsubjectPublicKeyInfoZsubjectPublicKey�DERZPEM)r r* r+ r Zload_pemr �decoder r. r! Z PublicKey� load_pkcs1) �clsZkey_pem�is_x509_certZderZ asn1_cert� remainingZ cert_info� key_bytesr% r r r �from_string^ s zRsaVerifier.from_stringN)�__name__� __module__�__qualname__�__doc__r&