I am trying to get TripleDES encryption working in Java. From the Wikipedia article under Keying Options
, I want to use option 1, where All three keys are ind
"TripleDES" is simply an alias for "DESede" in the Sun JCE provider – both return the exact same cipher. "DESede" is the standard name which should work on every Java platform, but in practice, "TripleDES" is probably pretty widely supported too.
According to this page, the SunJCE Triple DES implementation supports options #1 and #2:
Keysize must be equal to 112 or 168.
A keysize of 112 will generate a Triple DES key with 2 intermediate keys, and a keysize of 168 will generate a Triple DES key with 3 intermediate keys.
You should always specify the mode of operation and the padding when instantiating a cipher to make your intents clear. Otherwise the implementation is free to make the choice, which can be confusing.