terrychou / iVim

A vim port to iOS.
598 stars 35 forks source link

Decryption does not work anymore with new release (January 2021) #187

Closed DanielMontreal closed 3 years ago

DanielMontreal commented 3 years ago

I just updated to the new release. I have some files that are encrypted on my icloud and I can't read them anymore.

All the previous versions could decrypt correctly, but now it just appears as if I don't have the right password.

Tried it with other files and still does not work. The files are not corrupted since I still can open it with the vi from my Mac with the right decrypting key.

The new window to enter the decryption key is nice, if it could work ;-)

Thanks Daniel

terrychou commented 3 years ago

By "now it just appears as if I don't have the right password", do you mean that those files could be opened in iVim and it asks for password, but only show garbled content?

What do you mean by "Tried it with other files and still does not work."? Do you mean iVim does not work even for non-encrypted files?

Steps in details would be more helpful to figure out the reason.

DanielMontreal commented 3 years ago

When I type the right password, it opens but everything is garbled. As if I would have typed the wrong password.

Before this version, it was opening the file correctly.

I know the file is good because I still can open (with vi) the same file with the same password on my Mac.

terrychou commented 3 years ago

So everything works well in version 2.27? Only the recent update breaks it?

DanielMontreal commented 3 years ago

I don't know the version number I had before, but I usually do my updates every month or so. So YES the recent update I did in January broke it, and it was working fine before. I didn't have a popup window to enter the password in the previous version, so since there is this popup window it does not work anymore.

terrychou commented 3 years ago

I have changed some code which may be concerning this issue. Would you like to help to test? If so, please offer me an email address so that I can send you a TestFlight invitation.

DanielMontreal commented 3 years ago

Thanks! I volunteer to test if needed. I'm a retired system administrator (from a university) so you can talk technical to me. daniel.ouimet@yahoo.ca

terrychou commented 3 years ago

@DanielMontreal I have added you into the testing group, you should receive the invitation soon. Thanks for helping, Daniel.

DanielMontreal commented 3 years ago

Thanks! My pleasure! I used vim for 35 years and I tested so many systems, so nothing new for me.

Just tried this new version of iVim and still the same result. Screen capture of the result in this message.

Hope this helps! Daniel

IMG_6397 IMG_6396

DanielMontreal commented 3 years ago

Doing some tests this morning, new findings. 1- made a NEW text file encrypted with vim. Then opening with iVim... and it worked. 2- tried another encrypted file that was done couple years ago... iVim decryption does not work. 3- tried another encrypted file that was encrypted years ago but updated recently: iVim decryption does not work either. 4- I open the old file with the password in MacVim, then copy and paste all the informations to a new file with encryption using the same password. The new file opens in iVim.

Conclusion: it seems that iVim can open files encrypted recently with any vi, but fails with older encryption, even if the file was updated recently.

I can work around this (since my encrypted files are just lists of my personal things like passwords, etc.) by creating new files. Unless you have a solution ;-)

Hope this helps.

terrychou commented 3 years ago

Then the problem probably has something to do with the different encryption methods. Could you provide me with a copy of old file that has this problem (of course, one that does not expose any secret to me) for me to debug?

DanielMontreal commented 3 years ago

Yes, I have a file with all the phone numbers and emails of my friends and family. This file is not sensitive if you are the only one who has access. Is there an email or a way to send it to you? Thanks, Daniel

terrychou commented 3 years ago

@DanielMontreal maybe you can generate a problem file:

1) on a computer, make a copy of an old problem file; 2) open the copy with vi, then change its content to something insensitive; 3) then save the changed file, it will has the same encryption method of the original file, if I remember correctly; 4) then send this "generated" file to me to debug (you can test it with iVim to see if it has the problem too).

I think this would be better for your friends and family's privacy. Thanks for trusting anyway.

My email: terrychoucn@gmail.com

DanielMontreal commented 3 years ago

Hi, sorry for the delay, I did more tests and have more details now to help you. First, here is the file with just a few lines (insensitive info), same encryption method. In a zip package because github does not accept the original file (just unzip it to get the Test file). The vim file password is 1234 Test.zip

Here is what I found. First: the encryption is not that old, it comes from a CentOS 6.1 Linux system (from a couple of years ago). Second, with the SAME encryption method, iVim will decrypt it correctly if (and only if) all the characters in the file are simple English characters (us-ASCII characters). But in French, we also use characters like é è à ù ê â. So vim is using a different character codes. If the file is using any of these special characters (UTF8 characters), then iVim fails to decode it. Any other vim can decode it correctly (MacVim, vim on Linux or Unix, etc.), I tried all of them.

And before this version, iVim was decoding it correctly, this fails only with the new version.

This helps?

Thanks, Daniel

terrychou commented 3 years ago

Thanks for the sample file and further testing information! These are very helpful. I will look into this.

terrychou commented 3 years ago

@DanielMontreal I have fixed this. It turned out that vim would read some files more than once (in this case, it reads the file twice because it needs to do the encoding conversion). However, in my former implementation I assumed that files were only read once.

I have pushed the update to TestFlight, just have a look.

DanielMontreal commented 3 years ago

Fantastic! It now works fine! I confirm. You're great and fast. Case closed I think.

Many thanks! (Merci beaucoup) Daniel

terrychou commented 3 years ago

No problem. Your testing information helps a lot, thank you. I will include this into next update into App Store. No hesitate to report any further or other problems.