
    EqgI
                         d Z ddlZddlmZmZ ddlZddlZdeeef         deej	        j
        ej        j        f         fdZdeej	        j
        ef         deeef         fdZdS )	zA place to store TSIG keys.    N)AnyDicttextringreturnc                 J   i }|                                  D ]\  }}t          j                            |          }t	          |t
                    r)t          j                            ||          j        ||<   b|\  }}t          j                            |||          ||<   |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)r   keyringr
   valuekname	algorithmr   s          A/var/www/html/env/lib/python3.11/site-packages/dns/tsigkeyring.pyr   r      s     G~~'' D De""4((eS!! 	D X\\%77>GENN"'Y X\\%CCGENNN    r   c                 n   i }d }|                                  D ]\  }}|                                }t          |t                    r ||          ||<   =t          |j        t                    r ||j                  }nt          |j                  }|j                                        |f||<   |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                 r    t          j        |                                                                           S )N)base64encodebytesdecoderstrip)r   s    r   	b64encodezto_text.<locals>.b64encode6   s+    !&))002299;;;r   )r   to_textr   bytesr   r   r   )r   r   r   r
   keytnametext_secrets          r   r   r   -   s     H< < < ]]__ 
E 
E	cc5!! 	E'innHUOO#*e,, .'i
33!#*oo"}4466DHUOOOr   )__doc__r   typingr   r   dns.namer	   dns.tsigr   r
   Namer   r   r   r    r   r   <module>r)      s   $ " !           S#X 4sx|0K+L    $T#(-,- $sCx.      r   