%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/cloudinit/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/cloudinit/__pycache__/gpg.cpython-312.pyc

�

�f��z�dZddlZddlZddlmZej
e�Zgd�Zd�Z	d�Z
dd�Zdd�Zd	�Z
d
d
�Zy)z0gpg.py - Collection of gpg key related functions�N)�subp)�gpgz--with-fingerprintz--no-default-keyringz--list-keysz	--keyringc��	tjddd|gd��\}}|S#tj$r$}tjd||�d}Yd}~|Sd}~wwxYw)z*Export gpg key, armoured key gets returnedrz--exportz--armourT��capture�&Failed to export armoured key "%s": %sN)r�ProcessExecutionError�LOG�debug)�key�armour�_�errors    �//usr/lib/python3/dist-packages/cloudinit/gpg.py�
export_armourrsa����i�i�
�J�
�C�0�$�
�����M��	�%�%���	�	�:�C��G����M��	�s�"�A�A�Ac�J�tjddg|d��jS)z~Dearmor gpg key, dearmored key gets returned

    note: man gpg(1) makes no mention of an --armour spelling, only --armor
    rz	--dearmorF)�data�decode)r�stdout)rs r�dearmorr's"��
�9�9�e�[�)��E�B�I�I�I�c���g}|jt�|s|jd�|j|�tj|d��\}}|rtjd||�|S)z�List keys from a keyring with fingerprints. Default to a stable machine
    parseable format.

    @param key_file: a string containing a filepath to a key
    @param human_output: return output intended for human parsing
    z
--with-colonsTrr)�extend�GPG_LIST�appendrr
�warning)�key_file�human_output�cmdr�stderrs     r�listr!/s^��
�C��J�J�x����
�
�?�#��J�J�x���y�y��d�3��V�V�
����<�h��O��Mrc���tjd||�ddd|zd|g}|�g}d}d}t|�}	|d	z
}	tj|d�
�tjd|||�y#tj$r}|}Yd}~nd}~wwxYw	t|�}tjd|j|�tj|�n$#t$r}td
||||fz�|�d}~wwxYw��)a�Receive gpg key from the specified keyserver.

    Retries are done by default because keyservers can be unreliable.
    Additionally, there is no way to determine the difference between
    a non-existent key and a failure.  In both cases gpg (at least 2.2.4)
    exits with status 2 and stderr: "keyserver receive failed: No data"
    It is assumed that a key provided to cloud-init exists on the keyserver
    so re-trying makes better sense than failing.

    @param key: a string key fingerprint (as passed to gpg --recv-keys).
    @param keyserver: the keyserver to request keys from.
    @param retries: an iterable of sleep lengths for retries.
                    Use None to indicate no retries.z&Importing key '%s' from keyserver '%s'rz--no-ttyz--keyserver=%sz--recv-keysNrT�rz/Imported key '%s' from keyserver '%s' on try %dz6Import failed with exit code %d, will try again in %ssz@Failed to import key '%s' from keyserver '%s' after %d tries: %s)r
r�iterrr	�next�	exit_code�time�sleep�
StopIteration�
ValueError)	r�	keyserver�retriesr�trynumr�sleeps�e�naplens	         r�recv_keyr1Bs���I�I�6��Y�G��*�.��:�M�3�
O�C�����
�F��E�
�'�]�F�
��!���
	��I�I�c�4�(��I�I�A����	
�
���)�)�	��E��	��	��&�\�F��I�I�H�����
�

�J�J�v����	��%�(+�Y���'F�G���
��	��+s0�/A,�,B�?B�B�AC�	C2�C-�-C2c��	tjdddd|gd��y#tj$r!}tjd||�Yd}~yd}~wwxYw)	z0Delete the specified key from the local gpg ringrz--batchz--yesz
--delete-keysTrzFailed delete key "%s": %sN)rr	r
r)rrs  r�
delete_keyr3ssO��>��	�	�
�I�w���=�t�	
���%�%�>����0�#�u�=�=��>�s��A�A�Ac���t|�}|s'	t||��t|�}	t|�|S|S#t$rtj	d|��wxYw#t|�wxYw)zget gpg keyid from keyserver)r+zFailed to obtain gpg key %s)rr1r*r
�	exceptionr3)�keyidr+r
s   r�
getkeybyidr7}si��
�5�
!�F��	��U�i�0�"�5�)�F�
�u���M�6�M���	��M�M�7��?��	��

�u��s�7�!A�A�
A()F))r#r#)zkeyserver.ubuntu.com)�__doc__�loggingr'�	cloudinitr�	getLogger�__name__r
rrrr!r1r3r7�rr�<module>r>sL��7�����g����!����
�J��&.�b>�r

Zerion Mini Shell 1.0