3 ž}:a! ã @ s¬ d Z ddlmZmZ ddlZddlmZ ddlmZm Z G dd„ de ƒZG dd „ d ƒZG d d„ dƒZ G dd „ d e ƒZG dd„ de ƒZG dd„ deeƒZG dd„ deeƒZdS )zJOSE utilities.é )ÚHashableÚMappingN)Údefault_backend)ÚecÚrsac s$ e Zd ZdZdZ‡ fdd„Z‡ ZS )ÚabstractclassmethodaÚ Descriptor for an abstract classmethod. It augments the :mod:`abc` framework with an abstract classmethod. This is implemented as :class:`abc.abstractclassmethod` in the standard Python library starting with version 3.2. This implementation is from a StackOverflow answer that was derived from the implementation in the Python 3.3 abc library. http://stackoverflow.com/questions/11217878/python-2-7-combine-abc-abstractmethod-and-classmethod. Tc s d|_ tƒ j|ƒ d S )NT)Ú__isabstractmethod__ÚsuperÚ__init__)ÚselfÚtarget)Ú __class__© ú/usr/lib/python3.6/util.pyr s zabstractclassmethod.__init__)Ú__name__Ú __module__Ú__qualname__Ú__doc__r r Ú __classcell__r r )r r r s r c @ sH e Zd ZdZdd„ Zdd„ Zejjfdd„Z dd „ Z d d„ Zdd „ ZdS )ÚComparableX509zËWrapper for OpenSSL.crypto.X509** objects that supports __eq__. :ivar wrapped: Wrapped certificate or certificate request. :type wrapped: `OpenSSL.crypto.X509` or `OpenSSL.crypto.X509Req`. c C s* t |tjjƒs t |tjjƒs t‚|| _d S )N)Ú isinstanceÚOpenSSLÚcryptoÚX509ZX509ReqÚAssertionErrorÚwrapped)r r r r r r % s zComparableX509.__init__c C s t | j|ƒS )N)Úgetattrr )r Únamer r r Ú__getattr__* s zComparableX509.__getattr__c C s. t | jtjjƒrtjj}ntjj}||| jƒS )aL Dumps the object into a buffer with the specified encoding. :param int filetype: The desired encoding. Should be one of `OpenSSL.crypto.FILETYPE_ASN1`, `OpenSSL.crypto.FILETYPE_PEM`, or `OpenSSL.crypto.FILETYPE_TEXT`. :returns: Encoded X509 object. :rtype: str )r r r r r Zdump_certificateZdump_certificate_request)r ZfiletypeÚfuncr r r Ú_dump- s zComparableX509._dumpc C s t || jƒstS | jƒ |jƒ kS )N)r r ÚNotImplementedr )r Úotherr r r Ú__eq__? s zComparableX509.__eq__c C s t | j| jƒ fƒS )N)Úhashr r )r r r r Ú__hash__E s zComparableX509.__hash__c C s dj | jj| jƒS )Nz<{0}({1!r})>)Úformatr r r )r r r r Ú__repr__H s zComparableX509.__repr__N) r r r r r r r r Z FILETYPE_ASN1r r# r% r' r r r r r s r c @ s<