Appendix A - Examples
DynaPro Mini| PIN Encryption Device | Programmer’s Manual (Commands)
Page 91 of 128 (
D99875629-43
)
A.2
How to Parse Encrypted Big Block EMV Data From An SRED Device
This section provides an example of parsing encrypted EMV data sent from an SRED device in TLV
format, in response to
Command 0xAB - Request EMV Transaction Data (MAC-MSR)
. For more
information about big blocks and TLV format, see section
3.1 About Big Block Data and TLV Format
In this case, the device sends big block data to the host in the big block data buffer via
. Upon assembling the incoming packets and stripping off the packet
containers, the block of data looks like this:
01C7F98201C3DFDF540A9500030000000120039DDFDF550182DFDF250898CE04611018
060DFA8201A0F082019CF105DFDF1A0100F882010EDFDF598200F08569A27E2A2A9D7E
67A96624D10DBE3F366EC3F31C4072676FEF43213AF3C76ABE06A6E90F10E1650BE4EC
E9CF64E9143129F66B44E8C4A697CA5A0E319D933BF9BBC52B2DAF8FCC663354E2B0E5
45A5002F4A0C976E65DD23705AB36ECA78D6A6B99243F2C2B907A8F1F2A66D5558096D
7B1F91F1B6C06BF68841098EEABA502A57A3AA2F1344C4E405B86C3D64FB93E638D821
409493659966A247238109C0E117B669B74A5508261B8E8AFF3FFE68058C334B383D99
1EAE3C8F5594FBFB9118860FF67344F37DE54EA5F28BFECF8378072A9FAE3A61FEF132
54B6C7B2C1D0AF626E5A14F19C025B7CD1EF1456A31DDFDF560A950003000000012003
9DDFDF570180DFDF580106F782007FDFDF4001015F25031201015F24031401315F2A02
08269F02060000000002009F0607A00000000410109F1C0831313232333334349F3901
059C01009F34035E03005F5701305F3401005F2009544553542F43415244DFDF4D263B
353431333030303034303030313531333D303131343030303030303030303030303030
303F00000000000000C568ACEB
Because the calling command is tagged with “MAC,” its response should be interpreted using the
information in section
3.3 About Message Authentication Codes (“MAC-AMK
”. Specifically because
this is batch data coming from an SRED device, the data is interpreted using section
0xAB - Request EMV Transaction Data (MAC-MSR)
, so the data would be broken down as follows:
01C7
is the expected data length not including padding and CBC-MAC.
Appendix D MagTek Custom EMV Tags
and section
, the next byte,
F9
, is a tag that indicates
the beginning of a data object containing Message Authentication (MAC) structure and generic data.
According to
EMV Integrated Circuit Card Specifications for Payment Systems 4.3, Part IV,
Annex B Rules for BER-TLV Data Objects
, the next three bytes,
8201C3
, indicate the length of the
value in data block
F9
; lengths can be either one byte long from
0x00
to
0x7F
, or multiple bytes
starting with
0x80
or higher, in which case the lower 7 bits of the first byte specify how many
subsequent bytes will indicate the length of the value in the data object. In this case,
0x82
is greater than
0x7F
, and the lower 7 bits equal
0x02
, so the next 2 bytes
0x01C3
give the total length of the data
block for tag
F9
. The value in data object
F9
therefore consists of these 451 bytes:
DFDF540A9500030000000120039DDFDF550182DFDF250898CE04611018060DFA8201A0
F082019CF105DFDF1A0100F882010EDFDF598200F08569A27E2A2A9D7E67A96624D10D
BE3F366EC3F31C4072676FEF43213AF3C76ABE06A6E90F10E1650BE4ECE9CF64E91431
29F66B44E8C4A697CA5A0E319D933BF9BBC52B2DAF8FCC663354E2B0E545A5002F4A0C
976E65DD23705AB36ECA78D6A6B99243F2C2B907A8F1F2A66D5558096D7B1F91F1B6C0
6BF68841098EEABA502A57A3AA2F1344C4E405B86C3D64FB93E638D821409493659966
A247238109C0E117B669B74A5508261B8E8AFF3FFE68058C334B383D991EAE3C8F5594
FBFB9118860FF67344F37DE54EA5F28BFECF8378072A9FAE3A61FEF13254B6C7B2C1D0