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

Mailing List Archive: GnuPG: devel

gpg: overwriting .pdf on encryption => decryption fails

 

 

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


marius.hofert at math

Jun 21, 2012, 2:47 AM

Post #1 of 2 (166 views)
Permalink
gpg: overwriting .pdf on encryption => decryption fails

I'm not sure if I found a bug. I asked on stackoverflow where it was recommended
to write to this mailing list. Here is the link to the problem:
http://stackoverflow.com/questions/11134583/gpg-overwriting-pdf-on-encryption-decryption-fails

For convenience, here is the problem description (as on stackoverflow):

I use gpg (GnuPG) 1.4.11. to encrypt a file foo.pdf via gpg -c foo.pdf. The encrypted file is then foo.pdf.gpg and, additionally, the original file foo.pdf exists. I can then decrypt foo.pdf.gpg via gpg foo.pdf.gpg as expected. However, if I use gpg -o foo.pdf -c foo.pdf and choose to overwrite the existing file on encryption, then use gpg foo.pdf to decrypt the encrypted file, and finally choose to overwrite the existing file foo.pdf (again), the file is still protected and can't be viewed.

I then tried to execute gpg foo.pdf again (I thought decrypting failed the first time, that's why I tried it again). Now the file seems to be corrupted: "gpg: [don't know]: 1st length byte missing"

Cheers,

Marius

PS: I'm working on Xubuntu 12.04



_______________________________________________
Gnupg-devel mailing list
Gnupg-devel [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gnupg-devel


dshaw at jabberwocky

Jun 21, 2012, 6:34 AM

Post #2 of 2 (150 views)
Permalink
Re: gpg: overwriting .pdf on encryption => decryption fails [In reply to]

On Jun 21, 2012, at 5:47 AM, Marius Hofert wrote:

> I'm not sure if I found a bug. I asked on stackoverflow where it was recommended
> to write to this mailing list. Here is the link to the problem:
> http://stackoverflow.com/questions/11134583/gpg-overwriting-pdf-on-encryption-decryption-fails
>
> For convenience, here is the problem description (as on stackoverflow):
>
> I use gpg (GnuPG) 1.4.11. to encrypt a file foo.pdf via gpg -c foo.pdf. The encrypted file is then foo.pdf.gpg and, additionally, the original file foo.pdf exists. I can then decrypt foo.pdf.gpg via gpg foo.pdf.gpg as expected. However, if I use gpg -o foo.pdf -c foo.pdf and choose to overwrite the existing file on encryption, then use gpg foo.pdf to decrypt the encrypted file, and finally choose to overwrite the existing file foo.pdf (again), the file is still protected and can't be viewed.
>
> I then tried to execute gpg foo.pdf again (I thought decrypting failed the first time, that's why I tried it again). Now the file seems to be corrupted: "gpg: [don't know]: 1st length byte missing"

GPG is writing to the same file it's reading from (no temp files). As it reads plaintext to encrypt, that data is being clobbered by the already-encrypted data GPG is writing out (or vice versa on decryption).

David


_______________________________________________
Gnupg-devel mailing list
Gnupg-devel [at] gnupg
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

GnuPG devel 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.