A new version (0.3.9) has been released.

61 views
Skip to first unread message

Vinay Sajip

unread,
Sep 10, 2016, 5:14:07 AM9/10/16
to python-gnupg
A new version of python-gnupg has been released.

What Changed?
=============
This is an enhancement and bug-fix release, and all users are encouraged to upgrade.
See the project website [1] for more information.

Brief summary:


* 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.

This release [2] has been signed with my code signing key:

Vinay Sajip (CODE SIGNING KEY) <vina... at yahoo.co.uk>
Fingerprint: CA74 9061 914E AC13 8E66 EADB 9147 B477 339A 9B86

What Does It Do?
================
The gnupg module allows Python programs to make use of the
functionality provided by the Gnu Privacy Guard (abbreviated GPG or
GnuPG). Using this module, Python programs can encrypt and decrypt
data, digitally sign documents and verify digital signatures, manage
(generate, list and delete) encryption keys, using proven Public Key
Infrastructure (PKI) encryption technology based on OpenPGP.

This module is expected to be used with Python versions >= 2.4, as it
makes use of the subprocess module which appeared in that version of
Python. This module is a newer version derived from earlier work by
Andrew Kuchling, Richard Jones and Steve Traugott.

A test suite using unittest is included with the source distribution.

Simple usage:

>>> import gnupg
>>> gpg = gnupg.GPG(gnupghome='/path/to/keyring/directory')
>>> gpg.list_keys()

[{
...
'fingerprint': 'F819EE7705497D73E3CCEE65197D5DAC68F1AAB2',
'keyid': '197D5DAC68F1AAB2',
'length': '1024',
'type': 'pub',
'uids': ['', 'Gary Gross (A test user) <gary.gr... at gamma.com>']},
{
...
'fingerprint': '37F24DD4B918CC264D4F31D60C5FEFA7A921FC4A',
'keyid': '0C5FEFA7A921FC4A',
'length': '1024',
...
'uids': ['', 'Danny Davis (A test user) <danny.da... at delta.com>']}]
>>> encrypted = gpg.encrypt("Hello, world!", ['0C5FEFA7A921FC4A'])
>>> str(encrypted)

'-----BEGIN PGP MESSAGE-----\nVersion: GnuPG v1.4.9 (GNU/Linux)\n
\nhQIOA/6NHMDTXUwcEAf
.
-----END PGP MESSAGE-----\n'
>>> decrypted = gpg.decrypt(str(encrypted), passphrase='secret')
>>> str(decrypted)

'Hello, world!'
>>> signed = gpg.sign("Goodbye, world!", passphrase='secret')
>>> verified = gpg.verify(str(signed))
>>> print "Verified" if verified else "Not verified"

'Verified'

As always, your feedback is most welcome (especially bug reports [3],
patches and suggestions for improvement, or any other points via the
mailing list/discussion group [4]).

Enjoy!

Cheers

Vinay Sajip
Red Dove Consultants Ltd.



Ben Natal

unread,
Sep 13, 2016, 4:54:48 AM9/13/16
to python-gnupg
Thanks Vinay, thanks for posting the latest release of python-gnupg, I am using this library for the first time in my code, is there a simple way to decrypt zip files that are encrypted using gpg and contain multiple PDF files using this library, when I attempt to decrypt these files, I get the following errors.

2016-09-12 21:45:01,366 - INFO - Original Filename: //primus//IngramAu//preprocess\ACAP_16_7_F300.1.zip.gpg
2016-09-12 21:45:01,566 - INFO - False
2016-09-12 21:45:01,566 - INFO - decryption failed
2016-09-12 21:45:01,566 - INFO - [GNUPG:] ENC_TO 2F3278BF65D69988 1 0

[GNUPG:] USERID_HINT 2F3278BF65D69988 Autogenerated Key <ben....@sheridan.com>

[GNUPG:] NEED_PASSPHRASE 2F3278BF65D69988 2F3278BF65D69988 1 0

[GNUPG:] GOOD_PASSPHRASE

gpg: encrypted with 2048-bit RSA key, ID 65D69988, created 2016-09-08

      "Autogenerated Key <ben....@sheridan.com>"

[GNUPG:] BEGIN_DECRYPTION

[GNUPG:] DECRYPTION_INFO 2 9

[GNUPG:] PLAINTEXT 62 1473731050 

gpg: block_filter 0075BBA0: read error (size=16107,a->size=16107)

gpg: block_filter 00750118: read error (size=16324,a->size=16324)

gpg: WARNING: encrypted message has been manipulated!

[GNUPG:] BADMDC

[GNUPG:] DECRYPTION_FAILED

[GNUPG:] END_DECRYPTION

gpg: block_filter: pending bytes!

gpg: block_filter: pending bytes!


Any advice you can provide would be greatly helpful.

Thanks,
Ben

Vinay Sajip

unread,
Sep 13, 2016, 9:50:54 AM9/13/16
to python-gnupg
Dear Ben,

The error shown by gpg implies that your encrypted data is somehow corrupted.It's hard to say where/how the corruption occurred.

Regards,

Vinay

P.S. The OP was an announcement - please don't reply to announcements (or to this response), but start a new topic.


On Tuesday, September 13, 2016 at 9:54:48 AM UTC+1, Ben Natal wrote:
Thanks Vinay, thanks for posting the latest release of python-gnupg, I am using this library for the first time in my code, is there a simple way to decrypt zip files that are encrypted using gpg and contain multiple PDF files using this library, when I attempt to decrypt these files, I get the following errors.

2016-09-12 21:45:01,366 - INFO - Original Filename: //primus//IngramAu//preprocess\ACAP_16_7_F300.1.zip.gpg
2016-09-12 21:45:01,566 - INFO - False
2016-09-12 21:45:01,566 - INFO - decryption failed
2016-09-12 21:45:01,566 - INFO - [GNUPG:] ENC_TO 2F3278BF65D69988 1 0

[GNUPG:] USERID_HINT 2F3278BF65D69988 Autogenerated Key

[GNUPG:] NEED_PASSPHRASE 2F3278BF65D69988 2F3278BF65D69988 1 0

[GNUPG:] GOOD_PASSPHRASE

gpg: encrypted with 2048-bit RSA key, ID 65D69988, created 2016-09-08

      "Autogenerated Key 

Reply all
Reply to author
Forward
0 new messages