• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

python_gnupg.egg-info/H03-May-2022-3831

MANIFEST.inH A D17-Apr-2020107 75

PKG-INFOH A D11-Mar-20211.8 KiB3831

README.rstH A D11-Mar-202116.5 KiB544357

gnupg.pyH A D11-Mar-202160.5 KiB1,6501,354

messages.jsonH A D17-Apr-202019.5 KiB566565

setup.cfgH A D11-Mar-202167 85

setup.pyH A D12-Jan-20211.9 KiB4941

test_gnupg.pyH A D11-Mar-202151.8 KiB1,1881,058

README.rst

1.. image:: https://travis-ci.org/vsajip/python-gnupg.svg
2   :target: https://travis-ci.org/vsajip/python-gnupg
3
4.. image:: https://coveralls.io/repos/vsajip/python-gnupg/badge.svg
5   :target: https://coveralls.io/github/vsajip/python-gnupg
6
7
8What is it?
9===========
10
11The GNU Privacy Guard (gpg, or gpg.exe on Windows) is a command-line program
12which provides support for programmatic access via spawning a separate process
13to run it and then communicating with that process from your program.
14
15This project, ``python-gnupg``, implements a Python library which takes care
16of the internal details and allows its users to generate and manage keys,
17encrypt and decrypt data, and sign and verify messages.
18
19Installation
20============
21
22Installing from PyPI
23--------------------
24
25You can install this package from the Python Package Index (pyPI) by running::
26
27    pip install python-gnupg
28
29.. important::
30   There is at least one fork of this project, which was apparently created
31   because an earlier version of this software used the ``subprocess`` module
32   with ``shell=True``, making it vulnerable to shell injection. **This is no
33   longer the case**.
34
35   Forks may not be drop-in compatible with this software, so take care to use
36   the correct version, as indicated in the ``pip install`` command above.
37
38
39Installing from a source distribution archive
40---------------------------------------------
41To install this package from a source distribution archive, do the following:
42
431. Extract all the files in the distribution archive to some directory on your
44   system.
452. In that directory, run ``python setup.py install``.
463. Optionally, run ``python test_gnupg.py`` to ensure that the package is
47   working as expected.
48
49Credits
50=======
51
52* The developers of the GNU Privacy Guard.
53* The original version of this module was developed by Andrew Kuchling.
54* It was improved by Richard Jones.
55* It was further improved by Steve Traugott.
56
57The present incarnation, based on the earlier versions, uses the ``subprocess``
58module and so works on Windows as well as Unix/Linux platforms. It's not,
59however, 100% backwards-compatible with earlier incarnations.
60
61Change log
62==========
63
64.. note:: GCnn refers to an issue nn on Google Code.
65
66
670.4.8 (future)
68--------------
69
70Released: Not yet.
71
720.4.7
73-----
74
75Released: 2021-03-11
76
77* Fixed #129, #141: Added support for no passphrase during key generation.
78
79* Fixed #143: Improved permission-denied test. Thanks to Elliot Cameron for the patch.
80
81* Fixed #144: Updated logging to only show partial results.
82
83* Fixed #146: Allowed a passphrase to be passed to import_keys(). Thanks to Chris de
84  Graaf for the patch.
85
86
870.4.6
88-----
89
90Released: 2020-04-17
91
92* Fixed #122: Updated documentation about gnupghome needing to be an existing
93  directory.
94
95* Fixed #123: Handled error conditions from gpg when calling trust_keys().
96
97* Fixed #124: Avoided an exception being raised when ImportResult.summary()
98  was called after a failed recv_keys().
99
100* Fixed #128: Added ECC support by changing key generation parameters. (The Key-Length
101  value isn't added if a curve is specified.)
102
103* Fixed #130: Provided a mechanism to provide more complete error messages.
104
105Support for Python versions 3.5 and under is discontinued, except for Python 2.7.
106
107
1080.4.5
109-----
110
111Released: 2019-08-12
112
113* Fixed #107: Improved documentation.
114
115* Fixed #112: Raised a ValueError if a gnupghome is specified which is not an
116  existing directory.
117
118* Fixed #113: Corrected stale link in the documentation.
119
120* Fixed #116: Updated documentation to clarify when spurious key-expired/
121  signature-expired messages might be seen.
122
123* Fixed #119: Added --yes to avoid pinentry when deleting secret keys with
124  GnuPG >= 2.1.
125
126* A warning is logged if gpg returns a non-zero return code.
127
128* Added ``extra_args`` to ``import_keys``.
129
130* Added support for CI using AppVeyor.
131
132
1330.4.4
134-----
135
136Released: 2019-01-24
137
138* Fixed #108: Changed how any return value from the ``on_data`` callable is
139  processed. In earlier versions, the return value was ignored. In this version,
140  if the return value is ``False``, the data received from ``gpg`` is not
141  buffered. Otherwise (if the value is ``None`` or ``True``, for example), the
142  data is buffered as normal. This functionality can be used to do your own
143  buffering, or to prevent buffering altogether.
144
145  The ``on_data`` callable is also called once with an empty byte-string to
146  signal the end of data from ``gpg``.
147
148* Fixed #97: Added an additional attribute ``check_fingerprint_collisions`` to
149  ``GPG`` instances, which defaults to ``False``. It seems that ``gpg`` is happy
150  to have duplicate keys and fingerprints in a keyring, so we can't be too
151  strict. A user can set this attribute of an instance to ``True`` to trigger a
152  check for collisions.
153
154* Fixed #111: With GnuPG 2.2.7 or later, provide the fingerprint of a signing
155  key for a failed signature verification, if available.
156
157* Fixed #21: For verification where multiple signatures are involved, a
158  mapping of signature_ids to fingerprint, keyid, username, creation date,
159  creation timestamp and expiry timestamp is provided.
160
161* Added a check to disallow certain control characters ('\r', '\n', NUL) in
162  passphrases.
163
164
1650.4.3
166-----
167
168Released: 2018-06-13
169
170* Added --no-verbose to the gpg command line, in case verbose is specified in
171  gpg.conf - we don't need verbose output.
172
173
1740.4.2
175-----
176
177Released: 2018-03-28
178
179* Fixed #81: Subkey information is now collected and returned in a ``subkey_info``
180  dictionary keyed by the subkey's ID.
181
182* Fixed #84: GPG2 version is now correctly detected on OS X.
183
184* Fixed #94: Added ``expect_passphrase`` password for use on GnuPG >= 2.1 when
185  passing passphrase to ``gpg`` via pinentry.
186
187* Fixed #95: Provided a ``trust_keys`` method to allow setting the trust level
188  for keys. Thanks to William Foster for a suggested implementation.
189
190* Made the exception message when the gpg executable is not found contain the
191  path of the executable that was tried. Thanks to Kostis Anagnostopoulos for
192  the suggestion.
193
194* Fixed #100: Made the error message less categorical in the case of a failure
195  with an unspecified reason, adding some information from gpg error codes when
196  available.
197
198
1990.4.1
200-----
201
202Released: 2017-07-06
203
204* Updated message handling logic to no longer raise exceptions when a message
205  isn't recognised. Thanks to Daniel Kahn Gillmor for the patch.
206
207* Always use always use ``--fixed-list-mode``, ``--batch`` and
208  ``--with-colons``. Thanks to Daniel Kahn Gillmor for the patch.
209
210* Improved ``scan_keys()`` handling on GnuPG >= 2.1. Thanks to Daniel Kahn
211  Gillmor for the patch.
212
213* Improved test behaviour with GnuPG >= 2.1. Failures when deleting test
214  directory trees are now ignored. Thanks to Daniel Kahn Gillmor for the patch.
215
216* Added ``close_file`` keyword argument to verify_file to allow the file closing
217  to be made optional. Current behaviour is maintained - ``close_file=False``
218  can be passed to skip closing the file being verified.
219
220* Added the ``extra_args`` keyword parameter to allow custom arguments to be
221  passed to the ``gpg`` executable.
222
223* Instances of the ``GPG`` class now have an additional ``on_data`` attribute,
224  which defaults to ``None``. It can be set to a callable which will be called
225  with a single argument - a binary chunk of data received from the ``gpg``
226  executable. The callable can do whatever it likes with the chunks passed to it
227  - e.g. write them to a separate stream. The callable should not raise any
228  exceptions (unless it wants the current operation to fail).
229
230
2310.4.0
232-----
233
234Released: 2017-01-29
235
236* Added support for ``KEY_CONSIDERED`` in more places - encryption /
237  decryption, signing, key generation and key import.
238
239* Partial fix for #32 (GPG 2.1 compatibility). Unfortunately, better
240  support cannot be provided at this point, unless there are certain
241  changes (relating to pinentry popups) in how GPG 2.1 works.
242
243* Fixed #60: An IndexError was being thrown by ``scan_keys()``.
244
245* Ensured that utf-8 encoding is used when the ``--with-column`` mode is
246  used. Thanks to Yann Leboulanger for the patch.
247
248* ``list_keys()`` now uses ``--fixed-list-mode``. Thanks to Werner Koch
249  for the pointer.
250
251
2520.3.9
253-----
254
255Released: 2016-09-10
256
257* Fixed #38: You can now request information about signatures against
258  keys. Thanks to SunDwarf for the suggestion and patch, which was used
259  as a basis for this change.
260
261* Fixed #49: When exporting keys, no attempt is made to decode the output when
262  armor=False is specified.
263
264* Fixed #53: A ``FAILURE`` message caused by passing an incorrect passphrase
265  is handled.
266
267* Handled ``EXPORTED`` and ``EXPORT_RES`` messages while exporting keys. Thanks
268  to Marcel Pörner for the patch.
269
270* Fixed #54: Improved error message shown when gpg is not available.
271
272* Fixed #55: Added support for ``KEY_CONSIDERED`` while verifying.
273
274* Avoided encoding problems with filenames under Windows. Thanks to Kévin
275  Bernard-Allies for the patch.
276
277* Fixed #57: Used a better mechanism for comparing keys.
278
279
2800.3.8
281-----
282
283Released: 2015-09-24
284
285* Fixed #22: handled ``PROGRESS`` messages during verification and signing.
286
287* Fixed #26: handled ``PINENTRY_LAUNCHED`` messages during verification,
288  decryption and key generation.
289
290* Fixed #28: Allowed a default Name-Email to be computed even when neither of
291  ``LOGNAME`` and ``USERNAME`` are in the environment.
292
293* Fixed #29: Included test files missing from the tarball in previous versions.
294
295* Fixed #39: On Python 3.x, passing a text instead of a binary stream caused
296  file decryption to hang due to a ``UnicodeDecodeError``. This has now been
297  correctly handled: The decryption fails with a "no data" status.
298
299* Fixed #41: Handled Unicode filenames correctly by encoding them on 2.x using
300  the file system encoding.
301
302* Fixed #43: handled ``PINENTRY_LAUNCHED`` messages during key export. Thanks
303  to Ian Denhardt for looking into this.
304
305* Hide the console window which appears on Windows when gpg is spawned.
306  Thanks to Kévin Bernard-Allies for the patch.
307
308* Subkey fingerprints are now captured.
309
310* The returned value from the ``list_keys`` method now has a new attribute,
311  ``key_map``, which is a dictionary mapping key and subkey fingerprints to
312  the corresponding key's dictionary. With this change, you don't need to
313  iterate over the (potentially large) returned list to search for a key with
314  a given fingerprint - the ``key_map`` dict will take you straight to the key
315  info, whether the fingerprint you have is for a key or a subkey. Thanks to
316  Nick Daly for the initial suggestion.
317
3180.3.7
319-----
320
321Released: 2014-12-07
322
323Signed with PGP key: Vinay Sajip (CODE SIGNING KEY) <vinay_sajip@yahoo.co.uk>
324
325Key Fingerprint    : CA74 9061 914E AC13 8E66 EADB 9147 B477 339A 9B86
326
327* Added an ``output`` keyword parameter to the ``sign`` and
328  ``sign_file`` methods, to allow writing the signature to a file.
329  Thanks to Jannis Leidel for the patch.
330
331* Allowed specifying ``True`` for the ``sign`` keyword parameter,
332  which allows use of the default key for signing and avoids having to
333  specify a key id when it's desired to use the default. Thanks to
334  Fabian Beutel for the patch.
335
336* Used a uniform approach with subprocess on Windows and POSIX: shell=True
337  is not used on either.
338
339* When signing/verifying, the status is updated to reflect any expired or
340  revoked keys or signatures.
341
342* Handled 'NOTATION_NAME' and 'NOTATION_DATA' during verification.
343
344* Fixed #1, #16, #18, #20: Quoting approach changed, since now shell=False.
345
346* Fixed #14: Handled 'NEED_PASSPHRASE_PIN' message.
347
348* Fixed #8: Added a scan_keys method to allow scanning of keys without the
349  need to import into a keyring. Thanks to Venzen Khaosan for the suggestion.
350
351* Fixed #5: Added '0x' prefix when searching for keys. Thanks to Aaron Toponce
352  for the report.
353
354* Fixed #4: Handled 'PROGRESS' message during encryption. Thanks to Daniel
355  Mills for the report.
356
357* Fixed #3: Changed default encoding to Latin-1.
358
359* Fixed #2: Raised ValueError if no recipients were specified
360  for an asymmetric encryption request.
361
362* Handled 'UNEXPECTED' message during verification. Thanks to
363  David Andersen for the patch.
364
365* Replaced old range(len(X)) idiom with enumerate().
366
367* Refactored ``ListKeys`` / ``SearchKeys`` classes to maximise use of common
368  functions.
369
370* Fixed GC94: Added ``export-minimal`` and ``armor`` options when exporting
371  keys. This addition was inadvertently left out of 0.3.6.
372
3730.3.6
374-----
375
376Released: 2014-02-05
377
378* Fixed GC82: Enabled fast random tests on gpg as well as gpg2.
379* Fixed GC85: Avoided deleting temporary file to preserve its permissions.
380* Fixed GC87: Avoided writing passphrase to log.
381* Fixed GC95: Added ``verify_data()`` method to allow verification of
382  signatures in memory.
383* Fixed GC96: Regularised end-of-line characters.
384* Fixed GC98: Rectified problems with earlier fix for shell injection.
385
3860.3.5
387-----
388
389Released: 2013-08-30
390
391* Added improved shell quoting to guard against shell injection.
392* Fixed GC76: Added ``search_keys()`` and ``send_keys()`` methods.
393* Fixed GC77: Allowed specifying a symmetric cipher algorithm.
394* Fixed GC78: Fell back to utf-8 encoding when no other could be determined.
395* Fixed GC79: Default key length is now 2048 bits.
396* Fixed GC80: Removed the Name-Comment default in key generation.
397
3980.3.4
399-----
400
401Released: 2013-06-05
402
403* Fixed GC65: Fixed encoding exception when getting version.
404* Fixed GC66: Now accepts sets and frozensets where appropriate.
405* Fixed GC67: Hash algorithm now captured in sign result.
406* Fixed GC68: Added support for ``--secret-keyring``.
407* Fixed GC70: Added support for multiple keyrings.
408
4090.3.3
410-----
411
412Released: 2013-03-11
413
414* Fixed GC57: Handled control characters in ``list_keys()``.
415* Fixed GC61: Enabled fast random for testing.
416* Fixed GC62: Handled ``KEYEXPIRED`` status.
417* Fixed GC63: Handled ``NO_SGNR`` status.
418
4190.3.2
420-----
421
422Released: 2013-01-17
423
424* Fixed GC56: Disallowed blank values in key generation.
425* Fixed GC57: Handled colons and other characters in ``list_keys()``.
426* Fixed GC59/GC60: Handled ``INV_SGNR`` status during verification and removed
427  calls requiring interactive password input from doctests.
428
4290.3.1
430-----
431
432Released: 2012-09-01
433
434* Fixed GC45: Allowed additional arguments to gpg executable.
435* Fixed GC50: Used latin-1 encoding in tests when it's known to be required.
436* Fixed GC51: Test now returns non-zero exit status on test failure.
437* Fixed GC53: Now handles ``INV_SGNR`` and ``KEY_NOT_CREATED`` statuses.
438* Fixed GC55: Verification and decryption now return trust level of signer in
439  integer and text form.
440
4410.3.0
442-----
443
444Released: 2012-05-12
445
446* Fixed GC49: Reinstated Yann Leboulanger's change to support subkeys
447  (accidentally left out in 0.2.7).
448
4490.2.9
450-----
451
452Released: 2012-03-29
453
454* Fixed GC36: Now handles ``CARDCTRL`` and ``POLICY_URL`` messages.
455* Fixed GC40: Now handles ``DECRYPTION_INFO``, ``DECRYPTION_FAILED`` and
456  ``DECRYPTION_OKAY`` messages.
457* The ``random_binary_data file`` is no longer shipped, but constructed by the
458  test suite if needed.
459
4600.2.8
461-----
462
463Released: 2011-09-02
464
465* Fixed GC29: Now handles ``IMPORT_RES`` while verifying.
466* Fixed GC30: Fixed an encoding problem.
467* Fixed GC33: Quoted arguments for added safety.
468
4690.2.7
470-----
471
472Released: 2011-04-10
473
474* Fixed GC24: License is clarified as BSD.
475* Fixed GC25: Incorporated Daniel Folkinshteyn's changes.
476* Fixed GC26: Incorporated Yann Leboulanger's subkey change.
477* Fixed GC27: Incorporated hysterix's support for symmetric encryption.
478* Did some internal cleanups of Unicode handling.
479
4800.2.6
481-----
482
483Released: 2011-01-25
484
485* Fixed GC14: Should be able to accept passphrases from GPG-Agent.
486* Fixed GC19: Should be able to create a detached signature.
487* Fixed GC21/GC23: Better handling of less common responses from GPG.
488
4890.2.5
490-----
491
492Released: 2010-10-13
493
494* Fixed GC11/GC16: Detached signatures can now be created.
495* Fixed GC3: Detached signatures can be verified.
496* Fixed GC12: Better support for RSA and IDEA.
497* Fixed GC15/GC17: Better support for non-ASCII input.
498
4990.2.4
500-----
501
502Released: 2010-03-01
503
504* Fixed GC9: Now allows encryption without armor and the ability to encrypt
505  and decrypt directly to/from files.
506
5070.2.3
508-----
509
510Released: 2010-01-07
511
512* Fixed GC7: Made sending data to process threaded and added a test case.
513  With a test data file used by the test case, the archive size has gone up
514  to 5MB (the size of the test file).
515
5160.2.2
517-----
518
519Released: 2009-10-06
520
521* Fixed GC5/GC6: Added ``--batch`` when specifying ``--passphrase-fd`` and
522  changed the name of the distribution file to add the ``python-`` prefix.
523
5240.2.1
525-----
526
527Released: 2009-08-07
528
529* Fixed GC2: Added ``handle_status()`` method to the ``ListKeys`` class.
530
5310.2.0
532-----
533
534Released: 2009-07-16
535
536* Various changes made to support Python 3.0.
537
5380.1.0
539-----
540
541Released: 2009-07-04
542
543* Initial release.
544