Viewing File: /usr/lib64/python2.7/site-packages/dns/tsig.pyo

ó
;§>Sc@súdZddlZddlZddlZddlZddlZddlZddlZdej	j
fd„ƒYZdej	j
fd„ƒYZdej	j
fd„ƒYZ
d	e
fd
„ƒYZde
fd„ƒYZd
e
fd„ƒYZde
fd„ƒYZejjdƒZejjdƒZejjdƒZejjdƒZejjdƒZejjdƒZeZdZdZdZdZde e!ed„Z"de e!ed„Z#de e!d„Z$da%d„Z&d„Z'd „Z(d!„Z)dS("sDNS TSIG support.iÿÿÿÿNtBadTimecBseZdZRS(sBRaised if the current time is not within the TSIG's validity time.(t__name__t
__module__t__doc__(((s./usr/lib64/python2.7/site-packages/dns/tsig.pyRstBadSignaturecBseZdZRS(s-Raised if the TSIG signature fails to verify.(RRR(((s./usr/lib64/python2.7/site-packages/dns/tsig.pyRst	PeerErrorcBseZdZRS(s;Base class for all TSIG errors generated by the remote peer(RRR(((s./usr/lib64/python2.7/site-packages/dns/tsig.pyR#st
PeerBadKeycBseZdZRS(s.Raised if the peer didn't know the key we used(RRR(((s./usr/lib64/python2.7/site-packages/dns/tsig.pyR'stPeerBadSignaturecBseZdZRS(s4Raised if the peer didn't like the signature we sent(RRR(((s./usr/lib64/python2.7/site-packages/dns/tsig.pyR+stPeerBadTimecBseZdZRS(s/Raised if the peer didn't like the time we sent(RRR(((s./usr/lib64/python2.7/site-packages/dns/tsig.pyR/stPeerBadTruncationcBseZdZRS(sGRaised if the peer didn't like amount of truncation in the TSIG we sent(RRR(((s./usr/lib64/python2.7/site-packages/dns/tsig.pyR	3ssHMAC-MD5.SIG-ALG.REG.INTs	hmac-sha1shmac-sha224shmac-sha256shmac-sha384shmac-sha512iiiic
CsFt|ƒ\}
}|rqtj|d|ƒ}	t|ƒ}|dkrq|	jtjd|ƒƒ|	j|ƒqqntjd|ƒ}|	j|ƒ|	j|dƒ|rõ|	j|jƒƒ|	jtjdtj	j
ƒƒ|	jtjddƒƒn|d}|d?d@}|d	@}tjd
|||ƒ}|
|}t|ƒ}|dkr`tdƒ‚ntjd
||ƒ|}|rœ|	j|ƒ|	j|ƒn
|	j|ƒ|	jƒ}tjdt|ƒƒ}|||||}|
r3tj|d|ƒ}	t|ƒ}|	jtjd|ƒƒ|	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!Ili lÿlÿÿs!HIHiÿÿs TSIG Other Data is > 65535 bytess!HHN(t
get_algorithmthmactnewtlentupdatetstructtpackt
to_digestabletdnst
rdataclasstANYt
ValueErrortdigesttNone(twiretkeynametsecretttimetfudgetoriginal_idterrort
other_datatrequest_mactctxtmultitfirstt	algorithmtalgorithm_nameR
tmltidt	long_timet
upper_timet
lower_timettime_mactpre_mactoltpost_mactmactmpackt
tsig_rdata((s./usr/lib64/python2.7/site-packages/dns/tsig.pytsignGsJ





c

Cs.t||||||||||	|
||ƒ
S(N(R3(
RRRRRRRR R!R"R#R$R%((s./usr/lib64/python2.7/site-packages/dns/tsig.pythmac_md5zscCs\tjd|dd!ƒ\}|dkr7tjj‚n|d8}|dd!tjd|ƒ|d|!}|}
tjj||
ƒ\}}|
|}
tjd||
|
d!ƒ\}}}}|dd>|d}|
d7}
||
|
|!}|
|7}
tjd	||
|
d
!ƒ\}}}|
d
7}
||
|
|!}|
|7}
|
||krbtjj‚n|dkrÕ|tkrƒt	‚qÕ|t
kr˜t‚qÕ|tkr­t
‚qÕ|tkrÂt‚qÕtd|ƒ‚n||}||}||ks||kr
t‚nt|||||||||||	|
|ƒ
\}}}||krXt‚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!HIHHli s!HHHisunknown TSIG error code %d(RtunpackRt	exceptiont	FormErrorRtnamet	from_wiretBADSIGRtBADKEYRtBADTIMERtBADTRUNCR	RRR3R(RRRtnowR!t
tsig_startR2t
tsig_rdlenR"R#R$tadcounttnew_wiretcurrenttanametusedR*R+Rtmac_sizeRR0RRt
other_sizeR ttime_lowt	time_hightjunktour_mac((s./usr/lib64/python2.7/site-packages/dns/tsig.pytvalidate€sN

(
)

&

				

			cCs2ytjj|ƒt|<Wntk
r-nXdS(N(Rthashtgett_hashestKeyError(ttsig_algthash_alg((s./usr/lib64/python2.7/site-packages/dns/tsig.pyt_maybe_add_hash·s
cCsXiattdƒttdƒttdƒttdƒttdƒttdƒdS(NtSHA224tSHA256tSHA384tSHA512tSHA1tMD5(RORStHMAC_SHA224tHMAC_SHA256tHMAC_SHA384tHMAC_SHA512t	HMAC_SHA1tHMAC_MD5(((s./usr/lib64/python2.7/site-packages/dns/tsig.pyt
_setup_hashes½s




cCsÎtdkrtƒnt|ttfƒr@tjj|ƒ}nt	j
dkr„|tksg|tkr„t
dt|ƒdƒ‚ny|jƒt|fSWn+tk
rÉt
dt|ƒ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
    isTSIG algorithm s requires Python 2.5.2 or laters is not supportedN(RORR`t
isinstancetstrtunicodeRR8t	from_texttsyst
hexversionR\R]tNotImplementedErrorRRP(R%((s./usr/lib64/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
(RR8R9RR5R6R7(RR2R@RCRDRER*R+RRFR0((s./usr/lib64/python2.7/site-packages/dns/tsig.pytget_algorithm_and_macás
)

(*RRRRet
dns.exceptionRtdns.hashtdns.rdataclasstdns.nameR6tDNSExceptionRRRRRRR	R8RdR_R^RZR[R\R]tdefault_algorithmR:R;R<R=RtFalsetTrueR3R4RLRORSR`RRh(((s./usr/lib64/python2.7/site-packages/dns/tsig.pyt<module>sF	2	4		
	
Back to Directory File Manager