dukpt-php
dukpt-php copied to clipboard
Decryption error when KSN serial is > 10
Hello, Im using your library to decrypt tracks of a Magtek Reader and for some reasons Im able to decrypt tracks with ksn serial < 10 while rest are failing. If ksn is 9014030B2ABDC0000005 then decryption works, when ksn is like 9014030B2ABDC0000050 im getting garbage in return.
I do not mind to pay for a consulting. Thank you.
$key = new DUKPT\KeySerialNumber($ksn);
$encryptionKey = DUKPT\DerivedKey::calculatePinEncryptionKey ($key, $bdkMagtek);
Thank you for a library.
Ok. Seems I found a fix. but i do not understand this piece of code. in calculateDerivedKey
- $r8 = Utility::orHexString($r8, $shiftr, 43);
+ $r8 = Utility::orHexString($r8, $shiftr, 59);
Thats what i did to make decryption on Rambler reader to work. Magtek needed original padding of 43 to work properly.
From where this constant comes?