cryptomator / sanitizer

Utility to find and fix problems within vaults
https://cryptomator.org/
GNU General Public License v3.0
33 stars 9 forks source link

Add support to Vault version 7 #9

Open juanmbraga opened 4 years ago

juanmbraga commented 4 years ago

When trying to decrypt a vault with some files that Drive File Stream sent to lost and found, Sanitizer returns:

"Exception in thread "main" java.lang.IllegalArgumentException: Unsupported vault version 7 [...]"

Seems to be the same situation as this community post, so is it possible to add support for the newer version (7)?

cy2201 commented 4 years ago

Yes, very important! Please add the support for v7.

overheadhunter commented 4 years ago

We have plans to integrate plausibility checks into the main applications.

marcogrcr commented 4 years ago

Any advice on how to deal with version 7 vaults in the meantime?


UPDATE: I was able to make decryptFile work given that I had a version 6 masterkey.cryptomator.bkup file with the following instructions:

  1. Locate the vault directory (e.g. src/)
  2. Create a new empty folder (e.g. dst/)
  3. Copy src/d/ to dst/d/.
  4. Copy src/masterkey.cryptomator.bkup to dst/masterkey.cryptomator
  5. Run java -jar sanitizer-0.16.jar decryptFile -vault dst/

The other commands (i.e. check, decryptVault, encryptPath) did not worked though.


masterkey.cryptomator

{
  "scryptSalt": "...",
  "scryptCostParam": 32768,
  "scryptBlockSize": 8,
  "primaryMasterKey": "...",
  "hmacMasterKey": "...",
  "versionMac": "...",
  "version": 7
}

masterkey.cryptomator.bkup

{
  "scryptSalt": "...",
  "scryptCostParam": 32768,
  "scryptBlockSize": 8,
  "primaryMasterKey": "...",
  "hmacMasterKey": "...",
  "versionMac": "...",
  "version": 6
}
cy2201 commented 4 years ago

I have at least four corrupted files (3x JPG, 1x MP4). Need this sanitizer really bad.

permezel commented 3 years ago

Apparently me too. Spent a lot of time isolating problems and have determined I have some corruption, and accordingly stumbled on this, and sadly discover I need the version 7 support.

お願いします。

meekyphotos commented 3 years ago

Not an expert on this, but I've forked and managed to make it work to check and decrypt the vault with version 7. I'm assuming that there are several things that I'm missing as it appeared to be an easy fix. As such, I'm not sure if I should open a PR or not.

This is the relevant commit: https://github.com/travellingfreak/sanitizer/commit/ec4ca00b25b680cf1699c97f3e1f1fcde24f4edf

overheadhunter commented 3 years ago

With vault format 7, huge parts of the vault structure changed. While it may still be possible to decrypt single files by merely updating the libraries, you can't check the integrity of the dir structure.

We're currently preparing integration of sanitizer right into the main desktop application and have already implemented the first checks. This is going to be a part of Cryptomator 1.6.0.

ijoseph commented 3 years ago

Not an expert on this, but I've forked and managed to make it work to check and decrypt the vault with version 7. I'm assuming that there are several things that I'm missing as it appeared to be an easy fix. As such, I'm not sure if I should open a PR or not.

This is the relevant commit: travellingfreak@ec4ca00

This worked great for me to decyrpt folders and files! Worth forking the repo entirely and making a PR IMO. While it's probably not perfect, it's way better than nothing.