vi encryption: what algorithm has been used?

我与影子孤独终老i 提交于 2019-12-11 02:33:05

问题


I used an encrypted file to store my passwords for years. It has been encrypted using the vi -x command on Sun Solaris 10. I now tried to open the file on a linux box with bothvi -x and vi -x -cm=blowfish. Sadly the file is completely messed up. My guess is that a different encryption algorithm has been used on Solaris. How can I find out which algorithm has been used and how can I open the file with a more recent version of vi?

I do know the correct password and I do know several words in the encrypted file.

P.S.: I do not have any access to a solaris 10 Machine anymore


回答1:


I think vi uses the crypt function. This is a long shot, but if you have access to mcrypt, this should decode solaris crypt:

mcrypt  -a des --keymode pkdes --bare --noiv --decrypt filename

old unix style crypt

mcrypt  -a  enigma  --keymode  scrypt --bare --decrypt filename



回答2:


/usr/bin/vi (also linked from /usr/ucb/vi), /usr/xpg4/bin/vi, and /usr/xpg6/bin/vi on Solaris 10 (and such of those as were on all earlier versions of Solaris) all used crypt(1) (Enigma variant) encryption.

On Solaris 11 and later, vi is actually vim, and uses whatever encryption that version of vim supports, which is NOT compatible with crypt(1).

"Old" vi may still be on Solaris 11 as /usr/sunos/bin/vi, but does not have the -x option any more.

crypt(1) is also no longer on Solaris 11.

But one can easily scrounge the source (google for usr/src/cmd/crypt/crypt.c) and fix up whatever version one finds to compile ok.

And as a previous poster indicated, mcrypt can do the job too.

The latter is available for Macs via (at least) MacPorts ("port install mcrypt" although a trivial test of running mcrypt there didn't work for me), for CentOS via "yum install mcrypt", for Ubuntu via "apt install mcrypt"; cygwin also has an mcrypt package.

For any other OS or distro, you're on your own; I don't have everything. 😀



来源:https://stackoverflow.com/questions/14010434/vi-encryption-what-algorithm-has-been-used

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!