9

I opened up a document from 2015 I saved using the built in crypto in vim (:X). That was saves using blowfish at the time.

The message I got now (2017) was this:

Warning: Using a weak encryption method; see :help 'cm'
Enter encryption key: *********************************************
Enter same key again: *********************************************

That was weird, I thought, but I assumed it had to do with some flaw, and after reading up on the crypto methods I set cryptomethod=blowfish2. This works after opening it, showing cryptomethod as blowfish 2. The problem is that I still get the message about using weak encryption! Why? Are there remnants of the old blowfish1 crypto signature? Do I have to export the text and resave it in order to fix it?

  • 2
    Try to encrypt it again with blowfish2 (that only works, if all your vim versions are new enough) – Christian Brabandt Feb 10 '17 at 19:19
9

The cryptmethod is stored in the file itself, and isn't automatically updated.

You can see this with less:

$ less a
VimCrypt~02!!<C7>\<E1>wZzm
^E^X^Z<92>5<C9>I6<9C>S

VimCrypt~01! is cm=zip, VimCrypt~02! is cm=blowfish, and I think you can deduce what VimCrypt~03! stands for :-)

To upgrade a file, open it, explicitly set cm=blowfish2, and write it:

$ vim a
Need encryption key for "a"
Warning: Using a weak encryption method; see :help 'cm'
Enter encryption key: [enter-key]

:set cm?
  cryptmethod=blowfish
:set cm=blowfish2
:w
"a" [blowfish2] 1L, 3C written
:q

$ less a
VimCrypt~03!O[P<D5>1<D1><DA>^Zis<88>q<AB><99><8C><A6><C4><FB>6
a lines 1-1/1 (END)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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