Home > tGpg

tGpg

TGpg is a project mainly written in Vim Script, it's free.

Yet another plugin for encrypting files with gpg

This is a mirror of http://www.vim.org/scripts/script.php?script_id=1751

This plugin currently can do the following:

  • encrypt symmetrically
  • encrypt asymmetrically
  • clearsign buffer contents

I couldn't get any of the existing gpg plugins to work properly (windows Gvim & cygwin gpg) and do all the things I wanted it to do, so I wrote this one. The main purpose is to perform symmetric encryption (the default) but it's flexible enough to do also clearsign and asymmetric encryption. Depending on your version of gpg, this script could also be used as some kind of password safe.

You can set g:tgpgMode or b:tgpgMode to 'encrypt' for switching to asymmetric encryption as default. You can also control the use of symmetric and asymmetric encryption by setting set g:tgpgPattern_symmetric and g:tgpgPattern_encrypt.

This plugin passes the passphrase on the command line to the gpg programm. So, it could be possible that somebody makes the passphrase show up in some command log. Under some circumstances it could also be possible that some info (eg the recipients) is logged in your viminfo file. If you clearsign a message, the plain text will be written to disk. Ie, if you clearsign a gpg encrypted message, the text will temporarily be written to disk as plain text -- please keep in mind the vast range of possible consequences.

This plugin uses the (Buf|File)(Read|Write)Cmd autocommand events to write/read the file. I'm not sure how this works out with other plugins using these events.

As I don't like typing passphrases, this plugin caches all the passphrases entered in a script local variable. This means that passphrases are likely to be written to the swapfile, from where somebody somehow could possibly do something ... Set g:tgpgCachePW to 1 (buffer-wise caching only) or 0 (no caching) to change this.

This plugin was tested with Windows GVim & cygwin gpg 1.4.5 (using bash as shell) as well as linux vim & gpg 1.4.5. It's possible that the use of a pure Windows version of gpg or cmd.exe as shell doesn't work. (Please report problems.)

If you get a message telling you about gpg command line options instead of the decrypted file, please check the value of g:tgpgShellQuote.

If writing fails, it's possible that you end up with a corrupted or empty file. That's why we make backups by default. Set g:tgpgBackup to 0 to change this.

Previous:surrparen