Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the previous version of Ubuntu (eg: maverick, natty), I used to do a:

sudo apt-get install gedit-plugins seahorse

to have the ability to encrypt/decrypt file within Gedit after enabling the plugin in the preferences.

But since, Oneiric I've not found a way of achieving this.

And now that I'm running Precise (the LTS version!), I'm a bit disappointed of not being able to do such things.

share|improve this question
See if this link helps you. – Pipe Mar 29 '12 at 12:34

I had to fight a bit with ryran's example until I got what I needed: encrypt using my GPG key to several people. This is the code to encrypt:

gpg -a -e -r -r --no-tty -

And to decrypt:

gpg -d --no-tty - 2> /dev/null

And set input to "current document" and output to "replace current document" in both cases.

share|improve this answer

Try Geany, with the PGP plugin. Geany is a lightweight gtk+ based editor, with excellent support.

sudo apt-get install geany geany-plugin-pg
share|improve this answer

Another one that uses the agent and supports entering E-Mail for asymmetric encryption:


mail=$(zenity --entry --text="Enter E-Mail")
gpg -a -e --no-tty -r "$mail" --use-agent -

And decryption:


gpg --no-tty --use-agent -
share|improve this answer

Pipe's link (in the comments) gives the run-down.
You need to add entries under "Manage External Tools" to do this.. for now. You can even add keyboard shortcuts. What the link doesn't mention (as far as I saw) is that you need to install gnupg-agent to be able to enter passphrases.

Here's an example. Create a new action and call it symmetric encrypt:

gpg --use-agent --symmetric 2>/dev/null

Tweak the other options to your liking (you can make it so all the text in the whole window is automatically selected and replaced, you can make the output pop up in a bottom pane, etc.

Note: If you install gnupg2 instead of gnupg-agent, and then start your command-lines with gpg2 instead of gpg, you can take advantage of gpg2's cooler [integrated] agent.

share|improve this answer

Some autopromotion/request for feedback:

(notice I developed this also because I was not able to use the "External tools" method above without including in clear the password for my key - which I didn't want to).

share|improve this answer
+1 for the effort, but it tells me gedit-crypto-plugin breaks gedit (<< 3.12) gedit (version 3.10.4-0ubuntu4) is present and installed. What version of Ubuntu is it designed for? I am on 2014.04. – Nicolas Raoul Sep 4 '14 at 1:00
In the page I linked, you can see "In particular, current versions need gedit 3.12 or later; if you're using a previous version of gedit, download version 0.3 of gedit-crypto." - this is the version you need. – Pietro Battiston Sep 9 '14 at 16:59

Just expanding on @Ignacio solution (which works), I found annoying that if you encrypt twice (or decrypt), it breaks things... so I am running this with an extra care for the state of the encryption on the document:



if [ ! "${stdin:0:27}" == "-----BEGIN PGP MESSAGE-----"  ]; then 
    echo "$stdin" | gpg -a -e -r --no-tty -
    echo "$stdin"



if [ "${stdin:0:27}" == "-----BEGIN PGP MESSAGE-----"  ]; then 
    echo "$stdin" | gpg -d --no-tty - 2> /dev/null
    echo "$stdin"

Assuming the settings:

  • Save - Nothing
  • Input - Current document
  • Output - Replace current document
  • Applicability - All documents / All languages

Then you place a shortcut like Ctrl+Shift+D (decrypt) and Ctrl+Shift+E (encrypt), and you are good to go.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.