Ok - more info on this .....
I'm now attempting to replicate what's going on at the encryption end.... so I'm testing php's encrypt and decrypt system.
The client has pointed me at a encrypt/decrypt page on the web : http://www.riscure.com/tech-corner/online-crypto-tools/des.html. This is the site they use to double check their encryption/decryption is working ok.
So, with "Radix" set to ASCII, I put in a string "This is a test string", and a key "BlahBlahBlahBlah".
I alter Radix to HEX and get "546869732069732061207465737420737472696E67030303" (string), and "426C6168426C6168426C6168426C6168" (key)/
Then I press the "T-DES encrypt" button, and get a HEX output of : "08E1E0287E389F0D1D8B2F3633271CD6FC419926411EFE2B" .
Trying to replicate this in PHP I do this:
$string = "This is a test string";
$string = pkcs7_pad($string, mcrypt_get_block_size(MCRYPT_TRIPLEDES,MCRYPT_MODE_ECB) );
$string = bin2hex($string);
$string = strtoupper($string);
$key = "BlahBlahBlahBlah";
$key = strtoupper(bin2hex($key));
$iv_size = mcrypt_get_iv_size(MCRYPT_TRIPLEDES,MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv( $iv_size , MCRYPT_RAND );
$encrypted = mcrypt_encrypt( MCRYPT_TRIPLEDES , $key , $string , MCRYPT_MODE_ECB , $iv );
(The ECB mode doesn't actually use the initialisation vector, as far as I can make out, but not putting it into the function call throws a warning).
The result output is : " �S��😉x(m�#y}���,A�t�/*sz�oYɘ���#28�Uo�٨� "
passing the above through bin2hex() gives : " 06fc5389ec2978286dea23797dd50ea7cc2c41f41e749c2f2a0f737acc6f59c998d4cbee23323886556ff39ad9a8df05 "
What am I doing wrong/not understanding here?? I've tried everything I can think of to mimic what's being done in the Riscure page, but can't get the same results - which I think is why I can't get the decryption to work.... 🙁