Is there an encrypting text editor for ubuntu? In other words, the text editor, preferably GUI capable, should always save an encrypted file and always prompt for the password to re-open the file. The point is to combine the functionality of a text editor with an encryption tool.


Solution 1:

Vi/Vim

Just use vim or vi which offers file encryption with blowfish when using -x option.

create a file for encryption as follows:

vim -x filename.txt

Then it will prompt to enter encryption key

Enter encryption key:

Once a file has been encrypted by Vim once, you never need to use the -x option when opening that file again. Vim will automatically recognize it as an encrypted file and do the right thing.

Because Blowfish is a symmetric key encryption system, the same key is used for both encryption and decryption. When Vim opens a file for the first time with the -x option, the first thing it will do is ask you to give it a key you can use to encrypt and decrypt the file, with this prompt:

Need encryption key for "abc.txt"
Enter encryption key:

After entering the key, you will then be asked to confirm the key, to ensure you did not mistype it.

Enter same key again:

Then it will open as normally as usual.

Read more here

CryptoTE

According to the website.

CryptoTE is a text editor with integrated strong cryptography. 
It is based on the popular Scintilla widget and automatically stores 
text data in secure encrypted container files. 
Compared to other "password keeper" programs, CryptoTE does not force 
any structure upon your data: it works with plain ASCII text 
and does not require you to fill in grids, key-value attributes,descriptions etc. 
Encryption is transparently performed using the 
highly-secure Serpent cipher. The editing interface is thoroughly 
optimized for speed and ease of use. 
Multiple subfiles, Quick-Find and a two-click random password generator 
make daily use very convenient.

enter image description here

for ubuntu see.

Solution 2:

Gedit.

REQUIREMENTS

  • Gedit
  • Gedit plugin – External tools (enabled)
  • A valid gpg key

ENABLE GnuPG
This will only work if you have enabled GnuPG in your system.

GnuPG is an implementation of PGP (Pretty Good Privacy), which is a form of public key/private key encryption.

Install GnuPG

sudo apt-get install gnupg

Generate your keys:

gpg --gen-key 

When generating the keys, you can just press enter at any time to accept the default value in brackets. The most important part of your key generation is choosing your passphrase.

Your public keyring should just contain your own public key for now, you can view the keyring with the --list-keys option and your private key with the --list-secret-keys option.

gpg --list-keys
gpg --list-secret-keys

GnuPG source: http://www.ianatkinson.net/computing/gnupg.htm


SETUP

Just go to Tools > Manage External Tools, and add the scripts:

ENCRYPT
Paste the following code on a new command, called “Encrypt”:

#!/bin/bash
stdin=$(cat)

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

with the options:

  • ShortCut - Control + Shift + E
  • Save - Nothing
  • Input - Current document
  • Output - Replace current document
  • Applicability - All documents / All languages

enter image description here

DECRYPT
Paste the following code on a new command, called “Decrypt”:

#!/bin/bash
stdin=$(cat)
 
if [ "${stdin:0:27}" == "-----BEGIN PGP MESSAGE-----"  ]; then 
    echo "$stdin" | gpg -d --no-tty - 2> /dev/null
else
    echo "$stdin"
fi

with the options:

  • ShortCut - Control + Shift + D
  • Save - Nothing
  • Input - Current document
  • Output - Replace current document
  • Applicability - All documents / All languages

enter image description here


USAGE

Once that is done, then you can open encrypted files (asc – ascii files, not binary), or create new ones on spot using the shortcuts.

Example:

enter image description here

enter image description here

SOURCE
http://blog.brunobraga.net/encrypting-and-decrypting-with-gedit/


METHOD 2 Another way is to install zillo.

A simple plugin for gedit 3 that encode and decode selected text to base64.

See this question on how to install the plugin