Filippo La Torre wrote:If I have two keys of 16 bytes, for example:
I didn't understand how these become of 24 bytes
Your second example doesn't make sense. Are you using string
characters? If no, what base are you in -- as hexadecimal digits are only in the 0-9 and a-f range. Your first example, however, looks like a valid hexadecimal number (and it is eight bytes long).
Anyway, to answer your question....
As mentioned, triple DES uses DES keys, which are 56 bits long, or 8 bytes long (as one bit of each byte isn't used). If you want Triple DES with only two DES keys, you need to create the 24 byte key (needed by the java triple DES implementation) as follows....
k1) a1 23 b5 56 c7 89 d0 00
k2) b7 35 78 dc ff d4 f7 89
K = k1 k2 k1 = a1 23 b5 56 c7 89 d0 00 b7 35 78 dc ff d4 f7 89 a1 23 b5 56 c7 89 d0 00
Note: DES keys chosen randomly as examples -- no checking to confirm that the keys have correct parity, and hence, valid.