[Python-modules-commits] [python-gnupg] 02/09: Import python-gnupg_0.4.1.orig.tar.gz
Elena Grandi
valhalla-guest at moszumanska.debian.org
Sat Jul 22 16:07:09 UTC 2017
This is an automated email from the git hooks/post-receive script.
valhalla-guest pushed a commit to branch master
in repository python-gnupg.
commit c8cae436bd76deb1ca78fb573de1aa043b8a2d09
Author: Elena Grandi <valhalla-d at trueelena.org>
Date: Sat Jul 22 16:32:34 2017 +0200
Import python-gnupg_0.4.1.orig.tar.gz
---
PKG-INFO | 9 +-
README.rst | 760 +++++++++++++++++++++++++++++++---------------------------
gnupg.py | 353 +++++++++++++++------------
setup.py | 7 +-
test_gnupg.py | 217 ++++++++++++++---
5 files changed, 800 insertions(+), 546 deletions(-)
diff --git a/PKG-INFO b/PKG-INFO
index ee38cd5..4135fa8 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: python-gnupg
-Version: 0.3.9
+Version: 0.4.1
Summary: A wrapper for the Gnu Privacy Guard (GPG or GnuPG)
-Home-page: http://packages.python.org/python-gnupg/index.html
+Home-page: http://pythonhosted.org/python-gnupg/index.html
Author: Vinay Sajip
Author-email: vinay_sajip at red-dove.com
-License: Copyright (C) 2008-2016 by Vinay Sajip. All Rights Reserved. See LICENSE.txt for license.
-Download-URL: https://pypi.python.org/packages/source/p/python-gnupg/python-gnupg-0.3.9.tar.gz
+License: Copyright (C) 2008-2017 by Vinay Sajip. All Rights Reserved. See LICENSE.txt for license.
+Download-URL: https://pypi.io/packages/source/p/python-gnupg/python-gnupg-0.4.1.tar.gz
Description: This module allows easy access to GnuPG's key management, encryption and signature functionality from Python programs. It is intended for use with Python 2.4 or greater.
Platform: No particular restrictions
Classifier: Development Status :: 5 - Production/Stable
@@ -23,5 +23,6 @@ Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
diff --git a/README.rst b/README.rst
index 19794db..8902f5e 100644
--- a/README.rst
+++ b/README.rst
@@ -1,353 +1,407 @@
-.. image:: https://travis-ci.org/vsajip/python-gnupg.svg
- :target: https://travis-ci.org/vsajip/python-gnupg
-
-.. image:: https://coveralls.io/repos/vsajip/python-gnupg/badge.svg
- :target: https://coveralls.io/github/vsajip/python-gnupg
-
-
-What is it?
-===========
-
-The GNU Privacy Guard (gpg, or gpg.exe on Windows) is a command-line program
-which provides support for programmatic access via spawning a separate process
-to run it and then communicating with that process from your program.
-
-This project, ``python-gnupg``, implements a Python library which takes care
-of the internal details and allows its users to generate and manage keys,
-encrypt and decrypt data, and sign and verify messages.
-
-Installation
-============
-
-Installing from PyPI
---------------------
-
-You can install this package from the Python Package Index (pyPI) by running::
-
- pip install python-gnupg
-
-
-Installing from a source distribution archive
----------------------------------------------
-To install this package from a source distribution archive, do the following:
-
-1. Extract all the files in the distribution archive to some directory on your
- system.
-2. In that directory, run ``python setup.py install``.
-3. Optionally, run ``python test_gnupg.py`` to ensure that the package is
- working as expected.
-
-Credits
-=======
-
-* The developers of the GNU Privacy Guard.
-* The original version of this module was developed by Andrew Kuchling.
-* It was improved by Richard Jones.
-* It was further improved by Steve Traugott.
-
-The present incarnation, based on the earlier versions, uses the ``subprocess``
-module and so works on Windows as well as Unix/Linux platforms. It's not,
-however, 100% backwards-compatible with earlier incarnations.
-
-Change log
-==========
-
-N.B: GCnn refers to an issue nn on Google Code.
-
-0.4.0 (future)
---------------
-
-Released: Not yet
-
-0.3.9
------
-
-Released: 2016-09-10
-
-* Fixed #38: You can now request information about signatures against
- keys. Thanks to SunDwarf for the suggestion and patch, which was used
- as a basis for this change.
-
-* Fixed #49: When exporting keys, no attempt is made to decode the output when
- armor=False is specified.
-
-* Fixed #53: A ``FAILURE`` message caused by passing an incorrect passphrase
- is handled.
-
-* Handled ``EXPORTED`` and ``EXPORT_RES`` messages while exporting keys. Thanks
- to Marcel Pörner for the patch.
-
-* Fixed #54: Improved error message shown when gpg is not available.
-
-* Fixed #55: Added support for ``KEY_CONSIDERED`` while verifying.
-
-* Avoided encoding problems with filenames under Windows. Thanks to Kévin
- Bernard-Allies for the patch.
-
-* Fixed #57: Used a better mechanism for comparing keys.
-
-
-0.3.8
------
-
-Released: 2015-09-24
-
-* Fixed #22: handled ``PROGRESS`` messages during verification and signing.
-
-* Fixed #26: handled ``PINENTRY_LAUNCHED`` messages during verification,
- decryption and key generation.
-
-* Fixed #28: Allowed a default Name-Email to be computed even when neither of
- ``LOGNAME`` and ``USERNAME`` are in the environment.
-
-* Fixed #29: Included test files missing from the tarball in previous versions.
-
-* Fixed #39: On Python 3.x, passing a text instead of a binary stream caused
- file decryption to hang due to a ``UnicodeDecodeError``. This has now been
- correctly handled: The decryption fails with a "no data" status.
-
-* Fixed #41: Handled Unicode filenames correctly by encoding them on 2.x using
- the file system encoding.
-
-* Fixed #43: handled ``PINENTRY_LAUNCHED`` messages during key export. Thanks
- to Ian Denhardt for looking into this.
-
-* Hide the console window which appears on Windows when gpg is spawned.
- Thanks to Kévin Bernard-Allies for the patch.
-
-* Subkey fingerprints are now captured.
-
-* The returned value from the ``list_keys`` method now has a new attribute,
- ``key_map``, which is a dictionary mapping key and subkey fingerprints to
- the corresponding key's dictionary. With this change, you don't need to
- iterate over the (potentially large) returned list to search for a key with
- a given fingerprint - the ``key_map`` dict will take you straight to the key
- info, whether the fingerprint you have is for a key or a subkey. Thanks to
- Nick Daly for the initial suggestion.
-
-0.3.7
------
-
-Released: 2014-12-07
-
-Signed with PGP key: Vinay Sajip (CODE SIGNING KEY) <vinay_sajip at yahoo.co.uk>
-
-Key Fingerprint : CA74 9061 914E AC13 8E66 EADB 9147 B477 339A 9B86
-
-* Added an ``output`` keyword parameter to the ``sign`` and
- ``sign_file`` methods, to allow writing the signature to a file.
- Thanks to Jannis Leidel for the patch.
-
-* Allowed specifying ``True`` for the ``sign`` keyword parameter,
- which allows use of the default key for signing and avoids having to
- specify a key id when it's desired to use the default. Thanks to
- Fabian Beutel for the patch.
-
-* Used a uniform approach with subprocess on Windows and POSIX: shell=True
- is not used on either.
-
-* When signing/verifying, the status is updated to reflect any expired or
- revoked keys or signatures.
-
-* Handled 'NOTATION_NAME' and 'NOTATION_DATA' during verification.
-
-* Fixed #1, #16, #18, #20: Quoting approach changed, since now shell=False.
-
-* Fixed #14: Handled 'NEED_PASSPHRASE_PIN' message.
-
-* Fixed #8: Added a scan_keys method to allow scanning of keys without the
- need to import into a keyring. Thanks to Venzen Khaosan for the suggestion.
-
-* Fixed #5: Added '0x' prefix when searching for keys. Thanks to Aaron Toponce
- for the report.
-
-* Fixed #4: Handled 'PROGRESS' message during encryption. Thanks to Daniel
- Mills for the report.
-
-* Fixed #3: Changed default encoding to Latin-1.
-
-* Fixed #2: Raised ValueError if no recipients were specified
- for an asymmetric encryption request.
-
-* Handled 'UNEXPECTED' message during verification. Thanks to
- David Andersen for the patch.
-
-* Replaced old range(len(X)) idiom with enumerate().
-
-* Refactored ``ListKeys`` / ``SearchKeys`` classes to maximise use of common
- functions.
-
-* Fixed GC94: Added ``export-minimal`` and ``armor`` options when exporting
- keys. This addition was inadvertently left out of 0.3.6.
-
-0.3.6
------
-
-Released: 2014-02-05
-
-* Fixed GC82: Enabled fast random tests on gpg as well as gpg2.
-* Fixed GC85: Avoided deleting temporary file to preserve its permissions.
-* Fixed GC87: Avoided writing passphrase to log.
-* Fixed GC95: Added ``verify_data()`` method to allow verification of
- signatures in memory.
-* Fixed GC96: Regularised end-of-line characters.
-* Fixed GC98: Rectified problems with earlier fix for shell injection.
-
-0.3.5
------
-
-Released: 2013-08-30
-
-* Added improved shell quoting to guard against shell injection.
-* Fixed GC76: Added ``search_keys()`` and ``send_keys()`` methods.
-* Fixed GC77: Allowed specifying a symmetric cipher algorithm.
-* Fixed GC78: Fell back to utf-8 encoding when no other could be determined.
-* Fixed GC79: Default key length is now 2048 bits.
-* Fixed GC80: Removed the Name-Comment default in key generation.
-
-0.3.4
------
-
-Released: 2013-06-05
-
-* Fixed GC65: Fixed encoding exception when getting version.
-* Fixed GC66: Now accepts sets and frozensets where appropriate.
-* Fixed GC67: Hash algorithm now captured in sign result.
-* Fixed GC68: Added support for ``--secret-keyring``.
-* Fixed GC70: Added support for multiple keyrings.
-
-0.3.3
------
-
-Released: 2013-03-11
-
-* Fixed GC57: Handled control characters in ``list_keys()``.
-* Fixed GC61: Enabled fast random for testing.
-* Fixed GC62: Handled ``KEYEXPIRED`` status.
-* Fixed GC63: Handled ``NO_SGNR`` status.
-
-0.3.2
------
-
-Released: 2013-01-17
-
-* Fixed GC56: Disallowed blank values in key generation.
-* Fixed GC57: Handled colons and other characters in ``list_keys()``.
-* Fixed GC59/GC60: Handled ``INV_SGNR`` status during verification and removed
- calls requiring interactive password input from doctests.
-
-0.3.1
------
-
-Released: 2012-09-01
-
-* Fixed GC45: Allowed additional arguments to gpg executable.
-* Fixed GC50: Used latin-1 encoding in tests when it's known to be required.
-* Fixed GC51: Test now returns non-zero exit status on test failure.
-* Fixed GC53: Now handles ``INV_SGNR`` and ``KEY_NOT_CREATED`` statuses.
-* Fixed GC55: Verification and decryption now return trust level of signer in
- integer and text form.
-
-0.3.0
------
-
-Released: 2012-05-12
-
-* Fixed GC49: Reinstated Yann Leboulanger's change to support subkeys
- (accidentally left out in 0.2.7).
-
-0.2.9
------
-
-Released: 2012-03-29
-
-* Fixed GC36: Now handles ``CARDCTRL`` and ``POLICY_URL`` messages.
-* Fixed GC40: Now handles ``DECRYPTION_INFO``, ``DECRYPTION_FAILED`` and
- ``DECRYPTION_OKAY`` messages.
-* The ``random_binary_data file`` is no longer shipped, but constructed by the
- test suite if needed.
-
-0.2.8
------
-
-Released: 2011-09-02
-
-* Fixed GC29: Now handles ``IMPORT_RES`` while verifying.
-* Fixed GC30: Fixed an encoding problem.
-* Fixed GC33: Quoted arguments for added safety.
-
-0.2.7
------
-
-Released: 2011-04-10
-
-* Fixed GC24: License is clarified as BSD.
-* Fixed GC25: Incorporated Daniel Folkinshteyn's changes.
-* Fixed GC26: Incorporated Yann Leboulanger's subkey change.
-* Fixed GC27: Incorporated hysterix's support for symmetric encryption.
-* Did some internal cleanups of Unicode handling.
-
-0.2.6
------
-
-Released: 2011-01-25
-
-* Fixed GC14: Should be able to accept passphrases from GPG-Agent.
-* Fixed GC19: Should be able to create a detached signature.
-* Fixed GC21/GC23: Better handling of less common responses from GPG.
-
-0.2.5
------
-
-Released: 2010-10-13
-
-* Fixed GC11/GC16: Detached signatures can now be created.
-* Fixed GC3: Detached signatures can be verified.
-* Fixed GC12: Better support for RSA and IDEA.
-* Fixed GC15/GC17: Better support for non-ASCII input.
-
-0.2.4
------
-
-Released: 2010-03-01
-
-* Fixed GC9: Now allows encryption without armor and the ability to encrypt
- and decrypt directly to/from files.
-
-0.2.3
------
-
-Released: 2010-01-07
-
-* Fixed GC7: Made sending data to process threaded and added a test case.
- With a test data file used by the test case, the archive size has gone up
- to 5MB (the size of the test file).
-
-0.2.2
------
-
-Released: 2009-10-06
-
-* Fixed GC5/GC6: Added ``--batch`` when specifying ``--passphrase-fd`` and
- changed the name of the distribution file to add the ``python-`` prefix.
-
-0.2.1
------
-
-Released: 2009-08-07
-
-* Fixed GC2: Added ``handle_status()`` method to the ``ListKeys`` class.
-
-0.2.0
------
-
-Released: 2009-07-16
-
-* Various changes made to support Python 3.0.
-
-0.1.0
------
-
-Released: 2009-07-04
-
-* Initial release.
+.. image:: https://travis-ci.org/vsajip/python-gnupg.svg
+ :target: https://travis-ci.org/vsajip/python-gnupg
+
+.. image:: https://coveralls.io/repos/vsajip/python-gnupg/badge.svg
+ :target: https://coveralls.io/github/vsajip/python-gnupg
+
+
+What is it?
+===========
+
+The GNU Privacy Guard (gpg, or gpg.exe on Windows) is a command-line program
+which provides support for programmatic access via spawning a separate process
+to run it and then communicating with that process from your program.
+
+This project, ``python-gnupg``, implements a Python library which takes care
+of the internal details and allows its users to generate and manage keys,
+encrypt and decrypt data, and sign and verify messages.
+
+Installation
+============
+
+Installing from PyPI
+--------------------
+
+You can install this package from the Python Package Index (pyPI) by running::
+
+ pip install python-gnupg
+
+
+Installing from a source distribution archive
+---------------------------------------------
+To install this package from a source distribution archive, do the following:
+
+1. Extract all the files in the distribution archive to some directory on your
+ system.
+2. In that directory, run ``python setup.py install``.
+3. Optionally, run ``python test_gnupg.py`` to ensure that the package is
+ working as expected.
+
+Credits
+=======
+
+* The developers of the GNU Privacy Guard.
+* The original version of this module was developed by Andrew Kuchling.
+* It was improved by Richard Jones.
+* It was further improved by Steve Traugott.
+
+The present incarnation, based on the earlier versions, uses the ``subprocess``
+module and so works on Windows as well as Unix/Linux platforms. It's not,
+however, 100% backwards-compatible with earlier incarnations.
+
+Change log
+==========
+
+.. note:: GCnn refers to an issue nn on Google Code.
+
+0.4.2 (future)
+--------------
+
+Released: Not yet.
+
+
+0.4.1
+-----
+
+Released: 2017-07-06
+
+* Updated message handling logic to no longer raise exceptions when a message
+ isn't recognised. Thanks to Daniel Kahn Gillmor for the patch.
+
+* Always use always use ``--fixed-list-mode``, ``--batch`` and
+ ``--with-colons``. Thanks to Daniel Kahn Gillmor for the patch.
+
+* Improved ``scan_keys()`` handling on GnuPG >= 2.1. Thanks to Daniel Kahn
+ Gillmor for the patch.
+
+* Improved test behaviour with GnuPG >= 2.1. Failures when deleting test
+ directory trees are now ignored. Thanks to Daniel Kahn Gillmor for the patch.
+
+* Added ``close_file`` keyword argument to verify_file to allow the file closing
+ to be made optional. Current behaviour is maintained - ``close_file=False``
+ can be passed to skip closing the file being verified.
+
+* Added the ``extra_args`` keyword parameter to allow custom arguments to be
+ passed to the ``gpg`` executable.
+
+* Instances of the ``GPG`` class now have an additional ``on_data`` attribute,
+ which defaults to ``None``. It can be set to a callable which will be called
+ with a single argument - a binary chunk of data received from the ``gpg``
+ executable. The callable can do whatever it likes with the chunks passed to it
+ - e.g. write them to a separate stream. The callable should not raise any
+ exceptions (unless it wants the current operation to fail).
+
+
+0.4.0
+-----
+
+Released: 2017-01-29
+
+* Added support for ``KEY_CONSIDERED`` in more places - encryption /
+ decryption, signing, key generation and key import.
+
+* Partial fix for #32 (GPG 2.1 compatibility). Unfortunately, better
+ support cannot be provided at this point, unless there are certain
+ changes (relating to pinentry popups) in how GPG 2.1 works.
+
+* Fixed #60: An IndexError was being thrown by ``scan_keys()``.
+
+* Ensured that utf-8 encoding is used when the ``--with-column`` mode is
+ used. Thanks to Yann Leboulanger for the patch.
+
+* ``list_keys()`` now uses ``--fixed-list-mode``. Thanks to Werner Koch
+ for the pointer.
+
+
+0.3.9
+-----
+
+Released: 2016-09-10
+
+* Fixed #38: You can now request information about signatures against
+ keys. Thanks to SunDwarf for the suggestion and patch, which was used
+ as a basis for this change.
+
+* Fixed #49: When exporting keys, no attempt is made to decode the output when
+ armor=False is specified.
+
+* Fixed #53: A ``FAILURE`` message caused by passing an incorrect passphrase
+ is handled.
+
+* Handled ``EXPORTED`` and ``EXPORT_RES`` messages while exporting keys. Thanks
+ to Marcel Pörner for the patch.
+
+* Fixed #54: Improved error message shown when gpg is not available.
+
+* Fixed #55: Added support for ``KEY_CONSIDERED`` while verifying.
+
+* Avoided encoding problems with filenames under Windows. Thanks to Kévin
+ Bernard-Allies for the patch.
+
+* Fixed #57: Used a better mechanism for comparing keys.
+
+
+0.3.8
+-----
+
+Released: 2015-09-24
+
+* Fixed #22: handled ``PROGRESS`` messages during verification and signing.
+
+* Fixed #26: handled ``PINENTRY_LAUNCHED`` messages during verification,
+ decryption and key generation.
+
+* Fixed #28: Allowed a default Name-Email to be computed even when neither of
+ ``LOGNAME`` and ``USERNAME`` are in the environment.
+
+* Fixed #29: Included test files missing from the tarball in previous versions.
+
+* Fixed #39: On Python 3.x, passing a text instead of a binary stream caused
+ file decryption to hang due to a ``UnicodeDecodeError``. This has now been
+ correctly handled: The decryption fails with a "no data" status.
+
+* Fixed #41: Handled Unicode filenames correctly by encoding them on 2.x using
+ the file system encoding.
+
+* Fixed #43: handled ``PINENTRY_LAUNCHED`` messages during key export. Thanks
+ to Ian Denhardt for looking into this.
+
+* Hide the console window which appears on Windows when gpg is spawned.
+ Thanks to Kévin Bernard-Allies for the patch.
+
+* Subkey fingerprints are now captured.
+
+* The returned value from the ``list_keys`` method now has a new attribute,
+ ``key_map``, which is a dictionary mapping key and subkey fingerprints to
+ the corresponding key's dictionary. With this change, you don't need to
+ iterate over the (potentially large) returned list to search for a key with
+ a given fingerprint - the ``key_map`` dict will take you straight to the key
+ info, whether the fingerprint you have is for a key or a subkey. Thanks to
+ Nick Daly for the initial suggestion.
+
+0.3.7
+-----
+
+Released: 2014-12-07
+
+Signed with PGP key: Vinay Sajip (CODE SIGNING KEY) <vinay_sajip at yahoo.co.uk>
+
+Key Fingerprint : CA74 9061 914E AC13 8E66 EADB 9147 B477 339A 9B86
+
+* Added an ``output`` keyword parameter to the ``sign`` and
+ ``sign_file`` methods, to allow writing the signature to a file.
+ Thanks to Jannis Leidel for the patch.
+
+* Allowed specifying ``True`` for the ``sign`` keyword parameter,
+ which allows use of the default key for signing and avoids having to
+ specify a key id when it's desired to use the default. Thanks to
+ Fabian Beutel for the patch.
+
+* Used a uniform approach with subprocess on Windows and POSIX: shell=True
+ is not used on either.
+
+* When signing/verifying, the status is updated to reflect any expired or
+ revoked keys or signatures.
+
+* Handled 'NOTATION_NAME' and 'NOTATION_DATA' during verification.
+
+* Fixed #1, #16, #18, #20: Quoting approach changed, since now shell=False.
+
+* Fixed #14: Handled 'NEED_PASSPHRASE_PIN' message.
+
+* Fixed #8: Added a scan_keys method to allow scanning of keys without the
+ need to import into a keyring. Thanks to Venzen Khaosan for the suggestion.
+
+* Fixed #5: Added '0x' prefix when searching for keys. Thanks to Aaron Toponce
+ for the report.
+
+* Fixed #4: Handled 'PROGRESS' message during encryption. Thanks to Daniel
+ Mills for the report.
+
+* Fixed #3: Changed default encoding to Latin-1.
+
+* Fixed #2: Raised ValueError if no recipients were specified
+ for an asymmetric encryption request.
+
+* Handled 'UNEXPECTED' message during verification. Thanks to
+ David Andersen for the patch.
+
+* Replaced old range(len(X)) idiom with enumerate().
+
+* Refactored ``ListKeys`` / ``SearchKeys`` classes to maximise use of common
+ functions.
+
+* Fixed GC94: Added ``export-minimal`` and ``armor`` options when exporting
+ keys. This addition was inadvertently left out of 0.3.6.
+
+0.3.6
+-----
+
+Released: 2014-02-05
+
+* Fixed GC82: Enabled fast random tests on gpg as well as gpg2.
+* Fixed GC85: Avoided deleting temporary file to preserve its permissions.
+* Fixed GC87: Avoided writing passphrase to log.
+* Fixed GC95: Added ``verify_data()`` method to allow verification of
+ signatures in memory.
+* Fixed GC96: Regularised end-of-line characters.
+* Fixed GC98: Rectified problems with earlier fix for shell injection.
+
+0.3.5
+-----
+
+Released: 2013-08-30
+
+* Added improved shell quoting to guard against shell injection.
+* Fixed GC76: Added ``search_keys()`` and ``send_keys()`` methods.
+* Fixed GC77: Allowed specifying a symmetric cipher algorithm.
+* Fixed GC78: Fell back to utf-8 encoding when no other could be determined.
+* Fixed GC79: Default key length is now 2048 bits.
+* Fixed GC80: Removed the Name-Comment default in key generation.
+
+0.3.4
+-----
+
+Released: 2013-06-05
+
+* Fixed GC65: Fixed encoding exception when getting version.
+* Fixed GC66: Now accepts sets and frozensets where appropriate.
+* Fixed GC67: Hash algorithm now captured in sign result.
+* Fixed GC68: Added support for ``--secret-keyring``.
+* Fixed GC70: Added support for multiple keyrings.
+
+0.3.3
+-----
+
+Released: 2013-03-11
+
+* Fixed GC57: Handled control characters in ``list_keys()``.
+* Fixed GC61: Enabled fast random for testing.
+* Fixed GC62: Handled ``KEYEXPIRED`` status.
+* Fixed GC63: Handled ``NO_SGNR`` status.
+
+0.3.2
+-----
+
+Released: 2013-01-17
+
+* Fixed GC56: Disallowed blank values in key generation.
+* Fixed GC57: Handled colons and other characters in ``list_keys()``.
+* Fixed GC59/GC60: Handled ``INV_SGNR`` status during verification and removed
+ calls requiring interactive password input from doctests.
+
+0.3.1
+-----
+
+Released: 2012-09-01
+
+* Fixed GC45: Allowed additional arguments to gpg executable.
+* Fixed GC50: Used latin-1 encoding in tests when it's known to be required.
+* Fixed GC51: Test now returns non-zero exit status on test failure.
+* Fixed GC53: Now handles ``INV_SGNR`` and ``KEY_NOT_CREATED`` statuses.
+* Fixed GC55: Verification and decryption now return trust level of signer in
+ integer and text form.
+
+0.3.0
+-----
+
+Released: 2012-05-12
+
+* Fixed GC49: Reinstated Yann Leboulanger's change to support subkeys
+ (accidentally left out in 0.2.7).
+
+0.2.9
+-----
+
+Released: 2012-03-29
+
+* Fixed GC36: Now handles ``CARDCTRL`` and ``POLICY_URL`` messages.
+* Fixed GC40: Now handles ``DECRYPTION_INFO``, ``DECRYPTION_FAILED`` and
+ ``DECRYPTION_OKAY`` messages.
+* The ``random_binary_data file`` is no longer shipped, but constructed by the
+ test suite if needed.
+
+0.2.8
+-----
+
+Released: 2011-09-02
+
+* Fixed GC29: Now handles ``IMPORT_RES`` while verifying.
+* Fixed GC30: Fixed an encoding problem.
+* Fixed GC33: Quoted arguments for added safety.
+
+0.2.7
+-----
+
+Released: 2011-04-10
+
+* Fixed GC24: License is clarified as BSD.
+* Fixed GC25: Incorporated Daniel Folkinshteyn's changes.
+* Fixed GC26: Incorporated Yann Leboulanger's subkey change.
+* Fixed GC27: Incorporated hysterix's support for symmetric encryption.
+* Did some internal cleanups of Unicode handling.
+
+0.2.6
+-----
+
+Released: 2011-01-25
+
+* Fixed GC14: Should be able to accept passphrases from GPG-Agent.
+* Fixed GC19: Should be able to create a detached signature.
+* Fixed GC21/GC23: Better handling of less common responses from GPG.
+
+0.2.5
+-----
+
+Released: 2010-10-13
+
+* Fixed GC11/GC16: Detached signatures can now be created.
+* Fixed GC3: Detached signatures can be verified.
+* Fixed GC12: Better support for RSA and IDEA.
+* Fixed GC15/GC17: Better support for non-ASCII input.
+
+0.2.4
+-----
+
+Released: 2010-03-01
+
+* Fixed GC9: Now allows encryption without armor and the ability to encrypt
+ and decrypt directly to/from files.
+
+0.2.3
+-----
+
+Released: 2010-01-07
+
+* Fixed GC7: Made sending data to process threaded and added a test case.
+ With a test data file used by the test case, the archive size has gone up
+ to 5MB (the size of the test file).
+
+0.2.2
+-----
+
+Released: 2009-10-06
+
+* Fixed GC5/GC6: Added ``--batch`` when specifying ``--passphrase-fd`` and
+ changed the name of the distribution file to add the ``python-`` prefix.
+
+0.2.1
+-----
+
+Released: 2009-08-07
+
+* Fixed GC2: Added ``handle_status()`` method to the ``ListKeys`` class.
+
+0.2.0
+-----
+
+Released: 2009-07-16
+
+* Various changes made to support Python 3.0.
+
+0.1.0
+-----
+
+Released: 2009-07-04
+
+* Initial release.
diff --git a/gnupg.py b/gnupg.py
index 4515841..57f23bc 100644
--- a/gnupg.py
+++ b/gnupg.py
@@ -27,14 +27,14 @@ 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-2016 Vinay Sajip. All rights reserved.
+Modifications Copyright (C) 2008-2017 Vinay Sajip. All rights reserved.
A unittest harness (test_gnupg.py) has also been added.
"""
-__version__ = "0.3.9"
+__version__ = "0.4.1"
__author__ = "Vinay Sajip"
-__date__ = "$10-Sep-2016 08:38:35$"
+__date__ = "$07-Jul-2017 15:09:20$"
try:
from io import StringIO
@@ -240,14 +240,8 @@ class Verify(object):
if key in self.TRUST_LEVELS:
self.trust_text = key
self.trust_level = self.TRUST_LEVELS[key]
- elif key in ("RSA_OR_IDEA", "NODATA", "IMPORT_RES", "PLAINTEXT",
- "PLAINTEXT_LENGTH", "POLICY_URL", "DECRYPTION_INFO",
- "DECRYPTION_OKAY", "INV_SGNR", "FILE_START", "FILE_ERROR",
- "FILE_DONE", "PKA_TRUST_GOOD", "PKA_TRUST_BAD", "BADMDC",
- "GOODMDC", "NO_SGNR", "NOTATION_NAME", "NOTATION_DATA",
- "PROGRESS", "PINENTRY_LAUNCHED", "NEWSIG",
- "KEY_CONSIDERED"):
- pass
+ elif key in ("WARNING", "ERROR"):
+ logger.warning('potential problem: %s: %s', key, value)
elif key == "BADSIG": # pragma: no cover
self.valid = False
self.status = 'signature bad'
@@ -286,12 +280,6 @@ class Verify(object):
self.valid = False
self.key_id = value
self.status = 'no public key'
- elif key in ("KEYEXPIRED", "SIGEXPIRED", "KEYREVOKED"): # pragma: no cover
- # these are useless in verify, since they are spit out for any
- # pub/subkeys on the key, not just the one doing the signing.
- # if we want to check for signatures with expired key,
- # the relevant flag is EXPKEYSIG or REVKEYSIG.
- pass
elif key in ("EXPKEYSIG", "REVKEYSIG"): # pragma: no cover
# signed with expired or revoked key
self.valid = False
@@ -308,9 +296,13 @@ class Verify(object):
self.status = 'unexpected data'
else:
# N.B. there might be other reasons
- self.status = 'incorrect passphrase'
- else:
- raise ValueError("Unknown status message: %r" % key)
+ if not self.status:
+ self.status = 'incorrect passphrase'
+ elif key in ("DECRYPTION_INFO", "PLAINTEXT", "PLAINTEXT_LENGTH",
+ "NO_SECKEY", "BEGIN_SIGNING"):
+ pass
+ else: # pragma: no cover
+ logger.debug('message ignored: %s, %s', key, value)
class ImportResult(object):
"Handle status messages for --import"
@@ -351,7 +343,9 @@ class ImportResult(object):
}
def handle_status(self, key, value):
- if key == "IMPORTED":
+ if key in ("WARNING", "ERROR"):
+ logger.warning('potential problem: %s: %s', key, value)
+ elif key in ("IMPORTED", "KEY_CONSIDERED"):
# this duplicates info we already see in import_ok & import_problem
pass
elif key == "NODATA": # pragma: no cover
@@ -385,8 +379,11 @@ class ImportResult(object):
elif key == "SIGEXPIRED": # pragma: no cover
self.results.append({'fingerprint': None,
'problem': '0', 'text': 'Signature expired'})
+ elif key == "FAILURE": # pragma: no cover
+ self.results.append({'fingerprint': None,
+ 'problem': '0', 'text': 'Other failure'})
else: # pragma: no cover
- raise ValueError("Unknown status message: %r" % key)
+ logger.debug('message ignored: %s, %s', key, value)
def summary(self):
l = []
@@ -432,7 +429,10 @@ class SearchKeys(list):
def get_fields(self, args):
result = {}
for i, var in enumerate(self.FIELDS):
- result[var] = args[i]
+ if i < len(args):
+ result[var] = args[i]
+ else:
+ result[var] = 'unavailable'
result['uids'] = []
result['sigs'] = []
return result
@@ -552,14 +552,10 @@ class Crypt(Verify, TextHandler):
__bool__ = __nonzero__
def handle_status(self, key, value):
- if key in ("ENC_TO", "USERID_HINT", "GOODMDC", "END_DECRYPTION",
- "BEGIN_SIGNING", "NO_SECKEY", "ERROR", "NODATA", "PROGRESS",
- "CARDCTRL", "BADMDC", "SC_OP_FAILURE", "SC_OP_SUCCESS",
- "PINENTRY_LAUNCHED"):
- # in the case of ERROR, this is because a more specific error
- # message will have come first
- if key == "NODATA":
- self.status = "no data was provided"
+ if key in ("WARNING", "ERROR"):
+ logger.warning('potential problem: %s: %s', key, value)
+ elif key == "NODATA":
+ self.status = "no data was provided"
elif key in ("NEED_PASSPHRASE", "BAD_PASSPHRASE", "GOOD_PASSPHRASE",
"MISSING_PASSPHRASE", "DECRYPTION_FAILED",
"KEY_NOT_CREATED", "NEED_PASSPHRASE_PIN"):
@@ -584,6 +580,11 @@ class Crypt(Verify, TextHandler):
self.status = 'sig created'
elif key == "SIGEXPIRED": # pragma: no cover
self.status = 'sig expired'
+ elif key in ("ENC_TO", "USERID_HINT", "GOODMDC",
+ "END_DECRYPTION", "CARDCTRL", "BADMDC",
+ "SC_OP_FAILURE", "SC_OP_SUCCESS",
+ "PINENTRY_LAUNCHED", "KEY_CONSIDERED"):
+ pass
else:
Verify.handle_status(self, key, value)
@@ -604,13 +605,14 @@ class GenKey(object):
return self.fingerprint or ''
def handle_status(self, key, value):
- if key in ("PROGRESS", "GOOD_PASSPHRASE", "NODATA", "KEY_NOT_CREATED",
- "PINENTRY_LAUNCHED"):
- pass
+ if key in ("WARNING", "ERROR"): # pragma: no cover
+ logger.warning('potential problem: %s: %s', key, value)
elif key == "KEY_CREATED":
(self.type,self.fingerprint) = value.split()
- else:
- raise ValueError("Unknown status message: %r" % key)
+ elif key in ("PROGRESS", "GOOD_PASSPHRASE", "KEY_NOT_CREATED"):
+ pass
+ else: # pragma: no cover
+ logger.debug('message ignored: %s, %s', key, value)
class ExportResult(GenKey):
"""Handle status messages for --export[-secret-key].
@@ -644,7 +646,7 @@ class DeleteResult(object):
self.status = self.problem_reason.get(value,
"Unknown error: %r" % value)
else: # pragma: no cover
- raise ValueError("Unknown status message: %r" % key)
+ logger.debug('message ignored: %s, %s', key, value)
def __nonzero__(self):
return self.status == 'ok'
@@ -659,6 +661,7 @@ class Sign(TextHandler):
self.type = None
self.hash_algo = None
self.fingerprint = None
+ self.status = None
def __nonzero__(self):
return self.fingerprint is not None
@@ -666,12 +669,8 @@ class Sign(TextHandler):
__bool__ = __nonzero__
def handle_status(self, key, value):
- if key in ("USERID_HINT", "NEED_PASSPHRASE", "BAD_PASSPHRASE",
- "GOOD_PASSPHRASE", "BEGIN_SIGNING", "CARDCTRL", "INV_SGNR",
- "NO_SGNR", "MISSING_PASSPHRASE", "NEED_PASSPHRASE_PIN",
- "SC_OP_FAILURE", "SC_OP_SUCCESS", "PROGRESS",
- "PINENTRY_LAUNCHED"):
- pass
+ if key in ("WARNING", "ERROR", "FAILURE"): # pragma: no cover
+ logger.warning('potential problem: %s: %s', key, value)
elif key in ("KEYEXPIRED", "SIGEXPIRED"): # pragma: no cover
self.status = 'key expired'
elif key == "KEYREVOKED": # pragma: no cover
@@ -681,8 +680,12 @@ class Sign(TextHandler):
algo, self.hash_algo, cls,
self.timestamp, self.fingerprint
) = value.split()
+ self.status = 'signature created'
+ elif key in ("USERID_HINT", "NEED_PASSPHRASE", "GOOD_PASSPHRASE",
... 937 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-gnupg.git
More information about the Python-modules-commits
mailing list