2016-05-17 30 views
0

私はMagtek uDynamoを持っており、トラック1を復号化しようとしています。私は以下を読んで少しは理解していますが、実際にデータを復号化する方法はわかりません。ベンダーは、ANSIテストキーを使用して解読すると言っていましたが、それについては何も見つかりませんでした。私はKSN、セッション、シリアル番号を持っています。私も見つけたいくつかのJavaコードを試しましたが、うまくいかないようです。 nullを返すか、間違ったBDKを入れている可能性があります。私はちょうど私がどこかで読むことのためにシリアル番号を使用しています。私はAndroidでこれをやっています。私は、HTTPSと一緒に回線を越えて暗号化されるように、デバイス上にないサーバー上で実行されるコードをお勧めします。ANSI X9.24パート1規格の3DES DUKPTを復号化する

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

更新 私はこのhttps://github.com/camcima/dukpt-php/tree/e8fceb4df8757e7e097c435221b4e93e097d3c9fを使用していANSI X9.24の一部につき3DES DUKPTを解読するために1標準

を探しています

私はファイルを更新し、最新のphpseclibを持っていることを確認しなければならなかったが、データはC 4A fr (Wb f 7z n: w 9 、 f7 、m = z CRW

私は何かが欠けているはずです。私はさまざまなモードを試しましたが、私はエンコーディングを探しています。解決策やアイディアがあれば教えてください。すべての適切なBDKとKSNで

include 'vendor/autoload.php'; 

use DUKPT\DerivedKey; 
use DUKPT\KeySerialNumber; 
use DUKPT\Utility; 

$encryptedHexData = 'de8bfe769dca885cf3cc312135fe2cccfacf176235f4bdee773d1865334315ed2aefcab613f1884b5d63051703d5a0e2bd5d1988eeabe641bd5d1988eeabe641'; 
$ksn = '0117e00027'; 
$bdk = 'ABCDEFFEDCBA'; 

$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 />'; 
+0

[このブログエントリ](https://www.parthenonsoftware.com/blog/how-to-decrypt-magnetic-stripe-scanner-data-with-dukpt)は、過去に私を助けてきました。 –

+0

私はちょうどこれを試しましたhttp://57f4dad48e7a4f7cd171c654226feb5a.proxysheep.com/questions/32536045/how-to-decode-dukpt-cbc-mode-in-javaしかし、どのようにそれからクレジットカード番号を得るのですか、ありがとう – user1054513

+0

Areあなたは現在、track1を渡す方法を参照していますか? Track1はこの[wiki](https://en.wikipedia.org/wiki/Magnetic_stripe_card)に記載されています –

答えて

0

:また彼らのテストデータは、私は違いが私と彼らの間

コード私はルートにあるindex.phpを実行しているが何であるかわからないので、動作しませんあなたは今異なるモードを試してみる必要があります。

今、あなたはあなたのデバイスが使用している1把握するために、他のモードを試してみる必要があるDerivedKey::calculateDataEncryptionRequestKey($key, $bdk);

を使用しています。私のデバイスの正しい結果を見つけるために使用したコードは次のとおりです。

include 'vendor/autoload.php'; 

use DUKPT\DerivedKey; 
use DUKPT\KeySerialNumber; 
use DUKPT\Utility; 

$encryptedHexData = 'C25C1D1197D31CAA87285D59A892047426D9182EC11353C051ADD6D0F072A6CB3436560B3071FC1FD11D9F7E74886742D9BEE0CFD1EA1064C213BB55278B2F12'; 
$ksn = 'FFFFE00008'; 
$bdk = 'ABCDEFFEDCBA'; 

$key = new KeySerialNumber($ksn); 

$encryptionKey = DerivedKey::calculatePinEncryptionKey($key, $bdk); 
$decryptedOutput = Utility::hex2bin(Utility::tripleDesDecrypt($encryptedHexData, $encryptionKey, true)); 
echo '<br /><br />Pin Encryption Key: '.$encryptionKey; 
echo '<br />Decrypted Output: '.$decryptedOutput; 

$encryptionKey = DerivedKey::calculateMacRequestKey($key, $bdk); 
$decryptedOutput = Utility::hex2bin(Utility::tripleDesDecrypt($encryptedHexData, $encryptionKey, true)); 
echo '<br /><br />Mac Request Key: '.$encryptionKey; 
echo '<br />Decrypted Output: '.$decryptedOutput; 

$encryptionKey = DerivedKey::calculateMacResponseKey($key, $bdk); 
$decryptedOutput = Utility::hex2bin(Utility::tripleDesDecrypt($encryptedHexData, $encryptionKey, true)); 
echo '<br /><br />Mac Response Key: '.$encryptionKey; 
echo '<br />Decrypted Output: '.$decryptedOutput; 

$encryptionKey = DerivedKey::calculateDataEncryptionRequestKey($key, $bdk); 
$decryptedOutput = Utility::hex2bin(Utility::tripleDesDecrypt($encryptedHexData, $encryptionKey, true)); 
echo '<br /><br />Data Encryption Request Key: '.$encryptionKey; 
echo '<br />Decrypted Output: '.$decryptedOutput; 

$encryptionKey = DerivedKey::calculateDataEncryptionResponseKey($key, $bdk); 
$decryptedOutput = Utility::hex2bin(Utility::tripleDesDecrypt($encryptedHexData, $encryptionKey, true)); 
echo '<br /><br />Data Encryption Response Key: '.$encryptionKey; 
echo '<br />Decrypted Output: '.$decryptedOutput; 

したがって、このBDKおよびKSNの出力結果は次のとおりです。

Pin Encryption Key: 27F66D5244FF621EAA6F6120EDEB427F 
Decrypted Output: %B5452300551227189^HOGAN/PAUL ^000000725000000? 

Mac Request Key: 27F66D5244FF9DE1AA6F6120EDEBBD80 
Decrypted Output: W����U�P�TfB/`����þ&��f��3y;�U�Zy��UK�[��s�;�>�[�b 

Mac Response Key: 27F66D52BBFF62E1AA6F612012EB4280 
Decrypted Output: b�K2a�S0��9�Mb-����*L�J���� ��s�\���H�����=���e�]�,���Hwq� 

Data Encryption Request Key: C39B2778B058AC376FB18DC906F75CBA 
Decrypted Output: RA]�ԅⱰQ���'v}b��h��St�����?� lu/�ٵ�P��!���6�� � 

Data Encryption Response Key: 846E267CB822197406DA2B161191C6E4 
Decrypted Output: ��,�B^FZ�� ςs�c���*E�4��0��ǂ}����6`-P�b�ʞ̳aصĬ�&���+�� 
関連する問題