Closed FZachlod closed 7 years ago
To be precise it happens here:
CipherSupplier.class
cipher.init(ciphermode, key, params);
return cipher;
} catch (InvalidKeyException var6) {
Caused by: java.security.InvalidKeyException: Illegal key size at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1039) at javax.crypto.Cipher.implInit(Cipher.java:805) at javax.crypto.Cipher.chooseProvider(Cipher.java:864) at javax.crypto.Cipher.init(Cipher.java:1396) at javax.crypto.Cipher.init(Cipher.java:1327) at org.cryptomator.cryptolib.common.CipherSupplier.forMode(CipherSupplier.java:65) ... 28 more
key size is 32 bytes (256bits) though. Verified in the debugger.
Okay this is an issue Oracle Java not supporting AES-256 by default. I assume the GUI used a different JVM. One needs these files
http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html http://stackoverflow.com/questions/6481627/java-security-illegal-key-size-or-default-parameters
Afterwards the Oracle JVM has 256 bit AES support. Should be mentioned somewhere I assume but is actually no bug in Cryptomator.
And it is actually mentioned. Sometime reading the Docs just helps. But could terminate with a nice message I assume ;)
There would actually be a different exception, if we updated CryptoLib in the CLI project :D
D:\Downloads>java -jar cryptomator-cli-0.2.1.jar --bind localhost --port 8081 --vault TestVault=D:\cryptotest\ --password TestVault=test 2017-03-29 15:21:17,371 INFO [log:192] Logging initialized @978ms 2017-03-29 15:21:17,419 INFO [Server:346] jetty-9.3.z-SNAPSHOT 2017-03-29 15:21:17,458 INFO [ContextHandler:781] Started o.e.j.s.ServletContextHandler@6025e1b6{/,null,AVAILABLE} 2017-03-29 15:21:17,631 INFO [AbstractConnector:278] Started ServerConnector@6c40365c{HTTP/1.1,[http/1.1]}{localhost:8081} 2017-03-29 15:21:17,632 INFO [Server:414] Started @1241ms 2017-03-29 15:21:17,636 INFO [WebDavServer:94] WebDavServer started on port 8081. 2017-03-29 15:21:17,637 INFO [CryptomatorCli:64] Unlocking vault "TestVault" located at D:\cryptotest Exception in thread "main" org.cryptomator.cryptofs.UncheckedThrows$ExceptionThrownUnchecked: java.lang.IllegalArgumentException: Invalid key.
The password ("test") is definitely correct. I tried opening the vault with the GUI which works absolutely correct. Tried to open the /same/ vault within Linux works too with the same cryptomator jar. Specifying a wrong password gives a different exception though (wrong passphrase).
D:\Downloads>java -version java version "1.8.0_121" Java(TM) SE Runtime Environment (build 1.8.0_121-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
it happens somewhere within
Path vaultRoot = CryptoFileSystemProvider.newFileSystem(vaultPath, properties).getPath("/");