ó ;§>Sc@súdZddlZddlZddlZddlZddlZddlZddlZdej j fd„ƒYZ dej j fd„ƒYZ dej j fd„ƒYZ d e fd „ƒYZd e 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+st PeerBadTimecBseZdZRS(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-sha1s hmac-sha224s hmac-sha256s hmac-sha384s hmac-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|ƒ}|d kr`t d ƒ‚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(twiretkeynametsecretttimetfudget original_idterrort other_datat request_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_md5zsc Cs\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|sF         2  4