U mfI @s|dZddlZddlmZmZddlZddlZeeefeej j ej j fdddZ eej j efeeefddd ZdS) zA place to store TSIG keys.N)AnyDict)textringreturncCsbi}|D]P\}}tj|}t|tr@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) itemsdnsname from_text isinstancestrtsigKeysecret)rkeyringrvalueZkname algorithmrr=/opt/hc_python/lib/python3.8/site-packages/dns/tsigkeyring.pyr s  r )rrcCsvi}dd}|D]\\}}|}t|tr<||||<qt|jtrT||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)base64 encodebytesdecoderstrip)rrrr b64encode6szto_text..b64encode)rto_textr bytesrr r)rrrrkeyZtnameZ text_secretrrrr-s    r)__doc__rtypingrrZdns.namerZdns.tsigr rNamer r r rrrrrs (