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

Problems with decryptFile #3

Closed egarpor closed 5 years ago

egarpor commented 7 years ago

I am having troubles running the decryptFile utility. Seems like is missing some dependency on the Janino library?

Here is what I did:

$ java -jar sanitizer-0.13.jar decryptFile -vault /Users/Eduardo/Cryptomator_vault/
# Cryptomator vault sanitizer v0.13 #

Vault password:
Enter absolute path of an encrypted file: /Users/Eduardo/Cryptomator_vault/d/35/JG366DHSZ7C2CF7JS6NHVBSAROACEH/2RYXDGZIR6S4W24IB5POARRVCMIOKMBXGFXZINSRLU5NU4MMAY6Q====
Enter absolute path of decrypted output: /Users/Eduardo
14:45:54,681 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
14:45:54,681 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
14:45:54,681 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/Users/Eduardo/Desktop/sanitizer-0.13.jar!/logback.xml]
14:45:54,705 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@3d24753a - URL [jar:file:/Users/Eduardo/Desktop/sanitizer-0.13.jar!/logback.xml] is not of type file
14:45:54,824 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
14:45:54,826 |-ERROR in ch.qos.logback.core.joran.conditional.IfAction - Could not find Janino library on the class path. Skipping conditional processing.
14:45:54,826 |-ERROR in ch.qos.logback.core.joran.conditional.IfAction - See also http://logback.qos.ch/codes.html#ifJanino
14:45:54,828 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
14:45:54,829 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@59a6e353 - Registering current configuration as safe fallback point

Exception in thread "main" java.lang.IllegalStateException: Required key length not supported.
    at org.cryptomator.cryptolib.v1.Version1CryptorModule.assertRequiredKeyLengthIsAllowed(Version1CryptorModule.java:42)
    at org.cryptomator.cryptolib.v1.Version1CryptorModule.provideCryptorProvider(Version1CryptorModule.java:35)
    at org.cryptomator.cryptolib.v1.Version1CryptorModule_ProvideCryptorProviderFactory.get(Version1CryptorModule_ProvideCryptorProviderFactory.java:30)
    at org.cryptomator.cryptolib.v1.Version1CryptorModule_ProvideCryptorProviderFactory.get(Version1CryptorModule_ProvideCryptorProviderFactory.java:10)
    at org.cryptomator.cryptolib.DaggerCryptoLibComponent.version1(DaggerCryptoLibComponent.java:51)
    at org.cryptomator.cryptolib.Cryptors.version1(Cryptors.java:27)
    at org.cryptomator.sanitizer.CryptorHolder.bestGuessCryptorProvider(CryptorHolder.java:89)
    at org.cryptomator.sanitizer.restorer.FileDecryptor.decryptFile(FileDecryptor.java:36)
    at org.cryptomator.sanitizer.commands.DecryptFileRunner.run(DecryptFileRunner.java:21)
    at org.cryptomator.sanitizer.commands.DecryptFileCommand.run(DecryptFileCommand.java:79)
    at org.cryptomator.sanitizer.commands.Commands.run(Commands.java:75)
    at org.cryptomator.sanitizer.Sanitizer.main(Sanitizer.java:16)
    at org.cryptomator.sanitizer.Sanitizer$$Lambda$5/999966131.accept(Unknown Source)
    at java.util.Optional.ifPresent(Optional.java:159)
    at org.cryptomator.sanitizer.Sanitizer.main(Sanitizer.java:12)
tobihagemann commented 7 years ago

Required key length not supported means that JCE is not installed which is needed for 256-bit keys.

Check out this guide on how to install JCE.

egarpor commented 7 years ago

OK, so indeed the JCE was missing - I overlooked that part in the README. Thanks for pointing it out. But I still not able to decrypt a single file:

$ java -jar sanitizer-0.13.jar decryptFile -vault /Users/Eduardo/Cryptomator_vault/
# Cryptomator vault sanitizer v0.13 #

Vault password:
Enter absolute path of an encrypted file: /Users/Eduardo/Cryptomator_vault/d/35/JG366DHSZ7C2CF7JS6NHVBSAROACEH/2RYXDGZIR6S4W24IB5POARRVCMIOKMBXGFXZINSRLU5NU4MMAY6Q====
Enter absolute path of decrypted output: /Users/Eduardo/Desktop
15:26:32,490 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
15:26:32,490 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
15:26:32,490 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/Users/Eduardo/Desktop/sanitizer-0.13.jar!/logback.xml]
15:26:32,510 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@26ba2a48 - URL [jar:file:/Users/Eduardo/Desktop/sanitizer-0.13.jar!/logback.xml] is not of type file
15:26:32,639 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
15:26:32,641 |-ERROR in ch.qos.logback.core.joran.conditional.IfAction - Could not find Janino library on the class path. Skipping conditional processing.
15:26:32,641 |-ERROR in ch.qos.logback.core.joran.conditional.IfAction - See also http://logback.qos.ch/codes.html#ifJanino
15:26:32,643 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
15:26:32,644 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@5f2050f6 - Registering current configuration as safe fallback point

I did a check and it complains about the Janino library as well:

$ java -jar sanitizer-0.13.jar check -vault /Users/Eduardo/Cryptomator_vault/ -deep
# Cryptomator vault sanitizer v0.13 #

Vault password:
Scanning vault structure may take some time. Be patient...
Wrote structure to Cryptomator_vault.structure.txt.
135 files in vault

Checking the vault may take some time. Be patient...

15:28:48,568 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
15:28:48,568 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
15:28:48,568 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/Users/Eduardo/Desktop/sanitizer-0.13.jar!/logback.xml]
15:28:48,584 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@2d3fcdbd - URL [jar:file:/Users/Eduardo/Desktop/sanitizer-0.13.jar!/logback.xml] is not of type file
15:28:48,627 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
15:28:48,628 |-ERROR in ch.qos.logback.core.joran.conditional.IfAction - Could not find Janino library on the class path. Skipping conditional processing.
15:28:48,628 |-ERROR in ch.qos.logback.core.joran.conditional.IfAction - See also http://logback.qos.ch/codes.html#ifJanino
15:28:48,630 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
15:28:48,631 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@617c74e5 - Registering current configuration as safe fallback point

Found 0 problem(s):
* 0 FATAL
* 0 ERROR
* 0 WARN
* 3 INFO

See Cryptomator_vault.check.txt for details.

Done.

Is that because I also need to install Maven 3?

tobihagemann commented 5 years ago

Closed due to inactivity. Just retried decryptFile and it should work. I noticed in your log messages that you have to specify the complete path of the output when it's asking for Enter absolute path of decrypted output. E.g., /Users/.../Desktop is not enough, you have to specify the output filename as well like /Users/.../Desktop/foo.