0

Actually , i have encrypted file using vim -X option . Unfortunately i forget the encryption key. Is there any way to get back file without any data corruption .without knowing key.

Thanks.

1
  • 1
    I think you're out of luck. There should be no way to recover the text in a reasonable amount of time without the key.
    – Michael Anderson
    Feb 5, 2011 at 4:42

4 Answers 4

4

No, of course not. It wouldn't be very good encryption if there were a backdoor that let you get the plaintext without the key.

There's always brute-forcing, but if the key is very long it could easily take too long to be helpful.

3
  • Cant we pass the file to any decrypt algorithm ... which could find the actual key....
    – Pavunkumar
    Feb 5, 2011 at 5:53
  • 1
    @pavun_cool: that would render any encryption useless, wouldnt it?
    – akira
    Feb 5, 2011 at 6:54
  • @pavun_cool: and btw .. that "decrypt algorithm" is called "try all available keys till something does not look like garbage", aka "brute force" .. this is the right answer, even if you dont like it.
    – akira
    Feb 9, 2011 at 8:40
1

Short answer: No, it is not possible. (As others have mentioned.) See ":help encryption" and take note of the warnings.

Long answer: Vim can optionally use two encryption methods:

  1. The original—and default—is considered weak and potentially "broken," is based on zip's encryption scheme. There are supposedly zip encryption cracking programs out there, but I haven't ever been able to make one work, and they certainly would not work with Vim's encrypted files without modification.
  2. The new encryption scheme, introduced in 7.3, is Blowfish. You'd have to more than burn out a sun to gain the power alone needed to brute-force that key, which—assuming that there wasn't a mistake in implementing this method in Vim or there is no core flaw in the Blowfish algorithm—is probably the only way you'd manage to gain access to the file.

See ":help 'cryptmethod'"

I will also reiterate what others have said here: The encryption would not be much use if it were so easily broken.

I suggest that you should always write your passwords down in a secure place; install a decent "password safe" application such as KeePass.

0

Can't be done. Although Vim just uses standard algorithms (AES, I believe) to encrypt/decrypt files, it doesn't matter what program or library you use you're not going to decrypt it without the key. Algorithms like these work not because they're unbreakable, but because it takes an insanely long time to brute-force them (as in thousands of years at current computing abilities).

1
  • vim uses blowfish since 7.3 (or its homebrew encryption, which is 'rather weak')
    – akira
    Feb 5, 2011 at 6:23
0

If you had recently edited the file (when you last remembered the password), check in your temp folder, there should be a file with the contents. It would have a tilde at the end of the filename.

1
  • This definitely should not work; the backup file (the file with a tilde) should also be encrypted. If it you are seeing situations where it is not, you need to create a bug report where it is reproducible and send it to [email protected] and [email protected].
    – Heptite
    Feb 5, 2011 at 18:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .