a àMÒeI ã@s|dZddlZddlmZmZddlZddlZeeefeej j ej j fdœdd„Z eej j efeeefdœdd „ZdS) zA place to store TSIG keys.éN)ÚAnyÚDict)ÚtextringÚreturncCsbi}| ¡D]P\}}tj |¡}t|tƒr@tj ||¡j||<q |\}}tj |||¡||<q |S)a7Convert a dictionary containing (textual DNS name, base64 secret) pairs into a binary keyring which has (dns.name.Name, bytes) pairs, or a dictionary containing (textual DNS name, (algorithm, base64 secret)) pairs into a binary keyring which has (dns.name.Name, dns.tsig.Key) pairs. @rtype: dict) ÚitemsÚdnsÚnameÚ from_textÚ isinstanceÚstrÚtsigÚKeyÚsecret)rÚkeyringrÚvalueZknameÚ algorithmr©rú3/usr/lib/python3.9/site-packages/dns/tsigkeyring.pyr s  r )rrcCsvi}dd„}| ¡D]\\}}| ¡}t|tƒr<||ƒ||<qt|jtƒrT||jƒ}n t|jƒ}|j ¡|f||<q|S)a;Convert a dictionary containing (dns.name.Name, dns.tsig.Key) pairs into a text keyring which has (textual DNS name, (textual algorithm, base64 secret)) pairs, or a dictionary containing (dns.name.Name, bytes) pairs into a text keyring which has (textual DNS name, base64 secret) pairs. @rtype: dictcSst |¡ ¡ ¡S)N)Úbase64Z encodebytesÚdecodeÚrstrip)rrrrÚ b64encode6szto_text..b64encode)rÚto_textr Úbytesrr r)rrrrÚkeyZtnameZ text_secretrrrr-s    r)Ú__doc__rÚtypingrrZdns.namerZdns.tsigr rÚNamer r r rrrrrÚs (