U
    e]                     @   sl   d dl mZmZmZ d dlmZ d dlmZmZm	Z	m
Z
mZ d dlmZ dd Zdd ZG d	d
 d
eZdS )    )absolute_importdivisionprint_function)utils)	DERReaderINTEGERSEQUENCE
encode_derencode_der_integer)hashesc              
   C   sJ   t | t2}|t }|t }||fW  5 Q R  S Q R X d S N)r   Zread_single_elementr   Zread_elementr   Z
as_integer)Z	signatureseqrs r   Q/usr/lib/python3/dist-packages/cryptography/hazmat/primitives/asymmetric/utils.pydecode_dss_signature   s    r   c                 C   s    t tt tt| t tt|S r   )r	   r   r   r
   )r   r   r   r   r   encode_dss_signature   s
    r   c                   @   s   e Zd Zdd ZedZdS )	Prehashedc                 C   s&   t |tjstd|| _|j| _d S )Nz#Expected instance of HashAlgorithm.)
isinstancer   ZHashAlgorithm	TypeErrorZ
_algorithmdigest_size_digest_size)self	algorithmr   r   r   __init__   s    zPrehashed.__init__r   N)__name__
__module____qualname__r   r   Zread_only_propertyr   r   r   r   r   r      s   r   N)Z
__future__r   r   r   Zcryptographyr   Zcryptography.hazmat._derr   r   r   r	   r
   Zcryptography.hazmat.primitivesr   r   r   objectr   r   r   r   r   <module>   s   