Osdp - V2 1 - 5 - 2014
Osdp - V2 1 - 5 - 2014
Version 2.1.5
Communication Protocol for Peripheral Devices
with Data Security Extension
Copyright 2012
Security Industry Association
September 2012
Open Supervised Device Protocol (OSDPv2.1.5)
Foreword
This document, OSDPv2.1.5, is maintained by the SIA Standards Access Control and Identity
Subcommittee. As with many specifications, SIA anticipates that there may be questions,
interpretations, and extensions that may arise when using this specification. Please send all
correspondence of this nature to [email protected]. This address will be monitored by SIA staff and
all correspondence will be forwarded to the attention of the SIA Standards Access Control and
Identity Subcommittee.
The OSDP Specification Appendix E, contains the Behavior Profile 1: Transparent Smartcard Interface
Support Operations. The profile, located in Appendix E of the specification summarizes a means to
interact with a reader device. SIA is not responsible for rights clearance and recommends that all
users of the OSDP Specification consider any applicable third party intellectual property rights in
connection with implementations that wish to utilize messaging with third party reader devices.
Specifically, the OSDP Specifications address a mechanism for passing messages (APDUs) between
authentication software and a smartcard transparently, without reader support. This mechanism is
intended to support FICAM compliant authentication, which may be subject to the following U.S.
patents, among other intellectual property rights.
1. United States, 6575360, Device and method for personalizing chip cards; and
2. United States, 7853789, Method and system for establishing a communications pipe between
a personal security device and a remote computer system
SIA takes no position concerning the evidence, validity and scope of these patent rights, but does
recommend that all users of the OSDP Specifications respect the intellectual property rights of third
party rights holders. Regarding the U.S. patents noted above, the holders of these patent rights
have indicated, as of the date of this draft, that licenses under the foregoing U.S. patents are
available pursuant to fair, reasonable and non-discriminatory (FRAND) terms and conditions with
applications throughout the world. SIA has been provided the following information for those entities
wishing to contact these patent rights holders for a license.
Table of Contents
1 Introduction ........................................................................................................ 1
Communication Settings ............................................................................................. 1
2.1 Physical Interface .......................................................................................... 1
2.2 Signaling ...................................................................................................... 1
2.3 Character Encoding........................................................................................ 1
2.4 Channel Access ............................................................................................. 1
2.5 Multi-byte Data Encoding................................................................................ 1
2.6 Packet Size Limits.......................................................................................... 1
2.7 Timing ......................................................................................................... 2
2.8 Message Synchronization ................................................................................ 2
Packet Format ........................................................................................................... 2
3.1 SOM – Start of Message ................................................................................. 3
3.2 ADDR – Address ............................................................................................ 3
3.3 LEN – Length ................................................................................................ 3
3.4 CTRL - Control .............................................................................................. 3
3.5 Security Block ............................................................................................... 4
3.6 CMND/REPLY - Command/Reply Code ............................................................... 5
3.7 CHKSUM/CRC16/MAC[4] - Message Check Codes ............................................... 5
Commands ............................................................................................................... 5
4.1 Poll (osdp_POLL) ........................................................................................... 6
4.2 ID Report Request (osdp_ID) .......................................................................... 6
4.3 Peripheral Device Capabilities Request (osdp_CAP) ............................................. 6
4.4 Diagnostic Function Request (osdp_DIAG) ........................................................ 6
4.5 Local Status Report Request (osdp_LSTAT) ....................................................... 6
4.6 Input Status Report Request (osdp_ISTAT) ....................................................... 7
4.7 Output Status Report Request (osdp_OSTAT) .................................................... 7
4.8 Reader Status Report Request (osdp_RSTAT) .................................................... 7
4.9 Output Control Command (osdp_OUT) ............................................................. 7
4.10 Reader LED Control Command (osdp_LED) ....................................................... 8
4.11 Reader Buzzer Control Command (osdp_BUZ) ................................................... 9
4.12 Reader Text Output Command (osdp_TEXT) ...................................................... 9
4.13 Time and Date Command (osdp_TDSET) .........................................................10
4.14 Communication Configuration Command (osdp_COMSET) ..................................11
4.15 Data Transfer Command (osdp_DATA) .............................................................11
i
Open Supervised Device Protocol (OSDPv2.1.5)
4.16 Set Automatic Reader Prompt Strings (osdp_PROMPT) .......................................12
4.17 Scan and Send Biometric Template (osdp_BIOREAD) .........................................13
4.18 Scan and Match Biometric Template (osdp_BIOMATCH)......................................14
4.19 Continue Multi-Part Message (osdp_CONT).......................................................15
4.20 Manufacturer Specific Command (osdp_MFG) ...................................................15
4.21 Smart Card Operations Complete (osdp_SCDONE) ............................................15
5.1 General Acknowledge, Nothing to Report (osdp_ACK) ........................................15
5.2 Negative Acknowledge – SIO Comm Handler Error Response (osdp_NAK) .............15
5.3 Device Identification Report (osdp_PDID) ........................................................16
5.4 Device Capabilities Report (osdp_PDCAP).........................................................17
5.5 Local Status Report (osdp_LSTATR).................................................................17
5.6 Input Status Report (osdp_ISTATR).................................................................17
5.7 Output Status Report (osdp_OSTATR) .............................................................18
5.8 Reader Tamper Status Report (osdp_RSTATR) ..................................................18
5.9 Card Data Report, Raw Bit Array (osdp_RAW) ...................................................18
5.10 Card Data Report, Character Array (osdp_FMT) ................................................19
5.11 Keypad Data Report (osdp_KEYPAD) ...............................................................19
5.12 Communication Configuration Report (osdp_COM) ............................................20
5.13 Scan and Send Biometric data (osdp_BIOREADR) .............................................20
5.14 Scan and Match Biometric Template (osdp_BIOMATCHR) ....................................20
5.15 Manufacturer Specific Reply (osdp_MFGREP) ....................................................21
5.16 PD Busy Reply (osdp_BUSY) ..........................................................................21
APPENDIX A - Command and Reply Code Numbers ........................................................22
Commands ...........................................................................................................22
Replies .................................................................................................................22
Appendix B - Function Code Definitions List ..................................................................24
Function Code 001 – Contact Status Monitoring .........................................................24
Function Code 002 – Output Control .........................................................................24
Function Code 003 - Card Data Format .....................................................................24
Function Code 004 – LED Control .............................................................................24
Function Code 005 – Audible Output .........................................................................25
Function Code 006 – Text Output .............................................................................25
Function Code 007 – Time Keeping ...........................................................................25
Function Code 008 – Check Character Support ...........................................................25
Function Code 009 – Communication Security ............................................................25
Function Code 010 – Receive BufferSize ....................................................................26
Function Code 011 – Largest Combined Message Size .................................................26
Function Code 12 – Smart Card Support ...................................................................26
ii
Open Supervised Device Protocol (OSDPv2.1.5)
APPENDIX C - CRC Definition ......................................................................................27
Appendix D – Encryption ............................................................................................29
Commands ...........................................................................................................29
Replies .................................................................................................................30
Encryption Method: osdp-sc ....................................................................................30
SEC_BLK_TYPE Assignment .....................................................................................31
Appendix E – Extended Write Command and Extended Read Reply ...................................38
E.1 Extended Write Command (osdp_XWR) ...........................................................38
E.1.1 Profile specific command codes for XRW_PROFILE == 0..................................39
E.1.1.1 Profile Setting Read Request (osdp_PR00REQ) ...........................................39
E.1.1.2 Profile Set Command (osdp_PR00SET) ......................................................39
E.1.2 Profile specific command codes for XRW_PROFILE == 1..................................39
E.1.2.1 Transparent Content Send Request (osdp_PR01XMIT) .................................40
E.1.2.2 Profile Set Command (osdp_PR01SCDONE) ...............................................40
E.1.2.3 Request Secure PIN Entry Command (osdp_PR01SPE).................................40
E.2 Extended Read Reply (osdp_XRD) ...................................................................42
E.2.1 Profile specific reply codes for XRW_PROFILE == 0 .......................................42
E.2.1.1 Profile-00 NAK or Error reply (osdp_PR00ERROR) .......................................42
E.2.1.2 Profile Setting report (osdp_PR00REQR) ....................................................43
E.2.2 Profile specific reply codes for XRW_PROFILE == 1 .......................................43
E.2.2.1 Profile-01 NAK or Error reply (osdp_PR01ERROR) .......................................43
E.2.2.2 Card Present Notification reply (osdp_PR01PRES == 0x01) ..........................44
E.2.2.3 Transparent card data reply (osdp_PR01SCREP == 0x02) ............................44
E.2.2.4 Secure PIN Entry Complete reply (osdp_PR01SPER == 0x03).......................44
Appendix F – Test Vectors ..........................................................................................47
CRC (CCITT-1021) .................................................................................................47
Checsum ..............................................................................................................47
Sample Secure Channel establishment session: .........................................................47
References ...............................................................................................................48
iii
Open Supervised Device Protocol (OSDPv2.1.5)
Revision History
2012/09/28 - Marked “version 2.1.5”
- Replaced contradicting incidences of REPLY DELAY and REPLY TIMEOUT
- Recommend CRC method for new devices
- Marked Section 4.1.3 as Obsolete
- Expanded PD Busy Reply definition
- Added Blue color value in Section 4.10
iv
Open Supervised Device Protocol (OSDPv2.1.5)
2009/02/07 - Added the Data Transfer command – 0x6F
2009/01/13 - Extended the usage specification of "temp text time" in Command 0x6B
2007/03/07 - Changed the name of the protocol from "Pdp-1" to OSDP. It stands for
"Open Supervised Device Protocol"
2007/01/26 - Defined address = 0x7F for "broadcast" support mode, (HID/MM)
- Default communication address and baud rate assignment
recommendations (HID/MM)
- Command 0x6E and Reply 54: communication address and baud rate
configuration (HID/MM)
- Command 0x80 and Reply 0x90 "pass-through" messages (HID/MM)
- Updated Reply 0x53, showing key encoding guidelines
v
Open Supervised Device Protocol (OSDP)
1 Introduction
This document describes the communication protocol for interfacing one or more Peripheral Devices
(PD) to a Control Panel (CP). This document specifies the protocol implementation over a two-wire,
multi-dropped, serial communication channel, such as RS-485. This protocol is extensible to allow
transport over other media, such as TCP/IP.
Communication Settings
2.2 Signaling
Half duplex asynchronous serial
8 data bits
1 stop bit
no parity bits
9600, 19200 or 38400 Baud suggested
2.7 Timing
The transmitting device shall guarantee a gap of a minimum of two character times before it may
access the communication channel. This idle line delay is required to allow for signal converters
and/or multiplexers to sense that the line has become idle.
The transmitting device shall drive the line to a marking state for a minimum of 1 character time
before starting to send the first character of a message. (This can be achieved by sending a character
with all bits set to '1'.) A new message may not begin any sooner than full character time following
the last bit of the last message.
The transmitting device shall stop driving the line no longer than one full character time after the
transmission of the stop bit of the last character of a message.
A device must begin the transmission of its reply in less than the defined REPLY_DELAY from the
last character of the message requesting the reply.
The REPLY DELAY shall not exceed 20 milliseconds. The REPLY DELAY is defined as the time measured
from the receipt of the checksum character of the command to the transmission of the first byte of
the reply. The typical REPLY DELAY should be less than 3 milliseconds. If a device is overwhelmed it
can send a BUSY message(s) (The longest REPLY DELAY occurs when local data is being processed,
typically an infrequent event.)
The PD shall consider its communication "off-line" if the period between messages to which it
responds exceeds 8 seconds. Both sides must reset the connection state to “off-line” and reinitiate a
new connect sequence.
If the CP does not receive a reply before the REPLY_DELAY, it re-sends the last command.
Packet Format
All messages, regardless of origin, share the same structure.
SQN Values
The sequence number is incremented by the CP from one command to the next, skipping zero:
0->1->2->3->1->... Non-zero sequence numbers support error recovery: the Control Panel (CP)
acknowledges the last reply by sending the next command with the incremented sequence number,
or it repeats the command without changing the sequence number to request the repeat of the last
reply. This method allows the receiver to properly handle the command: process the command if it
did not receive it correctly last time (error occurred on the command), or to simply repeat the reply it
already made without executing the command again (error occurred in the reply).
SQN zero should be used only for communication startup, at boot time or after a communications
loss. Zero forces the PD to discard its last reply and to accept and process the current command.
CKSUM/CRC
This setting defines the message check character(s) method used to provide error detection.
The CKSUM value is the 8 least significant bits of the 2’s complement value of the sum of all previous
characters of the message. This mode is supported in order to allow for devices with limited
resources, but new devices should use the CRC method.
The CRC calculation is applied to all previous characters of the message. Refer to Appendix C for the
definition and sample code for the CRC algorithm.
Note, that during an established Secure Channel Session, the SEC_BLK_TYPE values in the Security
Block will override the CKSUM/CRC bit field and the check characters are derived from a Message
Authentication Code computed for the message. Refer to Appendix D for further details.
SEC_BLOCK_LEN
This field is set to the total byte count of the SB, including itself.
SEC_BLK_TYPE
This field defines the manner in which the security block applies to the rest of message (the optional
sec_blk_data[] array , the command/reply, the optional data[] array, and the message check
characters).
SEC_BLK_DATA
This section is an array whose size is (sec_blk_length-2). The data content is separately defined for
each SEC_BLK_TYPE.
A PD that receives an SB, but does not support the processing of the SB should return an osdp_NAK
response, error_code set to 0x05.
A PD whose settings require an encrypted connection, and receives a command without the
appropriate data security extension must return an osdp_NAK response, error_code set to 0x06.
Commands
The following commands can be sent from the CP to the PD. The value listed in the table below goes
in the message CMND field. Values 0x40 through 0x8F are reserved for core commands. Values
outside this range can be used for application specific and/or proprietary implementations.
This command serves as a general inquiry. The PD may return any reply that is marked as a possible
"poll response". Normally, the PD will return any unreported input data or status change information
as a poll response.
Command structure: None
Reply: Any of the Reply messages marked "poll response".
This command requests the return of the PD ID Report. The id request code parameter may request
the extended form of the PD ID block.
Command structure: 1-byte id request code
Timer values:
The timer value is specified in units of 100 milliseconds. The 16-bit value provided supports a
maximum pulse time of 6,553.5 seconds, which is 1 hour, 49 minutes, and 13.5 seconds.
The PD may respond with a reply 0x4A to indicate that output(s) have changed state, or at the PD's
option, it can return reply 0x40 (osdp_ACK), then send the output change report (0x4A) later.
Notes:
The LED will flash, alternating between the color specified for ON and color specified for OFF at the
rate specified by the corresponding timers. Setting both color codes to the same value will produce a
steady (non-flashing) output.
The 16-bit timer applies to the temporary LED commands only.
Examples:
To cause reader-0's first LED to flash red for 3 seconds, then resume its current display mode:
0,0, 2,1,2,1,0,30,0, 0,0,0,0,0
To set the reader's second LED to display a steady green output
0,1, 1,0,0,0,0,0,0, 1,1,1,2,2
The LED Control Command message packet may contain multiple 14-byte records. Use the total
message length to determine the number of records present.
Reply: osdp_ACK, osdp_NAK
Notes:
The Buzzer will sound, alternating between the ON and the OFF states specified by the corresponding
timers. Set the OFF time to zero to produce a steady tone.
Notes:
The time set command should be sent every time a new connection is established. This command
should be sent as often as necessary based on the time keeping capabilities of the PD.
Reply: osdp_ACK, osdp_NAK
Note:
The baud rate is expressed as a 32-bit integer holding the actual value of the baud rate to use, such
as 9600, 38400, etc.
If the PD is unable to comply, it will return the values that it will use after the completion of this
reply.
Reply: osdp_COM – PD Communication Configuration Report
The reader has a separate dictionary of strings for different user interactions. More will be defined as
needed. The String Index in the dictionary defines its meaning. The tables below show the Dictionary
Index and String Index for currently defined dictionaries.
The Locale field is a string up to 5 characters long. Pad shorter strings with zeros on the end. The
Local consists of an ISO 639 2 character language code followed by an optional underscore and 2
character ISO 3166 2 character territory code. For example:
en – English
en_US – English in the United States
fr – French
fr_BE – French in Belgium
Reply: osdp_ACK, osdp_NAK
Biometric Types
Value Meaning
0x00 Not specified – default -
0x01 Right Thumb Print
0x02 Right Index Finger Print
0x03 Right Middle Finger Print
0x04 Right Ring Finger Print
0x05 Right Little Finger Print
0x06 Left Thumb Print
0x07 Left Index Finger Print
0x08 Left Middle Finger Print
Replies
The PD must begin sending a reply less than 50 ms after it receives the last character of a valid
command. If it cannot, it should send an osdp_ACK, and the actual data requested will be sent to the
CP as a POLL reply when it becomes available.
If the command has a bad checksum/CRC, requests an unsupported checksum/CRC method or
exceeds the PDs input buffer size, the PD should not respond. In those cases the PD cannot be sure
the address field is correct, so this prevents wrong or multiple PDs from responding.
For any other detected failure, the PD should send a osdp_NAK message.
If the CP receives a packet with an invalid checksum/CRC or detects any other error, it must re-
transmit the command using the same SQN as the original request.
See 2222 for a quick reference table with the numeric reply values.
Notes:
The Vendor Code is a 24-bit identifier of the manufacturer. It is recommended that each
manufacturer use its IEE assigned Organizationally Unique Identifier, the same 24 bits it uses to form
the MAC addresses of its ethernet-based products.
The Model Number and Version fields are assigned by and managed by the Vendor. These fields have
no direct operational purpose.
The 32-bit Serial Number field is assigned and managed by the Vendor. This field has no direct
operational purpose.
The Firmware Revision fields are assigned and managed by the Vendor. These fields have no direct
operational purpose.
Commands
Replies
03 – Like 01, plus: The PD is able to accept timed commands to the Output. A timed command
specifies the state of the Output for the specified duration.
04 – Like 02 and 03 – normal/inverted drive and timed operation.
if ( nCrcTblValid == 0 ) {
nCrcTblValid = fCrcTblInit(&cCrcTable[0]);
}
for ( ii = 0, nCrc = 0x1D0F; ii < nLength; ii++ ) {
nCrc = (nCrc<<8) ^ cCrcTable[ ((nCrc>>8) ^ pData[ii]) & 0xFF];
}
return nCrc;
}
Note that the CRC table uses 512 bytes (256 two-byte entries). Depending on limitations
on system resources, some implementations may prefer to place a pre-built table into
Read Only Memory. Use the fCrcTblInit() function to generate the 256 entries, then
format the output and place into the form of an initialized array, such as:
const uint16 CrcTable[256] =
{
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE,
0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485,
0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D,
0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4,
0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC,
0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823,
0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B,
0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12,
0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A,
0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41,
0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49,
0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70,
0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78,
0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F,
0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067,
0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E,
0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256,
0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D,
0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C,
0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634,
0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB,
0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3,
0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A,
0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92,
0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9,
0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1,
0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8,
0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
};
Commands
Encryption Key Set (osdp_KEYSET)
This command transfers an encryption key from the CP to a PD.
Command structure: 2-byte header followed by variable length data
Notes:
The following notes apply to Key_Type = 0x01:
Used with the “Secure Channel protocol 03” Encryption Mode to transfer the Secure Channel
Base Key (SCBK):
The Length shall be 16, and the Data[] aray shall contain the 128-bit Secure Channel base key
(SCBK).
This command shall be sent by the CP and accepted by the PD only while the connection is
“secure”. The “secure” connection in this context shall meant that either a) the current
connection is encrypted and the session keys are based on the current SCBK, or b) that the
connection is inherently secure via physical security, such as CP/PD are connected via simple
short cable. The “inherently secure” connection shall be asserted to the CP and to the PD by
setting the devices into a special installation setup mode. The devices should exit the setup
mode automatically after a successful completion of this osdp_KEYSET command.
Reply: osdp_ACK, osdp_NAK
Replies
General Overview
The Master Key (MK) is the foundation of the osdp-sc data security environment. The Control Panel,
acting as the Server, contains the MK. The PDs are only loaded with a Secure Channel Base Key
(SCBK) unique to each PD. The SCBK is computed by applying each PD's cUID and the MK to a key
diversification algorithm.
To establish a secure connection between a CP and a PD, the PD presents its cUID in plain text. The
CP performs the key diversification on the cUID and computes the PD's SCBK, thus establishing the
Open Supervised Device Protocol (OSDPv2.1.5) 31 of 47
Open Supervised Device Protocol (OSDP)
common key for the secure session.
Once the SCBK has been shared between the CP and PD, a set of three separate keys are established
for the remaining of the communication "session": S-ENC, S-MAC1, and S-MAC2.
Each communication packet shall contain an encrypted message block for data privacy using S-ENC
and authenticated using S-MAC1 and S-MAC2 with non-repeating ICVs.
The Process
In order to establish a session using the secure channel protocol, the Client and the Server must be
mutually authenticated with each other and in the same process, a set of keys are established for
this session. The secure channel session is terminated and the session keys are destroyed whenever
any error is detected in the secure channel protocol. For example, the secure channel session can be
terminated by either party by forcing a timeout, or by simply sending an invalid MAC.
The following steps define the osdp-sc Secure Channel Session Connection Sequence (SCS-CS), and
also define the SEC_BLK_TYPE values assigned to each SCS step:
SCS_11 CP->PD
The CP sends SCS_11 code in SEC_BLK_TYPE to begin a new SCS-CS. The SEC_BLK_DATA[0] is used
to select SCBK or SCBK-D for the connection sequence. SEC_BLK_DATA[0] is set to 1 to select SCBK,
and is set to 0 to select SCBK-D. The message check method is crc16.
The CMND character is osdp_CHLNG with an 8-byte random number (RND.A[8]) as the server
challenge.
If the PD does not support the security block, and/or specifically SCS_11, then the PD shall return
the osdp_NAK response: error_code set to 0x05.
SCS_12 PD->CP
The PD responds with SCS_12 to acknowledge the beginning a new SCS-CS. The SEC_BLK_DATA[0]
is used to select SCBK or SCBK-D for the connection sequence. SEC_BLK_DATA[0] is set to 1 to
select SCBK, and is set to 0 to select SCBK-D. The message check method is crc16.
The PD performs the following operations:
a) generates its own 8-byte random number (RND.B[8]), and
b) generates a set of session keys: S-ENC, S-MAC1, and MAC2, using the server’s random
number, RND.A[8], along with SCBK – see “Session Key Derivation” paragraph below.
c) Generate the Client Cryptogram - see “Client Cryptogram” paragraph below.
The REPLY is osdp_CCRYPT, returning the PD’s ID (cUID), its random number, and the Client
Cryptogram.
SCS_13 CP->PD
The CP continues by sending SCS_13 code in SEC_BLK_TYPE. The SEC_BLK_DATA[0] is used to
select SCBK or SCBK-D for the connection sequence. SEC_BLK_DATA[0] is set to 1 to select SCBK,
and is set to 0 to select SCBK-D. The message check method is crc16.
Open Supervised Device Protocol (OSDPv2.1.5) 32 of 47
Open Supervised Device Protocol (OSDP)
After receiving the osdp_CCRYPT in the SCS_12 reply, the CP will generate:
a) the PD’s SCBK using its MK and cIUD – see “Key Diversification” paragraph below
b) generates a set of session keys: S-ENC, S-MAC1, and MAC2, using the server’s random
number, RND.A[8], along with SCBK – see “Session Key Derivation” paragraph below.
c) the Server Cryptogram – see “Server Cryptogram” paragraph below
The CP then formats and sends CMND osdp_SCRYPT, posting the Server Cryptogram.
SCS_14 PD->CP
The PD responds with SCS_14. The SEC_BLK_DATA[0] is used to select SCBK or SCBK-D for the
connection sequence. SEC_BLK_DATA[0] is set to 1 to select SCBK, and is set to 0 to select SCBK-D.
The message check method is crc16.
The PD processes the osdp_SCRYPT command and verifies the Server Cryptogram:
a) if the Server Cryptogram is ok, then
1) sec_blk_data[0] is set to “0x01” indicating that the Server Cryptogram in SCS_13
was accepted, and
2) generates the Intial MAC reply (osdp_RMAC_I) – as defined for the osdp_RMAC_I
reply.
b) else (the Server Cryptogram test failed), the
1) sec_blk_data[0] is set to “0xFF” indicating that the Server Cryptogram in SCS_13
was not accepted, and secure connection sequence cannot proceed. Both the CP and
the PD must begin a new secure connection sequence with SCS_11 – possibly using
SCBK-D.
2) the REPLY code is set to the osdp_NAK response, with the error_code set to 0x05.
Note: successful completion of the first four steps confirms that the SCBK is valid, and that both
sides have the full complement of the keys derived for this session: S-ENC, S-MAC1, and S-MAC2.
Also, the R-MAC is the initial ICV value that will be rolling throughout the session.
SCS_15 CP->PD
The data field is sent in plain text (unencrypted)
Note: this form provides Message Authentication, but no Data Security. Therefore, it is intended to be
used ONLY with the osdp_POLL command in "released" code. Certain development and test modes
may use this form for testing.
SCS_16 PD->CP
The data field is sent in plain text (unencrypted)
Note: this form provides Message Authentication, but no Data Security. Therefore, it is intended to be
Open Supervised Device Protocol (OSDPv2.1.5) 33 of 47
Open Supervised Device Protocol (OSDP)
used ONLY with the osdp_ACK Reply in "released" code. Certain development and test modes may
use this form for for testing.
SCS_17 CP->PD:
Data of the command is padded and encrypted using S-ENC key
Note: this form shall be used with all other commands (non-Poll)
SCS_18 PD->CP
Data of the reply is padded and encrypted using S-ENC key
Note: this form shall be used with all other replies (non-ACK)
Note: SCS_15 and SCS_16 provide for an efficient POLL/ACK cycle while maintaining encryption sync
and message integrity. The assumption is made that there is no significant loss of security by sending
POLL/ACK messages in plain text. If this becomes an issue, a site dependent security setting could
disable the use of SCS_15/SCS_16 support, forcing even POLL/ACK messages to use the
SCS_17/SCS_18 form.
Key Diversification
The Secure Channel Base Key (SCBK) is the secret key between the CP and the PD that is used to
establish cryptographic synchronization. To support site based key management where it is not
feasible to distribute the PDs’ SCBKs to the CPs, the following algorithm allows for computation of
unique SCBKs for each PD based on the PD’s cUID and a site specific Master Key:
SCBK = Enc( cUID || (~cUID), MK )
The above equation means that the concatenated 8-byte cUID and the one's complement inverse of
the cUID are encrypted by applying the AES128 algorithm using MK as the key. The nature of the
AES block transform algorithm guarantees that the resultant SCBKs are unique as long as the cUIDs
are unique.
Client Cryptogram
The Client Cryptogram is computed by encrypting the concatenated RND.A[8] and RND.B[8] using
key S-ENC. RND.A[8] is generated by the CP (server) and RND.B[8] is generated by the PD (client).
ClientCryptogram = ENC( RND.A[8] || RND.B[8], S-ENC )
Padding
When used, the padding shall be performed as follows:
Append the character 0x80 to the data block, then continue to append as many characters of 0x00 as
are required to make the size of the data block to be evenly divisible by the block size of 16.
Note – If the message size is same as the block size (16 bytes) then only SMAC-2 key will be used as
shown in the above diagram.
The Wrap Operation for Security Block Types SCS_15, SCS-16, SCS_17, and
SCS_18
1. The message check data field appended to all packets whose SEC_BLK_TYPE is SCS_15, SCS_16,
SCS_17, and SCS_18 is the first four bytes of the MAC. Note that as the table in the beginning of
Section 3 shows, the MAC is replaces the checksum or the crc bytes.
2. Adjust the message length value to reflect the 4 byte MAC in the total length.
Note: Steps 3, 4, and 5 apply only to SCS_17 and SCS_18 ----->>>
3. "data" bytes of command or reply are padded to be of even multiple of the encryption block size.
4. Adjust the message length member of the header to reflect the padded length of the message.
5. Encrypt the Command/Reply Block using CBC mode with S-ENC key and ICV is the one's
complement of the MAC of the last message received from the device the message is being prepared
for.
Note: Steps 3, 4, and 5 apply only to SCS_17 and SCS_18 <<<-------
6. The message (header, sec block, command/reply, data block) is padded to form an even multiple
of the encryption block length for the MAC calculation. (If the message size, prior to padding, is an
even multiple of the block size, then no padding is performed.)
7. The MAC is computed by encrypting the padded message using CBC mode, ICV=previously
received MAC, key=S-MAC1 for all blocks, except S-MAC2 is used for the last block. The result of the
last CBC cycle is the MAC. The partial results of the CBC operation are discarded.
Overview
The “extended write” command and the “extended read” reply support Peripheral Devices, such as
smart card readers, which are capable of performing intelligent operations. The ability to handle
complex tasks is referred to as “Behavior Profiles”, or more simply “Profiles”, throughout this
Appendix. The capabilities and specific nature of the various Profiles are documented in subsections
below.
(The messages in this section provide complete functional replacement for the following messages
that were removed from the main body of the specification: osdp_XMIT, osdp_RMODE, osdp_SPE,
osdp_SCDONE, osdp_SCREP, osdp_PRES, and osdp_SPER.)
Behavior Profiles
XRW_PROFILE Behavior Profile Description
0x00 Default – no specific Behavior Profile is in effect
0x01 Transparent smart card interface support
0x02 - Unassigned
XRW_PROFILE == 0 – No Specific Behavior Profile is in use - osdp_XWR commands support the read
back and the setting of the PD’s profile.
XRW_PROFILE == 1 – This Behavior Profile supports transparent operations between the CP and a
Smart Card. Note that the use of this profile may require licensing – refer to US Patents
6575360 & 7853785.
/* APDU: 00 20 00 00 08 30 30 30 30 00 00 00 00 */
offset = 0;
pin_verify -> abData[offset++] = 0x00; /* CLA */
pin_verify -> abData[offset++] = 0x20; /* INS: VERIFY */
pin_verify -> abData[offset++] = 0x00; /* P1 */
pin_verify -> abData[offset++] = 0x80; /* P2 */
pin_verify -> abData[offset++] = 0x08; /* Lc: 8 data bytes */
pin_verify -> abData[offset++] = 0xff;
pin_verify -> abData[offset++] = 0xff;
pin_verify -> abData[offset++] = 0xff;
pin_verify -> abData[offset++] = 0xff;
pin_verify -> abData[offset++] = 0xff;
pin_verify -> abData[offset++] = 0xff;
pin_verify -> abData[offset++] = 0xff;
pin_verify -> abData[offset++] = 0xff;
pin_verify -> ulDataLength = HOST_TO_CCID_32(offset); /* APDU size */
CRC (CCITT-1021)
Example 1:
537F0D00046E00802500006E38
Example 2:
53000900046100C066
Checksum
Example 1:
537F0C00006E00802500000F
Example 2:
5300080000610044
osdp_CHLG (530013000D03110076B0B1B2B3B4B5B6B73177):
Inside the PD:
- Generate 8 bytes random number; this session generates “A0A1A2A3A4A5A6A7”
- Generate session keys
o SMAC1 - 5e 86 c6 76 60 3b de e2 d8 be af e1 78 63 73 32
o SMAC2 - 6f da 86 e8 57 77 7e 81 13 20 35 75 82 39 17 2e
o ENC - bf 8d c2 a8 32 9a cb 8c 67 c6 d0 cd 9a 45 16 82
- Generate host cryptogram (keep in memory) : 26 d3 35 6e 07 76 2d 26 28 01 fc 8e 66 65 a8 91
- Generate card cryptogram : fd e5 d2 f4 28 ec 16 31 24 71 ea 3c 02 bd 77 96
osdp_SCRYPT (53001B000E0313007726D3356E07762D262801FC8E6665A89140B4) :
Inside the PD:
- Validates the cryptogram sent by host (26D3356E07762D262801FC8E6665A891) with the one stored in memory
(see osdp_CHLG)
- Generates RMAC. RMAC is generated by encrypting the host cryptogram by SMAC-1, the result of
this encryption is then encrypted using SMAC-2. For this sample session the value of RMAC
would be “b2 a3 00 57 eb 98 ba 22 29 ec 1f 87 56 62 b5 24”