This plugin adds transparent editing of GPG encrypted text files using the GPGMe library in Kate.
This project has been submitted upstream to be part of the Kate addons!
https://invent.kde.org/utilities/kate/-/merge_requests/1904
This repository will still be used for further development. All changes
here will be pushed upstream. Fixes from the Kate repo will be added here, too.
- Upon loading a GPG encrypted file the plugin will automatically attempt decryption (asking for passphrase)
- Upon successful decryption of a file the plugin will auto-select the key/fingerprint used for eventual re-encryption
- Saving (Ctrl+s) a decrypted file will automatically re-encrypt using the
same key that was used to decrypt!
SaveAs auto-encrypts when selecting .gpg/.asc as file extension - Plugin shows all available GPG keys with basic name filtering (initially auto-selects the most recently created key)
- Persistent settings (plugin remembers the last used settings on quit).
- Manual selection of key used for encryption (plugin settings can remain hidden as long as no encryption key change is necessary)
- Symmetric encryption possible
- A CMake & C++ build environment is installed
- Qt development libraries are installed
- C/C++ bindings for GPGMEpp are installed
- At least one public+private GPG key pair (if you only want to encrypt to yourself)
While this plugin makes it easy to decrypt+encrypt text, it also makes it easy to mess things up. You could accidentally encrypt a file, e.g. with a key that is not yours, which then you wouldn't be able to decrypt.
Or you could accidentally
save a currently decrypted file as plain text, leaving it unecrypted.
Update: I have taken care that this doesn't happen anymore.
- Use with care!
- Ctrl+s and Save/SaveAs will automatically (re-)encrypt the file (with either the same key that was used for decryption or the default selection).
- Think twice before pressing Ctrl+S!
- Ctrl+Z works after encryption and saving!
This plugin was developed and built on Manjaro Linux running KDE Plasma. I have tested the build and installation in fresh non-KDE Ubuntu 22.04.3 LTS/25.05 LTS and Fedora 42 VMs and had to install at least these packages manually:
- git
- cmake
- extra-cmake-modules
- cmake-extras
- g++
- kate
- libgpgmepp-dev (this should also install qmake and quite a few Qt dev libs)
- libgcrypt20-dev
- libgpg-error-dev
- libecm1-dev
- qt6-base-dev (required since Ubuntu 25.04)
- libkf6texteditor-dev (required since Ubuntu 25.04)
- qtcreator (Optional but helpful because it installs most Qt6 dev dependencies)
This line should do it for recent Ubuntu based distributions:
sudo apt install git cmake extra-cmake-modules cmake-extras g++ kate libgpgmepp-dev libgcrypt20-dev libgpg-error-dev libecm1-dev libkf6texteditor-dev qt6-base-dev
- Clone the git repository
- Run CMake in the cloned folder:
-
This works for me with Qt6: (optional Qt5 build with specified QT_MAJOR_VERSION)
cmake -B build/ -D CMAKE_BUILD_TYPE=Release -D QT_MAJOR_VERSION=6(or 5) -
cmake --build build/ -
Install the plugin to the Kate plugin path. This requires sudo!
-
Recommended:
sudo cmake --install build/
(I had cases when this was unreliable... If this does not work see manual installation below)
-
Manual installation in Manjaro:
sudo cp build/kate_gpg_plugin.so /usr/lib/qt6/plugins/kf6/ktexteditor/
or if you prefer a symlink:
sudo ln -s build/kate_gpg_plugin.so /usr/lib/qt6/plugins/kf6/ktexteditor/
-
Manual installation in Ubuntu:
sudo cp build/kate_gpg_plugin.so /usr/lib/x86_64-linux-gnu/qt5/plugins/ktexteditor/
(In my Ubuntu VM symlinking the plugin did not work. Plugin doesn't show up in Kate unless copied...)
Qt6 in Ubuntu needs a special path:sudo cp build/bin/kf6/ktexteditor/kate_gpg_plugin.so /usr/lib/x86_64-linux-gnu/qt6/plugins/kf6/ktexteditor/
-
Recommended:
- Run kate (from the current terminal prompt)
- Enable the "GPG Plugin" in Kate → Settings → Configure Kate → Plugins.
A new vertical button should appear in the left sidebar.
- At the moment the plugin only can work on a single open document! Opening multiple GPG encrpyted files may cause undefined behaviour! E.g. encrypting a file with the wrong key.
- Currently only the default email address for a key fingerprint will be used for encryption
- Passphrase prompts are handled by GPG(Me) and may look ugly. Won't touch this!
Automatically select key for re-encryption upon decryption success.
Done! ✅Attach to KATE's "Open File" dialog to suggest automatic decryption when a .gpg/.pgp/.asc file is opened.
Done! ✅
Attach to KATE's Save/Save As dialog to strongly suggest to re-encrypt a currently opened GPG file (to avoid saving it as unencrypted).
Done! ✅- Sign and verify documents
- Add support for subkeys
Partially solved.⚠️ - Add support for multiple GPG encrypted "Views" or "Documents" (this means handling multiple Kate tabs...)
© 2023, Dennis Lübke, kate-gpg-plugin (at) dennis2society.de