AlkantarClanX12

Your IP : 3.145.91.111


Current Path : /usr/lib/python3.6/site-packages/dnf/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/dnf/__pycache__/crypto.cpython-36.pyc

3

�ft`��@s<ddlmZddlmZddlmZddlmZddlZddlZddl	Zddl
ZddlZddlZddl
Z
ddlZyddlmZddlmZWn<ek
r�ddlZGdd	�d	e�ZGd
d�de�ZYnXdZejd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zejdd��Zdd�Z d"dd�Z!Gd d!�d!e�Z"dS)#�)�print_function)�absolute_import)�unicode_literals)�_N)�Context)�Datac@sVeZdZdd�Zdd�Zdd�Zedd��Zejd	d��Zd
d�Z	dd
�Z
dd�ZdS)rcCstj�|jd<dS)N�ctx)�gpgmer�__dict__)�self�r�/usr/lib/python3.6/crypto.py�__init__*szContext.__init__cCs|S)Nr)rrrr
�	__enter__-szContext.__enter__cCsdS)Nr)r�type�value�tbrrr
�__exit__0szContext.__exit__cCs|jjS)N)r�armor)rrrr
r3sz
Context.armorcCs||j_dS)N)rr)rrrrr
r7scCs$t|t�rtj|�}|jj|�dS)N)�
isinstanceZ
basestring�io�BytesIOr�import_)r�key_forrr
�	op_import;s

zContext.op_importcCs|jj||�dS)N)rZexport)r�pattern�modeZkeydatarrr
�	op_export@szContext.op_exportcCst|j|�S)N)�getattrr)r�namerrr
�__getattr__CszContext.__getattr__N)�__name__�
__module__�__qualname__rrr�propertyr�setterrrr rrrr
r)src@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)rcCstj�|jd<dS)N�buf)rrr
)rrrr
rHsz
Data.__init__cCs|S)Nr)rrrr
rKszData.__enter__cCsdS)Nr)rrrrrrr
rNsz
Data.__exit__cCs
|jj�S)N)r&�getvalue)rrrr
�readQsz	Data.readcCst|j|�S)N)rr&)rrrrr
r TszData.__getattr__N)r!r"r#rrrr(r rrrr
rGs
rZ	GNUPGHOME�dnfcCstjjdd�|jD��S)Ncss|]}|jr|VqdS)N)Zcan_sign)�.0�subkeyrrr
�	<genexpr>]sz*_extract_signing_subkey.<locals>.<genexpr>)r)�util�firstZsubkeys)�keyrrr
�_extract_signing_subkey\sr0cs(�fdd�tdt��d�D�}dj|�S)Nc3s|]}�||d�VqdS)�Nr)r*�i)�fpr_hexrr
r,asz)_printable_fingerprint.<locals>.<genexpr>rr1� )�range�len�join)r3Zsegmentsr)r3r
�_printable_fingerprint`sr8cCs�|j}t|�}x�|jD]x}xrt||�D]d}|j}||krNtjtd�|j|�q&|j	j
|�s\q&tjj
j|j|j|dd�tjtd�|j|�q&WqWdS)Nzrepo %s: 0x%s already importedF)�gpgdirZmake_ro_copyzrepo %s: imported key 0x%s.)Z_pubring_dir�keyids_from_pubringZgpgkey�retrieve�id_�logger�debugr�idZ_key_importZ_confirmr)ZyumZmiscZimport_key_to_pubring�raw_key�short_id)�repor9Z
known_keys�keyurl�keyinfo�keyidrrr
�import_repo_keyses
rFcCsltjj|�sgSt|��Jt��8}g}x,|j�D] }t|�}|dk	r0|j|j�q0W|SQRXWdQRXdS)N)	�os�path�exists�pubring_dirr�keylistr0�appendrE)r9rZkeyids�kr+rrr
r:vsr:cCs8td�|j|jt|j�|jjdd�f}tjd|�dS)NzLImporting GPG key 0x%s:
 Userid     : "%s"
 Fingerprint: %s
 From       : %szfile://�z%s)	rrA�useridr8�fingerprint�url�replacer=�critical)rD�msgrrr
�log_key_import�s
rUcCs8t|�|tjjjkr&tjtd��ntjtd��dS)Nz0Verified using DNS record with DNSSEC signature.zNOT verified using DNS record.)rUr)ZdnssecZValidityZVALIDr=rSr)rDZ
dns_resultrrr
�log_dns_key_import�srVccsFtjjtd�}|tjt<z
dVWd|dkr6tjt=n
|tjt<XdS)N)rG�environ�get�GPG_HOME_ENV)rJZorigrrr
rJ�s


rJcCs�tj�}g}t|���t���}|j|�x2|j�D]&}t|�}|dkrHq2|jt||��q2Wd|_	xF|D]>}t
��.}|j|jd|�|j
dtj�|j�|_WdQRXqhWWdQRXWdQRXtjj|�|S)NTr)�tempfileZmkdtemprJrrrKr0rL�Keyrrrr<�seekrG�SEEK_SETr(r@r)r-Zrm_rf)rZpb_dir�keyinfosrr/r+�infoZsinkrrr
�rawkey2infos�s"

,r`c
CsZ|jd�rtjtd�|j|�tjj||d��}t|�}WdQRXx|D]
}||_	qHW|S)Nzhttp:z.retrieving repo key for %s unencrypted from %s)rB)
�
startswithr=Zwarningrr?r)r-Z_urlopenr`rQ)rCrBZhandler^rDrrr
r;�s


r;c@s,eZdZdd�Zedd��Zedd��ZdS)r[cCs6|j|_|j|_d|_|j|_d|_|jdj|_	dS)Nr)
rEr<ZfprrPr@Z	timestamprQZuidsZuidrO)rr/r+rrr
r�szKey.__init__cCs&tjjrdnd}|jdd�jd|�S)N�0�0�i����)r)ZpycompZPY3r<�rjust)rZrjrrr
rA�szKey.short_idcCs
|jj�S)N)rA�lower)rrrr
�rpm_id�sz
Key.rpm_idN)r!r"r#rr$rArgrrrr
r[�sr[)N)#Z
__future__rrrZdnf.i18nr�
contextlibZ
dnf.pycompr)Zdnf.utilZdnf.yum.miscrZloggingrGrZZgpgrr�ImportErrorr	�objectrYZ	getLoggerr=r0r8rFr:rUrV�contextmanagerrJr`r;r[rrrr
�<module>s<