In my Python web app, I would need to decrypt a file that was encrypted using VIM. Assuming the web app knows the password used to encrypt the file in VIM, how do I write code to decrypt ?
+4
A:
Turns out that vim uses the same encryption as PKZIP:
from zipfile import _ZipDecrypter
fp = open(somefile, 'rb')
zd = _ZipDecrypter(somekey)
fp.read(12)
print ''.join(zd(c) for c in fp.read())
fp.close()
Ignacio Vazquez-Abrams
2010-02-26 08:06:27
Unfortunately `_ZipDecrypter` is not available in App Engine (or Python 2.5)
Sridhar Ratnakumar
2010-02-27 21:17:12
But copying that class into local file works.
Sridhar Ratnakumar
2010-02-27 21:26:58