I would like to create a TDES key with size 128bits and 2KTDES key with 192bits for authentication in a Desfire smart card. Hence I have used the keytool to generate the jceks with the following command. When I run the same under the C:\Program Files (x86)\Java\jdk1.8.0_25\jre\bin
folder I can see that the execution succeeds and the jceks is created. However when the export the keytool.exe to another location perhaps the desktop, I can see that the same command fails with the following error.
C:\Users\Charan\Desktop\KeyGen>keytool -genseckey -alias TDES -keyalg DESede -keysize 128 -storetype jceks -keystore TDES.jceks -storepass change -keypass change
keytool error: java.security.InvalidParameterException: Wrong keysize: must be equal to 112 or 168
C:\Users\Charan\Desktop\KeyGen>
C:\Users\Charan\Desktop\KeyGen>
I tried the same with both 112 and 168 options, either way it executes without errors but the keysizes created in both the cases is 192 bits. But the original question still remains a mystery because when I tried to create both 192 and 256 bit keys with DESEDE, I was able to do them when running the keytool from the bin folder. The keystore files generated did have the correct key length, 192 and 256.