2

Im decrypting a file sent by a client using gpg. The file is Obviusly encrypted, and theoretically, using my public key.

I have installed both his public key and my private key.

So, im running:

/usr/local/bin/gpg --output a.log  --decrypt --passphrase=mypassphrase --batch /usr/local/log/Banesco11052015.TXT.pgp

gpg: encrypted with 2048-bit RSA key, ID B61CC86B, created 2014-11-06 "Company SRL " gpg: WARNING: message was not integrity protected

But a.log is empty.

I also tried as well:

echo mypassphrase | gpg  --output a.log --passphrase-fd 0 /usr/local/log/Banesco11052015.TXT.pgp

The encrypted file has content, but is it possible though it has encrypted content, the file is actually empty on decryption?

Am I running the decrypt command wrongly? Maybe there is a problem with my keys?

Thanks in advance!

E.

  • What is the exit status of the gpg command? (Put echo $? >&2 after the /usr/local/bin/gpg … line to display it.) – Gilles 'SO- stop being evil' May 18 '15 at 21:14
  • Does not like that: /usr/local/bin/gpg echo $? >&2 --output a.log --decrypt --passphrase=mypassphrase --batch /usr/local/log/Banesco11052015.TXT.pgp usage: gpg [options] [filename] – Emiliano May 19 '15 at 12:32
  • 1
    Not on the line with the gpg command. On the next line. – Gilles 'SO- stop being evil' May 19 '15 at 12:44
  • Oh, hehe... Its "0". – Emiliano May 19 '15 at 12:58
3

Effectively, as @PSkocik, the file was empty.

Apparently, those 900 bytes on it were header information regarding the encryption.

Thank you all!

1

gpg seems to depend on a particular argument ordering (unfortunately not all command-line utilities allow as unrestricted argument ordering as possible) .

It should work if you follow the pattern from the man page:

gpg [--homedir dir] [--options file] [options] command [args]

In your case:

/usr/local/bin/gpg --output a.log --passphrase=mypassphrase  --decrypt  /usr/local/log/Banesco11052015.TXT.pgp

I would start with the simplest

gpg --decrypt /usr/local/log/Banesco11052015.TXT.pgp

and, if it works, add --passphrase and --output later:

  • I tried that: It makes me input the passphrase, and then nothing happens after "gpg: WARNING: message was not integrity protected" just like the other one. It should print the decrypted text, right? Then, same issue here – Emiliano May 19 '15 at 12:10
  • If it the command returns zero (=ran sucessfully), the message was simply empty. – PSkocik May 19 '15 at 12:46
  • Apparently it did run succesfully. But the encrypted file has some bytes on it! About 844 bytes. Is it possible that its size is 844 bytes but decrypted, its zero? – Emiliano May 19 '15 at 12:56
  • Yes, it is possible. – PSkocik May 19 '15 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.