| Current File : //proc/self/root/lib/python3.6/site-packages/josepy/__pycache__/util.cpython-36.pyc |
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'