���ѧۧݧ�ӧ�� �ާ֧ߧ֧էا֧� - ���֧էѧܧ�ڧ��ӧѧ�� - /home/ukubnwwtacc0unt/chapelbellstudios.com/uploads/cover/gpg.tar
���ѧ٧ѧ�
callbacks.py 0000644 00000003645 15204174361 0007050 0 ustar 00 # Copyright (C) 2004 Igor Belyi <belyi@users.sourceforge.net> # Copyright (C) 2002 John Goerzen <jgoerzen@complete.org> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from __future__ import absolute_import, print_function, unicode_literals from getpass import getpass del absolute_import, print_function, unicode_literals def passphrase_stdin(hint, desc, prev_bad, hook=None): """This is a sample callback that will read a passphrase from the terminal. The hook here, if present, will be used to describe why the passphrase is needed.""" why = '' if hook is not None: why = ' ' + hook if prev_bad: why += ' (again)' print("Please supply %s' password%s:" % (hint, why)) return getpass() def progress_stdout(what, type, current, total, hook=None): print("PROGRESS UPDATE: what = %s, type = %d, current = %d, total = %d" % (what, type, current, total)) def readcb_fh(count, hook): """A callback for data. hook should be a Python file-like object.""" if count: # Should return '' on EOF return hook.read(count) else: # Wants to rewind. if not hasattr(hook, 'seek'): return None hook.seek(0, 0) return None __init__.py 0000644 00000011623 15204174361 0006663 0 ustar 00 # Copyright (C) 2016 g10 Code GmbH # Copyright (C) 2004 Igor Belyi <belyi@users.sourceforge.net> # Copyright (C) 2002 John Goerzen <jgoerzen@complete.org> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """gpg: GnuPG Interface for Python (GPGME bindings) Welcome to gpg, the GnuPG Interface for Python. The latest release of this package may be obtained from https://www.gnupg.org FEATURES -------- * Feature-rich, full implementation of the GPGME library. Supports all GPGME features. Callback functions may be written in pure Python. Exceptions raised in callbacks are properly propagated. * Ability to sign, encrypt, decrypt, and verify data. * Ability to list keys, export and import keys, and manage the keyring. * Fully object-oriented with convenient classes and modules. QUICK EXAMPLE ------------- >>> import gpg >>> with gpg.Context() as c: >>> with gpg.Context() as c: ... cipher, _, _ = c.encrypt("Hello world :)".encode(), ... passphrase="abc") ... c.decrypt(cipher, passphrase="abc") ... (b'Hello world :)', <gpg.results.DecryptResult object at 0x7f5ab8121080>, <gpg.results.VerifyResult object at 0x7f5ab81219b0>) GENERAL OVERVIEW ---------------- For those of you familiar with GPGME, you will be right at home here. The python gpg module is, for the most part, a direct interface to the C GPGME library. However, it is re-packaged in a more Pythonic way -- object-oriented with classes and modules. Take a look at the classes defined here -- they correspond directly to certain object types in GPGME for C. For instance, the following C code: gpgme_ctx_t context; gpgme_new(&context); ... gpgme_op_encrypt(context, recp, 1, plain, cipher); Translates into the following Python code: context = core.Context() ... context.op_encrypt(recp, 1, plain, cipher) The Python module automatically does error-checking and raises Python exception gpg.errors.GPGMEError when GPGME signals an error. getcode() and getsource() of this exception return code and source of the error. IMPORTANT NOTE -------------- This documentation only covers a small subset of available GPGME functions and methods. Please consult the documentation for the C library for comprehensive coverage. This library uses Python's reflection to automatically detect the methods that are available for each class, and as such, most of those methods do not appear explicitly anywhere. You can use dir() python built-in command on an object to see what methods and fields it has but their meaning can often only be found in the GPGME documentation. HIGHER LEVEL PYTHONIC LAYER --------------------------- A more pythonic or intuitive layer is being added above the automatically generated lower level bindings. This is the recommended way to access the module as if it is ever necessary to modify the underlying GPGME API, the higher level methods will remain the same. The quick example above is an example of this higher layer in action, whereas the second example demonstrating the mapping to GPGME itself is the lower layer. The second example in the higher layer would be more like the encrypt line in the quick example. FOR MORE INFORMATION -------------------- GnuPG homepage: https://www.gnupg.org/ GPGME documentation: https://www.gnupg.org/documentation/manuals/gpgme/ GPGME Python HOWTO: http://files.au.adversary.org/crypto/gpgme-python-howto-split/index.html To view this documentation, run help(gpg) in Python or one of the following commands outside of Python: pydoc gpg pydoc3 gpg python -m pydoc gpg python3 -m pydoc gpg """ from __future__ import absolute_import, print_function, unicode_literals from . import core from . import errors from . import constants from . import util from . import callbacks from . import version from .core import Context from .core import Data del absolute_import, print_function, unicode_literals # Interface hygiene. # Drop the low-level gpgme that creeps in for some reason. gpgme = None del gpgme # This is a white-list of symbols. Any other will alert pyflakes. _ = [Context, Data, core, errors, constants, util, callbacks, version] del _ __all__ = [ "Context", "Data", "core", "errors", "constants", "util", "callbacks", "version" ] results.py 0000644 00000006346 15204174361 0006633 0 ustar 00 # Robust result objects # # Copyright (C) 2016 g10 Code GmbH # # This file is part of GPGME. # # GPGME is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # GPGME is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General # Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, see <https://www.gnu.org/licenses/>. from __future__ import absolute_import, print_function, unicode_literals del absolute_import, print_function, unicode_literals """Robust result objects Results returned by the underlying library are fragile, i.e. they are only valid until the next operation is performed in the context. We cannot arbitrarily constrain the lifetime of Python objects, we therefore create deep copies of the results. """ class Result(object): """Result object Describes the result of an operation. """ """Convert to types""" _type = {} """Map functions over list attributes""" _map = {} """Automatically copy unless blacklisted""" _blacklist = { 'acquire', 'append', 'disown', 'next', 'own', 'this', 'thisown', } def __init__(self, fragile): for key, func in self._type.items(): if hasattr(fragile, key): setattr(self, key, func(getattr(fragile, key))) for key, func in self._map.items(): if hasattr(fragile, key): setattr(self, key, list(map(func, getattr(fragile, key)))) for key in dir(fragile): if key.startswith('_') or key in self._blacklist: continue if hasattr(self, key): continue setattr(self, key, getattr(fragile, key)) def __repr__(self): return '{}({})'.format( self.__class__.__name__, ', '.join('{}={!r}'.format(k, getattr(self, k)) for k in dir(self) if not k.startswith('_'))) class InvalidKey(Result): pass class EncryptResult(Result): _map = dict(invalid_recipients=InvalidKey) class Recipient(Result): pass class DecryptResult(Result): _type = dict(wrong_key_usage=bool, is_de_vs=bool) _map = dict(recipients=Recipient) class NewSignature(Result): pass class SignResult(Result): _map = dict(invalid_signers=InvalidKey, signatures=NewSignature) class Notation(Result): pass class Signature(Result): _type = dict(wrong_key_usage=bool, chain_model=bool, is_de_vs=bool) _map = dict(notations=Notation) class VerifyResult(Result): _map = dict(signatures=Signature) class ImportStatus(Result): pass class ImportResult(Result): _map = dict(imports=ImportStatus) class GenkeyResult(Result): _type = dict(primary=bool, sub=bool) class KeylistResult(Result): _type = dict(truncated=bool) class VFSMountResult(Result): pass class EngineInfo(Result): pass util.py 0000644 00000003723 15204174361 0006103 0 ustar 00 # Copyright (C) 2016 g10 Code GmbH # Copyright (C) 2004,2008 Igor Belyi <belyi@users.sourceforge.net> # Copyright (C) 2002 John Goerzen <jgoerzen@complete.org> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from __future__ import absolute_import, print_function, unicode_literals import sys del absolute_import, print_function, unicode_literals def process_constants(prefix, scope): """Called by the constant modules to load up the constants from the C library starting with PREFIX. Matching constants will be inserted into SCOPE with PREFIX stripped from the names. Returns the names of inserted constants. """ from . import gpgme index = len(prefix) constants = { identifier[index:]: getattr(gpgme, identifier) for identifier in dir(gpgme) if identifier.startswith(prefix) } scope.update(constants) return list(constants.keys()) def percent_escape(s): return ''.join('%{0:2x}'.format(ord(c)) if c == '+' or c == '"' or c == '%' or ord(c) <= 0x20 else c for c in s) # Python2/3 compatibility if sys.version_info[0] == 3: # Python3 def is_a_string(x): return isinstance(x, str) else: # Python2 def is_a_string(x): return isinstance(x, basestring) __pycache__/version.cpython-36.opt-1.pyc 0000644 00000004206 15204174361 0014033 0 ustar 00 3 @f[ � @ s: d dl mZmZ ddlmZ [[dZdZejZe ej j�ZdZ ejd�Zed Zed Zed Zg Zejee�� ejee�� yee� W n& ek r� Z z d Z W Y d d Z[X nX e dkr�ejee�� nPy ejd�Zejeed �� W n. ek �r Z zejd� W Y d d Z[X nX dZd ZdZdZdZdZ[d S )� )�absolute_import�print_function� )�gpgmeZgpgz1.13.1F�.� TN�-z�Copyright (C) 2016-2018 g10 Code GmbH Copyright (C) 2015 Benjamin D. McGinnes Copyright (C) 2014-2015 Martin Albrecht Copyright (C) 2004-2008 Igor Belyi Copyright (C) 2002 John GoerzenzThe GnuPG hackerszgnupg-devel@gnupg.orgz3Python support for GPGME GnuPG cryptography libraryzhttps://gnupg.orga� Copyright (C) 2016-2018 g10 Code GmbH Copyright (C) 2015 Benjamin D. McGinnes <ben@adversary.org> Copyright (C) 2014, 2015 Martin Albrecht <martinralbrecht@googlemail.com> Copyright (C) 2004, 2008 Igor Belyi <belyi@users.sourceforge.net> Copyright (C) 2002 John Goerzen <jgoerzen@complete.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA���) Z __future__r r � r ZproductnameZ versionstrZ GPGME_VERSIONZgpgme_versionstr�boolZcvarZgpg_in_tree_buildZ in_tree_buildZis_beta�splitZversionlist�major�minorZpatchZversionintlist�append�int� ValueError�eZ beta_patch� Exception� copyrightZauthorZauthor_email�descriptionZhomepage�license� r r �/usr/lib64/python3.6/version.py�<module> s@ __pycache__/errors.cpython-36.opt-1.pyc 0000644 00000017660 15204174361 0013672 0 ustar 00 3 e�\c � @ s d dl mZmZmZ ddlmZ ddlmZ [[[dZdZej de � � [G dd� de�ZG d d � d e�Z d!dd�ZG d d� de e�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd � d e�ZdS )"� )�absolute_import�print_function�unicode_literals� )�gpgme)�utilNZGPG_ERR_c @ sR e Zd ZdZddd�Zedd� �Zedd� �Zed d � �Zedd� �Z d d� Z dS )�GpgErrora> A GPG Error This is the base of all errors thrown by this library. If the error originated from GPGME, then additional information can be found by looking at 'code' for the error code, and 'source' for the errors origin. Suitable constants for comparison are defined in this module. 'code_str' and 'source_str' are human-readable versions of the former two properties. If 'context' is not None, then it contains a human-readable hint as to where the error originated from. If 'results' is not None, it is a tuple containing results of the operation that failed. The tuples elements are the results of the function that raised the error. Some operations return results even though they signal an error. Of course this information must be taken with a grain of salt. But often, this information is useful for diagnostic uses or to give the user feedback. Since the normal control flow is disrupted by the exception, the callee can no longer return results, hence we attach them to the exception objects. Nc C s || _ || _|| _d S )N)�error�context�results)�selfr r r � r �/usr/lib64/python3.6/errors.py�__init__= s zGpgError.__init__c C s | j d krd S tj| j �S )N)r r Zgpgme_err_code)r r r r �codeB s z GpgError.codec C s | j d krd S tj| j �S )N)r r �gpgme_strerror)r r r r �code_strH s zGpgError.code_strc C s | j d krd S tj| j �S )N)r r Zgpgme_err_source)r r r r �sourceN s zGpgError.sourcec C s | j d krd S tj| j �S )N)r r Zgpgme_strsource)r r r r � source_strT s zGpgError.source_strc C sF g }| j d k r|j| j � | jd k r<|j| j� |j| j� dj|�S )Nz: )r �appendr r r �join)r Zmsgsr r r �__str__Z s zGpgError.__str__)NNN)�__name__� __module__�__qualname__�__doc__r �propertyr r r r r r r r r r # s r c @ s@ e Zd ZdZedd� �Zedd� �Zdd� Zdd � Z d d� Z dS ) � GPGMEErrorz�Generic error This is a generic error that wraps the underlying libraries native error type. It is thrown when the low-level API is invoked and returns an error. This is the error that was used in PyME. c C s | t j� �S )N)r Zgpgme_err_code_from_syserror)�clsr r r �fromSyserrorm s zGPGMEError.fromSyserrorc C s | j S )N)r )r r r r �messageq s zGPGMEError.messagec C s t | �S )N)�str)r r r r � getstringu s zGPGMEError.getstringc C s | j S )N)r )r r r r �getcodex s zGPGMEError.getcodec C s | j S )N)r )r r r r � getsource{ s zGPGMEError.getsourceN)r r r r �classmethodr r r r"