Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: GnuPG: users

Automating Decryption using gpg --batch --passphrase-file or gpg --batch --passphrase-fd 0

 

 

GnuPG users RSS feed   Index | Next | Previous | View Threaded


gukgukcommunity at yahoo

Jun 3, 2008, 9:45 PM

Post #1 of 3 (3820 views)
Permalink
Automating Decryption using gpg --batch --passphrase-file or gpg --batch --passphrase-fd 0

Hi !

I tried to automate decryption of pgp files by running this command line in windows xp
gpg --batch --passphrase-fd 0 < passphrase.txt --output "OUTPUT.CSV" --decrypt "OUTPUT.CSV.pgp"
or
gpg --batch --passphrase-file passphrase.txt --output "OUTPUT.CSV" --decrypt "OUTPUT.CSV.pgp"

but it's always failed.
It always throw an error
gpg: encrypted with 2048-bit RSA key, ID , created 2008-05-08
gpg: public key decryption failed: bad passphrase
gpg: decryption failed: secret key not available

I'm using gnupg 1.4.9.
Can anybody help me please?
Thanks


gukgukcommunity at yahoo

Jun 4, 2008, 8:13 PM

Post #2 of 3 (3779 views)
Permalink
Re: Automating Decryption using gpg --batch --passphrase-file or gpg --batch --passphrase-fd 0 [In reply to]

Hi Hardeep!
Thanks for your reply.
I did try your suggestion and It didn't work.
It still throwing the same error .
Can you tell more about the key setup?
What kind of procedure i need to follow so i can run gpg in SQL Job?
Thanks





----- Original Message ----
From: Hardeep Singh <hs2412 [at] gmail>
To: guk guk <gukgukcommunity [at] yahoo>
Sent: Wednesday, June 4, 2008 6:27:09 PM
Subject: Re: Automating Decryption using gpg --batch --passphrase-file or gpg --batch --passphrase-fd 0

Hi

The first method is incorrect. Correct usage of --passphrase-fd is as below:

gpg --batch --decrypt --passphrase-fd 0 --output output.csv
output.csv.pgp <passphrase.txt

The second seems ok. Yet, since its not working it could be a problem
with the key setup. Can the file be decrypted in the interactive mode
on the same machine without problems?

Regards
Hardeep

On 6/4/08, guk guk <gukgukcommunity [at] yahoo> wrote:
>
> Hi !
>
> I tried to automate decryption of pgp files by running this command line in
> windows xp
> gpg --batch --passphrase-fd 0 < passphrase.txt --output "OUTPUT.CSV"
> --decrypt "OUTPUT.CSV.pgp"
> or
> gpg --batch --passphrase-file passphrase.txt --output "OUTPUT.CSV"
> --decrypt "OUTPUT.CSV.pgp"
>
> but it's always failed.
> It always throw an error
> gpg: encrypted with 2048-bit RSA key, ID , created 2008-05-08
> gpg: public key decryption failed: bad passphrase
> gpg: decryption failed: secret key not available
>
> I'm using gnupg 1.4.9.
> Can anybody help me please?
> Thanks
>
>
>
>
>
>
> _______________________________________________
> Gnupg-users mailing list
> Gnupg-users [at] gnupg
> http://lists.gnupg.org/mailman/listinfo/gnupg-users
>
>


--
Hardeep Singh


John at Mozilla-Enigmail

Jun 4, 2008, 9:35 PM

Post #3 of 3 (3820 views)
Permalink
Re: Automating Decryption using gpg --batch --passphrase-file or gpg --batch --passphrase-fd 0 [In reply to]

guk guk wrote:
> I tried to automate decryption of pgp files by running this command line in
> windows xp
> gpg --batch --passphrase-fd 0 < passphrase.txt --output "OUTPUT.CSV"
> --decrypt "OUTPUT.CSV.pgp"
> or
> gpg --batch --passphrase-file passphrase.txt --output "OUTPUT.CSV"
> --decrypt "OUTPUT.CSV.pgp"

The general form is

gpg --batch --passphrase-file <passFile> --output <outputFile> --decrypt <pgpFile>

The first is wrong

gpg --batch --passphrase-fd 0 --output <> --decrypt <> < <passfileName>

The second looks correct, the quotes around the filenames are generally unneeded
on Win32, but shouldn't break things.

> but it's always failed. It always throw an error
> gpg: encrypted with 2048-bit RSA key, ID , created 2008-05-08
> gpg: public key decryption failed: bad passphrase

The bad passphrase error points to your passphrase file being at fault. Check
that your passphrase file is the same exact length as the passphrase.

Use DIR at a command prompt or any program that will do a hex dump for you.

A <CR><LF> (hex 0x0d0a) at the end of the passphrase in the file will cause the
passphrase to fail. <LF> (0x0a) alone seems to work as well as no line ending at
all.

notepad can be used to create the file without line endings.

These problems go away by removing the passphrase from the key. And remove the
charade that things are all that secure when the passphrase is in a file
readable by anyone with enough access.

--
John P. Clizbe Inet: John (a) Mozilla-Enigmail.org
You can't spell fiasco without SCO. PGP/GPG KeyID: 0x608D2A10/0x18BB373A
"what's the key to success?" / "two words: good decisions."
"what's the key to good decisions?" / "one word: experience."
"how do i get experience?" / "two words: bad decisions."

"Just how do the residents of Haiku, Hawai'i hold conversations?"
Attachments: signature.asc (0.66 KB)

GnuPG users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.