示例#1
0
 public function testDecryptSwipe()
 {
     $encryptedData = 'EE83560CE7D7A276196EF815A8E5D58838336A87CE90052B35BE5C78D49BCED40BE2531A3F6FF89E7DFDCF8E73747EEB92712F56CA47CA1A04EB8C41DFDF57C24E4ECF9A1C56C121BE467045CE8DA7EFA6F3D91F65D4247FF8588BE9AE6C082E6BA4A9F03EFDF21B4E4ECF9A1C56C121A37A63AFE2FD0F2B';
     $bdk = 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF';
     $ksn = new KeySerialNumber('FFFFFFFFFFFFFFE00024');
     $expected = '2542343030323437393437303731373439335E4645524E414E44455A2F4D415243555320432020202020205E313330323230313030303030202020202020202030303133363030303030303F3B343030323437393437303731373439333D31333032323031303030303031333630303030303F0000000000';
     $derivedKey = DerivedKey::getNowKey($ksn, $bdk);
     $actual = Utility::tripleDesDecrypt($encryptedData, $derivedKey);
     $this->assertEquals($expected, $actual);
 }
示例#2
0
 public function testDecryptDukptTrack2()
 {
     $encryptedHexData = 'AB3B10A3FBC230FBFB941FAC9E82649981AE79F2632156E775A06AEDAFAF6F0A184318C5209E55AD';
     $ksn = '62994901190000000002';
     $bdk = '0123456789ABCDEFFEDCBA9876543210';
     $key = new KeySerialNumber($ksn);
     $encryptionKey = DerivedKey::calculateDataEncryptionRequestKey($key, $bdk);
     $actual = Utility::hex2bin(Utility::removePadding(Utility::tripleDesDecrypt($encryptedHexData, $encryptionKey, true)));
     $expected = ";4266841088889999=080910110000046?0";
     $this->assertEquals($expected, $actual);
 }