Copyright © 2010-2014, International Technologies & Systems Corp. All rights reserved.
Page 46 of 74
SecureMag User Manual
This one-byte value is the length of the original Track data. It indicates the
number of bytes in the Track masked data field. It should be used to separate
Track 1 and Track 2 data after decrypting Track encrypted data field.
Track 3 unencrypted Length
This one-byte value indicates the number of bytes in Track 3 masked data field.
Track 1 and Track 2 masked
Track data masked with the MaskCharID (default is ‘*’). The first PrePANID (up
to 6 for BIN, default is 4) and last PostPANID (up to 4, default is 4) characters
can be in the clear (unencrypted). The expiration date is masked by default but
can be optionally displayed.
Track 1 and Track 2 encrypted
This field is the encrypted Track data, using either TDES-CBC or AES-CBC with
initial vector of 0. If the original data is not a multiple of 8 bytes for TDES or a
multiple of 16 bytes for AES, the reader right pads the data with 0.
The key management scheme is DUKPT and the key used for encrypting data is
called the Data Key. Data Key is generated by first taking the DUKPT Derived
Key exclusive or’ed with 0000000000FF0000 0000000000FF0000 to get the
resulting intermediate variant key. The left side of the intermediate variant key is
then TDES encrypted with the entire 16-byte variant as the key. After the same
steps are preformed for the right side of the key, combine the two key parts to
create the Data Key.
How to get Encrypted Data Length
The encrypted track data length is always a multiple of 8 bytes for TDES or
multiple of 16 bytes for AES. This value will be zero if there was no data on both
tracks or if there was an error decoding both tracks.
In the original format, Track 1 and Track 2 data are encrypted as a single block. In
order to get the number of bytes for encrypted data field, we need to get Track 1
and Track 2 unencrypted length first, and add the Track 1, Track 2 and Track 3
together. Round up the total length by 8 if it’s TDES or 16 for AES.
In enhanced format, the tracks data are encrypted separately rather than as a group.
To calculate the encrypted track length for each track, round up the track
unencrypted data length by 8 for TDES or 16 for AES. For example, to calculate
the encrypted track 1 length, round up the track 1 unencrypted data length (field 5)
by 8 for TDES or16 if it’s AES.
Please refer to section 10.7 Decryption Samples for detailed samples.