%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/plesk/python/2.7/lib/python2.7/site-packages/dns/
Upload File :
Create Path :
Current File : //opt/plesk/python/2.7/lib/python2.7/site-packages/dns/tsig.pyc

�
�ac@s4dZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
mZdejj
fd��YZdejj
fd��YZd	ejj
fd
��YZdefd��YZd
efd��YZdefd��YZdefd��YZejjd�Zejjd�Zejjd�Zejjd�Zejjd�Zejjd�Zieje6eje6eje6ej e6ej!e6ej"e6Z#eZ$dZ%dZ&dZ'dZ(de*e+e$d�Z,de*e+e$d�Z-de*e+d�Z.d �Z/d!�Z0dS("sDNS TSIG support.i����Ni(tlongtstring_typest	text_typetBadTimecBseZdZRS(s8The current time is not within the TSIG's validity time.(t__name__t
__module__t__doc__(((s=/opt/plesk/python/2.7/lib/python2.7/site-packages/dns/tsig.pyRstBadSignaturecBseZdZRS(s#The TSIG signature fails to verify.(RRR(((s=/opt/plesk/python/2.7/lib/python2.7/site-packages/dns/tsig.pyR"st	PeerErrorcBseZdZRS(s;Base class for all TSIG errors generated by the remote peer(RRR(((s=/opt/plesk/python/2.7/lib/python2.7/site-packages/dns/tsig.pyR'st
PeerBadKeycBseZdZRS(s$The peer didn't know the key we used(RRR(((s=/opt/plesk/python/2.7/lib/python2.7/site-packages/dns/tsig.pyR	,stPeerBadSignaturecBseZdZRS(s*The peer didn't like the signature we sent(RRR(((s=/opt/plesk/python/2.7/lib/python2.7/site-packages/dns/tsig.pyR
1stPeerBadTimecBseZdZRS(s%The peer didn't like the time we sent(RRR(((s=/opt/plesk/python/2.7/lib/python2.7/site-packages/dns/tsig.pyR6stPeerBadTruncationcBseZdZRS(s=The peer didn't like amount of truncation in the TSIG we sent(RRR(((s=/opt/plesk/python/2.7/lib/python2.7/site-packages/dns/tsig.pyR;ssHMAC-MD5.SIG-ALG.REG.INTs	hmac-sha1shmac-sha224shmac-sha256shmac-sha384shmac-sha512iiiic
Csvt|t�r|j�}nt|�\}
}|r�tj|d|�}	t|�}|dkr�|	jtj	d|��|	j|�q�ntj	d|�}|	j|�|	j|d�|r|	j|j
��|	jtj	dtjj
��|	jtj	dd��n|td�}|d?td�@}|td�@}tj	d	|||�}|
|}t|�}|dkr�td
��ntj	d||�|}|r�|	j|�|	j|�n
|	j|�|	j�}tj	dt|��}|||||}|
rctj|d|�}	t|�}|	jtj	d|��|	j|�nd}	|||	fS(
sjReturn 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
    t	digestmodis!His!Ii i��I����s!HIHs TSIG Other Data is > 65535 bytess!HHN(t
isinstanceRtencodet
get_algorithmthmactnewtlentupdatetstructtpackt
to_digestabletdnst
rdataclasstANYRt
ValueErrortdigesttNone(twiretkeynametsecretttimetfudgetoriginal_idterrort
other_datatrequest_mactctxtmultitfirstt	algorithmtalgorithm_nameR
tmltidt	long_timet
upper_timet
lower_timettime_mactpre_mactoltpost_mactmactmpackt
tsig_rdata((s=/opt/plesk/python/2.7/lib/python2.7/site-packages/dns/tsig.pytsignYsN



c

Cs.t||||||||||	|
||�
S(N(R8(
RRR R!R"R#R$R%R&R'R(R)R*((s=/opt/plesk/python/2.7/lib/python2.7/site-packages/dns/tsig.pythmac_md5�scCshtjd|dd!�\}|dkr7tjj�n|d8}|dd!tjd|�|d|!}|}
tjj||
�\}}|
|}
tjd||
|
d!�\}}}}|td�d>|td�}|
d7}
||
|
|!}|
|7}
tjd||
|
d	!�\}}}|
d	7}
||
|
|!}|
|7}
|
||krntjj�n|dkr�|t	kr�t
�q�|tkr�t�q�|t
kr�t�q�|tkr�t�q�td
|��n||}||}||ks
||krt�nt|||||||||||	|
|�
\}}}||krdt�n|S(s*Validate the specified TSIG rdata against the other input parameters.

    @raises FormError: The TSIG is badly formed.
    @raises BadTime: There is too much time skew between the client and the
    server.
    @raises BadSignature: The TSIG signature did not validate
    @rtype: hmac.HMAC objects!Hi
iiis!HIHHi s!HHHisunknown TSIG error code %d(RtunpackRt	exceptiont	FormErrorRtnamet	from_wireRtBADSIGR
tBADKEYR	tBADTIMERtBADTRUNCRRRR8R(RRR tnowR&t
tsig_startR7t
tsig_rdlenR'R(R)tadcounttnew_wiretcurrenttanametusedR/R0R"tmac_sizeR!R5R#R$t
other_sizeR%ttime_lowt	time_hightjunktour_mac((s=/opt/plesk/python/2.7/lib/python2.7/site-packages/dns/tsig.pytvalidate�sN

(
)"

&

				

			cCsnt|t�r$tjj|�}ny|j�t|fSWn+tk
ritdt	|�d��nXdS(s�Returns the wire format string and the hash module to use for the
    specified TSIG algorithm

    @rtype: (string, hash constructor)
    @raises NotImplementedError: I{algorithm} is not supported
    sTSIG algorithm s is not supportedN(
RRRR=t	from_textRt_hashestKeyErrortNotImplementedErrortstr(R*((s=/opt/plesk/python/2.7/lib/python2.7/site-packages/dns/tsig.pyR�s
cCs�|}tjj||�\}}||}tjd|||d!�\}}}}	|d7}||||	!}
||	7}|||kr�tjj�n||
fS(slReturn the tsig algorithm for the specified tsig_rdata
    @raises FormError: The TSIG is badly formed.
    s!HIHHi
(RR=R>RR:R;R<(RR7RERHRIRJR/R0R"RKR5((s=/opt/plesk/python/2.7/lib/python2.7/site-packages/dns/tsig.pytget_algorithm_and_mac�s
)

(1RthashlibRRt
dns.exceptionRtdns.rdataclasstdns.namet_compatRRRR;tDNSExceptionRRRR	R
RRR=RRtHMAC_MD5t	HMAC_SHA1tHMAC_SHA224tHMAC_SHA256tHMAC_SHA384tHMAC_SHA512tsha224tsha256tsha384tsha512tsha1tmd5RStdefault_algorithmR?R@RARBRtFalsetTrueR8R9RQRRW(((s=/opt/plesk/python/2.7/lib/python2.7/site-packages/dns/tsig.pyt<module>sN





	5	5	

Zerion Mini Shell 1.0