FCC WARNING STATEMENT
This equipment has been tested and found to comply with the limits for a Class B digital
device, pursuant to Part 15 of FCC Rules. These limits are designed to provide reasonable
protection against harmful interference when the equipment is operated in a commercial
environment. This equipment generates, uses, and can radiate radio frequency energy and,
if not installed and used in accordance with the instruction manual, may cause harmful
interference to radio communications. Operation of this equipment in a residential area is
likely to cause harmful interference in which case the user will be required to correct the
interference at his expense.
FCC COMPLIANCE STATEMENT
This device complies with Part 15 of the FCC Rules. Operation of this device is subject to
the following conditions: this device may not cause harmful interference and this device
must accept any interference received, including interference that may cause undesired
operation.
CANADIAN DOC STATEMENT
This digital apparatus does not exceed the Class B limits for radio noise for digital
apparatus set out in the Radio Interference Regulations of the Canadian Department of
Communications.
Le présent appareil numérique n’émet pas de bruits radioélectriques dépassant les limites
applicables aux appareils numériques de las classe A prescrites dans le Réglement sur le
brouillage radioélectrique édicté par les ministère des Communications du Canada.
CE STANDARDS
An independent laboratory performed testing for compliance to CE requirements. The unit
under test was found compliant to Class B.
LIMITED WARRANTY
ID TECH warrants to the original purchaser for a period of 12 months from the date of
invoice that this product is in good working order and free from defects in material and
workmanship under normal use and service. ID TECH’s obligation under this warranty is
limited to, at its option, replacing, repairing, or giving credit for any product that returned
to the factory of origin with the warranty period and with transportation charges and
insurance prepaid, and which is, after examination, disclosed to ID TECH’s satisfaction to
be defective. The expense of removal and reinstallation of any item or items of equipment
is not included in this warranty. No person, firm, or corporation is authorized to assume for
ID TECH any other liabilities in connection with the sales of any product. In no event shall
ID TECH be liable for any special, incidental or consequential damages to purchaser or any
third party caused by any defective item of equipment, whether that defect is warranted
against or not. Purchaser’s sole and exclusive remedy for defective equipment, which does
not conform to the requirements of sales, is to have such equipment replaced or repaired by
ID TECH. For limited warranty service during the warranty period, please contact ID
TECH to obtain a Return Material Authorization (RMA) number & instructions for
returning the product.
THIS WARRANTY IS IN LIEU OF ALL OTHER WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR PARTICULAR PURPOSE. THERE ARE NO
OTHER WARRANTIES OR GUARANTEES, EXPRESS OR IMPLIED, OTHER THAN
THOSE HEREIN STATED. THIS PRODUCT IS SOLD AS IS. IN NO EVENT SHALL
ID TECH BE LIABLE FOR CLAIMS BASED UPON BREACH OF EXPRESS OR
IMPLIED WARRANTY OF NEGLIGENCE OF ANY OTHER DAMAGES WHETHER
DIRECT, IMMEDIATE, FORESEEABLE, CONSEQUENTIAL OR SPECIAL OR FOR
ANY EXPENSE INCURRED BY REASON OF THE USE OR MISUSE, SALE OR
FABRICATIONS OF PRODUCTS WHICH DO NOT CONFORM TO THE TERMS
AND CONDITIONS OF THE CONTRACT.
The information contained herein is provided to the user as a convenience. While every
effort has been made to ensure accuracy, ID TECH is not responsible for damages that
might occur because of errors or omissions, including any loss of profit or other
commercial damage, nor for any infringements or patents or other rights of third parties
that may result from its use. The specifications described herein were current at the time of
publication, but are subject to change at any time without prior notice.
ID TECH and Value through Innovation are trademarks of International Technologies &
Systems Corporation. USB (Universal Serial Bus) specification is copyright by Compaq
Computer Corporation, Intel Corporation, Microsoft Corporation, and NEC Corporation.
Windows is registered trademarks of Microsoft Corporation.
ID TECH
10721 Walker Street
Cypress, CA 90630
(714) 761-6368
ID TECH SecureMag reader delivers superior reading performance with the ability to
encrypt sensitive card data. The data encryption process prevents card holder information
from being accessed when the data is stored or in transit, so the data remains secure from
end to end. The reader fully supports TDES and AES data encryption using DUKPT key
management method. The SecureMag is offered in USB, RS232 as well as PS2 interfaces.
2. Features and Benefits
Bi-directional card reading
Reads encoded data that meets ANSI/ISO/AAMVA standards and some
custom formats such as ISO track 1 format on track 2 or 3
Reads up to three tracks of card data
A LED and a beeper on the reader provide status of the reading operations
Compatible with USB specification Revision 2.0 (USB interface)
Compatible with HID specification Version 1.1 (USB interface)
Uses standard Windows HID driver for communications; no third party
device driver is required (USB interface)
Provides clear text confirmation data including card holder’s name and a
portion of the PAN as part of the Masked Track Data
User friendly configuration software for device configuration
AAMVA American Association of Motor Vehicle Administration
ABA American Banking Association
AES Advanced Encryption Standard
ASIC Application Specific Integrated Circuit
BPI Bits per Inch
CADL California Drivers License Format (obsolescent)
CE European Safety and Emission approval authority
COM Serial Communication
CTS Clear-To-Send
CDC USB to serial driver (Communication Device Class)
DES Data Encryption Standard
DUKPT Derived Unique Key Per Transaction
DMV Department of Motor Vehicle
GND Signal Ground
HID Human Interface Device
IPS Inches per Second
ISO International Organization for Standardization
JIS Japanese Industrial Standard
JPOS Java for Retail Point Of Sale
KB Keyboard
KSN Key Serial Number
LED Light Emitting Diode
LRC Longitudinal Redundancy Check Character.
MAC Message Authentication Code
MSR Magnetic Stripe Reader
OLE Object Linking and Embedding
OPOS OLE for Retail Point Of Sale
OTP One Time Programmable
PAN Primary account number
PCI Payment Card Industry
PID USB Product ID
POS Point of Sale
PPMSR Serial Port Power Magstripe Reader
P/N Part Number
PS/2 IBM Personal System/2 Keyboard Interface
RTS Request To Send
SPI Serial Peripheral Interface
T1, T2, T3 Track 1 data, Track 2 data, Track 3 data
TDES Triple Data Encryption Standard
VID USB Vendor ID
Note: many unusual words used in this document are defined in the Function ID
table on page.
A card may be swiped through the reader slot when the LED is green. The magnetic
stripe must face toward the magnetic read head and may be swiped in either direction.
After a card is swiped, the LED will turn off temporarily until the decode process is
completed. If there are no errors decoding the card data then the LED will turn green. If
there are any errors decoding the card data, the LED will turn red for less than one second
to indicate that an error occurred and then turn green.
The reader LED will be off during the data transfer and is ready to read another card
when the LED returns to green. A red LED indicates an error and the beeper will also
provide error indications. The beeper will beep for each correctly read track of data on
the magstripe card. Depending on the security level configured, the card data might be
displayed in clear or encrypted mode.
5VDC +/- 10%
Maximum operating current consumption less than 50mA
RS232 interface – external power adaptor supplies power through RS232 cable
USB interface – from host interface. No external power adaptor needed.
Swipe speed
3 to 65 inches per second
Bi-directional
Indicators
Tri-color LED
o Red indicates bad read
o LED off while reading and decoding
o Green indicates good read, and ready to read
Beeper
o A beep sound indicates good read
Communication Interface
RS232
o Baud Rate – 1200, 2400, 4800, 9600, 19200, 38400, 56700, 115200
o Data bits – 8
o Stop bits – 1 or 2
o Parity – off, odd, even, mark or space
o Supports RTS/CTS hardware and Xon-Xoff software handshaking
USB
o Complies with USB 2.0 specification
PS2 Keyboard
o IBM PS2 interface compatible
Card Size
Supports cards that meets the ISO 7810 and 7811 1-7 standards
Dimension
3.94 inches (length) by 1.38 inches (width) and 1.18 inches (height).
Command requests and responses are sent to and received from the device. For USB
interface devices, the commands are sent to the device using HID class specific request
Set_Report (21 09 …). The response to a command is retrieved from the device using
HID class specific request Get_Report (A1 01 …). These requests are sent over the
default control pipe. For RS232 interface devices, please see the commands listed below.
Function ID Table
The complete table of Function ID used in command/response are listed in Appendix A.
It’s recommended to have at least one second delay between Setting Commands and Get
Settings Commands.
Setting Command
The setting data command is a collection of many function setting blocks and its
format is as follows.
Command:
<STX><S><FuncSETBLOCK1>…<FuncBLOCKn><ETX><LRC>
Response: <ACK> or <NAK> for wrong command (invalid funcID, length and
value)
Each function-setting block <FuncSETBLOCK> has following format:
<FuncID><Len><FuncData>
Where:
<FuncID> is one byte identifying the setting(s) for the function.
<Len> is the length count for the following function-setting block <FuncData>.
<FuncData> is the current setting for this function. It has the same format as in
the sending command for this function.
Get Setting Command
This command will send current setting to application.
Command: <STX> <R> <FuncID> <ETX> <LRC 1>
Response: <ACK> <STX> <FuncID> <Len> <FuncData> <ETX> <LRC 2>
<FuncID>, <Len> and <FuncData> definition are same as described above.
15 for
RS232 and
USB HID
interface;
FD for USB
KB interface
Negative Acknowledge
<UnknownID>
16
Warning: Unsupported ID in setting
<AlreadyInPOS>
17
Warning: Reader already in OPOS
mode
<R>
52
Review Setting
<S>
53
Send Setting
<LRC>
-
Xor’d all the data before LRC.
ASCII
HEX
Name
Use
‘8’
38
Copyright Report
Requests reader’s copyright notice
‘9’
39
Version Report
Requests version string
‘F”
46
Key Loading
Special command to load encryption
keys
‘I’
49
Reader Reset
Reset the reader. Software reset does
not resend startup string
‘M’
4D
OPOS/ JPOS Command
Command to enter OPOS or JPOS
mode
‘P’
50
Arm/Disarm to Read
Arm to Capture Buffer Mode MSR
‘Q’
51
Read Buffered Data
Read Stored MSR Data
‘R’
52
Read MSR Options
Read various reader optional settings
‘S’
53
Set MSR Options
Set various reader optional functions
Reader Command Summary
Notation used throughout the document:
Bold: boldface font indicates default setting value
‘2’: single quotation indicates ASCII characters, for example, ‘2’ is 32 in hex
“Number”: a null terminated character string
<Len>: angle brackets indicate a specific character or character string in a command or
response
Hex: the hex character 53 is ‘5’ in ASCII or 83 in decimal. Sometimes hex characters are
represented with an h attached to the end, for example, 53h.
\02: is a way to show that the following number is in hex. It is used by the configuration
program.
02 38 03 39
A ‘31-byte’ Copyright Notice will be returned.
Response is as follows:
ACK STX <Copyright String> ETX LRC
Response Example mixed hex and ASCII:
\06\02Copyright (c) 2010, ID TECH \03>
7.2 Version Report Command
02 39 03 38
Response is as follows:
ACK STX<Version String> ETX LRC
Response Example mixed hex and ASCII:
\06\02ID TECH TM3 SecureMag RS232 Reader V 3.19\03\LRC
7.3 Reader Reset Command
02 49 03 48
The reader supports a reset reader command. This allows the host to return the
reader to its default state.
Response is as follows:
06
7.4 OPOS/JPOS Command
There are three forms of the command:
02 4D 01 30 03 7D Enter Standard Mode (Exit OPOS Mode)
02 4D 01 31 03 7C Enter OPOS Mode
02 4D 01 32 03 7F Enter JPOS Mode
Response is as follows:
17 Reader already in OPOS Mode
15 Command failure (wrong length or wrong parameter)
06 Success
7.5 Arm/Disarm to Read Command
Arm to read:
02 50 01 30 03 LRC
This command enables the MSR to be ready for a card swipe in buffered mode.
Any previously read data will be erased and reader will wait for the next swipe.
As the user swipes a card, the data will be saved, but will not be sent to the host.
The reader holds the data until receiving the next “Arm to Read” or “MSR Reset”
command.
Disarm to read:
02 50 01 32 03 LRC
This command will disable MSR read and clear any magnetic data in buffered
mode. The reader enters to a disarmed state and will ignore MSR data.
Response is as follows:
06
Other possible response statuses:
NAK 'P' command length must be 1
NAK 'P' command must be 0x30 or 0x32
NAK Reader not configured for buffered mode
NAK Reader not configured for magstripe read
NAK for keyboard interface is FD, non-KB mode NAK is 15
7.6 Read Buffered MSR Data Command
02 51 01 <Track Selection Option> 03 LRC
The <Track Select Option> byte is defined as follows:
‘0’ Any Track
‘1’ Track 1
‘2’ Track 2
‘3’ Track 1 and Track 2
‘4’ Track 3
‘5’ Track 1 and Track 3
‘6’ Track 2 and Track 3
‘7’ Track 1, Track 2 and Track 3
‘8’ Track 1 and/ or Track 2
‘9’ Track 2 and/ or Track 3
This command requests card data information for the buffered mode.
The selected MSR data is sent to the host with or without envelope format,
according to the operation mode setting.
This command does not erase the data.
Response is as follows:
Other possible response statuses:
18 'Q' command length must be 1
18 Reader not configured for buffered mode
NAK Already armed
NAK for keyboard interface is FD, non-KB mode NAK is 15
7.7 Read MSR Options Command
02 52 1F 03 LRC
<Response> format:
The current setting data block is a collection of many function-setting blocks
<FuncSETBLOCK> as follows:
<STX><FuncSETBLOCK1>…<FuncSETBLOCKn><ETX><CheckSum>
Each function-setting block <FuncSETBLOCK> has the following format:
<FuncID><Len><FuncData>
Where:
<FuncID> is one byte identifying the setting(s) for the function.
<Len> is a one byte length count for the following function-setting block <FuncData>
<FuncData> is the current setting for this function. It has the same format as in the
sending command for this function.
<FuncSETBLOCK> are in the order of their Function ID<FuncID>
7.8 Set MSR Options Command
The default value is listed in bold.
7.8.1. Beep Volume
The beep volume and frequency can be each adjusted to two different levels, or
turned off.
02 53 11 01 <Beep Settings>03 LRC
Beep Settings:
‘0’ for beep volume off
‘1’ for beep volume high, low frequency
‘2’ for beep volume high, high frequency
‘3’ for beep volume low, high frequency‘4’ for beep volume low, low frequency
‘2’ Moving stripe along head in direction of encoding
‘3’ Moving stripe along head against direction of encoding
With the bi-directional method, the user can swipe the card in either direction and
still read the data encoded on the magnetic stripe. Otherwise, the card can only be
swiped in one specified direction to read the card. Raw Decoding just sends the
card’s magnetic data in groups of 4 bits per character. No checking is done except
to verify track has or does not have magnetic data.
7.8.5. Terminator Setting
Terminator characters are used to end a string of data in some applications.
02 53 21 01 <Terminator Settings> 03 LRC
<Terminator Settings>
Any one character, 00h is none; default is CR (0Dh).
7.8.6. Preamble Setting
Characters can be added to the beginning of a string of data. These can be special
characters for identifying a specific reading station, to format a message header
expected by the receiving host, or any other character string. Up to fifteen ASCII
characters can be defined.
02 53 D2 <Len><Preamble> 03 LRC
Where:
Len = the number of bytes of preamble string
Preamble = {string length}{string}
NOTE: String length is one byte, maximum fifteen <0Fh>.
7.8.7. Postamble Setting
The postamble serves the same purpose as the preamble, except it is added to the
end of the data string, after any terminator characters.
02 53 D3 <Len><Postamble> 03 LRC
Where:
Len = the number of bytes of postamble string
Postamble = {string length}{string}
NOTE: String length is one byte, maximum fifteen <0Fh>.
7.8.8. Track n Prefix Setting
Characters can be added to the beginning of a track data. These can be special
characters to identify the specific track to the receiving host, or any other
character string. Up to six ASCII characters can be defined.
02 53 <n><Len><Prefix> 03 LRC
Where:
n is 34h for track 1; 35h for track 2 and 36h for track 3
Len = the number of bytes of prefix string
Prefix = {string length}{string}
NOTE: String length is one byte, maximum six.
7.8.9. Track x Suffix Setting
Characters can be added to the end of track data. These can be special characters
to identify the specific track to the receiving host, or any other character string.
Up to six ASCII characters can be defined.
02 53 <n><Len><Suffix> 03 LRC
Where:
n is 37h for track 1; 38h for track 2 and 39h for track 3
Len = the number of bytes of suffix string
Suffix = {string length}{string}
NOTE: String length is one byte, maximum six.
7.8.10. Track Selection
There are up to three tracks of encoded data on a magnetic stripe.
This option selects the tracks that will be read and decoded.
02 53 13 01 <Track_Selection Settings> 03 LRC
<Track_Selection Settings>
‘0’ Any Track
‘1’ Require Track 1 Only
‘2’ Require Track 2 Only
‘3’ Require Track 1 & Track 2
‘4’ Require Track 3 Only
‘5’ Require Track 1 & Track 3
‘6’ Require Track 2 & Track 3
‘7’ Require All Three Tracks
‘8’ Any Track 1 & 2
‘9’ Any Track 2 & 3
Note: If any of the required multiple tracks fail to read for any reason, no data for
any track will be sent.
7.8.11. Track Separator Selection
This option allows the user to select the character to be used to separate data
decoded by a multiple-track reader.
02 53 17 01 <Track_Separator> 03 LRC
<Track_Separator> is one ASCII Character.
The default value is CR, 0h means no track separator.
7.8.12. Start/End Sentinel and Track 2 Account Number Only
The SecureMag can be set to either send, or not send, the Start/End sentinel, and
to send either the Track 2 account number only, or all the encoded data on Track
2. (The Track 2 account number setting doesn’t affect the output of Track 1 and
Track 3.)
02 53 19 01 <SendOption> 03 LRC
<SendOption>
‘0’Don’t send start/end sentinel and send all data on Track 2
‘1’ Send start/end sentinel and send all data on Track 2
‘2’Don’t send start/end sentinel and send account # on Track 2‘3’ Send start/end sentinel and send account number on Track 2
The reader features configurable security settings. Before encryption can be enabled, Key
Serial Number (KSN) and Base Derivation Key (BDK) must be loaded before encrypted
transactions can take place. The keys are to be injected by certified key injection facility.
There are five security levels available on the reader as specified in the followings:
Level 0
Security Level 0 is a special case where all DUKPT keys have been used and
is set automatically when it runs out of DUKPT keys. The lifetime of DUKPT
keys is 1 million. Once the key’s end of life time is reached, user should
inject DUKPT keys again before doing any more transactions.
Level 1
By default, readers from the factory are configured to have this security
level. There is no encryption process, no key serial number transmitted
with decoded data. The reader functions as a non-encrypting reader and
the decoded track data is sent out in default mode.
Level 2
Key Serial Number and Base Derivation Key have been injected but the
encryption process is not yet activated. The reader will send out decoded
track data in default format. Setting the encryption type to TDES and AES
will change the reader to security level 3.
Level 3
Both Key Serial Number and Base Derivation Keys are injected and
encryption mode is turned on. For payment cards, both encrypted data and
masked clear text data are sent out. Users can select the data masking of
the PAN area; the encrypted data format cannot be modified. Users can
choose whether to send hashed data and whether to reveal the card
expiration date.
Level 4
When the reader is at Security Level 4, a correctly executed
Authentication Sequence is required before the reader sends out data for a
card swipe. Commands that require security must be sent with a four byte
Message Authentication Code (MAC) at the end. Note that data supplied
to MAC algorithm should NOT be converted to ASCII-Hex, rather it
should be supplied in its raw binary form. Calculating MAC requires
knowledge of current DUKPT KSN, this could be retrieved using Get
Default reader properties are configured to have security level 1 (no encryption). In order
to output encrypted data, the reader has to be key injected with encryption feature
enabled. Once the reader has been configured to security level 2, 3 or 4, it cannot be
reverted back to a lower security level.
8.1 Encryption Management
The Encrypted swipe read supports TDES and AES encryption standards for
data encryption. Encryption can be turned on via a command. TDES is the
default.
If the reader is in security level 3, for the encrypted fields, the original data is
encrypted using the TDES/AES CBC mode with an Initialization Vector
starting at all binary zeroes and the Encryption Key associated with the current
DUKPT KSN.
8.2 Check Card Format
ISO/ABA (American Banking Association) Card (card type 0)
Encoding method
Track1 is 7 bits encoding.
Track1 is 7 bits encoding. Track2 is 5 bits encoding. Track3 is 5 bits
encoding.
Track1 is 7 bits encoding. Track2 is 5 bits encoding.
Track2 is 5 bits encoding.
Additional check
Track1 2nd byte is ‘B’.
There is only one ‘=’ in track 2 and the position of ‘=’ is between 13
th
~ 20th character so account number length is 12-19 digits.
Total length of track 2 is above 19 characters.
AAMVA (American Association of Motor Vehicle Administration) Card
Encoding method
Track1 is 7 bits encoding. Track2 is 5 bits encoding. Track3 is 7 bits
encoding.
Others (Customer card)
8.3 MSR Data Masking
For ABA Card Data (Card Type 0)
For cards need to be encrypted, both encrypted data and clear text data are sent.
Masked Area
The data format of each masked track is ASCII.
The clear data include start and end sentinels, separators, first N, last M
digits of the PAN, card holder name (for Track1).
The rest of the characters should be masked using mask character.
Set PrePANClrData (N), PostPANClrData (M), MaskChar (Mask Character)
N and M are configurable and default to 4 first and 4 last digits. They
follow the current PCI constraints requirements (N 6, M 4 maximum).
Mask character default value is ‘*’.
Set PrePANClrDataID (N), parameter range 00h ~ 06h, default value 04h
Set PostPANClrDataID (M), parameter range 00h ~ 04h, default value 04h
MaskCharID (Mask Character), parameter range 20h ~ 7Eh, default value
2Ah
DisplayExpirationDataID, parameter range ‘0’~’1’, default value ‘0’
The demo software allows users to manually input and send commands to the device.
Type the <Command Data> in the field, and the command will be sent
Command will be sent out in the following structure:
<STX> <Command_Data> <ETX> <LRC>
where:
<STX> = 02h, <ETX> = 03h.
<Command_Data> : Please refer to Appendix A for a complete list of commands
<LRC> is a one byte Xor value calculated for the above data block from <STX> to
<ETX>.
eg. 02 53 18 03 4A (Set Default Configuration)
eg. 02 52 22 03 71 (Read Firmware Version)
Press “Send Command”, the input and output would be shown in the lower text box.
The encrypted data will show in the Manual Command / Encrypted Data textbox after a
card is swiped. By default, the cursor is in Manual Command / Encrypted Data textbox
To get the decrypted data, press the “Decrypt” button and the decrypted card data will be
displayed in the lower box.
The default initial key is 0123456789ABCDEFFEDCBA9876543210. If the reader is
programmed with a user-defined key, load the same key to the demo software by pressing
the “Input Initial Key” button. Type the initial key in the box, and press OK when
finished.
The demo software can be used to display the card data and send reader commands. To
view the card data on screen, place the cursor in the “manual command/ reader output”
text box and swipe the card. To send a reader command, type the appropriate command
in the text box and press the “Send Command” button.
General Setting
Provide options such as reader default settings, firmware version, beeper options, and
buffered mode options. For USB demo software, there are options to set the reader to
USB KB or USB HID mode.
MSR Security
The security is enabled by selecting TDES or AES. Once the encryption is enabled the
reader cannot be changed back to non-encrypted mode.
Port/ Settings
RS232 interface: select Com port and open/ close port.
USB KB interface: set KB polling interval and select language settings
Help
Provides version information of the demo software.
The USB version of the reader can be operated in two different modes:
- HID ID TECH mode (herein referred to as “HID mode”), Product ID: 2010
- HID with Keyboard Emulation (herein referred to as “KB mode”), Product ID: 2030
When the reader is operated in the HID mode, it behaves like a vendor defined HID
device. A direct communication path can be established between the host application and
the reader without interference from other HID devices.
10.1 Level 1 and level 2 Standard Mode Data Output Format
USB HID Output Format
Card data is only sent to the host on the Interrupt In pipe using an Input Report. The reader
will send only one Input Report per card swipe. If the host requests data from the reader
when no data is available, the reader will send a NAK to the host to indicate that it has
nothing to send.
Offset Usage Name .
0 T1 decode status
1 T2 decode status
2 T3 decode status
3 T1 data length
4 T2 data length
5 T3 data length
6 Card encode type
7-116 T1 data
117-226 T2 data
227-336 T3 data
Notes:
T1, T2 or T3 decode status: 0 for no error, 1 for error
T1, T2 or T3 Data Length: Each byte value indicates how many bytes of
decoded card data are in the track data field. This value will be zero if
there was no data on the track or if there was an error decoding the track.
Card Encode Type:
Value Encode Type Description
0 ISO/ABA ISO/ABA encode format
1 AAMVA AAMVA encode format
3 Other The card has a non-standard format. For
example, ISO/ABA track 1 format on track 2
4 Raw The card data is sent in Raw encrypted
format. All tracks are encrypted and no mask data is sent
T1, T2 or T3 data: The length of each track data field is fixed at 110 bytes, but
the length of valid data in each field is determined by the track data length field
that corresponds to the track number. The track data includes all data string
starting with the start sentinel and ending with the end sentinel.
ID TECH Reader Data Structure
Offset Usage Name .
0 T1 decode status
1 T2 decode status
2 T3 decode status
3 T1 data length
4 T2 data length
5 T3 data length
6 Card encode type
HID ID TECH Structure
HID Other Structure
HID Keyboard
BCD Device Release
00 01
i-Manufacture
01 i-Product
02 i-Serial-Number
00 # Configuration
01
Field
Value
Description
Length
09 Des type
02 Total Length
22 00
No. Interface
01 Configuration Value
01 iConfiguration
00 Attributes
80
Bus power, no remove wakeup
Power
32
100 mA
7,8 Total Output Length
9-HIDSIZE* Output Data
In this approach, the reader will keep all of the ID TECH data editing and
other features like preamble, postamble, etc. The output data is HIDSIZE*
bytes; the "Total Output Length" field indicates the valid data length in the
output data
Note*: HIDSIZE (560 bytes as described in USB enumeration. HIDSIZE is
subject to change. Software should auto adjust in case enumeration changes)
The data format is independent with MSR setting. No Track x data if track x
sampling data does not exist.
OPOS header:
Only HID KB interface has [Right Shift, Left Shift, Right Ctrl, Left Ctrl] under
POS mode.
Read Error:
Read Error 1 byte bits:
MB LB
B0 1: Track 1 sampling data exists (0: Track 1 sampling data does not exist)
B1 1: Track 2 sampling data exists (0: Track 2 sampling data does not exist)
B2 1: Track 3 sampling data exists (0: Track 3 sampling data does not exist)
B3 1: Track 1 decode success (0: Track 1 decode fail)
B4 1: Track 2 decode success (0: Track 2 decode fail)
B5 1: Track 3 decode success (0: Track 3 decode fail)
B6 0: if b0 to b5 are all 1, otherwise 1 (make it printable)
Read Error byte 2:
MB LB
B7 1: Track 4 sampling data exists (0: Track 4 sampling data does not exist)
B8 1: Track 4 JIS II decode success (0: Track4 JIS II decode fail)
B9, B10, B11
000: ISO Card (7, 5) or (7, 5, 5) encoding
001: Old CADL Card (6, 5, 6) encoding (no longer included)
010: AAMVA Card (7, 5, 7) encoding
011: JIS I Card (8, 5, 8) encoding
100: JIS II card (8) or ISO+JIS II
110: OPOS Raw Data Output
111: JIS I + JIS II
B12 Reserved for future use
Decode flag will set to 1 (B3, B4 and B5 all set to 1) in OPOS raw data mode.
Track ID
Track ID is a byte of ID, it will be '1', '2' and '3' for track 1, 2 and 3; it is not
accurate to use start sentinel to identify track.
Track x Error
Track x error is a byte of flags, it will be in format of: 0 0 1 b4, b3, b2 b1 b0
b0 1: Start sentinel error (0: Not start sentinel error)
b1 1: End sentinel error (0: Not end sentinel error)
b2 1: Parity error (0: Not parity error)
b3 1: LRC error (0: Not LRC error)
b4 1: Other error (0: Not other error)
Track x Error is set to 0x20 in OPOS raw data mode.
Track Length
Assume actual "Track x Data Length" is hex code xy; the Track x data length for
OPOS mode output will be hex code 3x, 3y.
Track x data length does not include the byte of "Track x data LRC", it is <30>
<30> in case of read error on track x.
Track Data
“Card Track x LRC code” is track x card data.
Track x LRC
“Track x data LRC” is a LRC to check track x data communication; XOR all
characters start from "Track x ID" to “Track x data LRC” should be 0.
For ISO cards, both masked clear and encrypted data are sent, no clear data will
be sent.
For other cards, only clear data is sent.
A card swipe returns the following data:
Card data is sent out in format of
<STX><LenL><LenH><Card Data><CheckLRC><CheckSum><ETX>
<STX> = 02h, <ETX> = 03h
<LenL><LenH> is a two byte length of <Card Data>.
<CheckLRC> is a one byte Exclusive-OR sum calculated for all <Card Data>.
<CheckSum> is a one byte Sum value calculated for all <Card data>.
<Card Data> card data format is shown below.
ISO/ABA Data Output Format:
card encoding type (0: ISO/ABA, 4: for Raw Mode)
track status (bit 0,1,2:T1,2,3 decode, bit
3,4,5:T1,2,3 sampling)
track 1 unencrypted length (1 byte, 0 for no track1 data)
track 2 unencrypted length (1 byte, 0 for no track2 data)
track 3 unencrypted length (1 byte, 0 for no track3 data)
track 1 masked (Omitted if in Raw mode)
track 2 masked (Omitted if in Raw mode)
track 3 data (Omitted if in Raw mode)
track 1,2 encrypted (AES/TDES encrypted data)
track 1 hashed (20 bytes SHA1-Xor)
track 2 hashed (20 bytes SHA1-Xor)
DUKPT serial number (10 bytes)
Non ISO/ABA Data Output Format
card encoding type (1: AAMVA, 3: Others)
track status (bit 0,1,2:T1,2,3 decode, bit
3,4,5:T1,2,3 sampling)
track 1 unencrypted data length (1 byte, 0 for no track1 data)
track 2 unencrypted data length (1 byte, 0 for no track2 data)
track 3 unencrypted data length (1 byte, 0 for no track3 data)
track 1 data
track 2 data
track 3 data
For ISO card, both clear and encrypted data are sent. For other card, only clear
data are sent.
A card swipe returns the following data:
Card data is sent out in format of
<STX><LenL><LenH><Card Data><CheckLRC><CheckSum><ETX>
<STX> = 02h, <ETX> = 03h
<LenL><LenH> is a two byte length of <Card Data>.
<CheckLRC> is a one byte Exclusive-OR sum calculated for all <Card Data>.
<CheckSum> is a one byte Sum value calculated for all <Card data>.
<Card Data> format is
ISO/ABA Data Output Format:
card encoding type (0: ISO/ABA, 4: for Raw Mode)
track status (bit 0,1,2:T1,2,3 decode, bit
3,4,5:T1,2,3 sampling)
track 1 unencrypted length (1 byte, 0 for no track1 data)
track 2 unencrypted length (1 byte, 0 for no track2 data)
track 3 unencrypted length (1 byte, 0 for no track3 data)
if card encoding type high bit set
■ mask and clear sent track status
■ encrypt and hash sent track status
In this mode tracks are encrypted separately rather than as a group
track 1 masked (Omitted if in Raw mode)
track 2 masked (Omitted if in Raw mode)
track 3 data (Omitted if in Raw mode)
track 1&2 encrypted (AES/TDES encrypted data)
sessionID encrypted (AES/TDES encrypted data)
track 1 hashed (20 bytes SHA1-Xor)
track 2 hashed (20 bytes SHA1-Xor)
track 3 hashed (optional) (20 bytes SHA1-Xor)
DUKPT serial number (10 bytes)
Non ISO/ABA Data Output Format:
card encoding type (1: AAMVA, 3: Others)
track status (bit 0,1,2:T1,2,3 decode, bit
3,4,5:T1,2,3 sampling)
track 1 length (1 byte, 0 for no track1 data)
track 2 length (1 byte, 0 for no track2 data)
track 3 length (1 byte, 0 for no track3 data)
track 1 data
This mode is used when all tracks must be encrypted, or encrypted OPOS support is
required, or when the tracks must be encrypted separately or when cards other than type 0
(ABA bank cards) must be encrypted or when track 3 must be encrypted. This format is
the standard encryption format, but not yet the default encryption format.
1. Encryption Output Format Setting:
Command: 53 85 01 <Encryption Format>
Encryption Format:
‘30h’: Original Encryption Format
‘31h’: Enhanced Encryption Format
2. Encryption Option Setting: (for enhanced encryption format only)
Command: 53 84 01 <Encryption Option>
Encryption Option: (default 08h)
bit0: 1 – track 1 force encrypt
bit1: 1 – track 2 force encrypt
bit2: 1 – track 3 force encrypt
bit3: 1 – track 3 force encrypt when card type is 0
bit4: 1 – new mask feature: see note 4) below
Note:
1) When force encrypt is set, this track will always be encrypted, regardless of
card type. No clear/mask text will be sent.
2) If and only if in enhanced encryption format, each track is encrypted
separately. Encrypted data length will round up to 8 or 16 bytes.
3) When force encrypt is not set, the data will be encrypted in original
encryption format, that is, only track 1 and track 2 of type 0 cards (ABA bank
cards) will be encrypted.
4) When new mask feature (bit 4) is set
a) Mask data can be sent even if set to “force encrypt” (bit0-3 is set);
b) If bank card and track 3 is ISO-4909 with PAN format, T3 will be
encrypted and has mask data.
Typical settings:
1) 08 (default):
Bank card: All three tracks will be encrypted. Only T1 and T2 can have
Force encryption. All three tracks will be encrypted without mask,
regardless of card type.
3) 10
Bank card: T1 and T2 will be encrypted. If the T3 is with ISO-4909
format, it’ll be encrypted and its mask data will be sent out. Otherwise, T3
will be sent in clear text.
Non-bank card: Will be sent in clear text.
4) 17
Bank card: All three tracks will be encrypted. T3 will allow to send mask
if it’s ISO-4909 format
Non-bank card: Will be encrypted without mask.
3. Hash Option Setting:
Command: 53 5C 01 <Hash Option>
Hash Option: (‘0’ – ‘7’)
Bit0: 1 – track1 hash will be sent if data is encrypted
Bit1: 1 – track2 hash will be sent if data is encrypted
Bit2: 1 – track3 hash will be sent if data is encrypted
4. Mask Option Setting: (for enhanced encryption format only)
Command: 53 86 01 <Mask Option>
Mask Option: (Default: 0x07)
bit0: 1 – tk1 mask data allow to send when encrypted
bit1: 1 – tk2 mask data allow to send when encrypted
bit2: 1 – tk3 mask data allow to send when encrypted
When mask option bit is set – if data is encrypted (but not forced encrypted),
the mask data will be sent; If mask option is not set, the mask data will not be sent
under the same condition.
Settings for OPOS:
1. Assume reader is under default setting (Encrypt Structure 0)
The OPOS driver/application may also send following command when change
(Decode/Raw format)
(Set raw or decode data format)
53 1D 01 30 // RAW data format
53 1D 01 31 // Decoded format
Card data is sent out in the following format
<STX><LenL><LenH><Card Data><CheckLRC><CheckSum><ETX>
Where <STX> = 02h, <ETX> = 03h
<LenL><LenH> is a two byte length of <Card Data>.
<CheckLRC> is a one byte Exclusive-OR sum calculated for all <Card Data>.
<CheckSum> is a one byte Sum value calculated for all <Card data>.
<Card Data> card data format is shown below.
ISO/ABA Data Output Format:
0 STX
1 Data Length low byte
2 Data Length high byte
3 Card Encode Type
1
4 Track 1-3 Status2
5 Track 1 unencrypted data length
6 Track 2 unencrypted data length
7 Track 3 unencrypted data length
8 Clear/masked data sent status 3
9 Encrypted/Hash data sent status
4
10 Track 1 clear/mask data
Track 2 clear/mask data
Track 3 clear/mask data
Track 1 encrypted data
Track 2 encrypted data
Track 3 encrypted data
Session ID (8 bytes) (Security level 4 only)
Track 1 hashed (20 bytes each) (if encrypted and hash track 1
allowed)
Track 2 hashed (20 bytes each) (if encrypted and hash track 2
allowed)
Track 3 hashed (20 bytes each) (if encrypted and hash track 3
allowed)
KSN (10 bytes)
CheckLRC
0 STX
1 Data Length low byte
2 Data Length high byte
3 Card Encode Type*
4 Track 1-3 Status
5 T1 unencrypted data length
6 T2 unencrypted data length
7 T3 unencrypted data length
8 Clear/mask data sent status *
9 Encrypted/Hash data sent status *
10 T1 clear data
T2 clear data
T3 clear data
CheckLrc
CheckSum
ETX
Note 1: Card Encode Type
Card Type will be 8x for enhanced encryption format and 0x for original
encryption format
Value Encode Type Description
00h / 80h ISO/ABA format
01h / 81h AAMVA format
03h / 83h Other
04h / 84h Raw; un-decoded format
For Type 04 or 84 Raw data format, all tracks are encrypted and no mask
data is sent. No track indicator ‘01’, ‘02’ or ‘03’ in front of each track.
Track indicator ‘01’,’02’ and ‘03’ will still exist for non-encrypted mode.
Note 2: Track 1-3 status byte
Field 4:
Bit 0: 1— track 1 decoded data present
Bit 1: 1— track 2 decoded data present
Bit 2: 1— track 3 decoded data present
Bit 3: 1— track 1 sampling data present
Bit 4: 1— track 2 sampling data present
Bit 5: 1— track 3 sampling data present
Bit 6, 7 — Reserved for future use
Field 8 (Clear/mask data sent status) and field 9 (Encrypted/Hash data sent
status) will only be sent out in enhanced encryption format.
Field 8: Clear/masked data sent status byte:
Bit 0: 1 —track 1 clear/mask data present
Bit 1: 1— track 2 clear/mask data present
Bit 2: 1— track 3 clear/mask data present
Bit 3: 0— reserved for future use
Bit 4: 0— reserved for future use
Bit 5: 0— reserved for future use
Note 4: Encrypted/Hash data sent status
Field 9: Encrypted data sent status
Bit 0: 1— track 1 encrypted data present
Bit 1: 1— track 2 encrypted data present
Bit 2: 1— track 3 encrypted data present
Bit 3: 1— track 1 hash data present
Bit 4: 1— track 2 hash data present
Bit 5: 1— track 3 hash data present
Bit 6: 1—session ID present
Bit 7: 1—KSN present
10.6 Additional Description
Except for USBKB and PS2 interfaces, track formatting (preamble, prefix,
separator, etc.) is not supported in a reader set to send encrypted track data. The
track data is always sent in the same format that is with no special formatting so
that the program doing the decoding can know where is data field is located. For
USBKB and PS2 interfaces, preamble and postamble will be available in the
encrypted track data
T1, T2 or T3 Data Length: Each byte value indicates how many bytes of decoded
card data are in the track data field. This value will be zero if there was no data on
the track or if there was an error decoding the track.
The hashed data may optionally be omitted, and also track 3 may be hashed and
included.
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.
Track Status (bit0, 1,2: T1,2,3 decode; bit 3,4,5: T1,2,3 sampling)
Sampling
Decoding
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Track 1 Empty
0
1
Track 2 Empty
0 1
Track 3 Empty
0 1
Track 1 Decoded
1
1
Track 2 Decoded
1 1
Track 3 Decoded
1 1
Track 1 Fail To
Decode
1
0
Track 2 Fail To
Decode
1 0
Track 3 Fail To
Decode
1 0
Track 1, 2 and 3 hashed
SecureMag reader uses SHA-1 to generate hashed data for both track 1, track 2
and track 3 unencrypted data. It is 20 bytes long for each track. This is provided
with two purposes in mind: One is for the host to ensure data integrity by
comparing this field with a SHA-1 hash of the decrypted Track data, prevent
unexpected noise in data transmission. The other purpose is to enable the host to
store a token of card data for future use without keeping the sensitive card holder
data. This token may be used for comparison with the stored hash data to
determine if they are from the same card.
Some Additional notes:
1. Track status byte is defined as the following
2. Please be aware that track status byte in secured output is different from
track status bytes in OPOS head (called read error1 and read error2).
OPOS header will only be used in OPOS mode security level 1 and
level 2 and secure output only used in level 3 or level 4.
3. For USB HID Secure Output, the output format is same as Secure
Output structure. No HID header is added. But the total length is the
HIDSIZE (560 bytes as described in USB enumeration. HIDSIZE is
subject to change. Software should auto adjust in case enumeration
changes). Unused bytes will be filled with 0x00. This applied to secure
Level 3 and Level 4 output, whether or not the data is encrypted.
4. Examples for field 8 (Clear/mask data sent status) and field 9
(Encrypted/Hash data sent status)
These two bytes are omitted in original structure. In the enhanced
encrypt structure, these two byte are used to indicate the presence of
each track’s Clear or Masked data, Encrypted data and hash data.
Example :
field 8 = 0x03 (00000011)
field 9 = 0xBF (10111111)
T1: Mask data present; Encrypted data present; Hash present
T2: Mask data present; Encrypted data present; Hash present
T3: No Mask data; Encrypted data present; Hash present
KSN: present
Session ID: not present
Additional Settings
Send LRC in secured mode (6F)
53 6F 01 31 // to send LRC in secure mode (Default)
53 6F 01 30 // Remove LRC in secure mode
Display Expiration Data (50)
53 50 01 30 // Do not display Expiration Date (Exp date Masked)
(Default)
53 50 01 31 // Display Expiration Data
Reader Serial Number (4E)
The serial number will be set to the same as S/N in unit’s label. The length
is 8 to 10 characters. User can read out the S/N with 52 4E command.
10.7 Decryption Example
Key for all examples is
0123456789ABCDEFFEDCBA9876543210
10.7.1. Security Level 3 Decryption - Original Encryption Format
Decryption of a three track ABA card with the original encryption format.
SecureMag Reader with default settings
Original encryption format can be recognized because the high bit of the fourth byte
underlined (00) is 0.
The above broken down and interpreted
02—STX character
7D—low byte of total length
01—high byte of total length
00—card type byte (interpretation old format ABA card)
3F—3 tracks of data all good
48—track 1 clear/mask data length
23—track 2 clear/mask data length
6B— track 3 clear/mask data length
Track 1 data masked (length 0x48)
252A343236362A2A2A2A2A2A2A2A393939395E42555348204A522F47454F5247452
0572E4D525E2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2A2
A2A2A2A2A2A2A3F2A
Track 2 data in hex masked (length 0x23)
3B343236362A2A2A2A2A2A2A2A393939393D2A2A2A2A2A2A2A2A2A2A2A2A2
A2A2A3F2A
Track 3 data unencrypted (length 0x6B)
3B333333333333333333333736373637363037303730373736373637363333333333333
333333337363736373630373037303737363736373633333333333333333333373637363
73630373037303737363736373633333333333333333333373637363736303730373F32
Track 1 & 2 encrypted length 0x48+0x23 rounded up to 8 bytes =0x6B -> 0x70 (112
decimal)
863E9E3DA28E455B28F7736B77E47A64EDDA3BF03A06E44F31D1818C0BCD7A3
53FB1AD70EFD30FFC3DA08A4FBC9372E57E8B40848BAEAA3FE724B3550E2F4B
Masked Data:
Track 1 data masked in ASCII:
%*4266********9999^BUSH JR/GEORGE
W.MR^*******************************?*
Track 2 data masked in ASCII:
;4266********9999=***************?*
Track 3 data unencrypted in ASCII:
;33333333337676760707077676763333333333767676070707767676333333333376767
607070776767633333333337676760707?2
Decrypted Data in ASCII:
%B4266841088889999^BUSH JR/GEORGE
W.MR^0809101100001100000000046000000?!;4266841088889999=080910110000046
?0
;33333333337676760707077676763333333333767676070707767676333333333376767
607070776767633333333337676760707?2
Decrypted Data in Hex:
2542343236363834313038383838393939395E42555348204A522F47454F52474520572
E4D525E303830393130313130303030313130303030303030303034363030303030303F
213B343236363834313038383838393939393D3038303931303131303030303034363F3
00000000000
Key Value: 8A 92 F6 74 00 BF 25 2E 57 9A A9 01 FF 27 48 41
KSN: 62 99 49 01 19 00 00 00 00 04
Session ID: AA AA AA AA AA AA AA AA
Decrypted Data in ASCII:
%B4266841088889999^BUSH JR/GEORGE
W.MR^0809101100001100000000046000000?!;4266841088889999=080910110000046
?0
;33333333337676760707077676763333333333767676070707767676333333333376767
607070776767633333333337676760707?2
Decrypted Data in Hex:
2542343236363834313038383838393939395E42555348204A522F47454F52474520572
E4D525E303830393130313130303030313130303030303030303034363030303030303F
213B343236363834313038383838393939393D3038303931303131303030303034363F3
0AAAAAAAAAAAAAAAA0000000000
10.7.3. Security Level 3 Decryption - Enhanced Encryption Format
Example of decryption of a three track ABA card with the enhanced encryption format.
The above broken down and interpreted
02—STX character
98—low byte of total length
01—high byte of total length
80—card type byte (interpretation new format ABA card)
3F—3 tracks of data all good
48—length of track 1
23—length of track 2
6B—length of track 3
03—tracks 1 and 2 have masked/clear data
BF—bit 7=1—KSN included
Bit 6=0—no Session ID included so not level 4 encryption
Bit 5=1—track 3 hash data present
Bit 4=1—track 2 hash data present
Bit 3-1—track 1 hash data present
Bit 2=1—track 3 encrypted data present
Bit 1=1—track 2 encrypted data present
Bit 0=1—track 1 encrypted data present
Track 1 decrypted data in hex including padding zeros (but there are no pad bytes here)
2542343236363834313038383838393939395E42555348204A522F47454F52474520572
E4D525E303830393130313130303030313130303030303030303034363030303030303F
21
Track 2 decrypted data in hex including padding zeros
3B343236363834313038383838393939393D3038303931303131303030303034363F300
000000000
Track 3 decrypted data in hex including padding zeros
3B333333333333333333333736373637363037303730373736373637363333333333333
333333337363736373630373037303737363736373633333333333333333333373637363
73630373037303737363736373633333333333333333333373637363736303730373F32
0000000000
10.7.4. Security Level 4 Decryption – Enhanced Encryption Format
Key Value: 89 52 50 33 61 75 51 5C 41 20 CF 45 F4 1A BF 1C
KSN: 62 99 49 01 19 00 00 00 00 03
Session ID: AA AA AA AA AA AA AA AA
Decrypted Data in ASCII:
%B4266841088889999^BUSH JR/GEORGE
W.MR^0809101100001100000000046000000?!
;4266841088889999=080910110000046?0
;33333333337676760707077676763333333333767676070707767676333333333376767
607070776767633333333337676760707?2
Decrypted Data in Hex:
2542343236363834313038383838393939395E42555348204A522F47454F52474520572
E4D525E303830393130313130303030313130303030303030303034363030303030303F
213B343236363834313038383838393939393D3038303931303131303030303034363F3
000000000003B3333333333333333333337363736373630373037303737363736373633
333333333333333333373637363736303730373037373637363736333333333333333333
333736373637363037303730373736373637363333333333333333333337363736373630
3730373F320000000000
10.8 Level 4 Activate Authentication Sequence
The security level changes from 3 to 4 when the device enters authentication mode
successfully. Once the security level is changed to level 3 or 4, it cannot go back to a
lower level.
Activate Authentication Mode Command
When the reader is in security level 4, it would only transmit the card data when it is
in Authenticated Mode.
When sending the authentication request, the user also needs to specify a time limit
for the reader to wait for the activation challenge reply command. The minimum
timeout duration required is 120 seconds. If the specified time is less than the
minimum, 120 seconds would be used for timeout duration. The maximum time
allowed is 3600 seconds (one hour). If the reader times out while waiting for the
activation challenge reply, the authentication failed.
Device Response
When authentication mode is requested, the device responds with two challenges:
Challenge 1 and challenge 2. The challenges are encrypted using the current DUKPT
key exclusive- or’ed with <F0F0 F0F0 F0F0 F0F0 F0F0 F0F0 F0F0 F0F0>.
The decrypted challenge 1 contains 6 bytes of random number followed by the last
two bytes of KSN. The two bytes of KSN may be compared with the last two bytes of
the clear text KSN sent in the message to authenticate the reader. The user should
complete the Activate Authentication sequence using Activation Challenge Reply
command.
Command Structure
Host -> Device:
<STX><R><80h><02h><Pre-Authentication Time Limit><ETX><LRC>
Pre-Authentication Time Limit: 2 bytes of time in seconds
Device Response Data: 26 bytes data, consists of <Current Key Serial Number>
<Challenge 1> <Challenge 2>
Current Key Serial Number: 10 bytes data with Initial Key Serial Number in the
leftmost 59 bits and Encryption Counter in the rightmost 21 bits.
Challenge 1: 8 bytes challenge used to activate authentication. Encrypted using the
key derived from the current DUKPT key.
Challenge 2: 8 bytes challenge used to deactivate authentication. Encrypted using the
key derived from the current DUKPT key.
Activation Challenge Reply Command
This command serves as the second part of an Activate Authentication sequence. The
host sends the first 6 bytes of Challenge 1 from the response of Activate
Authenticated Mode command, two bytes of Authenticated mode timeout duration,
and eight bytes Session ID encrypted with the result of current DUKPT Key
exclusive- or’ed with <3C3C 3C3C 3C3C 3C3C 3C3C 3C3C 3C3C 3C3C>.
The Authenticated mode timeout duration specifies the maximum time in seconds
which the reader would remain in Authenticated Mode. A value of zero forces the
reader to stay in Authenticated Mode until a card swipe or power down occurs. The
minimum timeout duration required is 120 seconds. If the specified time is less than
the minimum, 120 seconds would be used for timeout duration. The maximum time
allowed is 3600 seconds (one hour).
If Session ID information is included and the command is successful, the Session ID
will be changed.
The Activate Authenticated Mode succeeds if the device decrypts Challenge Reply
response correctly. If the device cannot decrypt Challenge Reply command, Activate
Authenticated Mode fails and DUKPT KSN advances.
Activation Data: 8 or 16 bytes, structured as <Challenge 1 Response> <Session ID>
Challenge 1 Response: 6 bytes of Challenge 1 random data with 2 bytes of
Authenticated mode timeout duration. It’s encrypted using the key derived from the
current DUKPT key.
Session ID: Optional 8 bytes Session ID, encrypted using the key derived from the
current DUKPT key.
Deactivate Authenticated Mode Command
This command is used to exit Authenticated Mode. Host needs to send the first 7
bytes of Challenge 2 (from the response of Activate Authenticated Mode command)
and the Increment Flag (0x00 indicates no increment, 0x01 indicates increment of the
KSN) encrypted with current DUKPT Key exclusive- or’ed with <3C3C 3C3C 3C3C
3C3C 3C3C 3C3C 3C3C 3C3C>.
If device decrypts Challenge 2 successfully, the device will exit Authenticated Mode.
The KSN will increase if the Increment flag is set to 0x01. If device cannot decrypt
Challenge 2 successfully, it will stay in Authenticated Mode until timeout occurs or
when customer swipes a card.
The KSN is incremented every time the authenticated mode is exited by timeout or
card swipe action. When the authenticated mode is exited by Deactivate
<Deactivation data>: 8-bytes response to Challenge 2. It contains 7 bytes of
Challenge 2 with 1 byte of Increment Flag, encrypted by the specified variant of
current DUKPT Key
0x01: Authentication Mode was activated successfully. The reader processed a
valid Activation Challenge Reply command.
0x02: The reader receives a good card swipe.
0x03: The reader receives a bad card swipe or the card is invalid.
0x04: Authentication Activation Failed.
0x05: Authentication Deactivation Failed.
0x06: Authentication Activation Timed Out. The Host fails to send an Activation
Challenge Reply command within the time specified in the Activate
Authentication Mode command.
0x07: Swipe Timed Out. The user fails to swipe a card within the time specified
in the Activation Challenge Reply command
any character supported
except 00 which means
none.
SendOptionID
19
Send Option
‘1’ (‘0’~0x3F)
Sentinel and Account
number control
Sentinel and Account
number control
0x30 - Not send start/end
sentinel and send all data on
Track 2, not error
notification. Control Key
Output.
0x31 - Send start/end
sentinel and send all data on
Track 2, not send error
notification. Control Key
Output.
0x32 - Not send start/end
sentinel and only send
account number on Track 2,
not send error notification.
Control Key Output.
0x33 - Send start/end
sentinel and only send
account number on Track 2,
not send error notification.
Control Key Output.
0x34 - Not send start/end
sentinel and send all data
on Track 2, send error
notification(default).
Control Key Output.
0x35 - Send start/end
sentinel and send all data on
Track 2, send error
notification. Control Key
Output.
0x36 - Not send start/end
sentinel and only send
account number on Track 2,
send error notification.
Control Key Output.
0x37 - Send start/end
sentinel and only send
account number on Track 2,
send error notification.
Control Key Output.
0x38 - Not send start/end
sentinel and send all data on
Track 2, not error
notification. Alt Key Output.
0x39 - Send start/end
sentinel and send all data on
Track 2, not send error
notification. Alt Key Output.
0x3a - Not send start/end
sentinel and only send
account number on Track 2,
not send error notification.
Alt Key Output.
0x3b - Send start/end
sentinel and only send
account number on Track 2,
not send error notification.
Alt Key Output.
0x3c - Not send start/end
sentinel and send all data on
Track 2, send error
notification(default). Alt
Key Output.
0x3d - Send start/end
sentinel and send all data on
Track 2, send error
notification. Alt Key Output.
0x3e - Not send start/end
sentinel and only send
account number on Track 2,
send error notification. Alt
Key Output.
0x3f - Send start/end sentinel
and only send account
number on Track 2, send
error notification. Alt Key
Output.
Note not all function ID are present in different hardware version of the SecureMag the
last column above has some codes:
‘-‘ feature not currently supported; exists for compatibility
‘s’ feature available on in the RS232 serial version of the reader
‘u’ feature available only in the USB version;
‘k’ feature available on in the keyboard version
‘p’ feature available only in the SPI version
‘r’ reset all does not affect this value
‘n’ not directly settable
‘d’ feature only for reader with data editing feature
‘e’ feature only for reader with encrypt feature
‘i’ feature ignored for encrypted transactions
Most function ID settings that relate to the content of formatting of the track output do
not work in secure mode. Exceptions to this are Preamble and Postamble in keyboard
mode only.
It is currently not possible to mix security with OPOS and JPOS support.
Appendix B Key Code Table in USB Keyboard Interface
For most characters, "Shift On" and "Without Shift" will be reverse if Caps Lock is on.
Firmware needs to check current Caps Lock status before sending out data.
For Function code B1 to BA, if "Num Lock" is not set, then set it and clear it after
finishing sending out code.
For Function code BB to C2, C9 to CC, if "Num Lock" is set then clear it and set it after
finishing sending out code.