HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/landscape/lib/__pycache__/gpg.cpython-38.pyc
U

���c�@sNddlZddlZddlZddlmZddlmZGdd�de�Zd
dd	�ZdS)�N)�glob)�getProcessOutputAndValuec@seZdZdZdS)�InvalidGPGSignaturez:Raised when the gpg signature for a given file is invalid.N)�__name__�
__module__�__qualname__�__doc__�r	r	�3/usr/lib/python3/dist-packages/landscape/lib/gpg.pyr
sr�/usr/bin/gpg�/etc/aptc		s��fdd�}�fdd�}t���ttjdd�ttd�|��td�|���D���}d	d
�ddf|d
||f}t�|d�}|�	|�|�
|�|S)a�Verify the GPG signature of a file.

    @param filename: Path to the file to verify the signature against.
    @param signature: Path to signature to use.
    @param gpg: Optionally, path to the GPG binary to use.
    @param apt_dir: Optionally, path to apt trusted keyring.
    @return: a C{Deferred} resulting in C{True} if the signature is
             valid, C{False} otherwise.
        cst���|S)N)�shutilZrmtree)Zignored)�gpg_homer	r
�remove_gpg_homes
z#gpg_verify.<locals>.remove_gpg_homecs@|\}}}|�d�|�d�}}|dkr<td�|||f��dS)N�asciirz)%s failed (out='%s', err='%s', code='%d'))�decoder)�args�out�err�code)�gpgr	r
�check_gpg_exit_codes

�z'gpg_verify.<locals>.check_gpg_exit_codecSsg|]}d|f�qS)z	--keyringr	)�.0Zkeyringr	r	r
�
<listcomp>'s�zgpg_verify.<locals>.<listcomp>z{}/trusted.gpgz{}/trusted.gpg.d/*.gpgz--no-optionsz	--homedirz--no-default-keyringz--ignore-time-conflictz--verify)r)�tempfileZmkdtemp�tuple�	itertools�chain�sortedr�formatrZaddBothZaddCallback)	�filenameZ	signaturerZapt_dirrrZkeyringsr�resultr	)rrr
�
gpg_verifys0	���
���

r")rr)	rr
rrZtwisted.internet.utilsr�	Exceptionrr"r	r	r	r
�<module>s