[net.emacs] Editing Encrypted Files

z (02/18/83)

CCA EMACS can now be used to edit encrypted files directly, without
first having to unencrypt them with the "crypt" command.  In fact, it is
possible to use this feature in such a way that the unencrypted text is
never resident in the file system.

Any of the normal commands for reading in files can be used to read in
an encrypted file be giving them a negative argument.  When you do so,
EMACS will prompt you for an encryption key, in addition to prompting
you for the filename as usual.  The encryption key is effectively the
password for the file; for maximum protection, it should be between five
and eight characters long.  When the file is read into the buffer, it
will appear in its unencrypted form.  Similarly, by giving a negative
argument to any of the commands which write files or regions, the file
or region can be encrypted as it is being written out.

If you read in an encrypted file and then save it using one of the
regular file writing commands, EMACS assumes that you want to re-encrypt
the file using the current encryption key, and so the output file is
encrypted in this way.  Among other things, this makes it possible to
exit with C-U C-U C-X C-Z and have all your encrypted files
automatically written back encrypted, each one using its original key.
If you would prefer to save a previously encrypted file in an
unencrypted state, you can do so by using a file writing command with a
negative argument, and then immediately typing a carriage return when it
prompts for the key.  Alternatively, if you know soon after you read in
an encrypted file that you are going to want to save it in an
unencrypted state, you can execute the command M-X Turn Off Encryption,
which will make EMACS think that the current file does not need to be
encrypted before it is written out.  If you give M-X Turn Off Encryption
an argument, it turns off automatic output encryption for all buffers.

For maximum security, you should keep your encrypted files stored with
mode 0600; this will discourage most attempts to break your encryption
scheme.