EasyGnuPG / egpg

Easy GnuPG, shell scripts to make GnuPG more accessible and easier to use. (Migrated to: https://gitlab.com/EasyGnuPG/egpg)
GNU General Public License v3.0
26 stars 5 forks source link

Problem with egpg seal #50

Closed diveshuttam closed 6 years ago

diveshuttam commented 6 years ago

If I press Ctrl+C (SIGINT) at the password prompt of gpg under egpg seal, a .sealed file is created which is empty as well as the original file is deleted. Though pressing Ctrl+D works fine.

Similar is the case with egpg sign Terminal doesn't seem to work properly after this.

diveshuttam commented 6 years ago

@dashohoxha can you confirm this on your side. I tried this on my pc config (egpg-2.1) as well as inside the containers(egpg-2.2)

diveshuttam commented 6 years ago

If this is the case, after fixing this, we should also create a test for this.

dashohoxha commented 6 years ago

can you confirm this

Yes it happens to me too. If it happens inside the container, it happens the same everywhere, since we have the same container.

dashohoxha commented 6 years ago

If this is the case, after fixing this, we should also create a test for this.

You can give it a try, but I think that it may be difficult to make an automated test where you can simulate a Ctrl+c. Anyway, it is not possible to cover everything with automated tests, because the number of the test cases would be too large.

dashohoxha commented 6 years ago

If I press Ctrl+C (SIGINT) at the password prompt of gpg under egpg seal, a .sealed file is created which is empty as well as the original file is deleted. Though pressing Ctrl+D works fine.

Everything is fine also when you press Enter or give a wrong password.

I think that the problem is with pinentry, the way that gpg uses to get the password. If you try gpg directly and then press Ctrl+c at the Passphrase prompt, the same will happen, it will produce an empty encrypted file. This seems to me wrong behavior, a bug that should be fixed.

Anyway, we can circumvent this in our script (the bash version) by checking for the exit status of the gpg command, or by checking weather the sealed file is empty, and then avoiding the destruction of the original file. You can do something similar on your python script (maybe using exceptions).

dashohoxha commented 6 years ago

Maybe we should report a bug about gpg or pinentry-tty.