How to avoid Passphrase prompt

Aneesh Varghese aneesh at
Wed Jan 31 12:47:22 CET 2018

Thanks for your reply..
How can we decrypt a file without passphrase prompt? Passphrase is entered via code.

Thanks & Regards

Aneesh Varghese

From: Peter Lebbing <peter at>
Sent: Wednesday, January 31, 2018 5:04 PM
To: Aneesh Varghese; gnupg-users at
Subject: Re: How to avoid Passphrase prompt

On 31/01/18 07:12, Aneesh Varghese wrote:
> How to avoid the passphrase prompt while decrypting the file in the
> version gnupg-w32-2.2.3_20171120.

You can remove the passphrase from the private key by:

gpg --edit-key KEYID

Just enter the old password but keep the "new" fields blank. GnuPG will
prompt whether you're sure you want to remove the protection of the key.
Choose "Yes, protection is not needed".

It will prompt multiple times when you have subkeys. It would be
possible to remove passphrase protection from just the encryption
subkey, but leave it on the rest. But this appears to be a bit awkward
as the prompt doesn't tell me which subkey I'm currently changing the
passphrase for...

There's also a way to supply the password up front, which would still
keep the on-disk private key encrypted. But this is more cumbersome, and
you don't say whether that is needed or not, so I'm just mentioning it,
not working it out.

More in general, it helps if you explain more about your situation and
your goals.



I use the GNU Privacy Guard (GnuPG) in combination with Enigmail.
You can send me encrypted mail if you want some privacy.
My key is available at <>

More information about the Gnupg-users mailing list