jamessan / vim-gnupg

This script implements transparent editing of gpg encrypted files.
http://www.vim.org/scripts/script.php?script_id=3645
729 stars 73 forks source link

Report errors from gnupg more clearly #65

Open ao2 opened 8 years ago

ao2 commented 8 years ago

Hi,

when my encryption subkey expires I get a message like this from gnupg.vim:

The recipient "0xXXXXXXXXXXXXXXXX" is not in your public keyring!

Would it be possible to detect that the actual cause of the failure is an expired key and report that more clearly? The current message sounds a little off for this case.

Thanks, Antonio

jamessan commented 8 years ago

I'll have to test that scenario to see what information gpg provides. Thanks for the report!

ao2 commented 6 years ago

I updated the title as the issue is more generic.

Today, on a new system, gnupg.vim failed with:

Message could not be decrypted!

with no further details.

Running gpg from the console it turned out I was missing pinentry-tty, gpg returns this message:

gpg: public key decryption failed: No pinentry
gpg: decryption failed: No secret key

Would it be possible for vim-gnupg to propagate such messages to the user?

Thanks, Antonio

jamessan commented 6 years ago

Would it be possible for vim-gnupg to propagate such messages to the user?

Right now, not easily. I've been contemplating changing the code to use the (neo)vim's job APIs, which would make it easier to distinguish stderr/stdout and do better error reporting.

However, I would probably want to get the change to use loopback pinentry done first. pinentry-curses (and probably pinentry-tty) really aren't meant to be used in combination with something like Vim, since they fight over the terminal. This would also resolve #32.

ao2 commented 6 years ago

I see, thanks for the info.