We help IT Professionals succeed at work.
Get Started

How do I automatically specify the decryption passphrase in a batch file using GnuPG?

731 Views
Last Modified: 2009-12-16
Hi,

I'm using GnuPG Command Line for Windows to automate the encrypting and decrypting of data. I have imported our public and private keys. However, to decrypt data sent to us, encrypted by our public key, I have to enter the passphrase. GnuPG prompts for this when I run it manually from the command line, and if I enter it, it works fine, but I need to automate this so need a way to automatically input the passphrase. This automated process will run on a secure server, so it does not matter if the passphrase is in the batch file or another file in plain text.

I run the below command line and get the below prompt:

Thanks
C:\gnupg-w32cli-1.2.2>gpg -d C:\gnupg\test.txt.pgp
 
You need a passphrase to unlock the secret key for
user: "XXXXXXXXXXXXXXXXXXXX"
2048-bit ELG-E key, ID 4116fh78, created 2001-11-26 (main key ID 31e7a345)
 
Enter passphrase:

Open in new window

Comment
Watch Question
IT Consultancy
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE