beautypg.com

Section 2. communications, Card data – MagTek iDynamo MagneSafe V5 User Manual

Page 9

background image

3

SECTION 2. COMMUNICATIONS

CARD DATA

The details about how the card data and commands are structured follow later in this section.

The reader will send only one swipe message per card swipe. When a card is swiped, the swipe
message will be sent even if the data is not decodable. If no data is detected on a track then
nothing will be transmitted for that track. If an error is detected on a track, the ASCII character
“E” will be sent in place of the track data to indicate an error.

The reader will always send data in blocks of 500 bytes. If card data is more than 500 bytes, the
reader will send this using 2 blocks of 500 bytes. If card data is less than or equal to 500 bytes,
the reader will only send 1 block with 500 bytes. If data is less than 500 bytes in a block, the
reader will use a lower case ‘x’ (0x78) as padding characters. Note: The longest message always
fits within 2 blocks.

A Swipe Message is composed of readable ASCII characters. It includes:

• Structural ASCII characters intended to give clues to the structure of the rest of the data.

• Simple ASCII fields that convey the ASCII representation of:

Masked Track Data
Device Serial Number
Format Code

• Binary fields that use sets of two ASCII characters representing hexadecimal digits to

convey the binary value of each byte in the field. The ASCII characters
0123456789ABCDEF convey the hexadecimal values of 0123456789ABCDEF
respectively. The Binary fields are:

Reader Encryption Status
Encrypted Track Data
MagnePrint Status
Encrypted MagnePrint Data
Encrypted Session ID
DUKPT Key Serial Number
Clear Text CRC
Encrypted CRC


For the encrypted fields, the original binary bytes are encrypted using the DES CBC mode with
an Initialization Vector starting at all binary zeroes and the PIN Encryption Key associated with
the current DUKPT KSN. This is done in segments of 8 bytes. If the last segment of the original
data is less than eight bytes long (track data only), the last bytes of the block will be set to binary
zeroes before encrypting. When decrypting track data, the End Sentinel can be used to find the
actual end of the data (ignoring the final zeroes). Each byte of encrypted data is then converted
to two bytes of ASCII data representing the Hexadecimal value of the encrypted byte (many of
the encrypted bytes will have values outside of the printable ASCII character range).