Hey weedpacket, thanks for sticking with me !.
I worked out the base64 encoding, but thats not the full story unfortunaltely.
I was still getting slightly different tokens from the two implementations. eg: from php I would get this: (base64)
NMZfff9JyQNKaMiiI2vcWoKDsz7V5uzK9YVap9GO3ww=
and from the java:
NMZfff9JyQNKaMiiI2vcWoKDsz7V5uzKzQy9JfS90FA=
they differ after character 32.
I looked in more detail at the java class I was using, with a bit of 'jad' I got the source of the 'encode()' method, which looks like this:
encodecipher = Cipher.getInstance("DESede/ECB/PKCS5Padding");
I wonder if this PKCS5Padding has anything to do with it ?.
I have printed the data and key before encryption and they are the same, the results after encryption differ as above.
My PHP looks like:
$data = '|1082538054680|helloworld';
$mcrypt_module = mcrypt_module_open('tripledes', '', ecb', '');
//getting initialization vector
$mcrypt_iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($mcrypt_module), MCRYPT_RAND);
//getting key size for this encryption mode
$key_size = mcrypt_enc_get_key_size($mcrypt_module);
echo('Key size is:'.$key_size."\n"); // 24 !.
mcrypt_generic_init($mcrypt_module,$key,$mcrypt_iv);
$encrypted_data = mcrypt_generic($mcrypt_module, $data);
$base64_encrypted = base64_encode( $encrypted_data );
echo('Here is the base 64 encrypted :'.$base64_encrypted."\n");
Can't see a way to specify that PKCS5Padding part.
Hmm....