I have a Magtek uDynamo and am trying to decrypt track 1. I have read the below and understand a little bit but don't know how to actually decrypt the data. The vendor said to use the ANSI test key to decrypt but I can't find anything on that. I have the KSN, session, and serial numbers. I have also tried some Java code I found, but it doesn't seem to work. It returns null or possibly I'm putting in the wrong BDK. I'm just using the serial number for that which I read somewhere. I'm doing this on Android. Preferably I would like code that runs on the server not on the device so it goes encrypted across the line along with HTTPS.
How ciphertext was generated in card reader using DUKPT encryption?
3DES-DUKPT (CBC) decryption confirmation
https://github.com/yinheli/dukpt/blob/master/src/main/java/com/yinheli/tool/DukptDecrypt.java
Update I'm looking to decrypt 3DES DUKPT per the ANSI X9.24 part 1 standard
I'm using this https://github.com/camcima/dukpt-php/tree/e8fceb4df8757e7e097c435221b4e93e097d3c9f
I had to update the files and make sure I got the most recent phpseclib and it runs but the data comes out like C��� ������4A�fr���( Wb������f�7z�n:�w�9��,��f7�,m=�z�CRW�
I must be missing something. I've tried different modes and I'm trying to look for encoding. Please let me know if you have a solution or ideas. Also their test data does work so I'm not sure what the difference is between mine and theirs
Code I'm running index.php in the root:
include 'vendor/autoload.php';
use DUKPT\DerivedKey;
use DUKPT\KeySerialNumber;
use DUKPT\Utility;
$encryptedHexData = 'de8bfe769dca885cf3cc312135fe2cccfacf176235f4bdee773d1865334315ed2aefcab613f1884b5d63051703d5a0e2bd5d1988eeabe641bd5d1988eeabe641';
$ksn = '00000232100117e00027';
$bdk = '0123456789ABCDEFFEDCBA9876543210';
$key = new KeySerialNumber($ksn);
$encryptionKey = DerivedKey::calculateDataEncryptionRequestKey($key, $bdk);
$actual = Utility::hex2bin(Utility::removePadding(Utility::tripleDesDecrypt($encryptedHexData, $encryptionKey, true)));
echo $encryptionKey.'<br />';
echo $actual.'<br /><br />';