File: //opt/saltstack/salt/lib/python3.10/site-packages/__pycache__/gnupg.cpython-310.pyc
o
�N�g$� � @ s� d Z dZdZdZzddlmZ W n ey ddlmZ Y nw ddlZddl Z ddl
Z
ddlZddlZddl
Z
ddlmZ ddlmZ ddlZddlZdZejd krkzdd
lmZmZmZ W n eyj dZY nw zddlmZ W n ey� G dd� de
j�ZY nw z
e d
ZeZeZW n ey� dZe Ze ZY nw e
�!e"�Z#e#j$s�e#�%e� � ej&j"dkr�dd� Z'n e�(d�Z)dd� Z'e�*� Z+dd� Z,dd� Z-dd� Z.dd� Z/dd� Z0dd� Z1d d!� Z2G d"d#� d#e3�Z4G d$d%� d%e3�Z5e�(d&ej6�Z7d'd(d)d*d+d,d-�Z8G d.d/� d/e3�Z9d0d1� Z:G d2d3� d3e;�Z<G d4d5� d5e<�Z=G d6d7� d7e=�Z>G d8d9� d9e3�Z?G d:d;� d;e4e?�Z@G d<d=� d=e3�ZAG d>d?� d?eA�ZBG d@dA� dAe3�ZCG dBdC� dCeC�ZDG dDdE� dEe?�ZEe�(dF�FdG�ej6�ZGe�(dHej6�ZHe�(dI�ZIG dJdK� dKe3�ZJdS )Lah A wrapper for the 'gpg' command::
Portions of this module are derived from A.M. Kuchling's well-designed
GPG.py, using Richard Jones' updated version 1.3, which can be found
in the pycrypto CVS repository on Sourceforge:
http://pycrypto.cvs.sourceforge.net/viewvc/pycrypto/gpg/GPG.py
This module is *not* forward-compatible with amk's; some of the
old interface has changed. For instance, since I've added decrypt
functionality, I elected to initialize with a 'gnupghome' argument
instead of 'keyring', so that gpg can find both the public and secret
keyrings. I've also altered some of the returned objects in order for
the caller to not have to know as much about the internals of the
result classes.
While the rest of ISconf is released under the GPL, I am releasing
this single file under the same terms that A.M. Kuchling used for
pycrypto.
Steve Traugott, stevegt@terraluna.org
Thu Jun 23 21:27:20 PDT 2005
This version of the module has been modified from Steve Traugott's version
(see http://trac.t7a.org/isconf/browser/trunk/lib/python/isconf/GPG.py) by
Vinay Sajip to make use of the subprocess module (Steve's version uses os.fork()
and so does not work on Windows). Renamed to gnupg.py to avoid confusion with
the previous versions.
Modifications Copyright (C) 2008-2021 Vinay Sajip. All rights reserved.
A unittest harness (test_gnupg.py) has also been added.
z0.4.8zVinay Sajipz$24-Nov-2021 09:13:33$� )�StringION)�Popen)�PIPE�nt)�STARTUPINFO�STARTF_USESHOWWINDOW�SW_HIDEc @ s e Zd Zdd� ZdS )�NullHandlerc C � d S �N� )�self�recordr r �9/opt/saltstack/salt/lib/python3.10/site-packages/gnupg.py�handleB � zNullHandler.handleN)�__name__�
__module__�__qualname__r r r r r r A s r FT�ntpathc C s d| S )Nz"%s"r ��sr r r �shell_quoteV s r z[^\w%+,./:=@-]c C sL t | t�s
tdt| � ��| sd}|S t�| �s| }|S d| �dd� }|S )a�
Quote text so that it is safe for Posix command shells.
For example, "*.py" would be converted to "'*.py'". If the text is
considered safe it is returned unquoted.
:param s: The value to quote
:type s: str (or unicode on 2.x)
:return: A safe version of the input, from the point of view of Posix
command shells
:rtype: The passed-in type
zExpected string type, got %sz''z'%s'�'z'\'')�
isinstance�string_types� TypeError�type�UNSAFE�search�replace)r �resultr r r r _ s
��c C s t st| t�r| �t�} | S r )�_py3kr � text_type�encode�
fsencodingr r r r �no_quote� s
r&