3 - Command Set
DynaPro Mini| PIN Encryption Device | Programmer’s Manual (Commands)
Page 27 of 128 (
D99875629-43
)
3.3
About Message Authentication Codes (“MAC-AMK” or “MAC-MSR”)
“MAC” is an abbreviation of Message Authentication Code, which is a string of bytes included in a
message that can be used to provide reasonable assurance that the message originated from a trusted
source and has not been modified. All messages in this document (including commands, responses, and
command payloads) that are tagged “MAC-AMK” or “MAC-MSR” must include the device’s unique
serial number and a four-byte MAC.
The sections in this document about all commands, responses, and data formats that include a MAC are
tagged with “MAC-AMK” or “MAC-MSR” in the section title. Some of these sections provide deep
detail about generating and using the MAC, including which key and variant to use, which data elements
to use, and how the resulting MAC is included in the message. The key used to calculate the MAC is
usually either the MSR key or the AMK key, and the variant is always
Message Authentication, Request
or Both Ways
. The choice of key depends on several factors, including the type of message, whether its
related processes use encryption, and which encryption keys those processes use.
In all cases, the MAC is produced by following
ISO 9797-1 Information Technology – Security
Techniques – Message Authentication Codes
, using Padding Method 1, Initial Transformation 1,
Output Transformation 3, Algorithm 3, DEA, with two 56 bit-keys (K and K'). That method produces an
8-byte MAC value, and the most significant 32 bits of that value serve as the MAC the device or host will
include with the message.
The host and device stage many MACed messages using big block data buffers (detailed in section
About Big Block Data and TLV Format
). In cases where the MACed message uses TLV data object
F9
, which is designed specifically for transmitting MACed messages, the message being sent as big block
data follows this general format (interpret hexadecimal as binary values, ignore whitespace and
/*comments*/, replace <angle bracketed values> with actual values):
AAAA /* 2-byte MSB message length excluding padding and CBC-MAC */
F9<len> /* container for MAC structure and generic data */
DFDF54(MAC KSN)<len><val>
DFDF55(MAC Encryption Type)<len><val>
DFDF25(IFD Serial Number)<len><val>
<Nested TLV data objects specific to the message>
<Padding to force F9 plus padding to be a multiple of 8 bytes>
<Four byte CBC-MAC>
The host and device construct and send the full F9-based message as follows:
The first two bytes of the message are in big-endian order (MSB first) not in TLV format, and
indicate the length of the full F9 object, starting with the F9 byte at the beginning, and ending at the
last byte of the F9 data object’s final nested child. By definition, this excludes any added padding
and the CBC-MAC itself at the end of the message (both described later).
The F9 data object is populated with nested TLV data objects as specified by the command, response,
or data format’s documentation. In general:
o
If the MAC is generated using a DUKPT key, F9 will include nested TLV data object
DFDF54 specifying the KSN for the DUKPT working key used to generate the MAC. If the
MAC is generated using a fixed key, F9 will not include DFDF54.