Appendix C - Cryptography
Appendix C
C.1
Decrypt PIN
PIN_DATA structure contains the information need to decrypt PIN.
public struct _PIN_DATA
{
public byte OpStatus;
public string KSN;
public string EPB;
}
C.1.1 Get key for the PIN decryption from BDK and KSN
First, convert KSN and EPB from hex string to byte array for further calculation.
byte[] bKSN = ConvertHexStringToByteArray(PinData.KSN);
byte[] bEPB = ConvertHexStringToByteArray(PinData.EPB);
Then, derive key from BDK and KSN
byte[] bPinKey;
// To get the bPinKey, reference to ANSI X9.24
C.1.2 Use Triple DES CBC to decrypt PIN block
Decrypt Encrypted PIN Block, use empty initial vector.
byte[] bIsoPinBlock = new byte[8];
byte[] iv = new byte[8];
TDES_Decrypt_CBC(bPinKey, iv, bEPB, 8, bIsoPinBlock, 8);
C.1.3 Extract PIN from PIN block
Reference to ISO 9564-1.
C.2
Decrypt Card Track
CARD_DATA structure contains the information need to decrypt track 1,2 and 3.
public struct _CARD_DATA
{
public byte DataType;
public byte CardOperationStatus;
public byte CardStatus;
public byte CardType;
public byte Track1Length;
public byte Track2Length;
public byte Track3Length;
public byte EncTrack1Length;
public byte EncTrack2Length;
public byte EncTrack3Length;
public byte EncMPLength;
IPAD, DynaPro, DynaPro Go, and DynaPro Mini| PIN Encryption Devices | Programmer's Reference (Microsoft Windows Store)
Page 64
Cryptography
Need help?
Do you have a question about the IPAD and is the answer not in the manual?
Questions and answers