U
    [^+                     @   sF   d Z ddlZG dd dejZG dd dejZG dd dejZdS )	zACME-specific JWS.

The JWS implementation in josepy only implements the base JOSE standard. In
order to support the new header fields defined in ACME, this module defines some
ACME-specific classes that layer on top of josepy.
    Nc                   @   sL   e Zd ZdZejddejdZejdddZejdddZ	ej
dd	 Zd
S )Headerz?ACME-specific JOSE Header. Implements nonce, kid, and url.
    nonceT)	omitemptyencoderkid)r   urlc              
   C   sF   zt | W S  t jk
r@ } zt d|W 5 d }~X Y nX d S )NzInvalid nonce: {0})joseZdecode_b64joseZDeserializationErrorformat)valueerror r   */usr/lib/python3/dist-packages/acme/jws.pyr      s    zHeader.nonceN)__name__
__module____qualname____doc__r   FieldZencode_b64joser   r   r   decoderr   r   r   r   r   
   s   r   c                   @   s2   e Zd ZdZejjZeZ	ej
dde	 e	jdZdS )	SignaturezGACME-specific Signature. Uses ACME-specific Header for customer fields.headerT)r   defaultr   N)r   r   r   r   r   r   _orig_slots	__slots__r   Z
header_clsr   Z	from_jsonr   r   r   r   r   r      s     r   c                       s2   e Zd ZdZeZejjZ	e
d fdd	Z  ZS )JWSzCACME-specific JWS. Includes none, url, and kid in protected header.Nc              
      s6   |d k}t t| j|||tdddddg||||dS )Nr   r   r   Zjwkalg)keyr   Zprotectr   r   r   include_jwk)superr   sign	frozenset)clsZpayloadr   r   r   r   r   r   	__class__r   r   r   -   s      zJWS.sign)NN)r   r   r   r   r   Zsignature_clsr   r   r   r   classmethodr   __classcell__r   r   r!   r   r   (   s
   r   )r   Zjosepyr   r   r   r   r   r   r   r   <module>   s   