EMV CPS v1.1 20070720
EMV CPS v1.1 20070720
EMV CPS v1.1 20070720
Personalization
Specification
Version 1.1
July 2007
© 2003-2007 EMVCo, LLC (“EMVCo”). All rights reserved. Any and all uses of the EMV Card
Personalization Specification (“Materials”) shall be permitted only pursuant to the terms and conditions of the
license agreement between the user and EMVCo found at http://www.emvco.com/specifications.cfm.
The specifications, standards and methods set forth in these Materials have not been finalized or
adopted by EMVCo and should be viewed as “work-in-process” subject to change at anytime without notice.
EMVCo makes no assurances that any future version of these Materials or any version of the EMV Card
Personalization Specification will be compatible with these Materials. No party should detrimentally rely on
this draft document or the contents thereof, nor shall EMVCo be liable for any such reliance.
These Materials are being provided for the sole purpose of evaluation and comment by the person or entity
which downloads the Materials from the EMVCo web site (“User”). The Materials may not be copied or
disseminated to any third parties, [except that permission is granted to internally disseminate copies within
the organization of the User]. Any copy of any part of the Materials must bear this legend in full.
These Materials and all of the content contained herein are provided "AS IS" "WHERE IS" and "WITH ALL
FAULTS" and EMVCo neither assumes nor accepts any liability for any errors or omissions contained in
these materials. MATERIALS AND INFORMATION PROVIDED BY EMVCO ARE NOT FINAL AND MAY
BE AMENDED AT EMVCO'S SOLE OPTION. EMVCO MAKES NO REPRESENTATIONS OR
WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, WITH RESPECT TO THE MATERIALS AND
INFORMATION CONTAINED HEREIN. EMVCO SPECIFICALLY DISCLAIMS ALL REPRESENTATIONS
AND WARRANTIES, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
SATISFACTORY QUALITY, AND FITNESS FOR A PARTICULAR PURPOSE.
EMVCo makes no representation or warranty with respect to intellectual property rights of any third parties in
or in relation to the Materials. EMVCo undertakes no responsibility of any kind to determine whether any
particular physical implementation of any part of these Materials may violate, infringe, or otherwise use the
patents, copyrights, trademarks, trade secrets, know-how, and/or other intellectual property rights of third
parties, and thus any person who implements any part of these Materials should consult an intellectual
property attorney before any such implementation. WITHOUT LIMITATION, EMVCO SPECIFICALLY
DISCLAIMS ALL REPRESENTATIONS AND WARRANTIES WITH RESPECT TO INTELLECTUAL
PROPERTY SUBSISTING IN OR RELATING TO THESE MATERIALS OR ANY PART THEREOF,
INCLUDING BUT NOT LIMITED TO ANY AND ALL IMPLIED WARRANTIES OF TITLE, NON-
INFRINGEMENT OR SUITABILITY FOR ANY PURPOSE (WHETHER OR NOT EMVCO HAS BEEN
ADVISED, HAS REASON TO KNOW, OR IS OTHERWISE IN FACT AWARE OF ANY INFORMATION).
Without limitation to the foregoing, the Materials provide for the use of public key encryption technology,
which is the subject matter of patents in several countries. Any party seeking to implement these Materials
is solely responsible for determining whether their activities require a license to any technology including, but
not limited to, patents on public key encryption technology. EMVCo shall not be liable under any theory for
any party's infringement of any intellectual property rights.
THIS PAGE LEFT INTENTIONALLY BLANK
i Tables and Figures July 2007
Table of Contents
1. Purpose v
2. Scope vi
3. Audience viii
4. Normative References ix
5. Definitions xi
6. Abbreviations and Notations xii
1 Card Personalization Data Processing 1
1.1 Overview of the Process 1
1.2 The Infrastructure of Card Personalization 2
1.3 Secure Messaging 3
1.4 The STORE DATA Command 3
1.5 The Common Personalization Record Format 4
2 Data Preparation 7
2.1 Creating Personalization Data 7
2.1.1 Issuer Master Keys and Data 8
2.1.2 EMV Application Keys and Certificates 8
2.1.3 Application Data 9
2.2 Creation of Data Groupings 10
2.3 Completion of Personalization 11
2.3.1 Multiple Transport Key Capability 12
2.4 Processing Steps and Personalization Device Instructions 12
2.4.1 Order that Data must be sent to the IC Card 13
2.4.2 Support for Migration to New Versions 14
2.4.3 Encrypted Data Groupings 15
2.4.4 PIN Block Format and Random Numbers 16
2.4.5 Grouping of DGIs 16
2.4.6 Security Level Indicator of Secure Channel Sessions 17
2.5 Creation of Personalization Log Data 19
2.6 Data Preparation-Personalization Device Interface Format 19
3 Personalization Device-ICC Interface 29
3.1 Processing Step ‘0F’ 29
3.1.1 Key Management 30
3.1.2 Processing Flow 30
3.2 Processing Step ‘0B’ 31
3.2.2 Key Management 33
3.2.3 Processing Flow 33
3.2.4 SELECT Command 34
3.2.5 INITIALIZE UPDATE Command 35
3.2.6 EXTERNAL AUTHENTICATE Command 39
3.2.7 STORE DATA Command 41
3.2.8 Last STORE DATA Command 45
3.3 Command Responses 45
3.4 Personalization Log Creation 45
4 IC Card Personalization Processing 49
4.1 Preparation for Personalization (Pre-Personalization) 49
4.2 Load / Update of Secure Channel Key Set 50
ii Tables and Figures July 2007
6.27
RCARD (Pseudo-Random Number from the IC Card) 69
6.28
RTERM (Random Number from the Personalization Device) 69
6.29
RANDOM (Random Number) 69
6.30
REQ (Required or Optional Action) 70
6.31
SEQNO (Sequence Number) 70
6.32
SKUENC (Personalization Session Key for confidentiality and
authentication cryptogram) 70
6.33 SKUDEK (Personalization Session Key for Key and PIN Encryption) 70
6.34 SKUMAC (Personalization Session Key for MACing) 70
6.35 TAG (Identifier of Data for a Processing Step) 71
6.36 TK (Transport Key) 71
6.37 TYPETK (Indicator of Use(s) of Transport Key) 71
6.38 VERCNTL (Version Control Personalization Instructions) 72
6.39 VNL (Version Number of Layout) 72
Annex A. Common EMV Data Groupings 73
A.1 Introduction 73
A.2 Common DGIs for EMV Payment Applications 73
A.3 Common DGIs for EMV PSE 79
A.4 Common DGIs to Load/Update Secure Channel Static Keys 80
A.5 Common DGIs to Create File Structure for EMV Records 82
Annex B. Overview of EMV Card Personalization Indirect Method 85
iv Tables and Figures July 2007
Tables
Table 1 – Data Content for tag ‘CF’ 8
Table 2 – Data Content for DGI ‘7FFF’ 11
Table 3 – Data Content for the Field ORDER 14
Table 4 – Data Contents for the Version Control Field VERCNTL 15
Table 5 – Data Content for the Field ENC 15
Table 6 – Data Content for the Field GROUP 17
Table 7 – Data Content for the Field SECLEV 18
Table 8 – IC Card Application Data sent to the Personalization Device 20
Table 9 – FORMATTK Codes and Associated Data 22
Table 10 – Layout of TKDATA for FORMATTK ‘01’ 23
Table 11 – Layout of Processing Steps Field 24
Table 12 – Personalization Device Instructions for the Personalization Processing
Step ‘0F’ 25
Table 13 – INITIALIZE UPDATE Command Coding 36
Table 14 – Response to INITIALIZE UPDATE command 36
Table 15 – Initial Contents of KEYDATA 36
Table 16 – Status Conditions for INITIALIZE UPDATE Command 36
Table 17 – EXTERNAL AUTHENTICATE Command Coding 39
Table 18 – Status Conditions for EXTERNAL AUTHENTICATE Command 39
Table 19 – Security Level (P1) 40
Table 20 – STORE DATA Command Coding for application personalization data 41
Table 21 – Coding of P1 in STORE DATA Command 42
Table 22 – Status conditions for STORE DATA command 42
Table 23 – Contents of Personalization Log 46
Table 24 – Derivation Data for Session Keys 56
Table 25 – Coding of TYPETK 71
Figures
Figure 1 – Overview of IC Card Personalization Data Format 5
Figure 2 – Overview of Personalization Data for an IC Card Application 5
Figure 3 – Layout of ICC Data Portion of Record (Section 3c of Table 8) 26
Figure 4 – Formatting of Personalization Data using DGIs within ICC Data Portion
of Record 26
Figure 5 – Formatting of pre-computed APDU commands within ICC Data Portion
of Record 27
Figure 6 – Personalization Command Flow 31
Figure 7 – Pre-computed APDU command placed in BER–TLV structure 32
Figure 8 –Personalization Two Key Zones 55
Figure 9 –Personalization One Key Zone 55
Figure 10 – C-MAC and MAC Computation 61
v Purpose July 2007
1. Purpose
Card personalization is one of the major cost components in the production of EMV
cards. This specification standardizes the EMV card personalization process with
the objective of reducing the cost of personalization thus facilitating the migration to
chip.
2. Scope
In this specification, card personalization means the use of data personalization
commands that are sent to a card that already contains the basic EMV application.
This is sometimes referred to as “on-card” personalization. The specification does not
cover cards where an application load file is personalized before being loaded onto
the card.
In terms of the lifecycle of the card, card personalization is assumed to take place
after pre-personalization (see Definitions) and prior to card issuance. However non-
EMV applications may well use the same personalization process as defined in this
specification. Other card personalization activities – embossing, magnetic stripe
encoding and the personalization of non-EMV IC applications – are not covered.
The interface between the card issuer and the data preparation system is not
covered.
Involved Entities
These terms are described in the Definitions section below.
Personalization
device
Data
Preparation
Issuer data
Issuer
vii Audience July 2007
Two methods are included in this specification – the indirect method and the direct
method.
Indirect Method
This method is defined in both the current version (1.1) and the original version (1.0)
of the EMV Card Personalisation Specification. The rationale is that the Data
Preparation System should not need to have knowledge of the ICC data used to
establish the secure channel for a particular target card/application. The method
assumes two security zones, one between the Data Preparation System and the
Personalisation Device, and a second zone between the Personalisation Device and
the ICC.
The role of the Personalisation Device is:
To receive the DGI data and Personalisation Device Instructions (PDI) from
the Data Preparation System
To establish the secure channel to the card
To decrypt/re-encrypt the sensitive data (application keys & PIN), and
To create and send personalisation APDU commands to the card.
An example of the process of Indirect method is shown in Annex B.
Direct Method
This method has been added in the current version (1.1) of the EMV Card
Personalisation Specification. The rationale is to reduce the time taken by the
Personalisation Device by pre-computing APDU commands in the Data Preparation
System. The method assumes a single security zone between the Data Preparation
System and the ICC. The Personalisation Device does not need to create APDU
commands; it simply passes on the commands received from the Data Preparation
System.
However the Data Preparation System needs to carry out additional preparation
work. If the Secure Channel Key Set in the card (KENC, KMAC, KDEC) is not known, a
pre-personalisation process is needed to load a derived key set known by the Data
Preparation System on to the ICC. The ICC needs to produce a pseudo-random
number, which the Data Preparation System can predict. The Data Preparation
System also needs to be able to predict the Secure Channel Sequence Counter. The
Data Preparation System uses this information to pre-compute the personalisation
APDU commands for the ICC application.
Note: In terms of the interface between the ICC and the Personalisation Device, the
formats of the personalisation messages are the same for either the indirect or the
direct method. The main difference between the two methods is the allocation of
processing between the Personalisation Device and the Data Preparation System.
viii Audience July 2007
3. Audience
There are three intended audiences for this document:
4. Normative References
The following documents contain provisions that are referenced in this specification.
The latest version shall apply unless a publication date is explicitly stated:
EMV Version 4.1 Integrated Circuit Card Specifications for Payment Systems
Book 1 – Application Independent ICC to Terminal Interface
Requirements
EMVCo Specification EMVCo Specification Update: Bulletin no. 23: First edition
Update: Bulletin no. 23 October 2003: Corrections and Clarifications to EMV Card
First edition Personalization Specification
EMVCo Specification EMVCo Specification Update: Bulletin no. 40: First edition
Update: Bulletin no. 40 February 2005: Additional Corrections and Clarifications to
First edition EMV Card Personalization Specification
5. Definitions
The following terms are used in this specification.
Data Preparation – The process of preparing and formatting data, ready for
sending to a personalization device.
ATR Answer-to-Reset
DF Dedicated File
EF Elementary File
IC Integrated Circuit
ID Identifier
IV Initialization Vector
PK Public Key
TK Transport Key
var. Variable
Hexadecimal Notation
Values expressed in hexadecimal form are enclosed in single quotes (e.g., ‘_’). For
example, 27509 decimal is expressed in hexadecimal as ‘6B75’.
Letters used to express constant hexadecimal values are always upper case (‘A’ - ‘F’).
Where lower case is used, the letters have a different meaning explained in the text.
Binary Notation
Values expressed in binary form are followed by a lower case “b”. For example, ‘08’
hexadecimal is expressed in binary as 00001000b (most significant bit first).
Length Fields
Length fields are “big-endian” encoded. For example if a two-byte length field has a
hexadecimal value of ‘13F’ (319 in decimal), it is encoded as ‘013F’.
∧ Logical AND.
∨ Logical OR.
:= Assignment (of a value to a variable).
( ) or [ ] Ordered set (of data elements).
B1 ⎢⎢B2 Concatenation of bytes B1 (the most significant byte) and B2 (the least
significant byte).
[B1 ⎢⎢B2] Value of the concatenation of bytes B1 and B2.
DES( )[ ] The data in the square brackets is encrypted using DES encryption and the
key in the normal brackets.
DES-1( )[ ] The data in the square brackets is decrypted using DES decryption and the
key in the normal brackets.
xv Abbreviations and Notations July 2007
DES3( )[ ] The data in the square brackets is encrypted using triple DES encryption
and the key in the normal brackets. Triple DES consists of encrypting an 8-
byte plaintext block X to an 8 byte ciphertext block Y using a double length
(16 byte) secret key K = (KL || KR) where KL and KR are DES keys. This is
done as follows:
Y := DES3(K)[X] := DES(KL)[DES-1(KR)[DES(KL)[X]]]
Requirement Numbering
Requirements are highlighted by being indented and numbered with a four digit
reference namely, section, subsection and requirement number. All requirements in
this specification are therefore uniquely numbered with the number appearing next
to each requirement. This convention is adopted to allow test specifications to be
conveniently developed.
1. Data preparation
2. Personalization device set-up and processing
3. IC card application processing.
Each of these steps, together with the two interfaces (1 to 2, 2 to 3), is briefly
described below and discussed in detail in subsequent chapters.
Data Preparation
Data preparation is the process that creates the data that is to be placed in an IC
card application during card personalization. Some of the data created may be the
same across all cards in a batch; other data may vary by card. Some data, such as
keys, may be secret and may need to be encrypted at all times during the
personalization process.
The output of the data preparation process is a file of personalization data, which is
passed to the personalization device. The format of the file records is shown in
Table 8.
The data preparation system must protect the completed personalization data file
for integrity and authenticity (e.g. MAC or signed hash). An example of
implementation in XML format is provided in the GlobalPlatform Messaging
Specification section 5.
2 Card Personalization Data Processing July 2007
Personalization Device
The personalization device is the terminal that acts on Processing Step and
Personalization Device Instruction data to control how personalization data is
selected and then sent to the IC card application. The Processing Step indicates the
format of the personalization data to be sent t the IC card application. Depending on
the Processing Step for IC card personalization processes this device must have
access to a security module (HSM) to establish and operate a secure channel
between the personalization device on the one hand and the application on an IC
card on the other. If the Processing Step indicates the pre-computed APDU
commands as personalization data then the commands to establish the secure
channel are part of the pre-computed APDU commands therefore the
personalization device is not required to explicitly establish the secure channel with
the IC card application. The secure channel services consist of MAC verification/
generation e.g. on commands sent to the application, and decryption and re-
encryption of secret data e.g. PIN values. Personalization device processing is
described in Chapter 3.
The IC card application receives the personalization data from the personalization
device and stores it in its assigned location, for use when the EMV card application
becomes operational.
Section 4.1 describes the processing requirements for an EMV card application that
must be performed prior to the start of personalization. The actual processing of the
EMV card prior to personalization (pre-personalization) is outside the scope of this
specification. However it is assumed that the EMV card application will have secure
channel keys established for personalization prior to the start of the personalization
process.
• Standard security between the personalization device and the IC card. This is
summarized in section 1.3.
• Standard commands for sending personalization data to the IC card application.
These are summarized in section 1.4.
• A standard record format for the personalization data sent to the personalization
device. This is summarized in section 1.5.
Two derived keys on the IC card are used during the establishment of the secure
channel. These are the KENC, used to generate a session key SKUENC which is in
turn used to create and validate authentication cryptograms, and the KMAC, used to
generate a session key SKUMAC which is in turn used to compute the MAC of the
EXTERNAL AUTHENTICATE command. Both of these keys (KENC and KMAC) are
derived from the same master key, the KMC. When the secure channel is to be
established explicitly by the personalization device the IC card provides the
personalization device with the identifiers of the KMC and the derivation data used
to create the derived keys. The identification of the KMC is described in section
3.1.1. The creation of derived keys is described in section 4.1. Once a secure
channel is established, personalization data can be sent to the IC card application.
Based on the security level set in the EXTERNAL AUTHENTICATE command, the
SKUENC may also be used to encrypt the command data field, and the SKUMAC to
produce the Command Message Authentication Code (C-MAC). In Direct method
the APDU commands are pre-computed according to the requested security level by
the data preparation system rather than by the personalization device.
In order to reduce personalization time, the data preparation process organizes the
personalization data to be sent to an EMV card application by the personalization
device into data groupings. A Data Grouping Identifier (DGI) identifies each data
grouping. The IC card application uses the DGI to determine how the data grouping
is to be processed after it is received from the personalization device. Much of the
data for an application is organized into records within the application when the
application is designed. Where this is the case, the easiest way to create data
groupings for an application is to make each record in the application a data
4 Card Personalization Data Processing July 2007
grouping. The principles of data grouping are described in section 2.2. In the
Indirect method the personalization devices parse the input record and create a
STORE DATA command for each data grouping or group of data groupings (see section
2.4.5) in the input record.
Some data groupings will contain data that must be kept secret during transmission
from the personalization device to the card application; this can be done using a
secret key known on either side of this interface. In this case an additional derived
key (KDEK) on the IC card is used to generate a session key SKUDEK. The KDEK is
derived from the same master key (KMC) as the KENC and KMAC. The IC card
provides the personalization device with the identifiers of the KMC and the
derivation data used to create the derived key. The SKUDEK, described in section 5.3
may be used for this encryption. In addition to this requirement for security, the
secure messaging described in section 1.3 provides the option for two additional
security features: the C-MAC and command data field encryption for all subsequent
STORE DATA commands.
In the Direct method the data grouping or group of data groupings are wrapped into
the pre-computed STORE DATA commands and the data groupings containing secret
data have been encrypted under the IC card’s SKUDEK by the data preparation
system.
There will be a MIC that identifies data to be placed on an IC card. The exact MIC
used for personalization data must be established between the data preparation
processing system(s) and the personalization device processing system(s). In Figure
1, which shows the organization of personalization data for the IC card module,
MIC2 is used to represent the IC card personalization data. MIC1 and MIC3
indicate non-ICC personalization data.
5 Card Personalization Data Processing July 2007
The header portion of this record contains information that is common to all IC card
applications to be personalized. Header information is described in Table 8.
An overview of the format of the data for each application is shown in Figure 2.
• data to be logged
The second part of the data for an IC card application is the data to be logged for
that application. However, the personalization device is not aware of what data
is contained in the data groupings. Therefore, data that must be logged must be
sent to the personalization device in a manner that indicates that this is data
that must be logged. The data preparation process for the application must
perform this task and instruct the personalization device. The data to be logged
may be a duplicate copy of some of the data to be sent to the IC card application.
See section 2.5 for additional information.
A complete description of the format for the personalization data for an IC card
application is given in section 2.6.
7 Data Preparation July 2007
2 Data Preparation
The data preparation process creates application data that is used to personalize the
IC card application and depending on the Processing Step the Personalization
Device Instructions (PDI) data that are used to direct the personalization process.
Whatever is produced by the data preparation process must be transported securely
to the personalization device itself (unless it is created in an HSM attached to the
personalization device). Any secret data created by the data preparation process
remotely from the personalization device must therefore be encrypted before
transmission and all data files generated remotely from the personalization device
must be protected by a Message Authentication Code (MAC) before transmission.
For Indirect method where the personalization device computes the APDU
commands the data preparation process consists of the following five steps:
For Direct method where the data preparation system computes the APDU
commands the data preparation process consists of the following five steps:
Other processes may also use one or more of the master keys used by the
personalization process. In this circumstance, a method of importing or exporting
master keys to allow appropriate data sharing between processes will be required.
Prior to the personalization process the identifier of the personalization master key
KMCID, key version number, KEYDATA and the corresponding relevant keys, must
be placed onto the card. KMCID and key version number are used to access the issuer
personalization master key (KMC) in order to derive the card unique static keys
using diversification data (KEYDATA).
The 6 byte KMCID (e.g. IIN right justified and left padded with 1111b per quartet)
concatenated with the 4 byte CSN (least significant bytes) form the key
diversification data that must be placed in tag ‘CF’. This same data must be used to
form the response to the INITIALIZE UPDATE command.
Application level symmetric DES secret keys for transaction certificate generation
etc. must be created during data preparation. In most cases such keys are derived
from appropriate issuer master keys.
If public key technology (DDA/CDA) is supported in the card, then a card level EMV
application RSA key pair must be generated and certified by the issuer. A second
1 If the CSN does not ensure the uniqueness of KEYDATA across different batches of cards other unique data (e.g. 2
right most bytes of IC serial number and 2 bytes of IC batch identifier) should be used instead.
9 Data Preparation July 2007
application RSA key pair may be required for PIN decipherment. The issuer
certificate(s) corresponding to the issuer private key used to certify the application
public key(s) must also be stored in the application.
The design of the data groupings plays a key part of the personalization process.
The application designer will have created default file and record definitions. An
optional file structure creation mechanism is defined in Annex A.5.
In general, a data grouping should be a record for the application. As all of the data
in a grouping will be sent to the IC card application in a single command, having a
data grouping based on a record will reduce the processing required by the IC card
application.
The following requirements and guidelines shall be used when creating data
groupings:
1. All data elements to be sent to the IC card during the personalization process
must be placed in a data grouping.
2. DES keys must be placed in a data grouping that consists of only DES keys.
More than one data grouping of DES keys may be created.
3. For ease of IC card management, most, if not all, of the content of each data
grouping should be identical to the content of a record for the application.
4. When assigning identifiers for data groupings, use of a combination of the
SFI and the record number is recommended. For the DGIs with the first byte
equal to ‘01’ through ‘1E’, the first byte indicates the SFI in which the data is
to be stored and the second byte indicates the record number within the SFI.
5. The first two or three data bytes of any DGI for the EMV application in the
range ‘01xx’ through ‘0Axx’ will consist of a record template tag ‘70’ and the
length of the remaining record data.
6. There are benefits from grouping all fixed length data elements together, and
placing all variable length data elements into another data grouping.
7. It is recommended that the length of data in a data grouping does not exceed
237 bytes.
8. Application designers do not usually place data elements that are only used
by internal IC card application processing in records. However, these data
elements must be placed in one or more DGIs. It is recommended that these
DGIs contain only data elements used exclusively for internal IC card
application processing.
9. If an application contains information in its FCI (the response to the SELECT
command) that is dependent on the personalization data, one or more data
groupings must be created for the FCI data.
10. Data grouping identifiers (DGI) ‘9F60’ through ‘9F6F’ are reserved for
sending payment systems proprietary data, e.g. card production life cycle
(CPLC) data to the IC card (rather than the application) and must not be
used as a DGI by an EMV CPS compliant application.
11 Data Preparation July 2007
11. Data grouping identifiers (DGIs) ‘7FF0’ through ‘7FFE’ are reserved for
application-independent personalization processing and must not be used as
a DGI by an EMV CPS compliant application.
12. Data grouping identifiers (DGIs) ‘8F01’, ‘7F01’ and ‘00CF’ are reserved
respectively for the secure channel derived keys, the key related data and the
key derivation data and must not be used as a DGI by an EMV CPS
compliant application for other purposes.
13. Data grouping identifiers (DGIs) ‘0062’ is reserved for file structure creation
and must not be used as a DGI by an EMV CPS compliant application for
other purposes.
14. The number of data groupings should be minimized to improve performance
during the personalization process.
15. If the data grouping is to be encrypted and the data is a DES key or PIN
Block data, no padding is required. Otherwise all data must be padded. Such
padding is accomplished by appending an ‘80’, followed by 0-7 bytes of ‘00’.
The length of the data part of the data grouping must be a multiple of 8-
bytes.
16. The Key Check Value for any DES key will be computed by encrypting 8
bytes of ‘00’ using ECB 3DES with the key concerned. The Key Check Value
is defined in section 6.15.
17. It is recommended that the data preparation system generate the Reference
PIN Block according to ISO 9564-1 format 1. The card application must
reformat the PIN Block if necessary.
18. The data within a DGI with a leftmost byte of the identifier in the range of
‘80’ to ‘8F’ is always encrypted. Nevertheless, encrypted data may also be
included in a DGI outside this range.
The DGI must be coded on two bytes in binary format, followed by a length indicator
coded as follows:
On 1-byte in binary format if the length of data is from ‘00’ to ‘FE’ (0 to 254
bytes).
On 3-byte with the first byte set to ‘FF’ followed by 2 bytes in binary format
from ‘0000’ to ‘FFFE’ (0 to 65 534), e.g. ‘FF01AF’ indicates a length of 431
bytes.
This DGI can in turn be used as the command body of a final STORE DATA command
issued in the personalization of the EMV application. The DGI ‘7FFF’ is not
mandatory.
Independently of the DGIs (including ‘7FFF’), the personalization device shall set b8
of the P1 parameter in the last STORE DATA command to 1b, indicating the
completion of personalization for the application.
The personalization device instructions are special instructions that are created
during the data preparation process and are used by the personalization device
during the personalization process. The personalization device instructions are not
sent to the card.
At this point no personalization device instructions are defined for the Processing
Step ‘0B’.
Order – The order in which data groupings must be sent to the IC card application
is specified in this instruction.
Group – Any set of data groupings that must be sent to the IC card application
within one STORE DATA command is specified with this instruction.
Security Level – The expected security level of the secure channel to be established
between the personalization device and the IC card application.
If the orders of STORE DATA command are set to ‘00’ for Order #1 and Order #n then
there is no requirement that Order #1 must be sent to the IC card before Order #n.
The DGI entries must be concatenated together without separators. For example, if
DGIs ‘0101’ and ‘0019’ were the DGIs in Order # 1, they would be coded ‘01010019’.
14 Data Preparation July 2007
When a DGI is part of a set of GROUPed DGIs, for example DGI ‘0129’ is part of
GROUP ‘02080129’ and should be sent to the IC application after DGI ‘0101’ then
the Order #n should be ‘01010208’.
version control field (VERCNTL) in the IC Card Application Data (see Table 12) is
the mechanism to signal to the personalization device what are acceptable
rejections. The contents of the VERCNTL field are shown in Table 4. If a DGI is
listed in VERCNTL field and the response from the IC card application is ‘6A88’
(considered a rejection of a data grouping), the personalization process must not be
aborted.
The DGI entries must be concatenated together without separators. For example, if
DGIs ‘0101’ and ‘0029’ may be rejected without error, they would be coded
‘01010029’.
The specifications for the encryption process appropriate to a given data grouping for
the IC card application must match the equivalent encryption process, either in the
data preparation process or in a local process associated with the personalization
device.
Normally the encryption process of the card application mirrors that of the data
preparation process. Since the encryption process for the EMV application is in ECB
mode (if the FORMATTK ‘00’ is used), the encryption of the prepared data must also
be done in ECB mode. In this case the personalization device decrypts the DGI in
ECB mode using the Transport Key before re-encrypting it in ECB mode under the
card secure channel session key SKUDEK.
The use of this random number mechanism must be indicated by the setting of
TYPETK. In particular the TYPETK in Table 10 takes a value of “TK using RANDOM
field and XOR operation” (b7=1, b6=0) as described in Table 25. In this case the
secret data must be XORed with the random number prior to encryption and after
decryption.
If the RANDOM field is shorter than the data to be XORed, the data to be XORed
must be divided into blocks the length of the RANDOM field. If the final block is
shorter than the RANDOM field, the leftmost bytes of the RANDOM field must be
used to XOR the short block.
The random number to use is contained in the RANDOM field as shown in Table 8.
If ISO 9564-1 format 1 is used to transport the PIN block, the use of the above
random number method to diversify the PIN block during transportation is
unnecessary. In this case, if the PIN block format stored within the card application
is different from ISO 9564-1 format 1, the IC application must reformat the PIN
block (e.g. to the format defined in the EMV VERIFY command).
The DGI entries must be concatenated without separators. For example, if DGIs
‘0208’ and ‘0029’ were the Grouped DGIs in GROUP # 1, they would be coded
‘02080029’. The Personalization Device must set the STORE DATA command with
17 Data Preparation July 2007
DGI ‘0208’ followed by DGI ‘0029’ (including identifier, length and content of each
DGI).
When only one security level is required for the entire personalization session
of an application only one SECLEV field shall be present in the PDI.
A value of ‘FF’ in the SECLEV indicates that more than one security levels of
secure channel are required for the personalization of the application.
If several security levels are specified, a DGI shall appear only once in the
DGI list associated to security levels.
When several security levels are specified, each security level requires to a
new secure channel initiation.
The LASTSCS field indicates whether the personalization is complete and the
personalization device shall set b8 of P1 of the last STORE DATA command to 1 or
not. If value of this field is set to ‘01’ it indicates that the personalization of the
application is not complete yet and further process is required. Note that further
process may be in a subsequent Processing Step or in another personalization
session that is out of scope of this document.
18 Data Preparation July 2007
The record format allows card management data for personalization as well as
functions other than personalization to be included in the file. These functions are
referred to in this document as processing steps. Examples of other types of card
management data are load or install application.
Table 8 provides the details of the format for the EMV card application data.
Sections 1 and 2 of the data format provide the details for the data that is common
to all IC card applications. Section 3 provides the details of the data for the first IC
card application (the EMV application); there must be as many section 3s as the
value of COUNTAID. They must be presented in the same order as in the list of AIDs
in section 2 of Table 8.
The data for an application has four parts. These are identified as a, b, c and d in
sections 3 of Table 8.
The first part (a) is processing data for the personalization device for the IC card
application. This part of the data is subdivided into parts “a1” and “a2”.
The second part (b) is the data for the IC card application to be logged by the
personalization device.
20 Data Preparation July 2007
The third part (c) is the data to be sent to the IC card application.
The fourth part (d) is the MAC related information for the IC card application data.
2 A personalization system implementing VNL 02.2 shall accept a MIC with VNL = 02.1
21 Data Preparation July 2007
The data in the ICC Data field has been “tagged” to allow it to contain data for other
processing steps and personalization data. The format is shown in Figure 3.
26 Data Preparation July 2007
If personalization using DGIs within the ICC Data field is step #2 of the processing
steps, Figure 4 shows how the value portion for step #2 is expanded into the data
layout for personalization data. The value of the field TAG for this format is ‘EF’ so
personalization data within ICC data field for step #2 will be identified by tag ‘EF’.
The length field for this tag is BER-TLV encoded. The data for this tag is the data
groupings for the IC application.
If the data to be sent to the IC card is to be encrypted based on the ENC field (see
section 2.4.3), only the value portion of the data grouping is encrypted. The DGI and
the length field are not encrypted.
The SELECT command is used, with the AID retrieved from the input data, to select
the application to be personalized.
The INITIALIZE UPDATE command provides the IC card with a personalization device
random number to be used as part of cryptogram creation. The IC card responds
with:
• A card-maintained sequence counter (for each secure channel key set) to be used
as part of the session key derivation.
• A card challenge to be used as part of cryptogram creation.
• A card cryptogram that the personalization device will use to authenticate the IC
card.
• An identifier and a version number of the KMC and the derivation data for the
KENC, KMAC and KDEK.
• The Secure Channel Protocol identifier.
The personalization device authenticates itself to the IC card application via the
EXTERNAL AUTHENTICATE command by providing a host cryptogram for the IC card
application to authenticate. The level of security to be used in subsequent
commands is also specified in the EXTERNAL AUTHENTICATE command.
If there are more applications to be personalized, then the next AID is retrieved
from the input data and the process described above is repeated with a new SELECT
command.
3.1.1.1 The personalization device and the entity that loads the KENC, the KMAC
and the KDEK to the IC card application prior to personalization, share the
KMC. Personalization device processing must be able to identify the KMC
in the personalization device key storage by an issuer identifier and a
version number. The identifiers of the KMC for use with a specific IC card
will be retrieved from the IC card itself (see Table 15).
3.1.1.2 The TK must be used without modification. The KMC must be used to
create card static derived keys which must in turn be used to create
session keys for communicating with the IC card application (see section
5.3).
3.1.2.1 The personalization device must read an IC Card Application Data record
(see Table 8) for each IC card to be personalized, and reset the IC card.
3.1.2.3 If present, data grouping ‘7FFF’ must be retrieved from the input record
and must be used as the data to be sent to the IC card application with the
last STORE DATA command. The ORDER within PDI field may override
this requirement.
3.1.2.4 The AID of each application to be personalized must be retrieved from the
data record for the IC card (see Table 8).
3.1.2.5 A series of STORE DATA commands are sent to the IC card application,
followed by a final STORE DATA command (see also LASTSCS in Table 7).
3.1.2.6 The card, the application and the personalization device must be
compatible with the interface requirements defined in EMV Version 4.1
Book 1.
3.1.2.7 The personalization device must use the information contained within the
Answer to Reset (for example negotiable mode) to determine the card
capabilities as a basis for choosing a mode of operation to minimize
personalization time.
31 Personalization Device-ICC Interface July 2007
Figure 6 summarizes the flow of commands and responses that must occur between
the personalization device and the IC card.
Personalization
Device IC
Card
Reset
ATR
SELECT
FCI
INITIALIZE UPDATE
EXTERNAL AUTHENTICATE
Commands repeated for
each application to be OK
personalized
Command repeated for STORE DATA
each block of data to be
inserted into card OK
OK
The Processing Step with the indicator ‘0B’ as value for the field ACT is used with
pre-computed APDU commands. The value of the field TAG for this format is ‘EE’.
There are no explicit Personalization Device Instructions and therefore the PDI field
is empty.
For the Processing Step ‘0B’ the personalization device activates the IC card (Reset)
and the IC card responds with Answer To Reset (ATR).
For each pre-computed APDU command the parsing information for APDU case (see
ISO/IEC 7816-3) related instructions and the length (BER encoded) of the pre-
computed APDU are pre-pended to the pre-compute APDU command. The data
preparation system incorporates a pre-computed APDU command as the value of a
BER–TLV structure as shown in Figure 7. The length of a tag itself is one byte.
32 Personalization Device-ICC Interface July 2007
• Tag ‘86’ - Push command: The card command or the command response
shall not be returned to the issuer.
• Tag ‘C1’ - Pull command: The command response shall be returned to
the issuer.
• Tag ‘C7’ - Dialogue command: The card command and the command
response shall be returned to the issuer.
• Tag ‘C9’ - Error Bypass flag: The error bypass flag see requirement
3.2.1.4.
3.2.1.2 If the value field of a tag is not present, the personalization device shall
interpret this as a request to perform a card reset.
3.2.1.3 If the pre-computed APDU command in the value field of the tag is
present and its length is shorter than 4 bytes or longer than 261 bytes,
then it implies a syntax error.
In some cases, card-reader specific protocols may impose upper limits on the length
of commands. If the command cannot be sent due to this reason, a length limit error
shall be generated.
• The value field of the error bypass flag is a single byte equal to ‘01’. If
the value is different, a syntax error shall be generated.
• A command has an error bypass flag if the error bypass flag TLV
element precedes the pre-computed APDU command TLV element. An
error bypass flag that is not followed by a command shall generate a
33 Personalization Device-ICC Interface July 2007
syntax error.
3.2.1.5 A command with an error bypass flag shall not result in termination of
the personalization process in case of APDU command processing error.
The SELECT command will be issued once for each IC card application to be
personalized.
3.2.4.1 The SELECT command must be coded according to EMV Version 4.1 Book
1. There are no application-dependent status conditions associated with
this command.
3.2.4.2 The AID in the SELECT command for the Processing Step ‘0F’ is obtained
from section 3a.1 of the input data record for the application (see Table 8).
3.2.4.3 The response to the SELECT command is not used to direct processing by
the personalization device. The data in the FCI (the response to the
SELECT command) may be added or changed during the personalization
process.
35 Personalization Device-ICC Interface July 2007
The INITIALIZE UPDATE command will be issued once for each secure channel
initiation. It shall be issued at least once for each IC card application to be
personalized.
3.2.5.2 The INITIALIZE UPDATE command must be coded as shown in Table 13.
RTERM is generated by the personalization device. Table 14 shows the
response to a successful INITIALIZE UPDATE command. Table 16 lists
36 Personalization Device-ICC Interface July 2007
status conditions that may occur, in addition to the general ones listed in
ISO/IEC 7816-3.
Field Length
KEYDATA (See Table 15) 10
Version number of the master key (KMC) 1
Identifier for Secure Channel Protocol (ALGSCP = 1
‘02’)
Sequence Counter 2
Card challenge (RCARD) 6
Card cryptogram 8
SW1 SW2 2
3.2.5.3 The Key Version Number defines the key set Version Number to be used
to initiate the Secure Channel Session. If this value is zero, the default
key set for the selected application shall be used. While implementing this
feature is required utilizing this feature is optional depending on the
personalization context (e.g. if the entity personalizing the EMV
37 Personalization Device-ICC Interface July 2007
3.2.5.4 If the value indicates a Key Version Number that is not present or
indicates a Key Version Number that is incomplete (i.e. the Key Version
Number does not contain Key Identifiers 1, 2 and 3), a response of '6A88'
shall be returned.
3.2.5.6 The identifier of the KMC is part of the response data to the INITIALIZE
UPDATE command and it facilitates locating the issuer’s KMC.
3.2.5.7 The first 6 bytes of KEYDATA returned from the INITIALIZE UPDATE
command are used to identify the master key for secure messaging (KMC).
The six least significant bytes of KEYDATA are used as key
diversification data. The personalization device must use the KMC and
KEYDATA to generate the KENC, the KMAC and the KDEK for this IC card,
as defined in section 4.1. These keys must have been placed in the IC card
prior to the start of the personalization process.
3.2.5.8 Subsequent processing must use the identifier for Secure Channel
Protocol (ALGSCP) in the response to the INITIALIZE UPDATE command to
determine how to create MACs and when to create session keys.
The session keys must be calculated during processing of the INITIALIZE UPDATE
response using data from the IC card. The session keys must be calculated as
described in section 5.3.
A pseudo-random card challenge generation algorithm in the card provides the data
preparation system with the ability to pre-compute the card challenge as opposed to
being random. This allows an off-card entity, with knowledge of the relevant Secure
Channel secret keys and the ability to track the Secure Channel Sequence Counter,
to pre-compute an authentication sequence without first communicating with the
card.
3 Implementation of the pseudo-random card challenge as defined in this requirement is mandatory unless issuer
policy requires a random number generation in which case the card may implement a switch so at the initialization
of the card it would be possible to choose a random or pseudo-random card challenge. Note that it is not possible to
generate the pre-computed APDU command at the data preparation for a card implementing a random as card
challenge.
38 Personalization Device-ICC Interface July 2007
• A MAC is calculated across the padded data using single DES plus
final triple DES, the SKUMAC session key and an ICV of binary zeroes;
• The six leftmost bytes of the resultant MAC constitute the card
challenge.
3.2.5.10 The personalization device must verify the card cryptogram in the
response to the INITIALIZE UPDATE command by generating a duplicate
cryptogram and comparing it to the value returned in the response. The
card cryptogram is a MAC created as described in section 5.4.1 using key
SKUENC and the data to be MACed is = RTERM (8 bytes)|| Sequence
Counter (2 bytes) || RCARD (6 bytes). If the card cryptogram does not verify
correctly, personalization processing must be terminated and a log of the
process written, as described in section 3.4.
The EXTERNAL AUTHENTICATE command will be issued once for each secure channel
initiation. It shall be issued at least once for each application to be personalized.
3.2.6.3 If the secure messaging bit of the class byte (bit 3) is not set, a response of
'6E00' shall be returned.
3.2.6.4 The security level is determined by the SECLEV field within the PDI.
b8 b7 b6 b5 b4 b3 b2 b1 Description
0 0 0 0 0 0 1 1 Encryption and MAC
0 0 0 0 0 0 0 1 MAC
0 0 0 0 0 0 0 0 No security
3.2.6.7 The C-MAC must be calculated by the personalization device and verified
by the IC card as described in section 5.4.2.
3.2.7.1 The CLA byte of the STORE DATA command must be consistent with the
security level of secure messaging set in EXTERNAL AUTHENTICATE
command (CLA = ‘80’ if security level = ‘00’, otherwise CLA = ‘84’).
3.2.7.2 The version of the STORE DATA command used to personalize the IC card
applications must be coded as shown in Table 20. One or more triplets
(DGI, Length, Data body) may be sent. The response to the STORE DATA
consists usually of SW1 SW2. Table 22 lists the status conditions that
may occur in addition to those specified in ISO/IEC 7816-3.
b8 b7 b6 b5-b1 Meaning
x Last STORE DATA command indicator
1 Last STORE DATA command
0 Not the last STORE DATA command
x x Encryption indicators:
1 1 All DGIs encrypted under SKUDEK
0 0 No DGI is encrypted4
0 1 Application dependent5
1 0 RFU
xxxxx RFU6
3.2.7.3 If the card implements extended APDU command data lengths as in ISO
7816-4 (indicated in the third software function of the card capabilities
of the Answer To Reset historical bytes), then the DGI or grouped DGIs
(if indicated by the GROUP instruction), must be sent to the IC
application in one STORE DATA command.
3.2.7.4 If the card does NOT implement extended APDU command data length
and the final length of an intended STORE DATA command data field
(data grouping(s) and possible MAC) would be more that 255 bytes, then
the DGI or grouped DGIs must be sent to the card in multiple STORE
DATA commands as follows:
• The first APDU contains a STORE DATA command according to
Table 20, truncated at the maximum allowable length (Lc equals
255 bytes including possible MAC).
• The subsequent APDU contains a STORE DATA command with any
remaining data as command data, possibly again truncated at the
maximum allowable length (Lc less than or equal to 255 bytes
including possible MAC).
4 The IC application may ignore or override this value to protect itself against intrusion. For example, the
application must reject a clear text DGI if it expects to receive it always encrypted.
5 For example, this bit can be set to indicate that some but not all of the DGI data is encrypted.
6 RFU values are ignored by the IC application.
43 Personalization Device-ICC Interface July 2007
3.2.7.5 The application is responsible for managing any DGI data that spans
more than one STORE DATA command. For the first STORE DATA
command, the application will use the length of the last (or only) DGI, and
the actual length of the DGI data, to determine whether a subsequent
STORE DATA command is expected. For subsequent STORE DATA
commands, the application concatenates the segments of data until the
total length of the data equals the DGI length in the first STORE DATA
command. Any inconsistency between the total length of the data
segments in the STORE DATA commands, and the DGI length, shall cause
an SW1SW2 of ‘6A80’ to be returned by the card.
3.2.7.6 The personalization device must set P2 to ‘00’ for the first STORE DATA
command sent to the IC card application. The personalization device must
then increment the value of P2 by 1 for each subsequent STORE DATA
command7.
3.2.7.7 If the FORMATTK field in the input record is set to ‘00’ and a DGI is listed
in the ENC field in the input record, the TK identified in the input record
must be used to decrypt the data created by the data preparation process.
After the input data is decrypted as described in section 3.2.7.8, it must be
re-encrypted prior to sending it to the IC card as described in section
3.2.7.12. Only the data portion of the data grouping is encrypted. The
DGI and length field are not encrypted.
3.2.7.8 If the FORMATTK field in the input record is set to ‘00’ and the encryption
type for the DGI listed in field ENC is ‘11’, decryption of data by the
personalization device must be done in ECB mode. This mode is
illustrated in section 5.6.1. Triple DES (as presented in section 5.6.1.3) is
used to decrypt each block.
3.2.7.9 If the FORMATTK field in the input record is set to ‘01’ and a DGI is listed
in the “DGIs for TK” field (as shown in Table 10) in the input record, the
TK identified in the input record must be used to decrypt the data created
by the data preparation process as described in section 3.2.7.10. If the
same DGI is listed in the ENC field in the input record, after the input
data is decrypted, it must be re-encrypted prior to sending it to the IC
card as described in section 3.2.7.12. Only the data portion of the data
grouping is encrypted. The DGI and length field are not encrypted.
3.2.7.10 If the FORMATTK field in the input record is set to ‘01’ and the CMODE
field (as shown in Table 10) is set to ‘11’, decryption of data by the
personalization device must be done in ECB mode. This mode is
illustrated in section 5.6.1. Triple DES (as presented in section 5.6.1.3) is
used to decrypt each block.
3.2.7.11 If a DGI is listed in the ENC field in the input record, after the input data
is decrypted, it must be re-encrypted prior to sending it to the IC card as
described in section 3.2.7.12. Only the data portion of the data grouping is
encrypted. The DGI and length field are not encrypted.
3.2.7.12 If the encryption type for the DGI listed in field ENC is ‘11’, the
personalization device uses the session key SKUDEK to encrypt the data.
Encryption must be done in ECB mode. This mode is illustrated in section
5.5.1. Triple DES (as presented in section 5.5.1.3) is used to encrypt each
block.
3.2.7.13 If all DGIs within STORE DATA command are encrypted the
personalization device must set b7 of P1 to 1, and b6 of P1 to 1. Based on
this setting of P1, the IC card must use session key SKUDEK to decrypt
each individual DGI data in ECB mode. This mode is illustrated in
section 5.6.1. Triple DES (as presented in section 5.6.1.3) is used to
decrypt each block.
3.2.7.14 If some DGIs within STORE DATA command are encrypted the
personalization device must set b7 of P1 to 0, and b6 of P1 to 1. Based on
this setting of P1 the IC application must have the knowledge of which
DGIs are encrypted. The IC card must use session key SKUDEK to decrypt
each individual encrypted DGI data in ECB mode. This mode is
illustrated in section 5.6.1. Triple DES (as presented in section 5.6.1.3) is
used to decrypt each block.
3.2.7.17 If the SW1 SW2 that is returned by the IC card is ‘6A88’, the input data
record for the IC card application must be checked for the presence of the
field VERCNTL. If the Data Grouping Identifier (DGI) that was rejected
by the IC card is listed in field VERCNTL, normal processing must
continue and the C-MAC must be saved to be used in the computation of
the next C-MAC i.e. it is prepended to the next command data body, and it
is this modified command data body that is MACed, using an IV of eight
‘00’ bytes. If the data grouping DGI is not listed in field VERCNTL,
personalization processing of the IC card application must be ended. The
IC card must be rejected and an error log entry written as described in
45 Personalization Device-ICC Interface July 2007
section 3.4.
3.2.8.1 Last STORE DATA command is indicated to the IC card application by the
setting of bit 8 of P1 to 1b by the personalization device. If the conditions
to transition the status of the application to “PERSONALIZED” are not
satisfied as a result of missing DGIs or missing data element(s), the SW1
SW2 ‘6A86’ may be returned by the application. Other status conditions
may be used and are specific to the application.
3.2.8.2 Data grouping ‘7FFF’, if present, must be retrieved from the input record
and must be used as the data to be sent to the IC card application with the
last STORE DATA command. The ORDER field within PDI may override this
rule.
3.2.8.3 If the IC card application being personalized uses DGI ‘7FFF’, there may
be additional status conditions that are specific to the application.
Beside specific behavior defined for each command in section 3.1.2 when a
personalization device receives an SW1SW2 code different from ’9000’, ’6A88’, ‘61xx’
or ‘67xx’; it shall abort the personalization process for the application if recovery is
not possible.
3.4.1.1 The personalization log must include the identifier of the personalization
bureau in the header record.
47 Personalization Device-ICC Interface July 2007
4.1.1.1 Unless the card is capable of dynamically building files and records and
initializing them to binary zeros, files must have been built with space
allocated for the data described in the specifications for the IC card
application and the space must be initialized to binary zeros.
4.1.1.3 If the File Control Information (FCI) for the application is not to be
personalized, it must be created prior to personalization.
4.1.1.5 The version number of the personalization master key (KMC) used to
generate the initial personalization keys (the KENC, the KMAC and the
KDEK) for each application must be on the IC card.
4.1.1.6 A derived key (KENC) must be generated for each IC card and placed into
the application. This key is used to generate the card cryptogram and to
verify the host cryptogram. This key is also used to decrypt the STORE
DATA command data field in CBC mode if the security level of secure
messaging requires the command data field to be encrypted.
The KENC will be derived in the following way: KENC := DES3(KMC)[Six least
significant bytes of the KEYDATA || ’F0’ || ‘01’ ]|| DES3(KMC)[ Six least
significant bytes of the KEYDATA || ‘0F’ || ‘01’].
50 IC Card Personalization Processing July 2007
4.1.1.7 A derived key (KMAC) must be generated for each IC card and placed into
the card. This key is used to verify the C-MAC for the EXTERNAL
AUTHENTICATE command and also to verify the C-MAC for the STORE
DATA command(s) if the security level of secure messaging requires a
MAC of the command data.
The KMAC will be derived in the following way: KMAC := DES3(KMC)[ Six
least significant bytes of the KEYDATA || ’F0’ || ‘02’ ]|| DES3(KMC)[ Six
least significant bytes of the KEYDATA || ‘0F’ || ‘02’].
4.1.1.8 A derived key (KDEK) must be generated for each IC card and placed into
the card. This key is used to decrypt in ECB mode secret data received in
the STORE DATA command.
The KDEK will be derived in the following way: KDEK := DES3(KMC)[ Six
least significant bytes of the KEYDATA || ’F0’ || ‘03’ ]|| DES3(KMC)[ Six
least significant bytes of the KEYDATA || ‘0F’ || ‘03’].
4.1.1.9 For each Secure Channel key set the sequence counter to be returned in
the response to the INITIALIZE UPDATE command must be initialized to
’0000’.
4.2.1.1 Each key set requires three static keys KENC, KMAC and KDEK and a
sequence counter that must be initialized to ’0000’.
51 IC Card Personalization Processing July 2007
Annex A.5 provides an optional mechanism to submit the file structure creation
instructions within a DGI to the application using STORE DATA command.
4.4.2.2 Each IC card must maintain a sequence counter for each secure channel
key set version that can be returned in the response to the INITIALIZE
UPDATE command. This counter must be incremented by 1 after each
successful EXTERNAL AUTHENTICATE command. Every time a key set
version is updated with new set of keys its sequence counter must be
initialized to ’0000’.
4.4.2.3 If the IC card application does not recognize the DGI in the STORE DATA
command, it must respond with an SW1 SW2 of ‘6A88’.
4.4.3.1 Commands requiring a MAC shall include an 8 byte C-MAC that must be
verified by the IC card prior to accepting the command. If the C-MAC
fails to verify successfully, the IC card must reject the command with SW1
SW2 = ‘6982’ and the secure channel session is terminated.
4.4.3.2 To verify a C-MAC, the IC card must generate a duplicate C-MAC and
compare it with the C-MAC included in the command data. The C-MAC
must be calculated as described in section 5.4.2.
4.4.3.3 If the C-MAC is verified, the IC card application must retain the C-MAC
from each command to be concatenated to the beginning of the next APDU
for the computation of the next C-MAC. The C-MAC must be retained for
a command even if the response to the command is not ‘9000’.
4.4.3.5 The secure channel described in this document is compliant with Secure
Channel Protocol '02' - implementation option '55'8 as defined in Appendix
E of the GlobalPlatform Card Specification.
8 Implementation of pseudo-random generation as defined in the section 3.2.5.9 unless issuer policy requires a
random number generation as opposed to pseudo-random number generation in which case the secure channel shall
be compliant with Secure Channel Protocol ‘02’ – implementation option ‘15’ as defined in Appendix E of the
GlobalPlatform Card Specification.
53 IC Card Personalization Processing July 2007
Data Perso IC
Prep Device Card
The purpose of having two key zones is to enable the data preparation process to be
independent of the IC card type, as far as possible.
Data IC
Prep Card
5.3.1.1 All encryption, decryption and MACing in commands that are sent to the
IC card must be performed using session keys (SKUENC, SKUMAC, and
SKUDEK).
5.3.1.2 Session keys must be calculated using the triple DES algorithm presented
in section 5.5.2.3 and the base keys KENC, KMAC, and KDEK to produce
SKUENC, SKUMAC, and SKUDEK respectively.
The session keys must be calculated for each IC card secure channel key set
used during processing of the INITIALIZE UPDATE command using a
sequence counter of the key set version provided by the IC card. See section
3.2.5 for specifications for the INITIALIZE UPDATE command.
These session keys are used for all cryptography for personalizing the IC
card application until the completion of the last STORE DATA command. See
section 3.2.8 for specifications for the last STORE DATA command.
5.4 MACs
The personalization process creates MACs for three purposes:
5.4.1.2 The full triple DES MAC is as defined in ISO 9797-1 as MAC Algorithm 1
with output transformation 1, without truncation, and with triple DES
taking the place of the block cipher.
5.4.1.3 All 64 bits of the final output block are used as the MAC created for
personalization cryptograms.
Based on the security level set in the EXTERNAL AUTHENTICATE command, secure
messaging may also be required for the following personalization command:
58 Cryptography for Personalization July 2007
Note: To avoid confusion with the MAC function defined in 5.4.1, C-MAC is
used as the name of the function to generate a secure message MAC and as
the name of the secure message MAC.
59 Cryptography for Personalization July 2007
• The value of Lc in the data to compute the C-MAC must reflect the
presence of the C-MAC in the command data, i.e. Lc = Lc + 8.
• The class byte shall be modified to indicate that this APDU
includes secure messaging. This is achieved by setting bit 3 of the
class byte. A STORE DATA command that contain C-MAC will have
a class byte of '84'.
If both the STORE DATA command and the security level of the
EXTERNAL AUTHENTICATE command specify encryption, the
encryption required by the STORE DATA command will be done
before the C-MAC is computed and the EXTERNAL AUTHENTICATE
encryption will be done after the C-MAC is computed.
The specific rules are:
o Data groupings that are sent to the IC card with a P1 setting in
the STORE DATA command indicate that the data is encrypted
under the SKUDEK before the C-MAC is computed.
o If the security level in the EXTERNAL AUTHENTICATE command
indicates that both encryption and MACing are used, the C-
MAC must be created on the original command data (includes
data encrypted under SKUDEK) then the APDU command data
field is encrypted under SKUENC.
2. Prepend the C-MAC computed for the previous command and
validated by the card to the left of the data requiring the MAC. If the
IC card rejects a STORE DATA command with a DGI that is listed in
field VERCNTL (see section 2.4.2), processing must continue. The
personalization device and the IC card must keep any C-MAC that has
been validated by the IC card to use as the first block of data for a
subsequent C-MAC generation.
3. Append a byte of ‘80’ to the right of the data.
4. If the resultant data block length is a multiple of 8, no further padding
is required. Otherwise, append up to 7 bytes of ‘00’ until the length is
a multiple of 8. Divide the block into 8-byte blocks with the leftmost 8
bytes (8 leftmost bytes of the EXTERNAL AUTHENTICATE command or
C-MAC from previous command for the subsequent STORE DATA
commands) being block one.
5. An Initialization Vector (IV) of all zeros is always used.
6. The C-MAC is computed as defined in section 5.4.2.3, using SKUMAC as
the key.
60 Cryptography for Personalization July 2007
5.4.2.3 The process of generating a C-MAC is performed with single DES plus
final triple DES MAC according to ISO 9797-1 as MAC Algorithm 3 with
output transformation 3, without truncation, and with DES taking the
place of the block cipher. This is also known as the “Retail MAC” and is
shown in Figure 10.
Both the personalization device and the IC card must create the C-MAC. The IC
card verifies the C-MAC by comparing the C-MAC it creates to the C-MAC in the
command. Both the personalization device and the IC card must also save the
verified C-MAC to be used as the first block in the next C-MAC creation or
verification.
5.4.3.1 For each application the input to the MAC is the data within section 3 of
the Table 8 excluding the fields MACkey and MACINP (LAPPL includes the
length for fields MACkey and MACINP).
5.4.3.2 Input to the MAC is first appended (to the right) with ‘80’. The result is
padded to the right with up to 7 bytes of ‘00’ (possibly none) to make the
input data a multiple of 8-byte blocks.
5.4.3.4 The leftmost 32 bits of the final output block are used as the MAC created
during data preparation process.
Both the data preparation system and the personalization system must create the
MAC. The personalization system must compare the MAC it creates to the MAC in
the field MACINP within the personalization data file to verify it.
5.4.3.5 Once the input to an application has been verified, subsequent processing
must ensure that the same input is delivered to the application without
alteration or addition.
61 Cryptography for Personalization July 2007
Yes
n:=1;
I1:=leftmost 8
bytes of data
I1
n:=n+1; C-MAC:=
D n:= next 8 bytes DES(SK L)[O n]
of data
5.5 Encryption
This section describes the encryption of secret data during personalization.
5.5.1.2 The personalization device must encrypt keys and secret data with Triple
DES in ECB mode using the session key SKUDEK.
5.5.2.2 Input to the encryption process is first padded to the right with ‘80’. The
result is padded to the right with up to 7 bytes of ‘00’ (possibly none) to
make the input data a multiple of 8-byte blocks.
5.5.2.3 Encryption of data must be done in Triple DES in CBC mode, as defined
in ISO 10116 with an Initial Vector equal to '00 00 00 00 00 00 00 00'.
5.6 Decryption
The personalization device must decrypt secret data encrypted by the data
preparation process. This secret data will then be re-encrypted prior to sending to
the IC card. The IC card should decrypt the secret data prior to storing it for future
use. This section describes the decryption of secret data during personalization.
63 Cryptography for Personalization July 2007
5.6.1.2 The IC card must use SKUDEK for decryption of encrypted data grouping
values.
5.6.2.2 Decryption of data must be done with Triple DES in CBC mode, as defined
in ISO 10116 with an Initial Vector equal to '00 00 00 00 00 00 00 00'.
5.7.1.1 Triple DES uses a compound operation of DES encryption and decryption.
DES and triple DES are defined in ISO/IEC 18033-3. Triple DES, as used
in this specification, uses keying option 2 as defined in ISO/IEC 18033-3.
65 Personalization Data Elements July 2007
6.4 C-MAC
A C-MAC is generated by an off-card entity and applied across the full
APDU command being transmitted to the card including the C-MAC
from previous command (if exists) prepended to header and the data
field in the command message. It does not include Le.
Purpose: Identifies the chaining mode to use to decrypt the related DGI
Format: 1 byte, binary
Content: ‘11’ – ECB mode as described in section 5.6.1.
Purpose: To specify the data groupings that must be encrypted. See section
2.4.3
Format: Binary, variable.
Purpose: Identifier of the key used to encrypt secret data sent from the data
preparation process to the personalization device.
Format: Binary, 12 bytes
Content: See Table 8
Purpose: Used to identify the owner of the specifications for this application.
Format: Binary, variable
Content: It is recommended that the RID of the owner of the specifications for
the application be used in the coding of this field.
6.12 KENC (DES Key for Creating Personalization Session Key for
Confidentiality and Authentication Cryptogram)
67 Personalization Data Elements July 2007
Purpose: This DES key is created prior to the start of the personalization
process and is used by the personalization process to create the
session key SKUENC.
Format: Binary, 16 bytes
Notes: Must be generated with odd parity.
6.13 KDEK (DES Key for Creating Personalization Session Key for
Key and PIN Encryption)
Purpose: This DES key is created prior to the start of the personalization
process and is used by the personalization process to create the
session key SKUDEK.
Format: Binary, 16 bytes
Notes: Must be generated with odd parity.
6.14 KMAC (DES Key for Creating Personalization Session Key for
MACs)
Purpose: This DES key is created prior to the start of the personalization
process and is used by the personalization process to create the
session key SKUMAC.
Format: Binary, 16 bytes
Notes: Must be generated with odd parity.
Purpose: The data used to derive the KDEK, KMAC and the KENC from the KMC.
Format: Binary, 10 bytes
Contents: See Table 15
Purpose: This DES key is used for generating derived keys to generate MACs
and encrypt and decrypt DES keys and secret data during
personalization (KENC, KMAC and KDEK).
Format: Binary, 16 bytes
Notes: Must be generated with odd parity.
68 Personalization Data Elements July 2007
Purpose: A MAC created over all of the data for an IC card application as
described in section 5.4.3. MACINP is the 4 leftmost bytes of the
created MAC.
Format: Binary, 4 bytes
69 Personalization Data Elements July 2007
Purpose: The DES key used to create MACINP. This key should be uniquely
created for the data for each application on each IC card.
Format: Binary, 16 bytes
Purpose: An identifier that specifies that this is data for IC card application(s).
The length and values of this field are established when the
personalization device is configured.
Format: ASCII, variable, 1 to 7 bytes
Purpose: To specify the order in which data groupings must be sent to the IC
card. See section 2.4.1.
Format: Binary, variable.
Purpose: This DES key is created during the personalization process and is
used to create cryptograms and may be used to encrypt and decrypt
secret data in CBC mode.
Format: Binary, 16 bytes
Content: Derived as described in section 5.3.
Remarks: Parity convention not required
Purpose: This DES key is created during the personalization process and is
used to encrypt and decrypt secret data in ECB mode.
Format: Binary, 16 bytes
Content: Derived as described in section 5.3.
Remarks: Parity convention not required
Purpose: This DES key is created during the personalization process and is
used when secure MACing is required to create C-MACs.
Format: Binary, 16 bytes
Content: Derived as described in section 5.3.
Remarks: Parity convention not required
71 Personalization Data Elements July 2007
Purpose: Identifier for the data in ICC Data in the input record to be used in a
Processing Step.
Format: Binary, variable
Content: A BER TLV encoded tag. A value of ‘EF’ is used for the
personalization Processing Step ‘0F’. A value of ‘EE’ is used for the
personalization Processing Step ‘0B’. See the appropriate platform
reference for other values.
Purpose: A DES key used to encrypt other key values for transmission
between the data preparation system and the personalization device.
Format: Binary, 16 bytes
Remarks: This key is not related to the KDEK and the SKUDEK used to encrypt
secret data sent to an IC card.
b8 b7 b6 b5 b4 b3 b2 b1 Meaning
x TK for MACkey encryption
0 TK not used for MACkey encryption
1 TK used for MACkey encryption
x x Encryption algorithm
0 1 General purpose TK
1 0 TK using RANDOM field and XOR
operation
0 0 RFU
1 1 RFU
x x x RFU
x x RFU for Proprietary Implementations
72 Personalization Data Elements July 2007
Purpose: To specify the data groupings that may be rejected by the IC card
without interrupting the personalization process. See section 2.4.2.
Format: Binary, variable.
Purpose: The version number of the layout of the file from the data
preparation process to the personalization device.
Format: Binary or ASCII, 4 bytes
Content: ”02.2” (ASCII) is defined for this specification
73 Annex A – Common EMV Data Groupings July 2007
801n** Duplicate Offline PIN Block - Offline PIN Yes Same as above
Table A-5
9010 PIN Related Data - Table A-6 PIN Try No GET DATA
Limit/Counter
901n** Duplicate PIN Related Data - PIN Try No Same as above
Table A-7 Limit/Counter
8101 ICC Private Key (DDA/PIN DDA/PIN Yes None
Encipherment)- Table A-8 Encipher
8102 ICC PIN Encipherment Private PIN Encipher Yes None
Key - Table A-9
8103 ICC Modulus (DDA/PIN DDA/PIN Yes None
Encipherment) - Table A-10 Encipher
8104 ICC Modulus PIN Encipherment PIN Encipher Yes None
– Table A-11
8201 CRT constant DDA/PIN DDA/PIN Yes None
Encipherment - Tables A-12 and Encipher
A-12b
8202 CRT constant DDA/PIN DDA/PIN Yes None
Encipherment - Tables A-12 and Encipher
A-12b
74 Annex A – Common EMV Data Groupings July 2007
The requirement column titled “Req.”, in the following tables of data elements
for each DGI, lists the requirements for each data element:
M (Mandatory) indicates that the data element must be present.
C (Conditional) indicates that the data element is necessary under certain
conditions.
O (Optional) indicates that the data element is optional
75 Annex A – Common EMV Data Groupings July 2007
To support DDA (and also PIN Encipherment using the same key), personalize
either DGIs ‘8101’ ICC Private Key and ‘8103’ Modulus, or ‘8201’ to ‘8205’ CRT
(Chinese Remainder Theorem) constants.
Additionally, to support a separate key for PIN Encipherment, personalize either
DGIs ‘8102’ and ‘8104’, or ‘8301’ to ‘8305’.
Table A-12 – Data Content for DGI ‘8201’ through ‘8205’ for p-1 mod q
convention
Req. Tag Data Element Length Encrypt
C N/A CRT constant p-1 mod q var. SKUDEK
Table A-12b – Data Content for DGI ‘8201’ through ‘8205’ for q-1 mod p
convention
Req. Tag Data Element Length Encrypt
C N/A CRT constant q-1 mod p var. SKUDEK
Table A-13 – Data Content for DGI ‘8301’ through ‘8305’ for p-1 mod q
convention
Req. Tag Data Element Length Encrypt
C N/A CRT constant p-1 mod q var. SKUDEK
Table A-13b – Data Content for DGI ‘8301’ through ‘8305’ for q-1 mod p
convention
Req. Tag Data Element Length Encrypt
C N/A CRT constant q mod p
-1 var. SKUDEK
Table A–17 – Application Common Internal Data Content for DGI ‘3000’
Req. Tag Data Element Length Encrypt
C 9F36 ATC 2 N/A
C 9F4F Log Format Var. N/A
These DGIs are defined to standardize any secure channel static keys update after
initialization of the card.
81 Annex A – Common EMV Data Groupings July 2007
Table A-22 – Data Grouping Identifiers for Secure Channel Static Keys
DGI Data Content Function Encrypt External
Access
7F01 Secure Channel DES Related data for No None
keys related data – Table Load/Update
A-23 personalization static
keys KENC, KMAC and
KDEK
8F01 Secure Channel DES Load/Update Yes None
Keys – Table A-24 personalization static
keys KENC, KMAC and
KDEK
00CF Secure Channel DES Derivation data for No INITIALIZE
Key derivation data - Load/Update UPDATE
Table A-25 personalization static
keys KENC, KMAC and GET DATA
KDEK (Tag ‘CF’)
The creation of EF used as internal files (including files to store PIN and application
keys) for EMV application is outside of scope of this document.
The Data Grouping Identifier ‘0062’ is recommended for use to create EFs under the
EMV CPS compliant application. One or more DGI ‘0062’ may be used to create EFs.
Table A-26 – Data Grouping Identifiers for Secure Channel Static Keys
DGI Data Content Function Encrypt External
Access
0062 Concatenation of (one Create EF to No READ
FCP per EF) File Control store/retrieve EMV, RECORD
Parameter – Table A-27 payment system and
issuer records STORE
DATA
UPDATE
RECORD
If the access rules are implicitly known by the EMV application (at the DF level)
then the presence of TLV tagged ‘8C’ is not required or if present it shall be
ignored by the EMV application.
If the access rules are to be communicated to the EMV application (at the DF
level) then they shall be coded as defined in Table A-28.
For an explanation on the value of the access mode byte for EFs see ISO/IEC
7816-4 Table 17.
For an explanation on the value of the security condition byte see ISO/IEC 7816-
4 Table 20.
st nd
VNL… AID1 AID2 Data for 1 AP for 2 AP…