dun forget DESede uses 112 or 168 size keys
This is a little simplistic as far as the SunJCE JCE provider is concerned.
A DES key is 56 bits and Triple DES key is either 2x56 bits or 3x56 bits. The first 56 bits
of 2x56 Bit Triple DES key is used to DES encrypt a block, the second 56 bits is used to
DES decrypt the the result of the first DES encryption and the first 56 bits is then used
again to further DES encrypt the block. A 3x56 Bit Triple DES key uses the first 56 bits to
encrypt a block, the second 56 bits to DES decrypt the result of the first DES encryption
and then finally the 3rd 56 bit key is used to DES encrypt.
Within the SunJCE provider, a DES key is packaged as 8 bytes of 7 bits with the least
significant bit of each byte being a parity bit. I can't remember whether it is even or odd
parity but it does not matter because the SunJCE provider ignores this bit!
A Triple DES key is packages as 24 bytes with the first 8 bytes bring used for the DES
key first encryption stage, the next 8 bytes as the DES key for the decryption stage and
the last 8 bytes used for the final DES encryption stage. If one tries to provide just 16
bytes as a representation of the 2x56 Bit key then one gets a
java.security.InvalidKeyException: Wrong key size
exception. If one wants the same 56 bit key used for both encryption stages of Triple
DES encryption then one must build the appropriate 24 bytes.