관리-도구
편집 파일: api_jwk.cpython-37.pyc
B �E�`~ � @ sH d dl Z ddlmZ ddlmZmZmZ G dd� d�ZG dd� d�ZdS ) � N� )�get_default_algorithms)�InvalidKeyError� PyJWKError� PyJWKSetErrorc @ sV e Zd Zddd�Zeddd��Zeddd��Zedd � �Zed d� �Z edd � �Z dS )�PyJWKNc C sJ t � | _|| _| j�dd �}|s.td| j ��|sLt| jt�rL| j�dd �}|�s| j�dd �}|dkr�|dkst|szd}n6|dkr�d }n(|d kr�d}n|dkr�d }ntd| ��n`|dkr�d}nR|dkr�d}nD|dk�r|s�td| j ��|dkr�d}ntd| ��ntd| ��| j�|�| _| j�s6td| j ��| j� | j�| _ d S )N�ktyzkty is not found: %sZalg�crvZECzP-256ZES256zP-384ZES384zP-521ZES512Z secp256k1ZES256KzUnsupported crv: %sZRSAZRS256�octZHS256ZOKPzcrv is not found: %sZEd25519ZEdDSAzUnsupported kty: %sz&Unable to find a algorithm for key: %s)r Z_algorithms� _jwk_data�getr � isinstance�dictZ Algorithmr Zfrom_jwk�key)�selfZjwk_data� algorithmr r � r �</opt/alt/python37/lib/python3.7/site-packages/jwt/api_jwk.py�__init__ sD zPyJWK.__init__c C s t | |�S )N)r )�objr r r r � from_dict6 s zPyJWK.from_dictc C s t �| �}t�||�S )N)�json�loadsr r )�datar r r r r � from_json: s zPyJWK.from_jsonc C s | j �dd �S )Nr )r r )r r r r �key_type? s zPyJWK.key_typec C s | j �dd �S )NZkid)r r )r r r r �key_idC s zPyJWK.key_idc C s | j �dd �S )NZuse)r r )r r r r �public_key_useG s zPyJWK.public_key_use)N)N)N)�__name__� __module__�__qualname__r �staticmethodr r �propertyr r r r r r r r s .r c @ s, e Zd Zdd� Zedd� �Zedd� �ZdS )�PyJWKSetc C sR g | _ |rt|t�std��t|�dkr0td��x|D ]}| j �t|�� q6W d S )NzInvalid JWK Set valuer z$The JWK Set did not contain any keys)�keysr �listr �len�appendr )r r$ r r r r r M s zPyJWKSet.__init__c C s | � dg �}t|�S )Nr$ )r r# )r r$ r r r r Y s zPyJWKSet.from_dictc C s t �| �}t�|�S )N)r r r# r )r r r r r r ^ s zPyJWKSet.from_jsonN)r r r r r! r r r r r r r# L s r# ) r Z algorithmsr � exceptionsr r r r r# r r r r �<module> s E