ó
Á£ô_c           @   sa   d  Z  d d l Z d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d e j f d „  ƒ  YZ d S(	   sä   ACME-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.
iÿÿÿÿNt   Headerc           B   sh   e  Z d  Z e j d d e d e j ƒZ e j d d e ƒZ e j d d e ƒZ	 e j
 d „  ƒ Z RS(   s?   ACME-specific JOSE Header. Implements nonce, kid, and url.
    t   noncet	   omitemptyt   encodert   kidt   urlc         C   sF   y t  j |  ƒ SWn. t  j k
 rA } t  j d j | ƒ ƒ ‚ n Xd  S(   Ns   Invalid nonce: {0}(   t   joset   decode_b64joset   DeserializationErrort   format(   t   valuet   error(    (    s,   /usr/lib/python2.7/site-packages/acme/jws.pyR      s    (   t   __name__t
   __module__t   __doc__R   t   Fieldt   Truet   encode_b64joseR   R   R   t   decoder(    (    (    s,   /usr/lib/python2.7/site-packages/acme/jws.pyR    
   s
   t	   Signaturec           B   sG   e  Z d  Z e j j Z e Z e j	 d d e
 d e ƒ  d e j ƒZ RS(   sG   ACME-specific Signature. Uses ACME-specific Header for customer fields.t   headerR   t   defaultR   (   R   R   R   R   R   t   _orig_slotst	   __slots__R    t
   header_clsR   R   t	   from_jsonR   (    (    (    s,   /usr/lib/python2.7/site-packages/acme/jws.pyR      s   t   JWSc           B   s5   e  Z d  Z e Z e j j Z e	 d d d „ ƒ Z RS(   sC   ACME-specific JWS. Includes none, url, and kid in protected header.c         C   sa   | d  k } t t |  ƒ j | d | d | d t d d d d d g ƒ d | d | d | d | ƒS(	   Nt   keyt   algt   protectR   R   R   t   jwkt   include_jwk(   t   Nonet   superR   t   signt	   frozenset(   t   clst   payloadR   R   R   R   R   R   (    (    s,   /usr/lib/python2.7/site-packages/acme/jws.pyR"   -   s
    !N(   R   R   R   R   t   signature_clsR   R   R   R   t   classmethodR    R"   (    (    (    s,   /usr/lib/python2.7/site-packages/acme/jws.pyR   (   s
   (   R   t   josepyR   R    R   R   (    (    (    s,   /usr/lib/python2.7/site-packages/acme/jws.pyt   <module>   s   