According to http://www.vim.org/html/editing.html#:X

*:X*
:XPrompt for an encryption key.  The typing is done without showing the
actual text, so that someone looking at the display won't see it.
The typed key is stored in the 'key' option, which is used to encrypt
the file when it is written.  See also |-x|. The value of the 'key' options 
is used when text is written.  When the option
is not empty, the written file will be encrypted, using the value as the
encryption key.  A magic number is prepended, so that Vim can recognize that
the file is encrypted. To disable the encryption, reset the 'key' option to 
an empty value:
:set key= When reading a file that has been encrypted and this option is not 
empty, it
will be used for decryption.  If the value is empty, you will be prompted to
enter the key.  If you don't enter a key, the file is edited without being
decrypted. If want to start reading a file that uses a different key, set the 
'key'
option to an empty string, so that Vim will prompt for a new one.  Don't use
the ":set" command to enter the value, other people can read the command over
your shoulder. Since the value of the 'key' option is supposed to be a 
secret, its value can
never be viewed.  You should not set this option in a vimrc file. An 
encrypted file can be recognized by the "file" command, if you add this
line to "/etc/magic", "/usr/share/misc/magic" or wherever your system has the
"magic" file:
     0stringVimCrypt~Vim encrypted file Notes:
- Encryption is not possible when doing conversion with 'charconvert'.
- Text you copy or delete goes to the numbered registers.  The registers can
  be saved in the .viminfo file, where they could be read.  Change your
  'viminfo' option to be safe.
- Someone can type commands in Vim when you walk away for a moment, he should
  not be able to get the key.
- If you make a typing mistake when entering the key, you might not be able to
  get your text back!
- If you type the key with a ":set key=value" command, it can be kept in the
  history, showing the 'key' value in a viminfo file.
- There is never 100% safety.  The encryption in Vim has not been tested for
  robustness.
- The algorithm used is breakable.  A 4 character key in about one hour, a 6
  character key in one day (on a Pentium 133 PC).  This requires that you know
  some text that must appear in the file.  An expert can break it for any key.
  When the text has been decrypted, this also means that the key can be
  revealed, and other files encrypted with the same key can be decrypted.
- Pkzip uses the same encryption, and US Govt has no objection to its export.
  Pkzip's public file APPNOTE.TXT describes this algorithm in detail.
- Vim originates from the Netherlands.  That is where the sources come from.
  Thus the encryption code is not exported from the USA. 
==============================================================================

Hope this helps.  The page is nicely formatted and has hyperlinks.  It seems 
to imply that it is doable.

mg

On Friday 15 March 2002 15:18, James wrote:
> Maybe this is why my mentor in unix insisted I use :wq instead of :x to
> write and exit....?
>
> James
>
>
> On Fri, 15 Mar 2002 13:31:32 +0000
>
> [EMAIL PROTECTED] wrote:
> > I am so glad I am not the only one to do this.  Except
> > I did this to the hosts.allow file.  I would like to
> > know how to unencrypt as well.
> >
> > It really is annoying that they use the X to encrypt
> > and the x to save and exit.  I have caught myself more
> > than once doing this and the first time I did not catch
> > it.
> >
> > Hopefully someone has an answer.
> >
> > > Hi i just made a major bummer i was editing httpd.conf - when saving i
> > > used :X insted of :x and i was asked for an encryption key - i then
> > > pressed enter (with an emty encryption key) and now the file is pure
> > > garbage - how do i unenrypt that file now.
> > >
> > >
> > >
> > > ___
> > > Mvh./Yours sincerely
> > >
> > > Lars
> > >
> > > =======================================================================
> > >= Lars Roland Kristiansen             | Email:        [EMAIL PROTECTED]
> > > Stu. Sci. Math/Computer science     | TLF(home):    39670663
> > > Copenhagen University -             | Home address: Emdrupvej 175
> > > Institute for Mathematical Sciences | C/O Rune Bruhn 2400 Copenhagen NV
> > > Url: www.math.ku.dk                 |
> > > =======================================================================
> > >=
> > >
> > >    "Politics is for the moment, equations are forever"
> > >                                                     - Albert Einstein
> > >
> > >
> > >
> > > Want to buy your Pack or Services from MandrakeSoft?
> > > Go to http://www.mandrakestore.com

----------------------------------------
Content-Type: text/plain; charset="us-ascii"; name="message.footer"
Content-Transfer-Encoding: 8bit
Content-Description: 
----------------------------------------

Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to