lithium0003 / ccViewer

CryptCloudViewer source codes
https://itunes.apple.com/us/app/cryptcloudviewer/id1458528598?mt=8
MIT License
92 stars 17 forks source link

Importing from rclone.conf did not copy the salt value #17

Closed johntajima closed 4 years ago

johntajima commented 4 years ago

I used the import rclone.conf option when creating new crypt rclone drive but it didn’t copy the salt value, only the password.

Here’s a relevant section of my rclone.conf file.

[gcrypt] type = crypt remote = gdrive:/secret filename_encryption = standard directory_name_encryption = true password = valuechanged password2 = othervaluechanged

lithium0003 commented 4 years ago

How much letters count is the password2? It must be grater than 22 characters. If it exactly has 22 characters, password2 is null. It happened https://github.com/rclone/rclone/issues/3492

johntajima commented 4 years ago

My password2 value is over 30characters.

lithium0003 commented 4 years ago

Thanks for information. I'm checking the logic around there.

lithium0003 commented 4 years ago

The password2 field character count must be 0,2,3 mod 4. Password/salt(password2) reveal section may fail when character count is 1 mod 4 or decoded text is not valid utf8 text. Are there any special characters (ex. emoji) in your original password2?

johntajima commented 4 years ago

Wait, did you mean the original password2 value has to be more than 22 characters or the resulting encrypted value has to be more than 22.

My original password2 is 8 characters long, the encrypted value is much longer. No special characters or emojis.

Also not sure what 0,2,3 mod 4 means

lithium0003 commented 4 years ago

It means the encrypted characters more than 22 and the count remainder divided by 4 must not be 1. 22 means null, 23 is ok, 24 is ok, 25 is NG. Encrypted password2 are encoded by BASE64 after encryption. Your original password2 has 8bytes means that it has 16+8=24bytes raw encrypted data, so BASE64 encoded data has 24*4/3=32 characters. 32 is just divided by 4, no remainder, this is OK.

lithium0003 commented 4 years ago

Thanks, I find it! This bug occurs in just divided by 4 characters. Fix it next release.