a àMÒeŽã@sPddlZddlZddlZddlZddlZddlZejjGdd„dejj ƒƒZ dS)éNcsXeZdZdZgd¢Z‡fdd„Zddd„Zedd d „ƒZdd d „Z eddd„ƒZ ‡Z S)ÚTSIGz TSIG record)Ú algorithmÚ time_signedÚfudgeÚmacÚ original_idÚerrorÚotherc sjtƒ ||¡| |¡|_| |¡|_| |¡|_| |¡|_ | |¡|_ t j j  |¡|_| | ¡|_dS)aƒInitialize a TSIG rdata. *rdclass*, an ``int`` is the rdataclass of the Rdata. *rdtype*, an ``int`` is the rdatatype of the Rdata. *algorithm*, a ``dns.name.Name``. *time_signed*, an ``int``. *fudge*, an ``int`. *mac*, a ``bytes`` *original_id*, an ``int`` *error*, an ``int`` *other*, a ``bytes`` N)ÚsuperÚ__init__Z_as_namerZ _as_uint48rZ _as_uint16rZ _as_bytesrrÚdnsÚrcodeZRcodeZmakerr ) ÚselfÚrdclassÚrdtyperrrrrrr ©Ú __class__©ú8/usr/lib/python3.9/site-packages/dns/rdtypes/ANY/TSIG.pyr )s!     z TSIG.__init__NTcKsš|j ||¡}tj |jd¡}|›d|j›d|j›dt|j ƒ›dtj   |j d¡›d|j ›d|›dt|j ƒ›}|j r–|dtj   |j d¡›7}|S)NTú r)rZchoose_relativityr r Úto_textrrrÚlenrÚrdataZ _base64ifyrr )rÚoriginÚ relativizeÚkwrrÚtextrrrrSs ÿþÿz TSIG.to_textc Cs®|jdd}| ¡}| ¡} | ¡} t | ¡¡} t| ƒ| krFtdƒ‚| ¡} tj   | ¡¡} | ¡}|dkr’t | ¡¡}t|ƒ|kr–tdƒ‚nd}|||||| | | | |ƒ S)NF)rz invalid MACrzinvalid other dataó) Úget_nameÚ get_uint48Ú get_uint16Úbase64Z b64decodeZ get_stringrÚ SyntaxErrorr r Ú from_text)ÚclsrrÚtokrrZ relativize_torrrZmac_lenrrrZ other_lenr rrrr#_s4    ÷zTSIG.from_textFc Cs~|j |d|d¡| t d|jd?d@|jd@|jt|jƒ¡¡| |j¡| t d|j |j t|j ƒ¡¡| |j ¡dS)NFz!HIHHé iÿÿlÿÿz!HHH) rZto_wireÚwriteÚstructÚpackrrrrrrr )rÚfileÚcompressrZ canonicalizerrrÚ_to_wires ûÿ  z TSIG._to_wirec CsR| ¡}| ¡}| ¡}| d¡}| d¡\} } | d¡} |||||||| | | ƒ S)Néz!HH)rrr Zget_counted_bytesZ get_struct) r$rrÚparserrrrrrrrr rrrÚfrom_wire_parserŽs"  ÷zTSIG.from_wire_parser)NT)NTN)NNF)N) Ú__name__Ú __module__Ú __qualname__Ú__doc__Ú __slots__r rÚ classmethodr#r,r/Ú __classcell__rrrrrs * ÿ  r) r!r(Z dns.exceptionr Z dns.immutableZ dns.rcodeZ dns.rdataZ immutablerZRdatarrrrrÚs