HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/jwt/contrib/algorithms/__pycache__/py_ecdsa.cpython-38.pyc
U

�b�[��@s@ddlZddlZddlmZddlmZmZGdd�de�ZdS)�N)�	Algorithm)�string_types�	text_typec@sBeZdZdZejZejZej	Z
dd�Zdd�Zdd�Z
dd	�Zd
S)�ECAlgorithmz�
    Performs signing and verification operations using
    ECDSA and the specified hash function

    This class requires the ecdsa package to be installed.

    This is based off of the implementation in PyJWT 0.3.2
    cCs
||_dS)N)�hash_alg)�selfr�r�A/usr/lib/python3/dist-packages/jwt/contrib/algorithms/py_ecdsa.py�__init__szECAlgorithm.__init__cCs~t|tj�st|tj�r|St|t�rrt|t�r:|�d�}ztj�|�}Wqztjj	k
rntj�|�}YqzXnt
d��|S)Nzutf-8zExpecting a PEM-formatted key.)�
isinstance�ecdsaZ
SigningKeyZVerifyingKeyrr�encodeZfrom_pemZderZ
UnexpectedDER�	TypeError)r�keyrrr	�prepare_keys
�


zECAlgorithm.prepare_keycCs|j||jtjjd�S)N)�hashfuncZ	sigencode)�signrr�utilZsigencode_string)r�msgrrrr	r3s
�zECAlgorithm.signcCs6z|j|||jtjjd�WStk
r0YdSXdS)N)rZ	sigdecodeF)�verifyrrrZsigdecode_string�AssertionError)rrrZsigrrr	r7s�zECAlgorithm.verifyN)�__name__�
__module__�__qualname__�__doc__�hashlibZsha256ZSHA256Zsha384ZSHA384Zsha512ZSHA512r
rrrrrrr	rsr)rrZjwt.algorithmsrZ
jwt.compatrrrrrrr	�<module>s