HEX
Server: LiteSpeed
System: Linux s1299.sgp1.mysecurecloudhost.com 4.18.0-553.52.1.lve.el8.x86_64 #1 SMP Wed May 21 15:31:29 UTC 2025 x86_64
User: everest2 (1878)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/jwcrypto/__pycache__/common.cpython-36.pyc
3

�-3[O�@s�ddlZddlmZmZdd�Zdd�Zdd�Zd	d
�ZGdd�de�Z	Gd
d�de	�Z
Gdd�de	�ZGdd�de	�ZGdd�de	�Z
Gdd�de	�ZdS)�N)�urlsafe_b64decode�urlsafe_b64encodecCs,t|t�s|jd�}t|�}|jd�jd�S)Nzutf-8�=)�
isinstance�bytes�encoder�decode�rstrip)�payloadr�r�/usr/lib/python3.6/common.py�base64url_encodes

r
cCsNt|�d}|dkr|d7}n"|dkr0|d7}n|dkr@td��t|jd��S)	N��z==�rrzInvalid base64 stringzutf-8)�len�
ValueErrorrr)r
�sizerrr�base64url_decodes

rcCs$t|t�r|jd�}tj|ddd�S)Nzutf-8�,�:T)Z
separatorsZ	sort_keys)rr)rrr�json�dumps)�stringrrr�json_encodes

rcCst|t�r|jd�}tj|�S)Nzutf-8)rrrr�loads)rrrr�json_decode%s

rc@seZdZdS)�JWExceptionN)�__name__�
__module__�__qualname__rrrrr+srcseZdZd�fdd�	Z�ZS)�InvalidJWAAlgorithmNcs(d}|r|d|7}tt|�j|�dS)NzInvalid JWA Algorithm namez (%s))�superr!�__init__)�self�message�msg)�	__class__rrr#0szInvalidJWAAlgorithm.__init__)N)rrr r#�
__classcell__rr)r'rr!/sr!cs eZdZdZ�fdd�Z�ZS)�InvalidCEKeyLengthz�Invalid CEK Key Length.

    This exception is raised when a Content Encryption Key does not match
    the required lenght.
    cs d||f}tt|�j|�dS)Nz&Expected key of length %d bits, got %d)r"r)r#)r$�expected�obtainedr&)r'rrr#>szInvalidCEKeyLength.__init__)rrr �__doc__r#r(rr)r'rr)7sr)cs"eZdZdZd�fdd�	Z�ZS)�InvalidJWEOperationz�Invalid JWS Object.

    This exception is raised when a requested operation cannot
    be execute due to unsatisfied conditions.
    Ncs:d}|r|}nd}|r&|dt|�7}tt|�j|�dS)NzUnknown Operation Failurez {%s})�reprr"r-r#)r$r%Z	exceptionr&)r'rrr#JszInvalidJWEOperation.__init__)NN)rrr r,r#r(rr)r'rr-Csr-cs eZdZdZ�fdd�Z�ZS)�InvalidJWEKeyTypez�Invalid JWE Key Type.

    This exception is raised when the provided JWK Key does not match
    the type required by the sepcified algorithm.
    cs d||f}tt|�j|�dS)NzExpected key type %s, got %s)r"r/r#)r$r*r+r&)r'rrr#\szInvalidJWEKeyType.__init__)rrr r,r#r(rr)r'rr/Usr/cs eZdZdZ�fdd�Z�ZS)�InvalidJWEKeyLengthz�Invalid JWE Key Length.

    This exception is raised when the provided JWK Key does not match
    the lenght required by the sepcified algorithm.
    cs d||f}tt|�j|�dS)Nz!Expected key of lenght %d, got %d)r"r0r#)r$r*r+r&)r'rrr#hszInvalidJWEKeyLength.__init__)rrr r,r#r(rr)r'rr0asr0)r�base64rrr
rrr�	Exceptionrr!r)r-r/r0rrrr�<module>s