o
    2³cµ	  ã                   @   s(   d Z ddlZddlZdd„ Zdd„ ZdS )zA place to store TSIG keys.é    Nc                 C   sb   i }|   ¡ D ](\}}tj |¡}t|tƒr tj ||¡j||< q|\}}tj |||¡||< q|S )a7  Convert 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)ÚtextringÚkeyringr   ÚvalueÚ	algorithmr
   © r   úE/var/www/html/gps/gps/lib/python3.10/site-packages/dns/tsigkeyring.pyr      s   
r   c                 C   sv   i }dd„ }|   ¡ D ].\}}| ¡ }t|tƒr||ƒ||< q
t|jtƒr*||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: dictc                 S   s   t  | ¡ ¡  ¡ S )N)Úbase64ÚencodebytesÚdecodeÚrstrip)r
   r   r   r   Ú	b64encode3   s   zto_text.<locals>.b64encode)r   Úto_textr   Úbytesr
   r   r   )r   r   r   r   ÚkeyÚtext_secretr   r   r   r   +   s   

r   )Ú__doc__r   Údns.namer   r   r   r   r   r   r   Ú<module>   s
   