File: //usr/lib/python3/dist-packages/duplicity/__pycache__/gpg.cpython-310.pyc
o
��`.E � @ s4 d Z ddlmZ ddlmZ ddlmZ ddlZddlZddlZddlZddl Z ddl
Z
ddlmZ ddlm
Z
ddlmZ dd lmZ zdd
lmZ ddlmZ W n eyg ddlmZ ddlmZ Y nw d
ZG dd� de�ZG dd� de�ZG dd� de�Z d!dd�Zd"dd�Zd#dd�Zd$dd �ZdS )%z�
duplicity's gpg interface, builds upon Frank Tobin's GnuPGInterface
which is now patched with some code for iterative threaded execution
see duplicity's README for details
� )�next)�str)�objectN)�config)�gpginterface)�tempdir)�util)�sha1)�md5)�newi c @ s e Zd ZdZdS )�GPGErrorz!
Indicate some GPG Error
N)�__name__�
__module__�__qualname__�__doc__� r r �//usr/lib/python3/dist-packages/duplicity/gpg.pyr 5 s r c @ s4 e Zd ZdZ ddd�ZejZed�Zdd� Z dS ) �
GPGProfilezF
Just hold some GPG settings, avoid passing tons of arguments
Nc C s� |du st |tdjf�sJ �|| _|| _|| _d| _|dur)t |t�s%J �|| _ng | _|dur;t |t�s7J �|| _ ng | _ | �
tj�| _
dS )a>
Set all data with initializer
passphrase is the passphrase. If it is None (not ""), assume
it hasn't been set. sign_key can be blank if no signing is
indicated, and recipients should be a list of keys. For all
keys, the format should be an hex key like 'AA0E73D2'.
N� )�
isinstancer � __class__�
passphrase�signing_passphrase�sign_key�encrypt_secring�list�
recipients�hidden_recipients�get_gpg_versionr �
gpg_binary�gpg_version)�selfr r r r r r r �__init__@ s
zGPGProfile.__init__sU ^gpg.*\(GnuPG(?:/MacGPG2)?\) (?P<maj>[0-9]+)\.(?P<min>[0-9]+)\.(?P<bug>[0-9]+)(-.+)?$c C s� t �� }|d ur||_tjrtj�� D ] }|jj�|� q|j dgdgd�}|j
d �� �� }| j
�|�}|d urMt|�d��t|�d��t|�d��fS td||f ��)Nz --version�stdout)�
create_fhs�maj�min�bugz/failed to determine gnupg version of %s from %s)r �GnuPG�callr �gpg_options�split�options�
extra_args�append�run�handles�readline�rstrip�_version_re�search�int�groupr )r! �binary�gnupg�opt�res�line�mr r r r a s (zGPGProfile.get_gpg_version)NNNN)
r
r r r r"