ok
Direktori : /lib/python3.6/site-packages/josepy/__pycache__/ |
Current File : //lib/python3.6/site-packages/josepy/__pycache__/jws.cpython-36.pyc |
3 �}:aY7 � @ s� d Z ddlZddlZddlZddlZddlmZmZmZm Z m Z mZ G dd� d�ZG dd� dej �ZG dd � d ej �ZG d d� dej �ZG dd � d �Zedkr�eej� � dS )zJSON Web Signature.� N)�b64�errors� json_util�jwa�jwk�utilc @ s, e Zd ZdZdZedd� �Zedd� �ZdS )� MediaTypez MediaType field encoder/decoder.zapplication/c C s( d|kr$d|krt jd��| j| S |S )zDecoder.�/�;zUnexpected semi-colon)r �DeserializationError�PREFIX)�cls�value� r �/usr/lib/python3.6/jws.py�decode s zMediaType.decodec C s. d|kr*|j | j�st�|t| j�d� S |S )zEncoder.r N)� startswithr �AssertionError�len)r r r r r �encode s zMediaType.encodeN)�__name__� __module__�__qualname__�__doc__r �classmethodr r r r r r r s r c @ s e Zd ZdZejdejjdd�Z ejddd�Z ejdejjdd�Zejddd�Z ejd dd�Zejd df d�Zejdejdd�Zejd ejdd�Zejdejejdd�Zejdejejdd�Zejddf d�Zdd� Zdd� Zdd� Zejdd� �Zejdd� �Zejdd� �ZdS )�Headera6 JOSE Header. .. warning:: This class supports **only** Registered Header Parameter Names (as defined in section 4.1 of the protocol). If you need Public Header Parameter Names (4.2) or Private Header Parameter Names (4.3), you must subclass and override :meth:`from_json` and :meth:`to_partial_json` appropriately. .. warning:: This class does not support any extensions through the "crit" (Critical) Header Parameter (4.1.11) and as a conforming implementation, :meth:`from_json` treats its occurrence as an error. Please subclass if you seek for a different behaviour. :ivar x5tS256: "x5t#S256" :ivar str typ: MIME Media Type, inc. :const:`MediaType.PREFIX`. :ivar str cty: Content-Type, inc. :const:`MediaType.PREFIX`. �algT)�decoder� omitempty�jku)r r �kid�x5u�x5c)r �default�x5tzx5t#S256�typ)�encoderr r �cty�critc s � fdd�� j j� D �S )z4Fields that would not be omitted in the JSON object.c s, i | ]$\}}|j t� |��st� |�|�qS r )Zomit�getattr)�.0�nameZfield)�selfr r � <dictcomp>M s z&Header.not_omitted.<locals>.<dictcomp>)�_fields�items)r, r )r, r �not_omittedK s zHeader.not_omittedc C s^ t |t| ��s tdjt|����| j� }|j� }t|�j|�rFtd��|j|� t| �f |�S )NzHeader cannot be added to: {0}z+Addition of overlapping headers not defined)� isinstance�type� TypeError�formatr0 �set�intersection�update)r, �otherZnot_omitted_selfZnot_omitted_otherr r r �__add__Q s zHeader.__add__c C s | j dkrtjd��| j S )z�Find key based on header. .. todo:: Supports only "jwk" header parameter lookup. :returns: (Public) key found in the header. :rtype: .JWK :raises josepy.errors.Error: if key could not be found NzNo key found)r r �Error)r, r r r �find_key_ s zHeader.find_keyc C s t jd��d S )Nz("crit" is not supported, please subclass)r r )Zunused_valuer r r r( n s zHeader.critc C s dd� | D �S )Nc S s&