gpg decrypt asks for Passphrase

1,213 views
Skip to first unread message

Krishna Seetharaman

unread,
Nov 10, 2016, 3:37:31 AM11/10/16
to python-gnupg, prabod...@aspiresys.com
Hi All,

I have used gpg library for python and want to decrypt the pgp files.  However when I execute the below command:
gpg --batch --passphrase <passphrase> -o outfile -d <pgp file>, it is showing up the popup.  Is there any reason why because I am using --batch option. 

Moreover, I tried using gpg.decrypt_file as:

status = gpg.decrypt_file(stream, always_trust=True , passphrase=config['gpg_passphrase'], output=outfile)


This also opens the popup for asking for passphrase.  I am using script based application where automated decryption is required without user input.  Please let me know why this error is occurring and what is the solution?

Please enter the passphrase to unlock the OpenPGP Secret key.


Let me know the solution for this and if you need more information.

Regards,
Krishna


Vinay Sajip

unread,
Nov 10, 2016, 4:17:25 AM11/10/16
to python...@googlegroups.com, prabod...@aspiresys.com, skris...@gmail.com
Dear Krishna,

This may happen unavoidably if you use GnuPG 2.1. What version, OS etc. are you using?

Regards,

Vinay Sajip


From: Krishna Seetharaman <skris...@gmail.com>
To: python-gnupg <python...@googlegroups.com>
Cc: prabod...@aspiresys.com
Sent: Thursday, 10 November 2016, 0:05
Subject: [python-gnupg] gpg decrypt asks for Passphrase

--

---
You received this message because you are subscribed to the Google Groups "python-gnupg" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-gnupg...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Vinay Sajip

unread,
Nov 11, 2016, 3:52:04 AM11/11/16
to Krishna Seetharaman, python...@googlegroups.com, Prabodh Panda
There is work in progress to provide better support for GPG 2.1. When that's committed, you'll also need to add a gpg-agent.conf in the relevant GnuPG home directory containing the line "allow-loopback-pinentry" (without the quotes).


Regards,

Vinay Sajip


From: Krishna Seetharaman <krishna.s...@aspiresys.com>
To: "python...@googlegroups.com" <python...@googlegroups.com>; Vinay Sajip <vinay...@yahoo.co.uk>
Cc: Prabodh Panda <prabod...@aspiresys.com>; "skris...@gmail.com" <skris...@gmail.com>
Sent: Thursday, 10 November 2016, 14:25
Subject: Re: [python-gnupg] gpg decrypt asks for Passphrase

Sorry GPG version is latest: 2.1.15

From: Krishna Seetharaman <krishna.s...@aspiresys.com>
Sent: Thursday, November 10, 2016 7:43:01 PM
To: python...@googlegroups.com; Vinay Sajip
Cc: Prabodh Panda; skris...@gmail.com
Subject: Re: [python-gnupg] gpg decrypt asks for Passphrase
 
Use windows server 2008 R2

From: Vinay Sajip <vinay...@yahoo.co.uk>
Sent: Thursday, November 10, 2016 2:47:23 PM
To: python...@googlegroups.com
Cc: Prabodh Panda; skris...@gmail.com
Subject: Re: [python-gnupg] gpg decrypt asks for Passphrase
 
Aspire Systems
This e-mail message and any attachments are for the sole use of the intended recipient(s) and may contain proprietary, confidential, trade secret or privileged information. Any unauthorized review, use, disclosure or distribution is prohibited and may be a violation of law. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
Aspire Systems
This e-mail message and any attachments are for the sole use of the intended recipient(s) and may contain proprietary, confidential, trade secret or privileged information. Any unauthorized review, use, disclosure or distribution is prohibited and may be a violation of law. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.


Vinay Sajip

unread,
Nov 12, 2016, 3:09:30 AM11/12/16
to Krishna Seetharaman, python...@googlegroups.com, Prabodh Panda
Dear Krishna,

Please see latest version of code in the repository - the code, test suite and documentation have been updated and tests pass successfully without popups with 2.1.15 on Linux (not yet tested on Windows).

Regards,

Vinay Sajip



From: Krishna Seetharaman <krishna.s...@aspiresys.com>
To: Vinay Sajip <vinay...@yahoo.co.uk>; "python...@googlegroups.com" <python...@googlegroups.com>
Cc: Prabodh Panda <prabod...@aspiresys.com>
Sent: Friday, 11 November 2016, 23:43
Subject: RE: [python-gnupg] gpg decrypt asks for Passphrase

Hi Vinay,
 
As of now, does it mean that we cannot avoid popup when decrypting the .pgp file when using the GPG 2.1.15 version?  How to call GPG2 libraries?  I tried installing gpg4win and used gpg2 command line. In this way gpg2 --batch --passphrase option prevented the popup to be shown and decrypted the file without prompt.  Is this correct way?  Is it possible to invoke gpg2 libraries using python API calls in the python code?
 
Thanks and Regards,
Krishna
Reply all
Reply to author
Forward
0 new messages