AlkantarClanX12
Current Path : /proc/self/root/usr/lib/python3.6/site-packages/dns/__pycache__/ |
Current File : //proc/self/root/usr/lib/python3.6/site-packages/dns/__pycache__/tsig.cpython-36.pyc |
3 �b�W& � @ s~ d Z ddlZddlZddlZddlZddlZddlZddlm Z m Z mZ G dd� dejj �ZG dd� dejj �ZG d d � d ejj �ZG dd� de�ZG d d� de�ZG dd� de�ZG dd� de�Zejjd�Zejjd�Zejjd�Zejjd�Zejjd�Zejjd�ZedededededediZeZdZd Z d!Z!d"Z"dd#d$efd%d&�Z#dd#d$efd'd(�Z$d/d)d*�Z%d+d,� Z&d-d.� Z'dS )0zDNS TSIG support.� N� )�long�string_types� text_typec @ s e Zd ZdZdS )�BadTimez8The current time is not within the TSIG's validity time.N)�__name__� __module__�__qualname__�__doc__� r r �/usr/lib/python3.6/tsig.pyr s r c @ s e Zd ZdZdS )�BadSignaturez#The TSIG signature fails to verify.N)r r r r r r r r r s r c @ s e Zd ZdZdS )� PeerErrorz;Base class for all TSIG errors generated by the remote peerN)r r r r r r r r r % s r c @ s e Zd ZdZdS )� PeerBadKeyz$The peer didn't know the key we usedN)r r r r r r r r r * s r c @ s e Zd ZdZdS )�PeerBadSignaturez*The peer didn't like the signature we sentN)r r r r r r r r r / s r c @ s e Zd ZdZdS )�PeerBadTimez%The peer didn't like the time we sentN)r r r r r r r r r 4 s r c @ s e Zd ZdZdS )�PeerBadTruncationz=The peer didn't like amount of truncation in the TSIG we sentN)r r r r r r r r r 9 s r zHMAC-MD5.SIG-ALG.REG.INTz hmac-sha1zhmac-sha224zhmac-sha256zhmac-sha384zhmac-sha512ZSHA224ZSHA256ZSHA384ZSHA512ZSHA1ZMD5� � � � FTc C s� t |t�r|j� }t|�\} }|r\tj||d�} t|�}|dkr\| jtj d|�� | j|� tj d|�}| j|� | j| dd� � |r�| j|j � � | jtj dtjj �� | jtj dd�� |td� }|d? td�@ }|td �@ }tj d |||�}| | }t|�}|dk�rtd��tj d||�| }|�rF| j|� | j|� n | j|� | j� }tj dt|��}|| | | | }| �r�tj||d�} t|�}| jtj d|�� | j|� nd} ||| fS ) aj Return a (tsig_rdata, mac, ctx) tuple containing the HMAC TSIG rdata for the input parameters, the HMAC MAC calculated by applying the TSIG signature algorithm, and the TSIG digest context. @rtype: (string, string, hmac.HMAC object) @raises ValueError: I{other_data} is too long @raises NotImplementedError: I{algorithm} is not supported )� digestmodr z!H� Nz!I� i�� l �� z!HIHz TSIG Other Data is > 65535 bytesz!HH)� isinstancer �encode� get_algorithm�hmac�new�len�update�struct�pack� to_digestable�dnsZ rdataclass�ANYr � ValueErrorZdigest)�wire�keyname�secret�time�fudge�original_id�error� other_data�request_mac�ctx�multi�first� algorithmZalgorithm_namer Zml�idZ long_time� upper_time� lower_timeZtime_macZpre_macZolZpost_mac�macZmpack� tsig_rdatar r r �signW sN r9 c C s t | ||||||||| | ||� S )N)r9 ) r'