Host Function Guide
Host Function Guide
Revision History
Revision Date Reason
All intellectual property is protected by copyright. All trademarks and product names used or referred to are the
copyright of their respective owners. No part of this document may be reproduced, stored in a retrieval system or
transmitted in any form or by any means, electronic, mechanical, chemical, photocopy, recording or otherwise without
the prior written permission of SafeNet, Inc.
Disclaimer
SafeNet makes no representations or warranties with respect to the contents of this document and specifically
disclaims any implied warranties of merchantability or fitness for any particular purpose. Furthermore, SafeNet
reserves the right to revise this publication and to make changes from time to time in the content hereof without the
obligation upon SafeNet to notify any person or organization of any such revisions or changes.
We have attempted to make these documents complete, accurate, and useful, but we cannot guarantee them to be
perfect. When we discover errors or omissions, or they are brought to our attention, we endeavor to correct them in
succeeding releases of the product.
SafeNet invites constructive comments on the contents of this document. Send your comments, together with your
personal and/or company details to the address below.
Email [email protected]
Document Information 2
This document provides a complete function reference for all functions that make up the Mark II function set. These
function sets, which are supported on SafeNet Hardware Security Modules (HSMs), may be utilized by EFT network
designers to implement a variety of key and PIN management schemes.
Mark II functions are available as standard on Luna EFT. Additionally, SafeNet also develops custom functions to meet
the specific needs of particular customers. Details can be found in a customization guide supplied with the product,
where applicable.
• Function Construction
• The Metafunction
• Function Library
• Error Codes
Document Conventions
This document uses standard conventions for describing the user interface and for alerting you to important information.
Notes
Notes are used to alert you to important or helpful information. They use the following format:
Cautions
Cautions are used to alert you to important information that may help prevent unexpected results or data loss. They use
the following format:
CAUTION: Exercise caution. Contains important information that may help prevent
unexpected results or data loss.
Warnings
Warnings are used to alert you to the potential for catastrophic data loss or personal injury. They use the following
format:
WARNING! Be extremely careful and obey all safety and security measures. In this
situation you might do something that could result in catastrophic data loss or
personal injury.
italics In type, the italic attribute is used for emphasis or to indicate a related document.
Support Contacts
If you encounter a problem while installing, registering or operating this product, please ensure that you have read the
documentation. If you cannot resolve the issue, please contact your supplier or SafeNet support. SafeNet support
operates 24 hours a day, 7 days a week. Your level of access to this service is governed by the support plan
arrangements made between SafeNet and your organization. Please consult this support plan for further information
about your entitlements, including the hours when telephone support is available to you.
International (1-410-931-7520)
Encryption Notation
The notation used for encryption and decryption is as follows:
• eK(D) where data D is encrypted under the key K.
• dK(D) where data D is decrypted with the key K.
Note:
- FM override is only applicable for those functions that return key specifier in response. For the
functions that receive key spec in request, FM (xy) and x>0 will cause an error.
- Also, Functions not having FM fields will generate keys according to global method.
- Now, keys can be stored on host in ANSI TR-31 key block and binary key block format also.
Hence, FM field value is updated to 3, 4 to allow the selection of key spec format 17 and 18.
KTPV
* The TR-31 Key Usage and Mode of Use are as defined in Ref. [43] of Mark II.
Note: There is no appropriate key usage in TR-31 draft that matches KGK. KGK is used for key
derivation therefore key usage ‘B0’ will be used for KGK.
Single M1 -
Double M3 M0
Triple M1 M0
'0' 0x30
'3' 0x33
'4' 0x34
'5' 0x35
'6' 0x36
'7' 0x37
'8' 0x38
'9' 0x39
Luna EFT Key Name *TR-31 Key usage *TR-31 Mode Algorithms
of use supported
KI K0 B,D,E D,T,A
CSCK C0 C,G,V T
KPVV V2 C,G T
KCVV C0 C, G, V T
KTPV V0 C,G T
ZKA KGK 16 X T
ZKA KK BLZ 17 C T
ZKA MK 18 X T
BDK B0 X T
IMK-AC E0 X T,A
IMK-SMC E1 X T,A
IMK-SMI E2 X T,A
IMK-DAC E3 X T
IMK-IDN E4 X T
Luna EFT Key Name *TR-31 Key usage *TR-31 Mode Algorithms
of use supported
IMK-CVC E6 X T
KTK K0 B,D,E T
PTK P0 B,D,E T
KMC E5 X T
FPVK V0 C, G,V D, T
MKDK 13,19, K0 N A
CCM D0 B,D,E A
* The TR-31 Key Usage and Mode of Use are as defined in Ref. [67] of Mark II.
Note: Mode of usage N in TR-31 version A will be treated as B (both), C (Mac calculate), or X
depending on the context. While importing from version A to version B or version A to version
C, key usage N is replaced by any of the above values depending on the function.
Key Usage 2 h
Algorithms 1 h
Mode of use 1 h
Key Version No 2 h
Exportability 1 h
Optional field 0 … n Var h Number of optional field as defined in the above field. First
byte of optional field will be treated as Optional Block ID.
Key Management KIS Interchange Key for sending a key encrypt key
(Interchange)
KIR Interchange Receiving key
Key Management KTM Terminal (ATM, EFTPOS) Master Key for exchange of working
(Terminal) keys - DPK, PPK, MPK
ZCMK Zone Control Master Key. Encrypts IWK, AWK, PVK A/B, CVK
A/B
PIN Verification PVK, DT (IBM 3624) PIN Verification Key (Visa) & Decimalisation Table, IBM 3624
Method
ZKA Processing ZKAKGK Key generation Key for German retail EFT systems
ZKAKK Encrypted PIN Verification key for German retail EFT systems
Card Issuance (Data KTK Transport Key to encrypt data between Data Preparation and Card
Preparation & Personalisation System
Personalisation)
PTK Transport Key to encrypt PINs between Data Preparation and Card
Personalisation System
RSA Keys HSM-stored/Host- Key export, signing, card personalization or terminal initialization.
stored
Operator Description
d Decrypt
e Encrypt
V Variant
Each field has an associated data type and its length in bytes. The data types are defined as follows:
Type Description
K-Spec Key specifier. A value that specifies the length, format and index for
a key.
Function Code 1 h
Note that with some functions the length of the function code may be longer than one byte.
Function Code 1 h
Return Code 1 h
Note that with some functions the length of the function code may be longer than one byte.
Function Fields
Host functions utilize two field constructs, namely the Variable-length field and the Key specifier.
Variable Length
The variable-length field construct provides a standard mechanism for incorporating a field of varying length into HSM
Request or Response messages. It comprises the variable-length data and a prefix which specifies the length of the
data, and which is also of variable-length. This section describes the method for specifying the actual length of a
variable-length data field in a function request or response. The actual length of the length prefix is specified by the most
significant bits of the most significant byte within the prefix. The remaining bits within the most significant byte form
part (or all, in the single-byte case) of the value of the length prefix.
Length of length prefix (bytes) Length indicator bits in most significant byte
1 0…
2 10…
3 110 …
4 1110 …
The encoding defined above results in the following ranges of values for the length prefixes, and ranges of lengths for
the corresponding data values:
1 00 – 7F 00 – 7F 0 – 127
Zero indicates one byte length field Length is 7 bit binary number (b6b5b4b3b2b1b0)
1 1 1 0 indicates four byte length field - Length is 28 bit binary number (b27b26...b01b00)
Key Specifier
The key specifier construct is a variable-length field that contains a variable-format specification of a key. In general, a
key specifier may contain either an index to an HSM-stored key, or an encrypted key from host storage – encrypted by
a variant of *KM. The format of a key specifier field is fully described in this section. Formats for key specifiers that
accommodate RSA public and private keys are also covered.
Most host functions perform transformations using cryptographic keys which are stored either within the secure
memory (HSM-stored) or in the host database in encrypted form (Host-stored). Traditionally, the choice of whether a
key should be HSM-stored or host-stored has been on a per-key-type basis and has been fixed in the function design.
The key specifier introduces the capability for that choice to be at the discretion of the user (or host software provider); it
also permits the possibility to HSM-store some keys of a key type and to host-store other keys of that same key type.
To support the capability, a ‘key specifier’ is defined which is a variable format field to be built into host function request
and (possibly) response messages. The key specifier provides access to a key - either by value (an encrypted key
from, or for, host storage) or by reference (an index to a key table).
Being variable format, a key specifier field will be variable length. Refer to the section entitled Variable Length Fields in
Function Request and Response Messages for details of the variable length field.
Although the key specifier introduces extra flexibility for the user, there need be no extra complexity for the host
programmer. One simply selects the appropriate key specifier format for the particular key, and then treats that instance
of the key specifier as a fixed length, fixed format field.
Currently, the functions that access HSM-stored keys, do so via Key Specifier Formats 00 to 03. The key specifier
formats support a 1-2 byte long BCD indices, and 1-2 byte long binary indices, thereby significantly increasing the
maximum index supported. The available formats can accommodate the maximum supported key index i.e. 9999 (or
15000 for KTMs).
Variants
KM Variants
The following KM variants are used to encrypt host stored keys.
0 X’00’ DPK
1 X’28’ PPK
2 X’24’ MPK
3 X’44’ KIS
4 X’88’ KIR
5 X’22’ KTM
6 X’20’ CSCK
7 X’18’ KPV, DT
8 X’14’ KPVV
9 X’48’ KCVV
14 X’5C’ KTPV
16 X’0C’ KGK
17 X’0A’ KKBLZ
18 X’1E’ MK-ZKA
24 X’72’ BDK
25 X’70’ SKB-auth
26 X’78’ SKB-enc
30 X’30’ IMK-AC
31 X’36’ IMK-SMI
32 X’3A’ IMK-SMC
33 X’3C’ IMK-DAC
34 X’50’ IMK-IDN
35 X’66’ KTK
36 X’6A’ PTK
37 X’6C’ KMC
38 X’7E’ IMK-CVC
47 X’9A’ Host-stored Random Keys exchanged between the FEP and the
terminal.
48 CCMK
57 MKDK
The variant constant is obtained by repeating the variant byte listed in the table above. The number of occurrence
depends upon the key length, for example, variant byte is repeated 8 times for single length keys, 16 times for double
length and 24 times for triple length.
Working key Variant Value 8-byte variant constant for working key
DPK 0 00000000
00000000
PPK 1 28282828
28282828
Working key Variant Value 8-byte variant constant for working key
MPK 2 24242424
24242424
KIS 3 4444444444444444
4444444444444444
KIR 4 8888888888888888
8888888888888888
KTM 5 2222222222222222
2222222222222222
DK-KIS 43 EE44EE4444444444
DK-KIR 44 EE88EE8888888888
DK-KTM 45 EE22EE2222222222
The variant constant will be applied identically to each 8-byte portion of the double length KM.
X'24' MPK
X'28' PPK
X'22' KTM
The variant bytes used for the Atalla variant scheme are listed in the following table.
1 X'08' PPK
2 X'10' DPK
3 X'18' MPK
X'22' DPK
X'24' MPK
X'28' PPK
64-bit DEA keys The variant constant is obtained by repeating the Variant Byte from the above table to yield
an 8 byte constant.
128 bit CBC and DEA The variant constant is obtained by concatenating the variant byte from the above table with
keys the constant xC0 and repeating these 2 bytes 8 times to yield a 16 byte constant.
192 bit CBC and DEA The variant constant is obtained by concatenating the variant byte from the above table with
keys the constant x30 and repeating these 2 bytes 12 times to yield a 24 byte constant.
Format 00
Index - short / BCD
Field length: 2
Format 1 x 00
Index 2 d 00 - 99
Format 01
Index - short / binary
Field length: 2
Format 1 x 01
Index 2 x 00 - FF
Format 02
Index - long / BCD
Field length: 3
Format 1 x 02
Format 03
Index - long / binary
Field length: 3
Format 1 x 03
Format 04
User Store Index – short / BCD
Format 1 h 04
Index 1 d 01 - 99
Format 05
User Store Index – short / binary
Format 1 h 05
Index 1 h 01 - FF
Format 06
User Store Index – long / BCD
Format 1 h 06
Index 2 d 01 - 9999
Format 07
User Store Index – long / binary
Format 1 h 07
Index 2 h 01 – FFFF
Format 08
HSM- or host-stored key - explicit
Format 1 h 08
Format 10 -14
The field lengths shown for formats 10-14 below assume DES keys appropriate to current functionality. However, the
algorithm and associated key length is not implicit in the key specifier; so these formats could be equally appropriate for
other algorithms, and might then have a different field length.
Format 10
Encrypted key - Single-length
Field length: 9
Format 1 x 10
Format 11
Encrypted key - Double-length - ECB
Field Length: 17
Format 1 x 11
Format 12
Encrypted key - Triple-length - ECB
Field length: 25
Format 1 x 12
Format 13
Encrypted key - Double-length – CBC
Field length: 17
Format 1 x 13
Format 14
Encrypted key –Triple-length– CBC
Field length: 25
Format 1 x 14
Format 15
The following key specifier format supports the storage of key attributes. Note an IV of all zeros is used in the formation
of the Authentication Code.
Format 1 h 15
Version 1 h 01
Key sub-type 1 h 00, unless otherwise specified for a particular Key Type.
For Key Type = 01:
00 = RFU
01 = KIS
02 = KIR
For Key Type = 02:
01 = Derive UKD (DUKPT IK)
02 = Derive TK (DUKPT PIN-encrypting key)
KM-Id 1 h Identifies the KM (applies to AMB HSM) used with the authentication
algorithm, otherwise must be zero.
Padding 1 h 00
1 1 h Variant Scheme
00 none
01 Safenet
02 Atalla
03 AS2805.6.3 2000
2 1 h 00 functions enabled
01 functions disabled (only set when
variant type = 00 )
The BPS-BDK Attributes for the format 15 key specifier are as follows:
BDK Attributes
F 1 H BPS Function
1 = TDEA
Format 16
The following key specifier format explicitly incorporates algorithms and other parameters associated with the key.
Format 1 h 16
Algorithm 1 h Algorithm
E0 = SEED
Format 17-18
Format 1 h 17
Secure key n h ANSI key Block. The length n is identical to that specified in bytes 1 – 4 of
Block the Block header.
Format 1 h 18
Secure key n h Binary Key Block. The key Block is identical Format 17 described above,
Block with the exception that the encrypted key field and the MAC field are
stored in binary and not expanded to hex-ASCII. The Key Block Length in
bytes 1-4 of the Secure Key Block, however, is the length of the equivalent
TR-31 Key Block (that is the length that would occur following the
expansion to hex-ASCII).
Translation (migration, export and import) of host stored keys in-between variant form and key block form requires
restriction and is allowed only if permitted by an administrator.
The following table summarizes the restrictions on keys translation in-between variant form and key block form, where,
A = Allowed
AWR = Allowed with restrictions.
variant A A
TR-31 AWR A
By default, keys migration/export/import restrictions are enabled. Select Enable Keys Migration/Export/Import from
keyblock to variant check box from the Configuration Control console operation to disable these restrictions. An error
code 'A1' is returned if key translation is performed without disabling these restrictions.
In case of Format 18, the optional block header fields are provided in binary.
Format 19
The following key specifier format supports a CAP Bitmap. The CAP Bitmap specifier is an authenticated data
structure containing a payload in the clear. Although the CAP Bitmap specifier does not contain a key, it is implemented
as a key specifier, as the key specifier format is easily extended to hold CAP Bitmap data.
The data specifier incorporates a header, a payload and an authentication code. The header indicates the format of the
payload. The present implementation only supports payload data that is not encrypted.
With the exception of the header (first 8 bytes) and the final field (8-byte authentication code) the complete contents of
the data specifier may be CBC-encrypted with KMv20, with the header utilized as the IV. An IV of all zeros is used in
the formation of the Authentication Code.
Host-stored bitmap
Format 1 h 19
KM-Id 1 h For the AMB HSM, identifies the KM used, otherwise must be
zero.
Pad1 2 h = 0000
Authentication Code 8 h 3DES CBC 64-bit MAC calculated on all previous fields, using
KMv19.
Format 20
The following key specifier format supports a Derived Unique Key per Transaction (DUKPT). DUKPT is a key
management method which uses a unique key for each transaction, and prevents the disclosure of any past key used
Format 1 h 20
BDK Var K-spec Key specifier for the Base Derivation Key (BDK). (Formats 0-3,
13, 14, 15, 17, 18 )
Format 20 key specifier incorporates a format 0-3 key specifier for HSM-stored BPS-BDK, or a format 15 key specifier
with Key Type = 02 for a host-stored BPS-BDK.
Format 50
This key specifier calculates a unique-per-card derived key. It is used to derive KKEK (as defined in [Reference [32] of
Mark II]) so that the key may be used to encrypt a key or sensitive data to be sent to the card. CardMethod (01 or 02)
define the mode of encryption.
Format 1 h 50
KMC Var K-Spec Key specifier for personalization master key (format 0 –3,
13, 17, 18).
Format 51
This key specifier calculates a unique-per-card derived session key. It is used to derive SKUENC, SKUMAC (as defined
in [32] and [33] of Mark II]) in support of the mutual authentication of the card being personalized and its host.
CardMethod (01 or 02) and SessionMethod (01 or 02) define the mode of encryption.
Format 1 h 51
KMC Var K-Spec Key specifier for personalization master key (format 0 –
3, 13, 17, 18).
Session data 16 h
Format 52 and 53
New key specifier formats are required in order to accommodate AES and the derivation scheme defined in
GlobalPlatform SCP03 [76].
Format 52
Unique-per-card derived AES key
Format 1 h 52
KMC Var K-Spec Key specifier for personalization master key(format 1C).
Card-unique derivation Var h Card derivation data used for deriving key.
data
Key Length should not be more than length of Card-unique derivation data.
Processing Steps
1. Process the derivation data using the derivation key and the card method.
2. Select the leftmost bits of the resultant as the derived key (as specified by key length).
NOTES:
1. The KDF-1 card method is as specified in 4.1.5 of [75]. The supplied derivation data should comprise of:
Context 16 bytes
Input data to PRF (that is called in KDF-1 card method) will contain
PRF (KI, Label || 0x00 || [L] || [i] || Context) where ,
KI = Encrypting key
2. This is as specified in [75], though no check or alterations will be made to the supplied data.
3. The derived key can be no longer than the derivation key.
KDF_1 specifies KDF in counter mode as specified in NIST SP 800-108. The PRF used in the KDF shall be CMAC as
specified in NIST SP 800-38B, used with full 16 byte output length.
Format 53
Unique-per-card derived AES key
Format 1 h 53
KMC Var K-Spec Key specifier for personalization master key(format 1C).
Card-unique derivation Var h Card derivation data used for deriving key.
data
Card-unique Derivation data Card derivation data used for deriving a key.
Card Key length Length of key to derive. Key Length should not be more than length of Card-unique
derivation data.
Session key length Length of key to derive. Session key length should not be more than length of
Session data.
Processing Steps
1. Process the card-unique derivation data using the derivation key and the card method.
2. Select the leftmost bits of the resultant as the card static key and as specified by card key length.
3. Process the session derivation data using the derivation key and the session method.
4. Select the leftmost bits of the resultant as the card session key and as specified by session key length.
NOTES
• The KDF-1 card/session method is as specified in 4.1.5 of [75]. The supplied card / session derivation data should
comprise of:
Derivation Constant - 1 byte
Context - 16 bytes
• More details regarding data formatting used in PRF is given in format 52. This is as specified in [77], though no
check or alterations will be made to the supplied data.
• KDF_1 specifies KDF in counter mode as specified in NIST SP 800-108. The PRF used in the KDF shall be CMAC
as specified in NIST SP 800-38B, used with full 16 byte output length.
• Each derived key should not be longer than the length of the derivation key used to derive it. It should be of a length
equal to or less than the derivation key (In 6.1 of [75] it is specified that the derived session key is the same length
as the card static key, but the HSM host functions do not enforce this stipulation).
Format 54
This key specifier format supports AES keys.
Format 1 h 54
K0, K1 N A
Conditions:
1. This key spec is available only for AES keys as of now.
2. KM index field must match the KM index specified in K-Spec in 17, 18.
3. For method type = 00, the associated parameter set will have two random numbers to derive two sub-keys, KIENC
and KIAUTH for decryption and authentication. Associated parameter values will be two sets of ICV and Random
Numbers. The objective of two intermediate keys are - KIENC for encryption/decryption and KIAUTH for
generation/verification of key.
4. For algorithm type = 0A, only 1 set of ICV and random number will be used.
5. The derivation method for keys for algorithm = 00, 0A}is same as EMV CSK for AES from EMV v4.3
6. All the individual parameters presented as an array in associated parameters will be of type var.
7. All the types defined as RFU will return error until and unless they have been defined and applicable for the function
in which the key spec has been supplied.
8. For encryption and authentication associated parameter will also support MAC length which will vary from decimal
4-16.
For method =00, Associated Parameter table is given below:
Format 80 - 83
The following formats (80 – 83) for the key specifier structure support the host-storage of RSA public and private keys.
A public key is stored in a clear form, with or without an authentication value, while a private key is stored encrypted by
a variant of KM.
Format 80
In accordance with existing HSM convention, multi-byte integers (modulus and exponent) are stored with the leftmost
byte containing the most-significant bits (i.e. big-endian).
Format 1 h 80
Format 81
This key specifier will be supported by the KM-MIGRATE function, to translate Authentication Value from an old KM to
the current KM.
Format 1 h 81
KM-Id 1 h For the AMB HSM, identifies the KM used with the
authentication algorithm, otherwise must be zero.
Format 82
This key specifier will be supported by the KM-MIGRATE function, to translate eKMv20(SK) and Authentication Value
from an old KM to the current KM.
Format 1 h 82
KM-Id 1 h For the AMB HSM, identifies the KM used to encrypt the
private key and with the authentication algorithm,
otherwise must be zero.
Format 83
It is required that CA-EFT public key is encrypted for host storage. Format 83 key specifier, as defined below,
incorporates an encrypted public key.
Format 1 h 83
KM-Id 1 h 00
Format 90
The following Key Specifier Format specifies the format for a ZKA Random Number. This key specifier incorporates the
data required to produce a clear PAC or MAC session key. A PAC key is produced if the key specifier is used within a
PIN management function and a MAC key is produced if the key specifier is used within a message authentication
function. It can also incorporate a format 92 key specifier as the MK-spec, in order to access a key in the MK2 table.
This key specifier format can also be used as an alternative format in a PPK-spec or MPK-spec request field in
standard functions. Specifically, the following functions will support a ZKA-RND format key specifier:
• MAC-UPDATE, MAC-GEN-FINAL, MAC-VER-FINAL
• PIN-TRANSLATE
• PIN-VERIFY, Calculate IBM Offset, MIGRATE-PIN
• PIN Verify – PVV, Calculate PVV from IBM Offset, Calculate PVV from PIN
Format 1 h 90
The CV values defined in ZKA documentation may be overridden by CV values stored within the HSM.
The following Control Vector values are used when constructing a format 90 host stored key specifier. Key values for
each type are defined below.
MAC 00 00 4D 00 03 41 00 00 00 00 4D 00 03 21 00 00
PAC 00 21 5F 00 03 41 00 00 00 21 5F 00 03 21 00 00
Format 91
The following Key Specifier Format specifies the format for a ZKA-Derived-*KK. This key specifier incorporates the
data required to derive a *KKBLZ as follows:
*KKBLZ = e*KGK1 (BLZ | BLZ) | e*KGK2 (BLZ | BLZ)
The key specifier may be used in the functions that contain a '*KK-spec' field, i.e. 'ZKA-PIN-VER – ecPVN method '
and 'ZKA-Calculate PVN – from encrypted PIN'
ZKA-Derived-*KK
Format 1 h 91
Format 92
The following Key Specifier Format specifies the format for a ZKA-MK2 key. This key specifier is used to reference an
MK in the MK2 table.
A value of X'FF' in any of the 'h' field or a value of 9999 in the 'd' field indicates that the field value has not been
specified. The permissible omitted fields are indicated in the usage context of the key specifier.
Specification of Sub-type Number, Version Number and Generation Number unambiguously references a specific
record in the MK2 table.
Alternatively (for example), Version Number and / or Generation Number may be set to X'FF' and / or Expiry Date may
be set to 9999 to indicate that a search of the table should be performed. The search criteria are specified in the context
where the key specifier is used.
MK2 reference
Format 1 h 92
Format 93
ZKA encrypted session key
Format 1 h 93
ATM-unique ZKA keys are generated by applying the SECCOS method (based on the ISO-10118-2/MDC-2 hash) of
key derivation (i.e. using a Master Key (KGK) as Master Derivation Key and a 16-byte terminal ID value as derivation
data).
The Derivation Data comprises 8 bytes of Terminal ID (16 alphanumeric EBCDIC characters) padded with 8 bytes of
‘00’, but this will not be checked and any value will be accepted – unless instructed otherwise.
Following are the details of SECCOS method implementation:
• Produce MDC-2 hash of Derivation Data (Refer sec 8.4.1 “Algorithm for the derivation of a card individual key from
a master key” of [68])
• Decrypt the hash data using ZKA Master Derivation key
• The resultant will be used as a Master/ Key Encryption Key that encrypts RND
Format 1A
The following Key Specifier Format (1A) specifies the format for carrying a KM-encrypted PIN.
The Domain Master Key (KM) and its variants are typically used to protect other keys. Modern usage of the KM has
involved the ‘key specifier’ function field. Consistent with this usage, the KM-encrypted PIN comprises a formatted PIN
Block that is encrypted using a dedicated variant of KM and managed within this key specifier, designed for this
purpose.
Prior to encryption, the PIN is formatted into an ISO format 3 PIN Block.
The ISO format 3 PIN Block is ECB-encrypted using a dedicated variant of KM, and therefore the resulting ciphertext
Block has a length of 8 bytes.
Use of ISO format 3 implies that the 12-digit Account Number Block (ANB) must be supplied when the PIN is
generated, and whenever the KM-encrypted PIN is subsequently used.
KM variant 27 is used for PIN-Block encryption to produce a KM-encrypted PIN for host storage. The hexadecimal
constant associated with KMv27 is X’74’.
KM-encrypted PIN
Format 1 h 1A
KM-encrypted PIN
Type 1 h = 01
Format 1B (Key Specifier Format for TLS Master Secret and Pre-master Secret Keys)
A new key specifier is used for the host storage of the TLS master secret and pre-master secret keys. The new key
specifier is as follows:
Format 1 h 1B
Format 1C (Key Specifier Format for Advanced Encryption Standard (AES) Support)
A new Key Specifier is required in order to support AES keys. This key specifier incorporates a KM-encrypted key,
while providing details of the KM used for encryption and of the incorporated key.
Format 1 h 1C
Algorithm 1 h Algorithm
01 = DES/3DES
02 = AES
E0 = SEED
KM-index Index of KM. Index must be greater than 1 and less than 17. Details regarding type (algorithm and
length) of KM is stored in the mode file.
Padding Padding is required by algorithms to maintain a block size (for example, 128-bit block size for
SEED & AES and 8 byte block size for 3DES).
01 : trailing zeros.
02 : trailing random.
Mode of operation Refers to mode of operation applied while decrypting/ encrypting key with KM. For more details
refer to the section below, KM Encryption Conditions.
KM Encryption Conditions
1. When KM is AES - Following conditions must hold when KM is AES:
o AES-192 and DES/3DES (single and triple length) KM-encrypted keys will need to be padded prior
to encryption, as block length for AES is 128-bit or 16 bytes.
o A mode of operation needs to be selected for encryption/decryption of AES-192 and AES-256 KM-
encrypted keys.
Where a standard key block is employed (for example, TR-31) these considerations may be addressed in the standard.
Otherwise padding and modes will either use a default specified here, or employ user selections as allowed for here.
Note: TR-31 does not currently allow for the use of AES as a key block protection key.
A mode of operation needs to be selected for encryption/decryption of keys which have length greater than 8 bytes or 64
bits.
04 , 05, 06, 07 KM encrypted keys Used for a host function to access and use a
key (PPK) in the User Store. The key
specifier identifies the index of the location in
the key store.
08 Explicit Key Type Identification Used when specifying explicit key type.
1B Host-stored keys Used for the host storage of the TLS master
secret and pre-master secret keys.
01 ANSI Identical to existing PIN-TRAN Format 1 – ANSI format; AS2805 Part 3 format 0; ISO 9564-1
Format 0.
02 Docutel 2 Contains 1-digit PIN length, 4 to 6-digit PIN and a user-defined padding string of 9 digits. If
the PIN has 4 or 5 digits, it is initially padded to the right with 2 or 1 zero digits to total 6 digits.
09 ZKA The input PIN Block may be ISO Format 0 or an ISO Format 1
A particular function may not support all of the formats identified above. The specification of each function identifies
which formats it supports.
Note: Functions that translate PIN, output PIN block format can be 09 only if input PIN block
format is 09.
The HSM needs to support all PIN blocks formats that are used within the industry. Many users do not require support
for some of these formats. Therefore, each PIN block format can be enabled or disabled.
The default condition for each PIN block format is as follows:
ISO-0 x
ISO-1 x
ISO-2 x
ISO-3 x
IBM 3624 x
Docutel x
A console operation allows the user to enable support for just those PIN block formats that are required.
Restrictions on reformatting
In those PIN translate functions that support the reformatting of the PIN block from one format to another,
disassociation of the PIN from the Account Number is prevented by the following restrictions on the reformatting that is
supported.
The table below lists the restrictions on PIN block reformatting based on the default PIN block format settings
(enabled/disabled). A console operation allows the user to modify the PIN block reformatting rules.
PIN Block Format Reformatting supported (non PCI mode) Reformatting supported
(PCI mode)
*PIN block formats ISO-2, IBM 3624, Docutel ATM, and Docutel ATM 2 are disabled by default. Hence, PIN block
reformatting support will not be allowed. The user needs to enable these PIN block formats in order to support
reformatting.
Encryption Notation
The notation used for encryption and decryption is as follows:
• eK(D) where data D is encrypted under the key K.
• dK(D) where data D is decrypted with the key K.
• e*K(D) where data D is encrypted under the double length key K, as specified in AS2805.6.1:2001.
• d*K(D) where data D is decrypted with the double length key K, as specified in AS2805.6.1:2001.
DEA 2 Keys
The prime components generated in the DEA 2 key generation process conform to the minimum requirements outlined
in Australian Standard AS2805.5.3:1985.
1 h FF Tag
42 h 0 Trailing zeros
1 h 0 Tag
46 h 0 Trailing zeros
Note: This format is used in functions C610, C620, C710 and C720
0 0 = no padding used
1 = padding used
Var (5 to 8n-1) Up to 8n-5 bytes of data, left justified. If data is less than (8n-5)
bytes, append random pad bytes and pad byte count in byte 8n-1.
The pad count includes byte 8n-1
Note:
- 8n represents the size of the modulus of the DEA 2 key that encrypts the DFormat 1 text
block. The size of the key will always be provided by a separate field (for example, see
functions C600, C610, C700, C710).
- DFORMAT1 always refers to data that is to be encrypted by an asymmetric key (either for
encryption or signing) and that the result of this operation is specified as an S-Block.
Data padding
A short data sequence is padded to the right with random bits, and a pad count.
Checksum calculation
The checksum is calculated as the 16-bit sum of bytes 4 to 8n-1 with a rotate left of 1 bit to the working total before each
byte is added in.
Length
This is the length of the field in bytes. A varying length field, as defined in “Variable Length Fields in Function Request
and Response Messages” (page Error! Bookmark not defined.), is indicated by “Var”.
Attribute
Following is the list of defined attributes:
B - represents a binary digit (bit). Fields must be grouped in multiples of eight (8) bits.
Bin - represents a binary number of length 2, 4 or 8 bytes. The number is in the big-endian representation with the most
significant bit first (on the left) and the least significant bit last (on the right).
h - represents a hexadecimal digit (0 to 9, and A to F). Fields must be grouped in multiples of two (2). Actual value(s)
must be in the content field.
d - represents a BCD digit.
x - represents an 8 bit field of unspecified format.
B64 - represents a data block of 64 bits.
B128 - represents a data block of 128 bits.
B160 - represents a data block of 160 bits
B512 - represents a data block of 512 bits.
K-Spec - represents a key specifier consisting of one of the formats specified earlier in this chapter.
D-Spec - represents a 64-bit encrypted data value preceded by a one byte KM index.
S-Block - represents a variable length, DEA 2 encrypted, data block. Clear text Data blocks are in DFORMAT1 format.
Content
This contains one of the following types of entries:
Nothing (indicating that the field needs no further explanation).
Explicit hexadecimal values (eg. function codes).
Cryptographic expressions, which are references to encrypted keys or data.
Abbreviated field names.
Description
This contains a simple explanation of the field contents.
Nomenclature
The nomenclature used for keys and operations conforms to Australian Standard AS2805.6.1:2001. In this document
keys can be single (64-bit), double (128-bit) and triple (192-bit) length and this is context dependent in the different
functions.
Variable Length
This section describes the method for specifying the actual length of a variable-length data field in a Luna EFT function
request or response. The method utilizes a length prefix that in itself has a variable length. The length prefix forms an
essential part of the variable-length data field.
The actual length of the length prefix is specified by the most significant bits of the most significant byte within the
prefix. The remaining bits within the most significant byte form part (or all, in the single-byte case) of the value of the
length prefix.
Length of length prefix (bytes) Length indicator bits in most significant byte
1 0…
Length of length prefix (bytes) Length indicator bits in most significant byte
2 10…
3 110 …
4 1110 …
The encoding defined above results in the following ranges of values for the length prefixes, and ranges of lengths for
the corresponding data values:
1 00 – 7F 00 – 7F 0 – 127
Key Specifier
Most host functions perform transformations using cryptographic keys, which are stored either within hardware security
module secure memory (HSM stored) or in the host database in encrypted form (host stored). Traditionally, the choice
of whether a key should be HSM stored or host stored has been on a per-key-type basis and has been fixed in the
function design.
New functionality now implements the capability for that choice to be at the discretion of the user (or host software
provider); it also permits the possibility to Luna EFT store (HSM store) some keys of a key type and to host store other
keys of that same key type.
To support this capability, a ‘key specifier’ is defined which is a variable format field, built into host function request and
response messages. The key specifier provides access to a key - either by value (an encrypted key from, or for, host
storage) or by reference (an index to a Luna EFT key table). Being variable format, a key specifier field is variable length
(see above).
Although the key specifier introduces extra flexibility for the user, there need be no extra complexity for the host
programmer, who simply selects the appropriate key specifier format for the particular key, and then treats that instance
of the key specifier as a fixed length, fixed format field.
Key specifier formats associate the following properties with a key:
• Key length
• Mode of Operation (for example, ECB, CBC) used to encrypt the key.
• Algorithm used to encrypt the key
• Algorithm used in the function for which this key is the cryptographic key.
• Whether the key is host or Luna EFT stored
Key specifiers are present in both request and response messages and need to be stored with the key for future use on
the host system. Any keys that are to be sent to terminals or other sites that do not require it should have the key
specifier field stripped by the application before transmission.
Support for key specifiers is detailed within each function definition, specifying which formats are valid for each key
field in the request and response.
Note: Key-specifier formats can be enabled or disabled through the console in the same way
as functions. The initial state for all format specifiers with the exception of 33 is enabled.
80 - CF Manufacturer Use
D0 - FF Proprietary Use
Variants
Variants of keys are used to provide functional separation as described in Australian Standard AS2805.6.1 Key
Management – Principles 1988. Custom variants 21, 22 and 23 are calculated as described in Australian Standard
AS2805.6.3 Key Management – Session Keys – Node to Node 1988, Clause 6.5. All other variants are calculated as
described in AS2805.6.1:1988. The constants used are defined in the table below.
In order to provide additional separation between 64-bit, 128-bit and 192-bit DEA keys and DEA2 keys the standard has
been extended as described below. In the case of CBC mode DEA keys the varianted key is obtained by an XOR
operation of the base key with the Variant Constant.
64-bit DEA keys: The variant constant is obtained by repeating the Variant Byte from the following table, to obtain the
same length as the key being varianted. This is the method used in formats 20 and 30.
That is, VC = 8 * (VB), KVn = K xor VC
128-bit DEA keys: The variant constant is obtained by repeating the Variant Byte from the following table, to obtain the
same length as the key being varianted. This is the method used in formats 23 and 33.
That is, VC = 8 * (VB), KVn = K xor VC
128-bit CBC mode DEA keys: The Variant Byte (VB) is concatenated with the constant X’C0’ to form a 2-byte (16-bit)
field. This field is repeated 8 times to form the Variant Constant (VC). Used in Formats 21, 25, and 31.
That is, VC = 8 * (VB || X’C0’), KVn = K xor VC
192-bit CBC mode DEA keys: The Variant Byte (VB) is concatenated with the constant X’30’ to form a 2-byte (16-bit)
field. This field is repeated 12 times to form the Variant Constant (VC). Used in Formats 22, 32.
That is, VC = 12 * (VB || X’30’), KVn = K xor VC
DEA2 keys: The variant constant (VC) is obtained by repeating the variant byte.
That is, VC = VB || VB || … || VB
22 ü 3 X'22' KDs
14 22 X'14’ KPVV
18 23 X'18' KPV, DT
E4 E4 X’E4’ KTK
30 X’30’ IMKAC
36 X’36’ IMKSMI
3A X’3A’ IMKSMC
3C X’3C’ IMKDAC
50 X’50’ IMKIDN
7E X’7E’ IMKcvc
20 X’20’ CSCK
Note: The variant of KM used to encrypt data (e.g. PPSN, PPASN, MACRES) is formed in the
same way as described above for KM variants used to encrypt keys. However, in this case the
length of the data is used to select the variant formation schema.
Visa Variant
Visa variant 1 (Vv1) is used in the support of the Visa Dynamic Key Exchange protocol. It consists of a variant byte of
x'08', which without extension, is modulo 2 added to the first (most significant) byte of each part (8 byte) of DEA 3 key
to derive the varianted key.
To support this capability, a ‘key specifier’ is defined which is a variable format field, built into host function request and
response messages. The key specifier provides access to a key - either by value (an encrypted key from, or for, host
storage) or by reference (an index to a Luna EFT key table). Being variable format, a key specifier field is variable length
(see above).
Although the key specifier introduces extra flexibility for the user, there need be no extra complexity for the host
programmer, who simply selects the appropriate key specifier format for the particular key, and then treats that instance
of the key specifier as a fixed length, fixed format field.
Key specifier formats associate the following properties with a key:
Key length
Mode of Operation (for example, ECB, CBC) used to encrypt the key.
Algorithm used to encrypt the key
Algorithm used in the function for which this key is the cryptographic key.
Whether the key is host or Luna EFT stored
Key specifiers are present in both request and response messages and need to be stored with the key for future use on
the host system. Any keys that are to be sent to terminals or other sites that do not require it should have the key
specifier field stripped by the application before transmission.
Support for key specifiers is detailed within each function definition, specifying which formats are valid for each key
field in the request and response.
Note: Key-specifier formats can be enabled or disabled through the console in the same way
as functions. The initial state for all format specifiers with the exception of 33 is enabled.
Format 00
Index - short / BCD
1 h 00 Format Code
Format 01
Index - short / binary
1 h 01 Format Code
Format 02
Index - long / BCD
1 h 02 Format Code
Format 03
Index - long / binary
1 h 03 Format Code
Format 20
DEA Encrypted key – 64-bit with KM index
1 h 20 Format Code
1 x i KM Index
Format 21
DEA CBC Encrypted key – 128-bit with KM index
1 h 21 Format Code
Format 22
DEA CBC Encrypted key – 192-bit with KM index
1 h 22 Format Code
Format 23
DEA ECB Encrypted key – 128-bit with KM index
1 h 23 Format Code
Format 24
Encrypted key – Future algorithm with KM index
1 h 24 Format Code
1 x 00 - FF Algorithm
01 = Invalid
02 = 3 DES
03 = AES
En = National
Fn = Proprietary
1 x 00 - FF Key length
01 = Invalid
02 = 128
03 = 192
04 = 256
1 x 00 - 0F Block Length
01 = 64
02 = 128
03 = 192
04 = 256
1 h 00 - 0F Mode of Operation
01 = ECB
02 = CBC
03 = CFB
04 = OFB
Format 25
HMAC-SHA1 key – 128-bit with KM index
1 h 25 Format Code
Note: Format 25 is used for the HMAC-SHA-1 algorithm as defined in AS2805 Part 4.2:1985,
Algorithm 2, using the hash algorithm SHA-1 defined in AS2805 Part 13.2:2000.
Format 30
DEA Encrypted Key – 64-bit
1 h 30 Format Code
Format 31
DEA CBC Encrypted key – 128-bit
1 h 31 Format Code
Format 32
DEA CBC Encrypted key – 192-bit
1 h 32 Format Code
Format 33
DEA ECB Encrypted key – 128-bit
1 h 33 Format Code
Format 34
Encrypted key – Future Algorithm
1 h 34 Format Code
1 h 01 - 0F Algorithm
01 = Invalid
02 = 3DES
03 = AES
En = National Allocation
Fn = Proprietary Allocation
1 h 00 - 0F Key Length
01 = Invalid
02 = 128
03 = 192
04 = 256
1 h 00 - 0F Block Length
01 = 64 bit
02 = 128 bit
03 = 192 bit
04 = 256 bit
1 h 00 - 0F Mode of Operation
01 = ECB
02 = CBC
03 = CFB
04 = OFB
Format 41
Cleartext key – DEA 2
1 h 41 Format Code
Format 42
Encrypted key – DEA 2 with KM index
1 h 42 Format Code
Variable length x eKMi(PK) DEA CBC Encrypted DEA2 key. Either the public key OR the Private key
field OR eKMi
(SK)
Block Format 1
Byte Bits Description
0 0 = no padding used
1 = padding used
4 to n-1 Up to n-4 bytes data, left justified. If data is less than n-4 bytes, append
random pad bytes and pad byte count in byte n-1. The pad count includes byte
n-1
The checksum is calculated as the 16-bit sum of bytes 4 to n-1 with a rotate left of 1 bit to the working total before each
byte is added in.
Block Format 2
Byte Bits Description
0 0 = no padding used
1 = padding used
2 to n-1 Up to n-2 bytes data, left justified. If data is less than n-2 bytes, append
random pad bytes and pad byte count in byte n-1. The pad count includes byte
n-1
Bytes 9 to 64 Modulus
Note: In CBC encipherment using a double-length key, the CBC mode of operation is applied
to the 'triple encipherment' block cipher. Triple encipherment of a block consists of
encipherment by the left half of the key, followed by decipherment by the right half of the key
and a further encipherment by the left half of the key.
P-Block - an RSA public key pair enciphered by another public key pair using format 2
The (usually128 byte) field is made up of two halves:
cPKB ( PKA modulus in format 1) followed by:
cPKB ( PKA exponent in format 1)
The PKA modulus and exponent can be either right justified and zero filled before formatting or they can be shorter, so
that they require justification after they are deciphered.
Note: The enciphered public key pair modulus (PKAmod) has to be at least 4 bytes smaller
than the enciphering modulus (PKBmod).
Q-block - an RSA public key pair enciphered by another public key pair using format 2
The (usually 128 byte) field is made up of two halves:
cPKB ( PKA modulus in format 2) followed by:
cPKB ( PKA exponent in format 2)
The PKA modulus and exponent can be either right justified and zero filled before formatting or they can be shorter, so
that they require justification after they are deciphered.
Note: The enciphered public key pair modulus (PKAmod) must be at least 2 bytes smaller than
the enciphering modulus (PKBmod).
D-block - data enciphered by one RSA public key, then signed by another RSA public key
of the same size
The procedure for producing an encrypted signature of a data block of up to n-4 bytes is:
Transform the data block into a ‘n’ byte signature using the first key and format 1.
Split the signature into a left part of n-2 bytes and a right part of 2 bytes.
Prefix the left part of the signature with 2 bytes defined by format 2. The resulting n byte block (which is always less
than the modulus of the second key) is encrypted.
Concatenate the result of the encryption (n bytes) and the right part of the signature (2 bytes) to form the encrypted
signature (n+2 bytes).
E-block - data enciphered by one RSA public key then signed by another larger RSA pub-
lic key
The field consists of: cPKB ( (cPKA ( data in format 1 ) ) in format 2 )
Note: The first enciphering public key pair modulus (PKAmod) has to be at least 2 bytes
smaller than the second enciphering modulus (PKBmod). The data size has to be at least 4
bytes smaller than the first enciphering public key pair modulus (PKAmod).
Note: Currently, only SafeNet’s ProtectToolkit EFT product makes use of the meta-function
format. Metafunction support can be enabled or disabled via the console under the Device
Administration/Function Control menu.
The meta-function is presented as a special function code called the Meta-function Indicator (E3). If the Meta-function
Indicator is found in the message, the Luna EFT knows that the message came encapsulated. It then extracts the
normal request message frame, processes it in the usual manner and then puts the meta-function back around the
response message before sending the reply.
Request Message
Comms Meta-function Meta-function Version Type specific Comms
Header Indicator Type data … trailer
Response Message
Comms Meta-function Meta-function Version Response Type specific Comms
Header Indicator Type Code data … trailer
(= 00)
A meta-function request could incorporate a normal request message as a variable-length field within its request data
(i.e. type specific data) or it could contain another meta-function as the variable-length field.
Two Meta-function types are presently defined. If the byte following the Meta-function Indicator byte is not one of the
defined types, the HSM returns a Meta-function Error Response message with Response Code = 01.
The Version field allows the format of the meta-function to change over time in a manner that provides backward
compatibility.
The Response Code field allows for error reporting for the meta-function header fields. This translates to a meta-
function with a variable-length field that has a zero length (instead of containing the request). So the return code would
be ‘Invalid field length’
META-FUNCTION-SUPPORT (E3)
E3 1 h Function Code
E3 1 h Function Code
Return Code 1 h A return code that indicates the status of the sent function
The meta-function message format provides a transparent mechanism for implementing extensions to the current host
message format. When used with SafeNet’s ProtectToolkit EFT product, it provides a unique message identifier for all
messages.
Message ID A four byte message ID, which uniquely identifies each meta-function message, is used to
map responses with their corresponding request message.
Not used when Meta-function Id = 00
Data The data field is a var field which in the request contains the encapsulated message request
and in the response contains the encapsulated response.
Not used when Meta-function Id = 00
Return Codes
00 - OK
01 - Invalid meta-function Id
02 - Invalid version number
03 - Invalid data field length
Note: If an error occurs in the E3 Function the encapsulated message is not run and no return
data will be presented.
Admin EEBF29 GET-KVC Verifies the existence and obtains the KVC
of keys stored in the Secure Memory.
EE9005 SIGN-DATA Signs the data using the private key and
signature algorithm indicated, and returns
the digital signature.
PIN Charset EE0E07 LOAD-CHARSET Load the character sets for PINn printing in
words for displaying in user-defined
character sets.
EE3003 OBM-CHANGE-PIN-3624 Extracts the old PIN and new PIN from
RSA-encrypted PIN block, verifies the old
PIN and calculates a PIN offset for the
new PIN.
EE3006 OBM-CHANGE-PIN- Extracts the old PIN and new PIN from
HASH RSA-encrypted PIN block, verifies the old
PIN and calculates a TPV for the new PIN.
0016 GET-CLOCK Gets the date and time from Luna EFT.
Japan PIN EF0601 JAPPINTRAN Allows translation of PIN block format and
PIN encryption key.
Clear PIN EE0600 CLEAR-PIN-ENCRYPT Formats a clear PIN into an ANSI PIN
Block and encrypts it using the supplied
PPK.
AB-KEY-GEN (3B00)
This function generates a random ATM A-key and B-key.
KL 1 x Key length:
1 = Single
2 = Double
3 = Triple
rc 1 x Return Code
The A-key is returned encrypted under KMVAA and the Transport Key. The B-key is returned encrypted under KMVA6
and the Transport Key.
ADVANCED-RANDOM-KEY-GENERATION (EE0619)
This host function generates random key according to key format details and returns it in key format key-spec.
rc 1 h Return Code
Key Details
Key detail field contains following details pertaining to 1C key format.
KM-index 1 h Index of KM
Algorithm 1 h Algorithm
In case of format 10-14, key details contains key type of derived key.
Key detail field contains following details pertaining to 17 and 18 key format.
For other Luna EFT keys, see TR-31 Key Usage and Mark II Key Types.
Optional field 0 … n Var h Number of optional field as defined in above filed. First byte of
optional field will be treated as Optional Block ID.
Note:
- While transferring keys in Key Block between two terminals, this function does not generate
keys for Variant ID 11, as this variant is for terminal keys (KIS/KIR).
- Also, random keys cannot be generated with variants (11, 25 & 26) using key spec 10,
11,12,13 and 14.
APACS-MAC-GEN (EE0704)
Request Length Type Description
KTi Var K-spec Key specifier for KT containing eKMv5(KT) (Formats: 10,
11, 13)
AB 8 h Concatenation of A and B
rc 1 h Return Code
This function generates the MAC for a terminal response message. The MAC calculation includes the request MAC
residue and the Authorization Parameter. The function also derives an updated KT. It returns the response MAC residue
for processing with the confirm message.
Processing Steps
1. Derive MAC key using KTi, A and B. Refer, 10.5.2 and 10.8 in [43].
2. Calculate the authorization parameter using the MAC key and AP Data. Refer, 10.7.3 in [43].
3. Form an extended message by prefixing the request MAC residue and suffixing the authorization parameter to the
Data. Refer, 10.2.3 in [43].
4. Calculate the MAC for extended message. Refer, 10.2.2 and 10.8.5 in [43].
5. Extract the response MAC residue from the MAB, pad, and encrypt using KMv12. Refer, 10.2.2 in [43].
6. Derive the updated KTo using the existing KTi, the request MAC residue and the response MAC residue. Refer,
10.6.1 and 10.8.4 in [43].
APACS-MAC-VER-CONFIRM (EE0705)
Request Length Type Description
FM 1 h Function Modifier
AB 8 h Concatenation of A and B
rc 1 h Return Code
This function verifies the MAC for a terminal confirm message. The MAC calculation includes the response MAC
residue.
Note: For initialization and host storage, KT is managed identically to a KTM. Hence, the
existing facilities for initialization of a KTM may be used to initialize a KT. For host storage, the
KT is encrypted using variant 5 of KM.
Processing Steps
1. Derive MAC key using KT, A and B. Refer, 10.5.2 and 10.8 in [43].
2. Form an extended message by prefixing the response MAC residue to the Data. Refer, 10.2.3 in [43].
3. Calculate the MAC for the extended message. Refer, 10.2.2 and 10.8.5 in [43].
4. Compare the calculated MAC with the MAC value in the function request. Exit with error code 08, if the comparison
fails.
APACS-MAC-VER-REQUEST (EE0703)
Request Length Type Description
AB 8 h Concatenation of A and B
rc 1 h Return Code
This function verifies the MAC for a terminal request message. It returns the MAC residue for processing with the
response message. When the message includes an encrypted PIN, the function also derives the PPK required for use
in a PIN translate or PIN verify function.
Note: For initialization and host storage, KT is managed identically to a KTM. Hence, the
existing facilities for initialization of a KTM may be used to initialize a KT. For host storage, the
KT is encrypted using variant 5 of KM.
Processing Steps
1. Derive MAC key using KT, A and B. Refer, 10.5.2 and 10.8 in [43].
2. Calculate the MAC for Data. Refer, 10.2.2 and 10.8.5 in [43].
3. Compare the calculated MAC with the MAC value in the function request. Exit with error code 08, if the
comparison fails
4. Extract MAC residue from MAB, pad, and encrypt using KMv12. Refer, 10.2.2 in [43].
5. If PIN flag = 1, derive PIN Processing Key (PIN Protect Key) using KT, A, B, C and D. Encrypt the key using
KMv1. The length of the PPK will be the same as the length of KT. Refer, 10.5.5 and 10.8.3 in [43].
AUTH-PARAM-GENERATE (EF0617)
Request Length Type Description
FM 1 h Function Modifier
Issuer Domestic Code 5 d Issuer ABI code (domestic identifier for Italian bank) -
ASCII
rc 1 h Return Code
This function computes the Authentication Parameter for the input encrypted PIN Block. The function decrypts the PIN
Block and uses the authentication parameter algorithm with the input ABI code, Card Secure Code and PAN data to
compute the Authentication Parameter. The returned Authentication Parameter is optionally enciphered using the
provided key.
BDKGEN (EE0408)
Request Length Type Description
rc 1 h Return Code
This function generates a BDK. For subsequent use with other functions, the generated BDK key is encrypted by the
associated variant of the Domain Master Key.
Notes
– The key specifiers 13, 14 under the Response, are generated when using the Legacy option.
– The key specifiers 11, 12, 13, 14 under the Response, are generated based on the chosen operation on console
and FM. See, section Function Modifier Values.
Derived Unique Key per Transaction (DUKPT) is a key management method which uses a unique key for each
transaction, and prevents the disclosure of any past key used by the transaction-originating HSM (i.e. terminal PIN
pad).
This method relies on the use of a 'base derivation' key or BDK present only in the HSM of the first receiving node that
cryptographically processes that transaction. The unique Transaction Keys used by the HSM of a terminal are
transformations of an injected, unique-per-terminal Initial Key which is derived from the BDK. The transaction keys can
be calculated by the HSM of the receiving node using only the BDK and non-secret data transmitted by the terminal as
part of each transaction. With this method each transaction-originating HSM uses a unique key for each transaction,
yet never contains any information which would allow the determination of any key previously used by the HSM –
except by an exhaustive key search, nor of any key which has been or will be used by any other transaction-originating
HSM.
B-DECIPHER-ECB (85)
Request Length Type Description
85 1 h Function Code
85 1 h Function Code
rc 1 h Return Code
This function decrypts the supplied encrypted DATA using the B-key (BK) of the HSM stored 3624 Terminal Key Set as
indicated by the specified index (TKSI), and using the DES in Electronic Code Book mode.
B-ENCIPHER-ECB (84)
Request Length Type Description
84 1 h Function Code
84 1 h Function Code
rc 1 h Return Code
This function encrypts the supplied DATA under the B- key (BK) of the HSM stored 3624 Terminal Key Set as indicated
by the specified index (TKSI), using the DES in Electronic Code Book mode.
BPS-DECIPHER (EE0810)
Request Length Type Description
FM 1 h Function Modifier
F 1 h BPS Function
0 = Specified with key.
w 1 h Number of rounds
0 = Specified with key.
s 2 h Cardinality of s-integer
Tweak Data Var h When Tweak hash algo = 0 then, 8 bytes or 0 (implying 8
bytes of zeros)
When Tweak hash algo is 1 then, minimum length
supported by SHA1
When Tweak hash algo is 2 then, minimum length
supported by SHA256
rc 1 h Return Code
This function performs the decryption of BPS-encrypted data using a derived key. The DPK is derived as a UKD
(Unique Key per Device) or DUKPT-KPE, as defined in the key specifier.
Each s-integer in eDPK (Data) and IV is represented as a number of bits as specified by n. For example, decimal digits
could be represented in 4 bits (packed BCD) or in 8 bits (unpacked BCD or ASCII), and alpha-numerics (for example, s
= 61) could be represented in 6 or 8 bits. In all cases superfluous, high-order bits, i.e. where n > (log2(s) – rounded up),
are discarded without checking. The s-integers output from the decipher operation will be coded on the number of bits
specified in n.
The s-integer fields in eDPK (Data) and Data are left-justified in the byte-array. For example, if n = 4 and len is odd,
there will be a trailing 4-bit padding value.
If len > maxb, the CBC operating mode will be used (as defined in [70]). In this case, IV may incorporate maxb s-
integers or may be a zero-length field implying an IV of s-integers each with a value of zero. If len ≤ maxb then IV must
be a zero-length field.
Processing Steps
1. Check that F and w = 0. Different values may be allowed in the future where the information is not specified with
the key.
2. Check that s has a value of 10 or 61.
3. Check that n has a value as follows:
If s = 10, n = 4 or 8; if s = 61, n = 6 or 8.
If tweak hash algorithm is None, then tweak data can be 8 bytes or a zero-length field implying 8 bytes of
zeroes.
If tweak hash algorithm is not None, then tweak data must have at least the minimum length supported by the
identified hash algorithm.
4. Derive the DPK using the format 20 key specifier, which must incorporate a key specifier with format 0-3 or 15 in
order to access the BPS-BDK and associated parameters.
5. BPS-decrypt eDPK(Data) using the derived DPK, s, len, and IV .
6. Set each s-integer in decrypted result as n bits, with leading zero bits if required. Left-justify the padded s-integers
in the byte-array Data.
BPS-ENCIPHER (EE0811)
Request Length Type Description
FM 1 h Function Modifier
F 1 h BPS Function
0 = Specified with key
w 1 h Number of rounds
0 = Specified with key
s 2 h Cardinality of s-integer
Tweak Data Var h When Tweak hash algo = 0 then, 8 bytes or 0 (implying 8
bytes of zeros)
When Tweak hash algo is 1 then, minimum length
supported by SHA1
When Tweak hash algo is 2 then, minimum length
supported by SHA256
rc 1 h Return Code
This function performs the BPS encryption of data using a derived key. This function is not necessarily required, but
may be useful for testing purposes.
C-KEY-GEN (3B10)
This function generates a new random ATM Communication key and returns it encrypted under KMvA6, KMv22,
KMv44 and the old communication key.
KL 1 x Key length:
1 = Single
2 = Double
3 = Triple
CM 1 x Cipher mode:
0 = ECB
1 = CBC
rc 1 x Return Code
CALC-CSC (EE0501)
Request Length Type Description
rc 1 h Return code
This host function calculates CSC values to support CSC algorithm v2.0. The function generates CSC values
according to the algorithm given in CSC algo field, and returns them to the host.
The calculation of CSC function returns 6 bytes CSC packed string in an order as follows:
5CSC, 4CSC and 3CSC ( a packed representation of the 5,4 and 3 digit CSCs)
The function supersedes host function A8.
FM Function Modifier = 00
CSCK Spec Key Specifier for CSC Key. Formats: 0-3, 11, 13, 17, 18
Expiry Date/ Any Random Number, as specified in Table 37 of Page 69, in American Express Hardware
Unpredictable Security Module (HSM) Function Requirements.pdf , October 2010.
Number
Service Code Service code to derive CSC string. Left most nibble must be 0.
The possible range is 000-999 as given in section 4.6.4 of Reference [47] and Page 3-20 of
Reference [46].
Must be 0000 in case of CSC v1.0
Processing Steps
1. Get PAN and Expiry Date and form Card Data as detailed in the section 4.6.2 of Reference [46].
2. Depending upon the CSC algorithm, form account block and encrypt it with the CSC key and derive 12-nibble CSC
string as detailed in section 4.6.2 & 4.6.3 of Reference [46].
Note: It is the application’s responsibility to provide correct Service code and there is no check
for correctness in host function.
CALC-CSC-1 (000F)
This host function calculates CSC values to support CSC algorithm v2.0. The function generates CSC values
according to the algorithm given in CSC algo field, and returns them to the host.
rc 1 h Return code
The calculation of CSC function returns 6 bytes CSC packed string in an order as follows:
5CSC, 4CSC and 3CSC ( a packed representation of the 5,4 and 3 digit CSCs).
Expiry Date/ Any Random Number, as specified in Table 37 of Page 69, in American Express Hardware
Unpredictable Security Module (HSM) Function Requirements.pdf , October 2010.
Number
Processing Steps
1. Get PAN and Expiry Date and form Card Data as detailed in the section 4.6.2 of reference [16].
2. Depending upon the CSC algorithm, form account block and encrypt it with the CSC key and derive 12-nibble CSC
string as detailed in section 4.6.2 & 4.6.3 of reference [16].
Note: It is the application’s responsibility to provide correct Service code and there is no check
for correctness in host function.
CALCULATE-CSC (A8)
Request Length Type Description
A8 1 Function code
A8 1 h Function code
rc 1 h Return code
This function calculates CSC values and returns them to the host. Six bytes are returned. This is a packed
representation of the 3, 4 or 5 digit CSCs. The CSCs are returned in the previously mentioned order.
CardData This is the account Block derived from the PAN and expiry date as defined by American Express.
CALCULATE-IDN (EE3055)
This function is used to derive IDN number for cloud based payments.
FM 1 h Function Modifier = 00
rc 1 h Return Code
Processing Steps
1. Decrypt CMKCLIDN from KM55(CMKCLIDN)
2. Read first two bytes of IDN data.
3. Repeat steps ahead for iteration up to number of IDN value and then exit with resultant concatenated IDNs.
4. Use IDN generation algorithm as defined in reference [83], [84], [85] of Mark II, to generate IDN for current iterative
value of IDN data.
5. Append the response buffer with IDN for current iteration.
6. Increment the value of IDN data by 1.
7. Increment IDN data and go to step 3 for next iteration.
CCM-DECRYPT (EE305E)
This function is used for deciphering using CBC-Counter mode.
FM 1 h Function Modifier = 00
rc 1 h Return Code
Output Format = 1
Processing Steps
1. Extract CCMK
2. Pass Cipher text C, SV, CCMK and A to algorithm for CCM (Counter with CBC-MAC) for decrypting data received
(reference [83], [84], [85] of Mark II) for processing.
3. Extract D1, D2 and D3 as D = D1 || D2 || D3, where D is decrypted text and separation for D2 & D3 done via D2
offset and D3 offset
4. Based on key usage, encrypt D2 using provided key details.
5. Return D1, D2 and D3.
CCM-ENCRYPT (EE305D)
This function is used for enciphering in CBC-Counter mode.
FM 1 h Function Modifier = 00
D2 Type 1 h 0 = No data
1 = Data
rc 1 h Return Code
D2 Type Value = 1
Processing Steps
1. Extract CCMK.
2. If SV is not provided, generate a random 11 byte number.
3. Decrypt D2 using provided key details.
4. Concatenate D1, D2 and D3 as D = D1 || D2 || D3.
5. Pass D, SV, CCMK and A to Algorithm for CCM (Counter with CBC-MAC) for protecting data transmission
(reference [83], [84], [85] of Mark II) for processing.
6. Return Cipher text C and the initial SV sent to algorithm for processing.
CHECK-AUTHENTICATION-CODE (EE3050)
This function is used to validate the Authentication Code involving encrypted data.
FM 1 h Function Modifier = 00
rc 1 h Return Code
00 = Success
08 = Validation failed
Processing Steps
1. Decrypt Session ID using DPK Spec, Decryption Mode, IV, eDPK (Session_ID)
2. After decryption, remove as many check for N and extract N leftmost bytes from decrypted data. This will be
Session_ID
3. Follow the steps as provided in Algorithm for Deriving the Authentication Code (reference [83], [84], [85] of Mark II)
by using D1, D2, Session_ID
4. Compare the authentication codes calculated and provided (=CMSMPA_AUTH).
5. If the supplied and calculated values are same, the return code will be 00, else 08.
CHECK-CLEAR-MOBILE-PIN (EE3058)
This function is used to verify the encrypted mobile PIN with clear mobile PIN.
FM 1 h Function Modifier = 00
rc 1 h Return Code
MPPK –spec Var K-spec Key specifier to denote the MPPK to be used to
decrypt Mobile PIN
Formats: 0-3, 11, 13, 17, 18, 1C
Processing Steps
1. Check Mobile PIN value for length >=4 and <=8. Any length outside the range is error condition.
2. Decrypt the encrypted Mobile PIN
a. Decrypt MPPKref
b. Decrypt eMPPKref (Mobile PIN) or referenced mobile PIN using Encryption Mode ref, Ivref and
PaddingModeRef and get decrypted PIN block
c. Using ANB, derive Mobile PIN
d. Proceed to step 3
3. Compare the PIN from step 1 and step 2. If the two are same, return success, else return standard PIN errors.
CHECK-ENCRYPTED-MOBILE-PIN (EE3059)
This function is used to verify the provided mobile PIN against the reference mobile PIN.
FM 1 h Function Modifier = 00
Incoming Mobile PIN Var h Structure for Encrypted Mobile PIN (Incoming)
Details Encrypted Mobile PIN Details
Reference Mobile PIN Var h Structure for Encrypted Mobile PIN (Reference)
Details Encrypted Mobile PIN Details
rc 1 h Return Code
MPPK –spec Var K-spec Key specifier to denote the MPPK to be used to
decrypt Mobile PIN
Formats: 0-3, 11, 13, 17, 18, 1C
Processing Steps
1. Compare for ANB.
ANB in Incoming Mobile PIN details should match ANB in Reference Mobile PIN details.
2. Decrypt the Incoming Mobile PIN
a. Decrypt MPPKImp
b. Decrypt mobile PIN block using Decryption Mode Imp, IVImp (if needed) and PaddingModeImp
c. Using ANB, derive mobile PIN
d. Proceed to step 2
3. Decrypt the Reference Mobile PIN
a. Decrypt MPPKref
b. Decrypt eMPPKref (Mobile PIN) or referenced mobile PIN using Encryption Mode ref, Ivref and
PaddingModeRef and get decrypted PIN block
c. Using ANB, derive mobile PIN
d. Proceed to step 3
4. Compare the PIN from step 1 (derived if encrypted, else clear) and from step 2. If the two are same, success is
retured, else standard PIN errors.
CHESS-KEK-RECEIVE-6.3 (D002)
This function translates the encryption key of the *KEK from the Key Transport Key (*KTK) to variants of a Domain
Master Key (*KM) for host storage on the CKDS.
rc 1 h Return Code
CLEAR-PIN-ENCRYPT (EE0600)
This function accepts a clear PIN, formats it into an ANSI PIN Block and encrypts the PIN Block using the supplied
PPK.
FM 1 h Function Modifier
rc 1 h Return Code
PIN-Len Identifies the number of digits in the PIN, in the range 4 – 12.
PIN Clear PIN consisting of from 4 to 12 digits, packed 2 digits per byte. If PIN-len is odd, the digits must
be left justified in the PIN field with one trailing decimal pad digit.
PPK-Spec Key specifier for the PPK (eKMv1 - Format 0-3, 10, 11, 12, 13, 14, 17, 18, 20 or 90).
ANB 12 PAN digits of the Account Number Block used to format the ANSI PIN Block.
CONSTRUCT-TOKEN-B1 (C850)
This function generates a random KTK, enciphers it with an ATM’s public encipherment key, and builds a key token B1
signed by the host’s private signature key. This function required to support Remote Key transport on Diebold ATMs.
rc 1 x Return Code
eKMvAA(A) Var K-spec ASN.1 Random A-Key put in token B1 (format 21)
CREATE-ADDI-ICC-CERTIFICATE (EE0013)
Request Length Type Description
FM 1 h Function Modifier
ICC Public Key Var h A variable-length data element. This field is only present if
Remainder NIC > N – 42 and consists of the NIC – NI + 42 least
significant bytes of the ICC Public Key.
ICC Public Key Exponent Var h A variable-length data element provided by the issuer. ICC
Public Key Exponent equal to 3 or 216 + 1.
rc 1 h Return Code
Additional ICC Public Key Var h Digital signature for the public key certificate. The field
Certificate length is equal to the length NI of the modulus of SI
This function creates an ICC certificate with different SDA data than the certificate previously created by function
EE2048 or EE2058.
The function extracts the data from original certificate, adds data provided in the request message and creates the
additional certificate incorporating the new SDA data.
Processing Steps
1. Extract the required certificate data fields from ICC Public Key Certificate (i.e. fields up to and including ‘ICC
Public Key or Leftmost Digits of the ICC Public Key’.
2. Append ICC Public Key Remainder, ICC Public Key Exponent and Static Data to be Authenticated to form
the certificate data (MSG).
3. Calculate the hash value (h) of resulting certificate data.
4. Concatenate a header byte (B), the left part of certificate data (MSG1), the hash result (h) and the trailer byte (E) to
form X = B || MSG1 || h || E.
5. Sign X using the Issuer Private Key provided in SI to give Additional ICC Public Key Certificate.
CREATE-CSCK (A9)
Request Length Type Description
A9 1 h Function code
CSCK-Storage Indicator 1 h This field specifies whether the key is to be stored in the
host database or in HSM secure memory. Currently only the
value 0 is supported which means storage on the host.
*KBS Var h Key Block structure. Optional and present only if CSCK
needed in TR-31 Key Block Form for host- storage.
A9 1 h Function code
rc 1 h Return code
This function causes a random *CSCK to be generated and returned to the host encrypted under the *KM variant 6.
*KBS : KBS must be present if global settings require key in TR-31 key block.
Notes
– The key specifier 11 under the Response, are generated when using the Legacy option.
– The key specifiers 11, 13 under the Response, are generated based on the chosen operation on console and
FM.
CREATE-CSR (EE9204)
Request Length Type Description
FM 1 h Function Modifier
rc 1 h Return Code
Common Name 64
State 128
Locality 128
Organization Name 64
Email Id 128
• Common Name is the only mandatory field in CSR PU. Rest all other fields are optional.
• Digest used while creating the certificate is SHA256. No other value is supported.
• While using HSM stored keys, index of Public Key (PK) should be same as index of Private Key (SK).
• The final CSR generated by the function should be verifiable by openssl req command.
CREATE-X509-CERTIFICATE (EE9202)
Request Length Type Description
FM 1 h Function Modifier
Key Type 2 h Indicates the valid usage for the private key
2 Key Transport
User Data Var h Data to be stored in key specifier of Private Key (May be
zero length field)
rc 1 h Return Code
Private Key Var K-Spec Key Specifier containing the private key (SK) encrypted by
a KM variant.
(Format: 82)
This function returns a new DER encoded X.509 certificate along with RSA’s private key.
NOTES:
• Country Name must only be two characters.
• Maximum length of fields is as in the table below:
Common Name 64
State 128
Locality 128
Organization Name 64
Email Id 128
Serial Number 20
• Version Number, Common Name, Key length and Validity Period are the only mandatory fields in Certificate
Request PU. Rest all other fields are optional.
• Key Length’s allowed values are 1024 and 2048.
• Validity Period should be less than 3650 days. Also, if Current Date + Validity period (days) crosses 19-01-2038:
Error Code 0x04 FN_INVALID_FIELD_CONTENT is returned.
• Digest used while creating the certificate is SHA1.
• Key Type and User Data would be returned within Format 82 of Private Key.
• Key Type can only be “Key Transport”. No other value is supported.
• Version Number 01 will not support Serial Number as input in Certificate Request, whereas Version Number 02 will
support Serial Number as input in Certificate Request. The version number field in the function specification does
not refer to X.509 certificate version.
CVC3-GENERATE (EE0010)
Request Length Type Description
FM 1 h Function Modifier
UN 4 x Unpredictable Number
rc 1 h Return Code
This function generates a CVC3 using the method specified in reference [41] of Mark II.
Processing Steps
1. Derive KDCVC3 using IMKCVC and PAN Data.
2. If IV Mode = 0, IVCVC3 = IV Data
If IV Mode = 1, calculate IVCVC3 using KDCVC3 and IV Data.
3. Calculate CVC3 using KDCVC3, IVCVC3, UN and ATC.
4. Return the calculated CVC3 in the response.
CVC3-VERIFY (EE0011)
Request Length Type Description
FM 1 h Function Modifier
UN 4 x Unpredictable Number
rc 1 h Return Code
This function generates a CVC3 and compares it with the value of the transaction CVC3 provided in the request.
Processing Steps
1. Calculate CVC3 identically to processing steps 1 – 3 in function CVC3-GENERATE (EE0010)
2. Compare the calculated value of CVC3 with CVC3 in the request.
Return the result of the comparison in the response. A Return Code of 00 indicates CVC3 verification, and a Return
Code of 08 indicates verification failure.
CVV-GENERATE (EE0802)
Request Length Type Description
rc 1 h Return Code
This function generates a Card Verification Value (CVV) by the Visa method for card data (CVV-data).
CVK-Spec A key specifier which incorporates an index to a HSM-stored double length or key pair CVV or a host-
stored double-length CVV.
CVV-Data The data from which the CVV is generated. It is up to the host to format the field correctly and to do
any required range checking on the data. This field is normally populated in packed BCD format.
The data to be formed is dependent on which scheme you are following and is governed by respective
standard. For instance, the values used by Visa for the Card Verification Value (CVV) are PAN, Expiry
Date, and Service Code. See Reference A [91] for details on CVV calculation (as per Visa).
CVV The three digit Card Verification Value. The three digits are left aligned and right padded with the
hexadecimal digit "F".
Note: This function is equivalent to function CVV-GEN (9B) but incorporates a key specifier to
access the CVK.
CVV-VERIFY (EE0803)
Request Length Type Description
rc 1 h Return Code
This function verifies card data (CVV-data) deriving a CVV for that data and validating it against the CVV in the request.
CVK-Spec A key specifier which incorporates an index to a HSM-stored double length or key pair CVV or a
host-stored double-length CVV.
CVV-Data The data from which the CVV is generated. It is up to the host to format the field correctly and to do
any required range checking on the data. This field is normally populated in packed BCD format.
The data to be formed is dependent on which scheme you are following and is governed by
respective standard. For instance, the values used by Visa for the Card Verification Value (CVV) are
PAN, Expiry Date, and Service Code. See Reference A [91] for details on CVV calculation (as per
Visa).
CVV The digit byte Card Verification Value. The three digits are left aligned and right padded with the
hexadecimal digit "F".
A Return Code of 00 indicates CVV verification, and a Return Code of 08 indicates verification failure.
Note: This function is equivalent to function CVV-VER (9C) but incorporates a key specifier to
access the CVK.
D51-PPK-GEN (47)
Request Length Type Description
47 1 h Function Code
n 1 d KTM Index
47 1 h Function Code
rc 1 h Return Code
This function generates a random PIN Protect Key (PPK) and associated encrypted verification constant for a Docutel
5100 ATM.
For transmitting to the ATM, the generated key is returned encrypted by the Terminal Master Key (KTMn) indicated by
the specified index (KTM-index).
For host storage and subsequent use with the PIN Management Functions, the generated key is returned encrypted
under the KM Variant 1.
The verification constant (VCon) of X'0123456789ABCDEF' is encrypted by the generated key and the result is
returned for transmission to the ATM.
dCVV-GENERATE (EE0014)
Request Length Type Description
FM 1 h Function Modifier
CVV Data 16 h
rc 1 h Return Code
This function generates a CVV for the virtual mag stripe data (CVV Data).
IMKCVC-spec A key specifier which incorporates an index to a HSM-stored double length key or a host-stored
double-length key.
CVV Data The data from which the CVV is generated. It is up to the host to format the field correctly and to do
any required range checking on the data. This field is normally populated in packed BCD format.
The data to be formed is dependent on which scheme you are following and is governed by
respective standard. For instance, the values used by Visa for the Card Verification Value (CVV) are
PAN, Expiry Date, and Service Code. See Reference A [91] for details on CVV calculation (as per
Visa).
CVV The three-digit Card Verification Value. The three digits of packed BCD are left- aligned and right-
padded with the hexadecimal digit ‘F’.
Processing Steps
1. Recover IMK using IMK-spec.
2. Derive MK (UDK) using IMK and PAN Data. (The algorithm is identical to MK Method = 00 in function EE2018.)
Length Processing
– Derive MK:
MK1 = DES3(IMKCVC)[PAN Data]
MK2= DES3(IMKCVC)[PAN Data XOR (‘FF’||‘FF’||‘FF’||‘FF’||‘FF’||‘FF’||‘FF’||‘FF’)]
MK= (MK1 || MK2)
3. Calculate CVV using MK and CVV Data. (The method is identical to that in function EE0802.)
dCVV-VERIFY (EE0015)
Request Length Type Description
CVV Data 16 h
rc 1 h Return Code
This function verifies the virtual mag stripe data (CVV Data), calculating a CVV for that data and comparing it with the
CVV in the request.
IMKCVC-spec A key specifier which incorporates an index to a HSM-stored double length key or a host-stored
double-length key.
CVV Data The data from which the CVV is generated. It is up to the host to format the field correctly and to do
any required range checking on the data. This field is normally populated in packed BCD format.
The data to be formed is dependent on which scheme you are following and is governed by
respective standard. For instance, the values used by Visa for the Card Verification Value (CVV) are
PAN, Expiry Date, and Service Code. See Reference A [91] for details on CVV calculation (as per
Visa).
CVV The three-digit Card Verification Value. The three digits of packed BCD are left- aligned and right-
padded with the hexadecimal digit ‘F’.
Processing Steps
1. Recover IMKCVC using IMKCVC-spec.
2. Derive MK (UDK) using IMKCVC and PAN Data. (The algorithm is same as Function EE0014)
3. Calculate CVV1 using MK and CVV Data. (CVV1 is calculated using the method specified in reference [42] of
Mark II ).
4. Compare CVV1 with CVV and return result. A Return Code of 00 indicates CVV verification, and a Return Code of
08 indicates verification failure.
DECIPHER-2 (EE0801)
Request Length Type Description
FM 1 h Function Modifier
CM 1 h Cipher Mode
00 = ECB
01 = CBC
rc 1 h Return Code
This function deciphers the supplied data using a host-stored session key (DPK) supplied within a key specifier.
The function performs single-DES or triple-DES decipherment, as determined by the length of the supplied key, and
supports both Electronic Code Book (ECB) and Cipher Block Chaining (CBC) modes of operation. The function
supports decipherment of large messages (or data files) either by one call to the function or by multiple calls. For CBC
decipherment using multiple calls, chaining values must be maintained between calls.
DPK-Spec Key specifier incorporating a single or double or triple length host-stored or HSM-stored DPK.
ICV Chaining value for CBC decipherment. For decipherment of a message or file using one call, or on the
first call of a multi-call decipherment, this field should be set to the required value of the Initialization
Vector (IV). On subsequent calls of a multi-call decipherment, the field should be set to the value of
the OCB provided by the previous call.
For ECB decipherment, this field will be ignored.
OCV Chaining value for CBC decipherment. For decipherment of a message or file using a multi-call
decipherment, the value in this field should be used as the ICV in the next call.
For ECB decipherment, this field will be set to zero.
Note:
- This function supercedes functions 81, 83.
- When the function modifier is missing, the function returns error code 24, missing function
code.
DECIPHER-3 (EE0805)
Request Length Type Description
CM 1 h Cipher Mode
00 = ECB
01 = CBC
rc 1 h Return Code
This function deciphers the supplied data using a session key (DPK) supplied within a key specifier.
The function performs DES or SEED decryption, as determined by the DPK key specifier and supports both Electronic
Code Book (ECB) and Cipher Block Chaining (CBC) modes of operation. The function supports decipherment of large
messages (or data files) either by one call to the function or by multiple calls. For CBC decipherment using multiple
calls, chaining values must be maintained between calls.
DPK-Spec Key specifier incorporating a single-length or double-length or triple –length host-stored or HSM-stored
DPK. This field determines the encryption method.
DES – formats 00 – 03 (DES/TDES keys only), 10, 11, 12, 13, and 14, 17, and 18 .
SEED1 – formats 00 – 03 (SEED keys only) 16, 17 and 18.
ICV Chaining value for CBC decipherment. For decipherment of a message or file using one call, or on the
first call of a multi-call decipherment, this field should be set to the required value of the Initialization
Vector (IV). On subsequent calls of a multi-call decipherment, the field should be set to the value of
the OCB provided by the previous call.
For ECB decipherment, the contents of this field will be ignored.
For DES processing this field must be 8 bytes in length while for SEED processing this field must be
16 bytes in length.
eDPK(Data) Ciphertext to be deciphered. For DES processing this field must be a multiple of 8 bytes long while for
SEED processing it must be a multiple of 16 bytes.
OCV Chaining value for CBC decipherment. For decipherment of a message or file using a multi-call
decipherment, the value in this field should be used as the ICV in the next call.
For ECB decipherment, the contents of this field will be set to zero.
For DES processing this field will be 8 bytes in length, while for SEED processing this field will be 16
bytes in length.
Note: When the function modifier is missing, the function returns error code 24, missing
function code.
1SEED: A national security standard of Korea (KICS Korean Information Communication Standard) since June 2002.
SEED Algorithm: A 128-bit block cipher that has been widely used in Korea for confidential services such as e-
commerce, e-mail, financial service, data storage, electronic toll collection, VPN and digital rights management.
DECIPHER-4 (EE0807)
Request Length Type Description
FM 1 h Function Modifier
CM 1 h Cipher Mode
00 = ECB
01 = CBC
rc 1 h Return Code
This function decrypts the encrypted magnetic-stripe data, encrypted using the Magtek DUKPT algorithm.
The function is similar to the function DECIPHER-2 (EE0801), however, it incorporates support only for DPK derived
using the DUKPT key specifier (format 20 only). The DPK is derived using the ANS X9.24-1 algorithm for deriving a
PIN encrypting key.
DPK Key specifier incorporating a single or double length host-stored or HSM-stored DPK.
ICV Chaining value for CBC decipherment. For decipherment of a message or file using one call, or on the
first call of a multi-call decipherment, this field should be set to the required value of the Initialization
Vector (IV). On subsequent calls of a multi-call decipherment, the field should be set to the value of
the OCB provided by the previous call.
For ECB decipherment, this field will be ignored.
OCV Chaining value for CBC decipherment. For decipherment of a message or file using a multi-call
decipherment, the value in this field should be used as the ICV in the next call.
For ECB decipherment, this field will be set to zero.
Note:
- The function is disabled by default.
- The DPK is derived using the ANS X9.24-1 algorithm for deriving a PIN encrypting key.
- This function ignores the value assigned to the “Derived Key Type” field of the Format 20.
Though the function will accept the values as: 0x02 or 0x12, this value will be internally ignored
while deriving the PIN-encryption key.
DECIPHER-AES (EE0809)
Request Length Type Description
FM 1 h Function Modifier
CM 1 h Cipher Mode
00 = ECB
01 = CBC
rc 1 h Return Code
This function deciphers the supplied data using a host-stored session key (DPK) supplied within a key specifier. The
function performs AES decipherment and supports both Electronic Code Book (ECB) and Cipher Block Chaining (CBC)
modes of operation.
The function supports decipherment of large messages (or data files) either by one call to the function or by multiple
calls. For CBC decipherment using multiple calls, chaining values must be maintained between calls.
DPK-Spec Key specifier incorporating 128-bit or 192-bit or 256-bit AES host-stored key DPK.
ICV Chaining value for CBC decipherment. For decipherment of a message or file using one call, or on
the first call of a multi-call decipherment, this field should be set to the required value of the
Initialization Vector (IV). On subsequent calls of a multi-call decipherment, the field should be set to
the value of the OCB provided by the previous call. For ECB decipherment, this field will be ignored.
OCV Chaining value for CBC decipherment. For decipherment of a message or file using a multi-call
decipherment, the value in this field should be used as the ICV in the next call.
For ECB decipherment, this field will be set to zero.
Note: In EE0808 and EE0809, only AES encryption/decryption is allowed hence 52, 53 and 1C
format must contain AES keys only.
DERIVE-CBP-SESSION-KEYS (EE3052)
This function is used to derive Session Keys and Restricted Use Keys for Contactless and Remote Payments on
cloud.
FM 1 h Function Modifier = 00
Session Key Data Var h Session key data for deriving Session Key (SK) (alias
Limited Use Key (LUK))
KTK-spec Var K-Spec Key Specifier for Key Transport Key to encrypt SK
Formats: 0-3, 11, 12, 13, 14, 17, 18
Derivation Data for SUK Var h Derivation data to be used to derive SUK from SK
Refer Encrypted Mobile PIN Details
KTK-Spec Var K-Spec Key Specifier for Key Transport Key to encrypt SUK
Formats: 0-3, 11, 12, 13, 14, 17, 18
rc 1 h Return Code
For SUK Derivation Method = 00, use the structure Encrypted Mobile PIN Details
PF 1 h = 00
PIN block format (ISO-3)
Processing Steps
1. Retrieve Card Master Key from CMKxx. Here, xx belongs to {CLMD, CLUMD, RPMD, RPUMD}.
2. Extract KTK for encrypting SK from KTK-spec.
3. If Card Key Type = {01, 03}, then extract KTK for SUK from KTK spec.
4. Repeat following steps for number of SK_SUK times and exit after that.
5. Derive the Session Key from specified Session Key Method using the Session Key data.
To derive SK, use 2 byte ATC from Session Key Data.
If Session Key Method = 01, derive SK (alias LUK) using CMKxx and LUK derivation data, reference [86], [87], [88]
of Mark II. Please note that the 8th nibble will be ignored.
6. Extract KVC as per KVC method.
7. Encrypt derived Session Key using KTK, Encryption Mode for SK and IVSK.
8. Append encrypted SK with KVC in response.
9. If Card Key Type = {01, 03}, then proceed to step 10 for SUK derivation, else step 15 for next iteration.
10. Decrypt Mobile PIN using encrypted Mobile PIN details.
11. Derive SUK using clear Mobile PIN and SK by following the processing steps as defined in reference [83], [84], [85]
of Mark II.
12. Extract KVC as per KVC method.
13. Encrypt derived SUK by KTK extracted from KTK spec, using Encryption Mode for SUK and IVSUK.
14. Append encrypted SUK with KVC in temporary response buffer for SUK.
15. Increment ATC by 1 and proceed for next iteration from step 2. In case of LUK, increment counter value by 1
(allowed values are 0-99).
16. Merge the response buffers for array of SKs with response buffer for array of SUKs and publish the response.
DERIVE-CLOUD-CMK (EE3051)
This function is used to derive Card Master Keys for contactless and remote payments on cloud.
FM 1 h Function Modifier = 00
Function modifier reserved for possible future use.
CMK Derivation Data Var h PAN with seq/mod seq number as the key to be derived
requires.
No specific check in HSM.
Key-Spec Var h Key spec for input key specified in key type field above to
encrypt CMKxx
xx in CMKxx refers to Card Key Type (CLMD, CLUMD,
RPMD, RPUMD, CLIDN)
Formats: 0-3, 11, 12, 13, 14, 17, 18
Following fields must be present if Encryption Method = 12, i.e., outgoing key ekeytype (MK) needed in TR-31 key
block format and key type other than 00.
rc 1 h Return Code
Key Details
Format 1C
Key detail field contains following details pertaining to 1C key format.
KM-index 1 h Index of KM
Algorithm 1 h Algorithm
Format 10-14
In case of format 10-14, key details contain key type of derived key.
Format 17-18
Key detail field contains following details pertaining to 17 and 18 key format.
KM-index 1 h Index of KM
= 00
Processing Steps
1. Extract IMKxx from IMKxx-Spec depending upon card key type field.
Note:
- xx in CMKxx refers to Card Key Type - CLMD, CLUMD, RPMD, RPUMD, CLIDN
- xx in IMKxx refers to CL, RP, IDN
DERIVE-CVC3-KD-IV (EE0012)
Request Length Type Description
FM 1 H Function Modifier
Following fields must be present if Encryption Method =02 i.e. Outgoing Key needed in TR-31Key block format.
Exportability 1 h Any valid value as described in the table Defined values for
exportability byte.
rc 1 h Return Code
IVCVC3TRACK1 2 h
IVCVC3TRACK2 2 h
This function derives a unique-per-card, 16-byte, ICC CVC3 Data Key, DKCVC3. Optionally, it also calculates the 2-
byte IVCVC3 for Track 1 and Track 2.
The following table shows valid values of key usage, algorithms and mode of use.
Processing Steps
1. Derive KDCVC3 using IMKCVC and PAN Data.
2. Encrypt KDCVC3 using KTK or derived KKEK
3. Calculate kvc(KDCVC3).
4. If len(IV Data 1) > 0
calculate IVCVC3TRACK1
5. If len(IV Data 2) > 0
calculate IVCVC3TRACK2
DERIVE-ICC-MASTER-KEY (EE204A)
Request Length Type Description
IMK Type 1 h 01 = AC
02 = SMI
03 = SMC
04 = IDN
Exportability 1 h Any valid value as described in the table Defined values for
exportability byte.
rc 1 h Return Code
This function derives a unique-per-card, 16-byte, ICC Master Key. Depending on the type of IMK referenced, the
derived key may be one of the following: MKAC, MKSMI, MKSMC or MKIDN.
Although the derivation method provided in the EMV2000 specification [5] is not mandated, the payment system
specifications all incorporate that same method. Therefore, this function is appropriate for Europay, MasterCard or Visa
implementations.
Function Modifier Reserved for possible future use; must be set to zero.
IMK-Spec Key specifier for the Issuer Master Key (Formats 0 – 3, 11. 13, 17, 18). The Key specifier
describes the location of the key to be loaded from the ESM.
IMK Type 1 byte flag to represent the Issuer Master Key sub-type.
PAN Data PAN data, used to derive MK, which is then used with KTK to produce eKTK(MK).
KTK-Spec Key specifier for the Key Transport Key (KTK) (Formats 0 - 3, 11, 12, 13, 14, 17, 18, 50, 51).
Encryption Method ECB , CBC , CBC with padding encryption methods represented using 00 , 01 or 11
respectively.
KVC(MK) The return Key Verification Code (KVC) computed for the MK.
Processing Steps
1. Calculate the ICC Master Key (MK) using the Issuer Master Key and supplied PAN Data, according to the method
specified in A1.4 of [5].
2. Encrypt MK with KTK or the derived KKEK using the method specified by Encryption Method.
If KTK-Spec incorporates a format 50 key specifier, the MK is returned encrypted by the derived key KKEK.
3. Calculate the KVC for MK and return in kvc(MK).
For Encryption Method = 11, the derived key will be padded as shown in following table. The 24-byte plaintext padded
block will be encrypted using the CBC mode of operation. This will produce a 24-byte encrypted key which will be
returned in the response.
Length (bytes) 1 16 1 6
Function usage
The function is called during card initialization: the encrypted key would be passed to the card personalization system.
Notes
– Encryption Method = 12, Key Type field will be used to identify TR-31 Key usage.
– Key usage field must be matched to correct Key Type value.
– Encryption Method = 12, Response eKTK(MK) or eKKEK(MK) will be Var type field.
Following Table explained key usage, mode of use and algorithms fields to form TR-31 Key Block format key.
02 = SMI ‘E2’
03 = SMC ‘E1’
04 = IDN ‘E4’
DERIVE-KEY (EE0409)
Request Length Type Description
rc 1 h Return Code
Derived Key Var K-Spec Key specifier formats for Derived Key
(Formats: 10, 11, 12, 13, 14)
This function performs a key derivation operation in such a manner that the supplied derivation key is used to encrypt
the supplied derivation data. The result will be another single, double or triple DES key that is Derived Key.
FM The Host Key Protection using function modifier can be in the range of x0,
where x= 0, 1, or 2.
Derivation key Key specifier incorporating a single, double and triple length host-stored key.
The key type of the derivation key may be 40, 41, 42, 43 and 44 depending on the Key Type
field.
00, 40 40
01, 41 41
02, 42 42
03, 43 43
04, 44 44
05, 45 45
Derivation Data This field supplies the proprietary data which will be used to derive the key. The length of the
derivation data can be 8, 16 and 24 byte to derive the single, double or triple length key.
NOTE: A DES key (8 bytes) cannot be used to derive a triple DES key (16 or 24 bytes).
Derived Key Key specifier incorporating a single, double, and triple length derived key for host storage.
Processing Steps
1. Encrypt the derivation data by derivation key in the supplied ‘Derivation method’. The resultant value will be the
derived key.
Derived key specifier will be created based on the derived key length, ‘Key Type’ and the chosen mode of operation
on the console.
DERIVE-MOBILE-SESSION-KEY (EE305A)
This function is used to derive mobile session keys from the mobile master keys.
FM 1 h Function Modifier = x0
Method 1 h Method used to derive the Session key from the Master Key
rc 1 h Return Code
Processing Steps
1. Decrypt MKDK-1 to get Mobile Master Key for encryption.
2. Decrypt MKDK-2 to get Mobile Master Key for authentication.
3. If Method = 00, decrypt the derivation data using IV, Decryption Method and DPK Spec. Extract N leftmost bytes
to get derivation data in clear.
For Method = 01, Session ID is available in clear.
4. Derive the Mobile Session key (as defined in reference [83], [84], [85] of Mark II) passing MKDK-1 to get DPK
(Mobile Session Key for Encryption).
5. Derive the Mobile Session key (as defined in reference [83], [84], [85] of Mark II) passing MKDK-2 to get MPK
(Mobile Session Key for Authentication).
6. Encrypt them with required KM variant and publish the results in eKMv0 (DPK) and eKMv2 (MPK) using format 1C.
Use key details 1 to derive DPK (derived in step 4) and key details 2 to derive MPK (derived in step 5).
DERIVE-NEW-ICC-KEY (EE2053)
Request Length Type Description
KEK Var K-Spec Key Specifier for KEK (Format: 11, 13, 50, 51)
(derived from KMC)
Key Var K-Spec Key Specifier for Key (Format: 11, 13, 50, 51)
(for format 50 and 51, Key is derived from KMC; for format
11 and 13, Key refers to a host-stored KMC)
Following fields must be present if FM =01 i.e. Outgoing Key ( eKEK(Key)) needed in TR-31 Key Block Format.
Exportability 1 h Any valid value as described in the table Defined values for
exportability byte.
Y = 0 (Don’t pad)
Y = 3 (Pad to triple length)
rc 1 h Return Code
This function is provided to support the management of the Card Management Key (KMC) and the associated derived
card keys. It derives a new ICC key – Key – derived from the KMC.
KEK utilizes the format 50 key specifier which incorporates a 16 byte ‘Card unique derivation data’ field.
The KVC is calculated by encrypting all zero data with the key and then using the leftmost 3 bytes.
KEK- For formats 11 or 13 references a host stored KMC. For formats 50 or 51, the decryption key is derived
spec: from a stored KMC.
The following table shows valid key usage, algorithms and mode of use for derived Key.
DERIVE-NEW-ICC-KEY-SET (EE2052)
Request Length Type Description
K1KEK Var K-Spec Key Specifier for K1KEK (Format: 50, 51)
(derived from KMC1 )
K2xxx Var K-Spec Key Specifier for K2xxx (Format: 50, 51)
(derived from KMC2)
Following fields must be present if FM =01 i.e. Outgoing Keys needed in TR-31Key Block Format.
Exportability 1 h Any valid value as described in the table Defined values for
exportability byte.
Key Usage 2 h Valid value ‘M0’, ‘M1’, ’M2’, ’M3’, ’M4’, ’M5’
Exportability 1 h Any valid value as described in the table Defined values for
exportability byte.
Exportability 1 h Any valid value as described in the table Defined values for
exportability byte.
rc 1 h Return Code
This function is provided to support the management of the Card Management Key (KMC) and the associated derived
card keys.
This function derives a new ICC key set – K2KEK, K2MAC and K2ENC – derived from the new KMC, denoted KMC2. The
keys are returned individually encrypted by K1KEK, which is derived from the old KMC, denoted KMC1.
K1KEK and K2xxx utilize the format 50 key specifier which incorporates a 16-byte ‘Card-unique derivation data’ field. The
eighth byte and the sixteenth byte (numbering from one at the left) must be set to specified values that indicate the key
type of the derived key, as specified in Reference [32], and as follows:
01 = KENC
02 = KMAC
03 = KKEK
The format 50 key specifier must have ‘Card method’ set to 01 and 02. This indicates that the ‘Card-unique derivation
data’ will be ECB-encrypted to derive the card keys.
K1KEK Key specifier for K1KEK (derived from KMC1). The specifier must have the appropriate bytes set to 03, so
that a valid (old) K1KEK is derived.
K2xxx Key specifier for K2xxx (derived from KMC2). The specifier must have the appropriate bytes set to 01, so
that a valid (new) K2ENC is derived. After deriving the K2ENC, the two bytes are firstly overwritten with 02
and the K2MAC is derived, then they are overwritten with 03 and the K2KEK is derived.
Notes
FM = 01, output key eK1KEK(K2ENC), eK1KEK(K2MAC), eK1KEK(K2KEK) requested in TR-31 Key block format. Fields
mentioned to prepare Key block format keys must be present.
Following table described other fields used in order to prepare TR-31 Key Block key.
DUKPT-KEY-MAILER (EE040B)
Request Length Type Description
Line No. 1 h
Column No. 1 h
Data Var h
Line No. 1 h
Column No. 1 h
Data Var h
rc 1 h Return Code
This function derives the initial key for a DUKPT PIN Entry Device. The key is printed in component form on two
envelopes (A and B) for subsequent entry into the device. The function is controlled by an associated set of console
operations that determine various printing options.
IK A format-20 key specifier that provides the BDK and KSN used to derive the initial key for PIN Entry
Device. The Encryption Counter part of the KSN (i.e. the least significant 21 bits) must be zeroes
Line No. This is the number of the line on which the ‘Data’ is to be printed. It must be in the range of 1 to 40.
Column No. This is the number of the column from which the ‘Data’ is to be printed. It must be in the range of 1 to
120.
Data This is a variable length field that contains the ASCII data to be printed.
Note: Each optional item to be printed is defined by appending a set of the fields ‘Line no.’,
‘Column no.’, and ‘Data’ to the host request. Each ‘Data’ character must be printed within the
area defined by the size of the key mailer envelope. Also, each ‘Data’ character must not
overprint any other defined area (including other defined ‘Data’ areas).
EMV-AC-GEN (EE2000)
Request Length Type Description
IMKAC –Spec Var K-Spec Key specifier for IMKAC(Formats: 0–3, 11, 13, 17,18)
RN 8 h Random Number
rc 1 h Return Code
AC 8 h Application Cryptogram
This function generates an Application Cryptogram (TC, AAC or ARQC) as defined in ref. [1] of Mark II.
RN Random number for creating the ICC Session Key as defined in ref. [1] of Mark II. The HSM
performs no checking on the contents of this field.
AC Data Data used to calculate the TC, AAC or ARQC, as specified in ref. [1] of Mark II. The HSM performs
no checking on the contents of this field. This field must be a multiple of eight bytes.
The return code (rc) for this function indicates the success or failure of the function call. See Error Codes for a complete
listing of return codes.
Processing Steps
1. Derive the ICC Master Key (MKAC) using the Issuer Master Key and APANB, according to the method specified in
2.7.1 of reference[1] of Mark II.
2. Derive the ICC Session Key (SK) using the derived MKAC and RN, according to the method specified in 2.7.2 of
reference [1] of Mark II.
3. Calculate the Application Cryptogram using SK and the data provided in AC-Data, according to the method
specified in figure 2.3 of reference [1] of Mark II.
EMV-AC-GEN-MULTI (EE2019)
Request Length Type Description
MK Method 1 h 00 = Common
01 = SECCOS.
MK Data Var h Data used with IMKAC to derive MKAC. The contents of this
field are dependent on the value of MK Method.
AC Key Data Var h Data used with MKAC to derive the session key SKAC. The
contents of this field are dependent on the value of AC Key
Method.
rc 1 h Return Code
This function generates an Application Cryptogram (AC). The AC can be an ARQC, a TC or an AAC.
The function is sufficiently flexible to meet the AC Generation requirements of all processing variations used in different
EMV implementations. The function therefore supports several methods in each processing step.
Each step involves a key, a method and some data, where the specific method determines the format of the related
data. In the first step an initial key is provided in a key specifier, but subsequent steps use a key from a previous step.
The function treats each processing step independently, so does not treat any combination of methods as invalid.
However many combinations of methods would not coincide with the processing performed by any issued EMV card.
00 Common [1-8]
01 SECCOS [34]
Value 00
Field Length Type Description
MK Data is a variable-length field that contains the concatenation of the PAN and PAN Sequence
Number. The function processing of the MK Data to form an 8-byte field is, in summary, as follows:
Length Processing
Value 01
Field Length Type Description
01 SKD function using ATC and UN M/Chip 2.1 [31], SECCOS [34]
03 Tree of keys using ATC. Fixed IV, h EMV 4.1 CCD [35]
and b.
Value 00
Field Length Type Description
Null 0
Value 01
Field Length Type Description
UN 4 h Unpredictable Number
Value 02
Field Length Type Description
IV 16 h Initialization Vector
Value 03
Field Length Type Description
Value 04
Field Length Type Description
Value 05
Field Length Type Description
R 8 h Random Number
The random number (R) is combined with MKAC to form SKAC as described in clauses 2.7.2 and
2.8 of [7]. The identical transformation is also described in the SECCOS specifications [34] and in
the EMVCo Bulletin No 46 [36].
Value 06
Field Length Type Description
ATC is padded and encrypted using MKAC to form a double-length SKAC as described in 11.1.3.1
of [48].
Value 08
Field Length Type Description
00 1 1
01 1 2 EMV [5]
Usage of Methods
The following table is a matrix of the common combinations of methods. A call to the function would typically use the
methods identified across a single row of the table.
Implementation Methods
MK AC Key AC
AEIPS 00 00 02
J/Smart 00 04 02
M/Chips 2.1 00 01 03
Implementation Methods
MK AC Key AC
SECCOS 01 01 03
VSDC 1.3.2 00 00 02
NSICCS 00 08 03
EMV-AC-GEN-MULTI-AES (EE2023)
This function is used to generate AC for AES implementation of ICC cards.
AC Key Data Var h Data used with MKac to derive the Session key SKac.
The contents of this field are dependent on the value of AC
Key Method.
AC Method 1 h AC Method = 05
rc 1 h Return Code
• IMKxx will be used along with MK data length and method to derive card master/unique key. For EMV, refer section
A1.4, option C of Reference A [95]. For SECCOS, refer section 8.4.1.2 of Reference A [98].
• Card Master Key along with AC key data and AC key method to be used to derive Session key. For EMV, refer
section A1.3.1 of Reference A [95]. For SECCOS, refer chapter 8 of Reference A [98].
• Session Key will be used over AC data and/or ARPC data to compute cryptograms. Refer section A1.2.2 of
Reference A [95].
• Compute an ARQC as described in section 2 8.1.2 of Reference A [95] to verify the Transaction ARQC. Then an
ARPC must be computed as described in section 8.2.2 of Reference A [95].
Value 00
Field Length Type Description
Value 01
Field Length Type Description
Value 00
Field Length Type Description
R 16 h Random Number
Recommended value for EMV 4.3 AES; 2bytes of ATC appended with 14 bytes of 0x00
Value 01
Field Length Type Description
EMV-AC-VERIFY (EE2001)
Request Length Type Description
IMKAC-Spec Var K-Spec Key specifier for IMKAC (Formats: 0–3, 11, 13, 17 and 18)
RN 8 h Random Number
rc 1 h Return Code
This function verifies an application cryptogram (TC, AAC or ARQC) as defined in Reference [1] of Mark II.
FM = 00. When the = 00 is set to 00 the Bitmap field is not included. When the = 00 is set to 01 or 04
the Bitmap field is included. The setting of this field also effects the AC/CAP Token and the
Transaction Data fields. For details see the descriptions in the table above.
APANB Application PAN Block as defined in Reference [1] of Mark II. The HSM performs no checking on
the contents of this field.
RN Random number for creating the ICC Session Key as defined in Reference [1] of Mark II. The HSM
performs no checking on the contents of this field.
AC Application Cryptogram (TC, AAC or ARQC) Calculated by ICC as defined in reference [1] of Mark
II. This field is 8 bytes in length. This field is present when FM = 00.
CAP Token CAP Token (AAC or ARQC) that has been produced by an EMV ICC. This field is a Var field. This
field is present when FM = 01 or 04. When the function is used with FM = 01 or 04 support is
provided for a variable-length Application Cryptogram created as indicated by the set bits in the
Bitmap field. This modification supports the Chip Authentication Program as specified in [reference
[31] of Mark II].
The CAP Token field contains the bits of the Application Cryptogram to be verified as indicated by
the Bitmap (see below). If the length (in bits) of this field is greater than the number of bits that are
set to 1 in the Bitmap field, then the significant bits must be left-justified and padded to the right
with zero bits.
AC-Data Data used to calculate the TC, AAC or ARQC, as specified in reference [1] of Mark II. The HSM
performs no checking on the contents of this field. This field must be a multiple of eight bytes.
Bitmap The Bitmap field is a key specifier field. It specifies a HSM stored or host stored portion of the
Issuer Proprietary Bitmap (IPB) that relates to the Shortened AC. This field is not available when
FM is set to 00. The number of set bits must be ≤16 and ≥ 64 (note: there is no requirement that the
number of set bits is a multiple of 8).
Transaction Data signed to produce CAP Token. Only present when FM = 04. Must be a multiple of eight bytes.
Data
See EMV Function Examples for examples of request and response packages for this function.
The return code (rc) for this function indicates the success or failure of the function call. See Error Codes for a complete
listing of return codes.
Processing Steps
1. Derive the ICC Master Key (MKAC) using the Issuer Master Key and APANB, according to the method specified in
2.7.1 of reference [1] of Mark II.
2. Derive the ICC Session Key (SK) using the derived MKAC and RN, according to the method specified in 2.7.2 of
reference [1] of Mark II.
3. Calculate the Application Cryptogram using SK and the data provided in AC-Data, according to the method
specified in figure 2.3 of reference [1] of Mark II.
4. When FM=01, select only the bits indicated by the set bits in the bitmap to generate the reference Application
Cryptogram.
5. Compare the values of the calculated Application Cryptogram and that supplied in AC.
EMV-ARPC-GEN (EE2006)
Request Length Type Description
IMKAC-Spec Var K-Spec Key specifier for IMKAC(Formats: 0–3, 11, 13, 17 and 18)
rc 1 h Return Code
This function generates an Authorization Response Cryptogram as defined in reference [1] of Mark II.
APANB Application PAN Block as defined in reference [1] of Mark II. The HSM performs no checking on
the contents of this field.
ARPC Data Authorization Response Cryptogram Data, used for calculating the ARPC as defined in reference
[1] of Mark II.
The return code (rc) for this function indicates the success or failure of the function call. See Error Codes for a complete
listing of return codes.
Processing Steps
1. Derive the ICC Master Key (MKAC) using the Issuer Master Key and APANB, according to the method specified in
2.7.1 of reference [1] of Mark II.
2. Calculate the ARPC using the MKAC and the data provided in ARPC-DATA according to the method specified in
figure 2.4 of reference [1] of Mark II.
EMV-DAC-GEN (EE2002)
Request Length Type Description
IMKDAC –Spec Var K-Spec Key specifier for IMKDAC (Formats: 0–3, 11, 13, 17 and 18)
rc 1 h Return Code
This function generates a Data Authentication Code (DAC) as defined in reference [1] of Mark II.
APANB Application PAN Block as defined in reference [1] of Mark II. The HSM performs no checking on
the contents of this field.
The return code (rc) for this function indicates the success or failure of the function call. See Error Codes for a complete
listing of return codes.
Processing Steps
1. Derive the DAC using the Issuer Master Key and APANB, according to the method specified in 2.9 of reference [1]
of Mark II.
EMV-DAC-VERIFY (EE2003)
Request Length Type Description
rc 1 h Return Code
This function verifies a Data Authentication Code (DAC) as defined in reference [1] of Mark II.
APANB Application PAN Block as defined in reference [1] of Mark II. The HSM performs no checking on
the contents of this field.
DAC DAC(Data Authentication Code) calculated by ICC as defined in reference [1] of Mark II.
The return code (rc) for this function indicates the success or failure of the function call. See Error Codes for a complete
listing of return codes.
Processing Steps
1. Derive the DAC using the Issuer Master Key and APANB, according to the method specified in 2.9 of reference [1]
of Mark II.
2. Compare the values of the calculated Data Authentication Code and that supplied in DAC.
EMV-GENERATE-ARPC (EF2012)
Request Length Type Description
IV 16 h Initialization Vector
rc 1 h Return Code
IV Initialization Vector
ARPC Data Authorization Response Cryptogram Data, used for calculating the ARPC as defined in [1].
Processing Steps
1. Derive the ICC Master Key (MKAC) using the Issuer Master Key and PAN Data, according to the method specified
in A1.4 of reference [5] of Mark II.
2. Derive the ICC Session Key (SK) using the derived MKAC, IV, h, b and ATC, according to the method specified in
A1.3 of reference [5] of Mark II.
3. Calculate the ARPC using SK and ARPC Data according to the method specified in 8.2 of reference [5] of Mark II.
Note: ARPC Data should contain the value Y, which is the XORed combination of the ARQC
and the ARC.
Function usage
The function is used during online transactions. It can also be used during card initialization to test a card.
EMV-ICC-DN-GEN (EE2004)
Request Length Type Description
rc 1 h Return Code
This function generates a ICC Dynamic Number as defined in reference [1] of Mark II.
APANB Application PAN Block as defined in reference [1] of Mark II. The HSM performs no checking on the
contents of this field.
IDN Data Data for calculating IDN, as specified in reference [1] of Mark II.
The return code (rc) for this function indicates the success or failure of the function call. See Error Codes for a complete
listing of return codes.
Processing Steps
1. Derive the ICC Master Key (MKIDN) using the Issuer Master Key and APANB, according to the method specified in
2.7.1 of reference [1] of Mark II.
2. Calculate the IDN using the MKIDN and the data provided in IDN Data, according to the method specified in 2.10 of
reference [1] of Mark II.
Note: IDN Data should contain the value which is the ICC Application Transaction Counter
(ATC) and the Unpredictable Number (UN).
EMV-ICC-DN-VERIFY (EE2005)
Request Length Type Description
IMKIDN-Spec Var K-Spec Key specifier for IMKIDN(Formats: 0–3, 11, 13, 17,18)
RN 8 h Random Number
rc 1 h Return Code
This function verifies a ICC Dynamic Number as defined in reference [1] of Mark II.
APANB Application PAN Block as defined in reference [1] of Mark II. The HSM performs no checking on
the contents of this field.
RN Random number for calculating data of IDN as defined in reference [1] of Mark II.
IDN Calculated ICC Dynamic Number as defined in reference [1] of Mark II.
The return code (rc) for this function indicates the success or failure of the function call. See Error Codes for a complete
listing of return codes.
Processing Steps
1. Derive the ICC Master Key (MKIDN) using the Issuer Master Key and APANB, according to the method specified in
2.7.1 of reference [1] of Mark II.
2. Calculate the IDN using the MKIDN and the data provided in IDN Data, according to the method specified in 2.10 of
reference [1] of Mark II.
3. Compare the values of the calculated ICC Dynamic Number and that supplied in IDN.
Note: IDN Data should contain the value which is the ICC Application Transaction Counter
(ATC) and the Unpredictable Number (UN).
EMV-PIN-CHANGE-UNBLOCK (EE2016)
Request Length Type Description
P2 1 h Function Flag
00 = PIN UnBlock only
01 = PIN Change – delta Block
02 = PIN Change – non-delta PIN
Scheme 1 h 01 = MasterCard
02 = Visa 1.4 PIN
03 = Visa 1.3 PIN
04 = CPA
IMKSMI Var K-Spec Key specifier for IMKSMI (Formats: 0–3, 11, 13, 17,18)
IMKSMC Var K-Spec Key specifier for IMKSMC (Formats: 0–3, 11, 13, 17,18)
IMKAC Var K-Spec Key specifier for IMKAC (Formats: 0–3, 11, 13, 17,18)
rc 1 h Return Code
New PIN Data Var h Encrypted New PIN Data. The output PIN block format is
ISO-2
This function provides the cryptographic processing for an issuer script which will unBlock or change the offline
reference PIN stored in an EMV’96-based card. It calculates the MAC and, if required, the encrypted new PIN data.
PAN Data Formatted PAN and PAN Sequence No. This field is used with IMK to derive unique integrity
and confidentiality keys. Currently the Var field must be 8 bytes.
Session Key Data If Scheme = 01 (MasterCard), then Session Key Data contains an 8-byte random number.
If Scheme = 02 (Visa) then Session Key Data contains a 2-byte ATC. This field should be
used to calculate session integrity and confidentiality keys.
If Scheme = 04 (CPA) then Session Key Data must have 8-bytes of diversification value that
can be used to derive a session key as per section A1.3.1 of SU-46_New Session Key
Derivation algorithm w CVN 5_PU.pdf.
ePPK(PIN1) If the Function Flag (P2) = 01, this field is decrypted to get the existing PIN
PF ISO formats 0 and 3. This field is used to get the new PIN and, if appropriate, the existing PIN
ANB This field is used to get the new PIN and, if appropriate, the existing PIN
Script-Data Position For P2 = 01 or 02, this points to the start byte in Script-Data where the encrypted PIN data will
be copied. A Script-Data Position of zero points to the start of Script-Data. This field is big
endian.
The function will fail with Error Code 78 if PF indicates a PIN block format that is disabled.
EMV-PIN-CHANGE-UNBLOCK-EMV-2000 (EE2017)
Request Length Type Description
P2 1 h Function Flag
00 = PIN UnBlock only
01 = PIN Change – delta Block
02 = PIN Change – non-delta PIN
Scheme 1 h 01 = MasterCard
02 = Visa 1.4 PIN
03 = Reserved. (American Express)
IMKSMI Var K-Spec Key specifier for IMKSMI (Formats: 0–3, 11, 13, 17,18)
IMKSMC Var K-Spec Key specifier for IMKSMC (Formats: 0–3, 11, 13, 17,18)
IV 16 h Initialization Vector
rc 1 h Return Code
This function provides the cryptographic processing for an issuer script which will unBlock or change the offline
reference PIN stored in an EMV2000-based card. It calculates the MAC and, if required, the encrypted new PIN data.
The key specifiers 11, 13 (IMKSMI/IMKSMC/IMKAC) and 10, 11, 13 (PPK) under the Request, are generated based on
the chosen operation on console and FM.
PAN Data Formatted PAN and PAN Sequence No. This field is used with IMK to derive unique integrity and
confidentiality keys. Currently the Var field must be 8 bytes.
ePPK(PIN1) If the Function Flag (P2) = 01, this field is decrypted to get the existing PIN
PF ISO formats 0 and 3. This field is used to get the new PIN and, if appropriate, the existing PIN
ANB This field is used to get the new PIN and, if appropriate, the existing PIN
Script-Data For P2 = 01 or 02, this points to the start byte in Script-Data where the encrypted PIN data will be
Position copied. A Script-Data Position of zero points to the start of Script-Data. This field is big endian.
Script-Data Used to calculate the MAC. If the last (or only) data Block is less than 8 bytes it is padded to the
right with a hexadecimal 80. If this data Block is still less than 8 bytes it is right filled with 1 byte
hexadecimal zeros until it is 8 bytes. The script data length must be greater than or equal to the sum
of offset and the length of encrypted New PIN data.
The function will fail with Error Code 78 if PF indicates a PIN block format that is disabled.
EMV-PIN-CHANGE-UNBLOCK-MULTI (EE2021)
Request Length Type Description
SC 1 h Select Code
02 = PIN Unblock only
03 = PIN Change
MK Method 1 h 00 = Common
01 = SECCOS.
MK Data Var h Data used with IMKSMx to derive MKSMx . The contents of
this field are dependent on the value of MK Method.
SM Key Data Var h Data used with MKSMx to derive the session key SKSMx .
The contents of this field are dependent on the value of SM
Key Method. When SM Key Method = 07, It must contain 8-
bytes of diversification value to derive session key.
rc 1 h Return Code
This function is a combination of the designs of functions EE2019 and EE2017 , using the approach to key derivation
from the former with modifications as appropriate, and the encryption / MAC fields specific to PIN Unblock/Change
from the latter.
The subscript SMx is used to denote both SMI and SMC.
FM = 00
MK Method Methods are supported for deriving the ICC Master Keys. (MKSMX)
00=Common; 01=SECCOS.
MK Data Data used with IMKSMx to derive MKSMx . The contents of this field are dependent on the value of
MK Method.
SM Key Method Methods exist for deriving a Session Key (SKsmx) from the MKSMX.
SM Key Data Data used with MKSMx to derive the session key SKSMx . The contents of this field are dependent
on the value of SM Key Method.
PF Data It is a variable-length field that contains zero or more fields incorporating the data required by the
specific PF Method.
PC Method PIN confidentiality data. Encrypt the cleartext PIN block using SKSMC to generate the Encrypted
New PIN data.
00 = Formatting 01 / ECB
01 = Formatting 01 / CBC
02 = Formatting 00 / ECB
03 = Formatting CPA/ CBC
PC methods 00 and 01 employ formatting method 01. With this formatting method, a length byte is
prepended to the 8-byte plaintext PIN block and 7 bytes of padding are appended, as follows:
This produces a 16-byte result which is then encrypted using the identified encryption mode of
operation (ECB or CBC). The resultant is 16-byte New PIN Data field.
Note: The formatting 01 as described above is currently applicable only when the PF Method
supplied is 11 or 12. As per the enhancement in EE2021:
If “PC Method = 02” and “PF Method = 11 or 12” then,
Formatting 01 is not applicable; instead formatting 00 will be applied.
PC method 02 employs formatting method 00. This is a null formatting method, whereby no further
formatting is applied. The 8-byte plaintext PIN block is encrypted using the ECB mode of operation
and the resultant is 8-byte New PIN Data field.
PI Method PIN integrity method. Supports the following two methods for calculating MAC:
- using SKSMI.
- using clause as specified in 3.1.1.5 of [80]
PI Data It is a variable-length field incorporating the data required by the specific PI method.
New PIN Data Encrypted New PIN Data. It is formatted as a standard Var field. This field is only present when
SC = 03.
Note: When SC =02 then fields IMKSMC –Spec , PF Method, PF Data, PC Method is not
used ; they must have a valid length field but there data portion will not be checked .
The function is sufficiently flexible to meet the requirements of all processing variations used in different EMV
implementations. The function therefore supports several methods in each processing step.
Each step involves a key, a method and some data, where the specific method determines the format of the related
data. In the first step an initial key is provided in a key specifier, but subsequent steps use a key from a previous step.
The function treats each processing step independently, so does not treat any combination of methods as invalid.
However many combinations of methods would not coincide with the processing performed by any issued EMV card.
01 ISO-1 [40]
PF Data It is a variable-length field that contains zero or more fields incorporating the data required by the
specific PF methods.
Value 01
Field Length Type Description
and 02
ePPK(PIN) 8 h Encrypted PIN Block
PPK Var K-Spec Key specifier for PPK (Formats: 0 - 3, 10, 11, 12, 13, 14)
Value 11
Field Length Type Description
PPK Var K-Spec Key specifier for PPK (Formats: 0 - 3, 10, 11, 12, 13,
14)
Value 12
Field Length Type Description
PPK Var K-Spec Key specifier for PPK (Formats: 0 - 3, 10, 11, 12, 13,
14)
PI Data It is a variable-length field that contains zero or more fields incorporating the data required by the
specific PI method.
Value 00 & 01
Field Length Type Description
Script-Data For SC = 03, this points to the start byte in Script-Data where the encrypted New PIN data will be
Position copied. A Script-Data Position of zero points to the start of Script-Data. This field is big Endean.
Script-Data Used to calculate the MAC. If the last (or only) data Block is less than 8 bytes it is padded to the
right with a hexadecimal 80. If this data Block is still less than 8 bytes it is right filled with 1 byte
hexadecimal zeros until it is 8 bytes. The script data length must be greater than or equal to the
sum of offset and the length of encrypted New PIN data.
03 Tree of keys using ATC. Fixed IV, h EMV 4.1 CCD [35]
and b.
07 When SM Key Method=07, then the Section A1.3.1 of SU-46_New Session Key
Session Key Data field must have Derivation algorithm w CVN 5_PU.pdf
8-bytes of diversification value that
can be used to derive a session key
SM Key Data is a variable-length field that contains zero or more fields incorporating the data
required by the specific SM Key methods.
Value 02
Field Length Type Description
IV 16 h Initialization Vector
Value 03
Field Length Type Description
Value 04
Field Length Type Description
Value 05
Field Length Type Description
R 8 h Random Number
Value 06
Field Length Type Description
ATC is padded and encrypted using MKSMI or MKSMC to form a double-length SKSMI or SKSMC as
described in 11.1.3.1 of [48].
Note: Derivation of a single-length session key will not be supported.
Value 08
Field Length Type Description
Processing steps
1. If SC is 03, derive the ICC MAC Master Key (MKSMC) using the Issuer Master Key (IMKSMC) and MK Data
according to method specified in MK Method.
2. Derive the ICC MAC Session Key (SKSMC) using the derived MKSMC, SM Key Data according to the method
specified in SM Key Method.
3. Derive the ICC Encipherment Master Key (MKSMI) using the Issuer Master Key (IMKSMI) and MK Data, according
to the method specified in MK Method.
4. Derive the ICC Encipherment Session Key (SKSMI) using the derived MKSMI, SM Key Data according to the
method specified in SM Key Method.
5. If SC is 3, create the cleartext PIN block according to the method specified in PF Method.
6. If SC is 3, encrypt cleartext PIN block using SKSMC according to the encryption mode of operation specified in PC
Method. If SC is 3, insert the resulting ciphertext in Script-Data (PI Data) at the position specified by Script-Data
Position (PI Data).
7. Calculate the MAC for Script-Data using SKSMI.
Usage of Methods
The following table is a matrix of the common combinations of methods. A call to the function would typically use the
methods identified across a single row of the table.
Implementation Methods
MK SM Key PF PC PI
AEIPS 00 04 11, 12 02 00
J/Smart 00 04 11,12 00 00
M/Chip 2.1 00 05 02 02 00
SECCOS 01 05 01, 02 01 00
Implementation Methods
MK SM Key PF PC PI
Note:
- As indicated in the table above, the AEIPS and M/Chip 2.1 Implementations hold equivalent
values for the PC Method.
- Since, encrypting one block of 8-bytes CBC with an IV of 0 is the same as ECB, the
encryption modes (CBC and ECB) fall equivalent with each other. Hence, even though AEIPS
and M/Chip 1.2 specifies CBC mode, it is equally correct to use ECB.
EMV-PIN-CHANGE-UNBLOCK-MULTI-AES (EE2025)
This function is used to change and unblock PIN with respect t to AES keys for EMV processing.
SC 1 h Select Code
02 = PIN Unblock only
03 = PIN Change
MK Data Var h Data used with IMKsmx to derive MKsmx. The contents of
this field are dependent on the value of MK Method. Refer to
MK Method described in the table below.
SM Key Data Var h Data used with MKsmx to derive the session key SKsmx.
The contents of this field are dependent on the value of SM
Key Method.
rc 1 h Return Code
Value 00
Field Length Type Description
Value 01
Field Length Type Description
Value 00
Field Length Type Description
R 16 h Random Number
Recommended value for EMV 4.3 AES; 2bytes of ATC appended with 14 bytes of 0x00
Value 01
Field Length Type Description
01 ISO-1 [40]
PF Data It is a variable-length field that contains zero or more fields incorporating the data required by
the specific PF methods.
Value 01 and 02
Field Length Type Description
PPK Var K-Spec Key specifier for PPK (Formats: 0 - 3, 10, 11, 12, 13, 14)
Value 00 and 01 With this formatting method, a length byte is prepended to the 8-byte plaintext PIN block and 7
bytes of padding are appended, as follows:
X'08' || <8-byte plaintext PIN block> || X'80000000000000"
This produces a 16-byte result which is then encrypted using the identified encryption mode of
operation (ECB or CBC). The resultant is 16-byte New PIN Data field.
Value 02 and 03 ISO 9797-1 pad method 4 will be used with 8 byte PIN Block to make it 16 byte plaintext block
before encryption.
The 16-byte plaintext PIN block is encrypted using the encryption mode of operation (ECB or
CBC).
PI Data It is a variable-length field that contains zero or more fields incorporating the data required by
the specific PI method.
Value 05
Field Length Type Description
Script-Data Position: For SC = 03, this points to the start byte in Script-Data where the
encrypted New PIN data will be copied. A Script-Data Position of zero points to the start of
Script-Data. This field is big Endean.
Script-Data: Used to calculate the MAC. If the last (or only) data Block is less than 8 bytes it is
padded to the right with a hexadecimal 80. If this data Block is still less than 8 bytes it is right
filled with 1 byte hexadecimal zeros until it is 8 bytes. The script data length must be greater
than or equal to the sum of offset and the length of encrypted New PIN data.
Processing Steps
1. The function derives two keys (Script ENC and Script MAC) to card specific keys and dynamize them for scripting
to session keys. Derive the ICC Encipherment Master Key (MKsmi) using the Issuer Master Key (IMKsmi) and MK
Data, according to the method specified in MK Method. Derive the ICC Encipherment Session Key (SKsmi) using
the derived MKsmi, SM Key Data according to the method specified in SM Key Method.
2. An ISO-PIN-Block-Format-2 PIN Block must be generated and AES-encrpyted with the Script ENC sessionkey. A
AES-CMAC must be computed with the Script MAC sessionkey.
3. The Card specific key is calculated as described in section A1.4, Option C of Reference A [95].
4. The Dynamic session key is calculated as described in section A1.3.1 of Reference A [95].
5. The encryption and mac computation is done as described in section 9.3.1.1 and 9.2.1.1 of Reference A [95].
6. If SC is 3, create the clear text PIN block according to the method specified in PF Method. Encrypt clear text PIN
block using SKsmc according to the encryption mode of operation specified in PC Method. Insert the resulting
cipher text in Script-Data (PI Data) at the position specified by Script-Data Position (PI Data).
7. Calculate the MAC for Script-Data using SKsmi.
EMV-PIN-CHANGE-UNBLOCK-VISA (EF2015)
Request Length Type Description
P2 1 h Function Flag
00 = PIN UnBlock only
01 = PIN Change/UnBlock using PIN
02 = PIN Change/UnBlock using PIN
Offset 6 d Offset
rc 1 h Return Code
The purpose of this function is to provide the issuer with the capability either to unBlock the PIN or to simultaneously
change and unBlock the reference PIN.
This function calculates the MAC and if required the encrypted new PIN data.
IMKSMI –Spec Issuer Master Key for secure message integrity key specifier.
Formats 0 - 3, 11, 13, 17 and 18 are accepted.
IMKSMC –Spec Issuer Master Key for secure message confidentiality key specifier.
Formats 0 - 3, 11, 13, 17 and 18 are accepted.
The following three request fields are utilized in the calculation of the new PIN. These fields are only processed when
P2 = 01 or 02.
PPK-Spec Key specifier for PPK. Formats 0 - 3, 10, 11 12, 13, 14, 17, and 18 are accepted.
The following four request fields are utilized in the calculation of the current PIN. These fields are only processed
when P2 = 01.
PVK-Spec Key specifier for PVK. Formats 0 - 3 , 11, 12, 13, 14, 17, and 18 are accepted.
Offset This field consists of 12 digits of offset data. The significant digits are left justified in the field.
Script-Data Position For P2 = 01 or 02, this points to the start byte in Script-Data where the encrypted PIN data will
be copied. A Script-Data Position of zero points to the start of Script-Data. This field is big
endian.
Script-Data Used to calculate the MAC. If the last (or only) data Block is less than 8 bytes it is padded to
the right with a hexadecimal 80. If this data Block is still less than 8 bytes it is right filled with 1
byte hexadecimal zeros until it is 8 bytes. The script data length must be greater than or equal
to the sum of offset and the length of encrypted New PIN data.
Processing Steps
1. Get the value of P2.
2. If the value of P2 is set to ‘01’ perform the following steps -
– Get the current reference PIN from the PVK-Spec, Validation Data, Offset and PIN length fields.
– Derive the ICC Data Encipherment Master Key (MKSMC) using the Issuer Master Key (IMKSMC) and PAN
data, according to the method specified in A1.4 of reference [5] of Mark II. Derive the ICC Data Encipherment
Session Key (SKSMC) using the derived MKSMC and ATC, according to the method specified in B.4 of
reference [9] of Mark II.
– Get the new reference PIN from the ePPK(PIN), PPK-Spec and ANB fields.
– A 16 hexadecimal digit PIN Block is formed as follows
- Take the 8 rightmost digits of the DK A and right justify them in a 16 digit field, zero fill the remaining 8 digits.
- Take a second 16 hexadecimal digit Block, form the unformatted ANSI PIN Block with the new PIN.
- Xor the 2 Blocks of data to form the PIN Block.
– Xor this PIN Block with the current PIN, where the current PIN is left justified in a 16 hexadecimal digit Block
and zero filled. The result is called the “delta PIN”.
– Encrypt the delta PIN with the Data Encipherment SKs according to B.3 (figure B-2) of reference [9] of Mark II
to generate the encrypted new PIN data.
3. If the value of P2 is set to ‘02’ perform the following steps -
– Derive the ICC Data Encipherment Master Key (MKSMC) using the Issuer Master Key (IMKSMC) and PAN
data, according to the method specified in A1.4 of Ref [5]. Derive the ICC Data Encipherment Session Key
(SKSMC) using the derived MKSMC and ATC, according to the method specified in B.4 of reference [9] of
Mark II.
– Get the new reference PIN from the ePPK(PIN), PPK-Spec and ANB fields.
– A 16 hexadecimal digit PIN Block is formed as follows
- Take the 8 rightmost digits of the DK A and right justify them in a 16 digit field, zero fill the remaining 8 digits.
- Take a second 16 hexadecimal digit Block, form an unformatted ANSI PIN Block with the new PIN.
- Xor the 2 Blocks of data to form the PIN Block.
– Encrypt this PIN Block with the Data Encipherment Session Keys according to B.3 (figure B-2) of reference [9]
of Mark II to generate the encrypted new PIN data.
4. Derive the ICC MAC Master Key (MKSMI) using the Issuer Master Key (IMKSMI) and PAN data, according to the
method specified in A1.4 of reference [5] of Mark II. Derive the ICC MAC Session Key (SKSMI) using the derived
MKSMI and ATC, according to the method specified in B.4 of reference [9] of Mark II .
5. Calculate the MAC according to B.2 (figure B-1) of reference [9] using SKSMI. If P2 is equal to ‘00’, the MAC data
is the Script-Data. If P2 is equal to ‘01’ or ‘02’, copy in the encrypted PIN data into the Script-Data at the position
specified by the ‘Script-Data position’ field, use this resulting data as the MAC data.
The function will fail with Error Code 78 if the format 10 PIN block is disabled.
Note:
- Request fields that are not required for processing are present but not used. They must be of
the correct length and format. If the field is a var field it must be a valid variable-length field, its
data portion will not be checked.
- When P2 = ‘00’ the response field ‘New PIN data’ is absent.
EMV-SCRIPT-CRYPTO (EE2007)
Request Length Type Description
SC 1 h Select Code
01 = Encrypt Command Data Only
02 = Calculate MAC for entire command
03 = Encrypt and Calculate MAC
RN 8 h Random Number
rc 1 h Return Code
This function performs the cryptographic processing required for Secure Messaging as defined in reference [1] of Mark
II. It is intended to be used to either:
• encrypt the command data;
• calculate a MAC for the command header and command data; or
• encrypt the command data and calculate a MAC for the command header and encrypted command data.
APANB Application PAN Block as defined in reference [1] of Mark II. The HSM performs no checking on
the contents of this field.
RN ARQC/AAC/TC.
Text Script Command Data that is included in the sent Script to ICC.
Offset For SC = 3, points to the start byte in ‘Script-Data’ where the encrypted ‘Text’ will be copied. An
‘Offset’ of zero points to the start of Script-Data. Note this field is always big endian. i.e. the byte
order in this field is most significant byte first.
Script-Data Script Data is sent to ICC. The script data length must be greater than or equal to the sum of
offset and the length of encrypted New PIN data.
eSMC(text) Encrypted text in a variable length field. This is the same length as the specified input “Text” field.
If FM = 0 this is pure data and is not formatted as a Var field. If FM = 1 it is a standard Var field.
Processing Steps
1. If SC is 1 or 3, derive the ICC MAC Master Key (MKSMC) using the Issuer Master Key (IMKSMC) and APANB,
according to the method specified in 2.7.1 of reference [1] of Mark II. Derive the ICC MAC Session Key (SKSMC)
using the derived MKSMC and RN, according to the method specified in 2.7.2 of reference [1] of Mark II.
2. If SC is 2 or 3, derive the ICC Encipherment Master Key (MKSMI) using the Issuer Master Key (IMKSMI) and
APANB, according to the method specified in 2.7.1 of reference reference [1] of Mark II. Derive the ICC
Encipherment Session Key (SKSMI) using the derived MKSMI and RN, according to the method specified in 2.7.2 of
reference [1] of Mark II.
3. If SC is 1 or 3, encrypt Text using SKSMC – CBC mode. If SC is 3, insert the resulting ciphertext in Script-Data at
the position specified by Offset.
4. If SC is 2 or 3, calculate the MAC for Script-Data using SKSMI.
EMV-SCRIPT-CRYPTO-EMV-2000 (EF2013)
Request Length Type Description
SC 1 h Select Code
01 = Encrypt Command Data Only
02 = Calculate MAC for entire command
03 = Encrypt and Calculate MAC
IV 16 h Initialization Vector
Offset 2 h Offset
rc 1 h Return Code
This function performs the cryptographic processing required for Secure Messaging, i.e. message authentication and /
or message encryption. It is intended to be used to either:
(i) just encrypt the command data;
(ii) just calculate a MAC for the command header and command data; or
(iii) both encrypt the command data and calculate a MAC for the command header and encrypted command data.
The ICC Session Key is derived using the method specified in the EMV2000 specification, s reference [5] of Mark II.
IV Initialization Vector
Text Script Command Data that is included in the sent Script to ICC. (Length must be a multiple of 8.)
Offset For SC = 3, points to the start byte in ‘Script-Data’ where the encrypted ‘Text’ will be copied. An
‘Offset’ of zero points to the start of Script-Data.
This field is big endian. i.e. the byte order in this field is most significant byte first.
Script-Data Script Data is sent to ICC. (Length must be a multiple of 8). The script data length must be greater
than or equal to the sum of offset and the length of encrypted New PIN data.
eSKSMC(Text) Encrypted text in a variable length field. This is the same length as the specified input “Text” field. If
FM = 00 this is pure data and is not formatted the same as a Var field. If FM = 01 it is a standard Var
field.
Processing Steps
1. If SC is 1 or 3, derive the ICC MAC Master Key (MKSMC) using the Issuer Master Key (IMKSMC) and PAN Data,
according to the method specified in A1.4 of reference [5] of Mark II.
2. Derive the ICC MAC Session Key (SKSMC) using the derived MKSMC, IV, h, b and ATC, according to the method
specified in A1.3 of reference [5] of Mark II.
3. If SC is 2 or 3, derive the ICC Encipherment Master Key (MKSMI) using the Issuer Master Key (IMKSMI) and PAN
Data, according to the method specified in A1.4 of reference [5] of Mark II.
4. Derive the ICC Encipherment Session Key (SKSMI) using the derived MKSMI, IV, h, b and ATC, according to the
method specified in A1.3 of reference [5] of Mark II.
5. If SC is 1 or 3, encrypt Text using SKSMC according to the encryption mode of operation specified in Encryption
Mode. If SC is 3, insert the resulting ciphertext in Script-Data at the position specified by Offset.
6. If SC is 2 or 3, calculate the MAC for Script-Data using SKSMI.
EMV-SCRIPT-CRYPTO-MULTI (EE2020)
Request Length Type Description
SC 1 h Select Code
01 = Encrypt Command Data Only
02 = Calculate MAC for entire command
03 = Encrypt and Calculate MAC
MK Method 1 h 00 = Common
01 = SECCOS.
MK Data Var h Data used with IMKSMx to derive MKSMx . The contents of
this field are dependent on the value of MK Method.
SM Key Data Var h Data used with MKSMx to derive the session key SKSMx .
The contents of this field are dependent on the value of SM
Key Method.
Offset 2 h Offset
rc 1 h Return Code
This function performs the cryptographic processing required for Secure Messaging, i.e. message authentication and /
or message encryption. It is intended to be used to either:
(i) just encrypt the command data;
(ii) just calculate a MAC for the command header and command data; or
(iii) both encrypt the command data and calculate a MAC for the command header and encrypted command data.
The subscript SMx is used to denote both SMI and SMC.
FM =00
MK Data Data used with IMKSMx to derive MKSMx . The contents of this field are dependent on the value of
MK Method.
SM Key Method Methods for deriving a Session Key(SKSMx ) from the MKSMx .
SM Key Data Data used with MKSMx to derive the session key SKSMx . The contents of this field are dependent
on the value of SM Key Method.
Text Script Command Data that is included in the sent Script to ICC. (Length must be a multiple of 8.)
Offset For SC = 3, points to the start byte in ‘Script-Data’ where the encrypted ‘Text’ will be copied. An
‘Offset’ of zero points to the start of Script-Data.
Script-Data Script Data is sent to ICC. (Length must be a multiple of 8). The script data length must be greater
than or equal to the sum of Offset and the length of encrypted Text.
eSKSMC(Text) Encrypted text in a variable length field. This is the same length as the specified input Text field.
The function is sufficiently flexible to meet the requirements of all processing variations used in different EMV
implementations. The function therefore supports several methods in each processing step.
Each step involves a key, a method and some data, where the specific method determines the format of the related
data. In the first step an initial key is provided in a key specifier, but subsequent steps use a key from a previous step.
The function treats each processing step independently, so does not treat any combination of methods as invalid.
However many combinations of methods would not coincide with the processing performed by any issued EMV card.
See Usage of Methods for a table of the common combinations of methods.
SC The processing that the function must perform is specified in the SC request field, as follows:
Value Process
03 Combine 1 and 2, i. e. encrypt the command data, insert the resultant ciphertext
into the Script-Data field and calculate a MAC.
All fields in the request message are mandatory. Any field not used in a specific function call
must be in an appropriate format. That is, fixed length fields must have the required length and
variable-length fields must have a valid length. The content in an unused field is ignored,
therefore unused variable-length fields can have a length of zero.
If SC is 1 then IMKSMI is not used .
If SC is 2 then IMKSMC is not used.
00 Common [1-8]
01 SECCOS [34]
Value 00
Field Length Type Description
MK Data is a variable-length field that contains the concatenation of the PAN and PAN
Sequence Number. The function processing of the MK Data to form an 8-byte field is, in
summary, as follows:
Length Processing
Value 01
Field Length Type Description
03 Tree of keys using ATC. Fixed IV, h and b. EMV 4.1 CCD [35]
SM Key Data is a variable-length field that contains zero or more fields incorporating the data
required by the specific SM Key methods.
Value 02
Field Length Type Description
IV 16 h Initialization Vector
Value 03
Field Length Type Description
Value 04
Field Length Type Description
Value 05
Field Length Type Description
R 8 h Random Number
Value 06
Field Length Type Description
ATC is padded and encrypted using MKSMI or MKSMC to form a double-length SKSMI or SKSMC
as described in 11.1.3.1 of [48].
Value 08
Field Length Type Description
Processing steps
1. If SC is 1 or 3, derive the ICC Encipherment Master Key (MKSMC) using the Issuer Master Key (IMKSMC) and MK
Data according to the method specified in MK Method. Derive the ICC Encipherment Session Key (SKSMC) using
the derived MKSMC and SM Key Data according to the method specified in SM Key Method.
2. If SC is 2 or 3, derive the ICC MAC Master Key (MKSMI) using the Issuer Master Key (IMKSMI) and MK Data,
according to the method specified in MK Method. Derive the ICC MAC Session Key (SKSMI) using the derived
MKSMI and SM Key Data according to the method specified in SM Key Method.
3. If SC is 1 or 3, encrypt Text using SKSMC according to the encryption mode of operation specified in SM Method
(00-ECB, 01-CBC, 02-ECB). If SC is 3, insert the resulting ciphertext in Script-Data at the position specified by
Offset.
4. If SC is 2 or 3, calculate the MAC for Script-Data using SKSMI. For SM Method 02 MAC would be calculated as
described in appendix C of [80].
Usage of Methods
The following table identifies the common combinations of methods. A call to the function would typically use the
methods identified across a single row of the table.
Implementation Methods
MK SM Key SM
AEIPS 00 04 01
J/Smart, VSDC 00 04 00
SECCOS 01 05 01
NSICCS 00 08 02
EMV-SCRIPT-CRYPTO-MULTI-AES (EE2024)
This function is used to encrypt and authenticate data for AES implementation of ICC cards for post issuance script
updates.
SC 1 h Select Code
01 = Encrypt Command Data Only
02 = Calculate MAC for entire command
03 = Encrypt and Calculate MAC
SM Key Data Var h Data used with MKsmx to derive the session key SKsmx.
The contents of this field are dependent on the value of SM
Key Method.
rc 1 h Return Code
Value 00
Field Length Type Description
Value 01
Field Length Type Description
Processing Steps
• IMKxx will be used along with MK data length and method to derive card master/unique key. Refer section A1.4,
option C of Reference A [95] for EMV; Refer section 8.4.1.2 of Reference A [98] for SECCOS 7.1.
• Card Master Key along with AC key data and AC key method to be used to derive Session key. Refer section
A1.3.1 of Reference A [95] for EMV and refer chapter 8 of Reference A [98] for SECCOS.
• Session Key will be used over AC data and/or ARPC data to compute cryptograms (Refer section A1.2.2 of
Reference A [95]).
• The encryption and mac computation is done as described in section 9.3.1.1 and 9.2.1.1 of Reference A [95]. This
corresponds to section 13.3 and 13.4 of Reference A [98].
EMV-SCRIPT-CRYPTO-VISA (EF2014)
Request Length Type Description
SC 1 h Select Code
01 = Encrypt Command Data Only
02 = Calculate MAC for entire command
03 = Encrypt and Calculate MAC
Offset 2 h Offset
rc 1 h Return Code
This function performs the cryptographic processing required for Secure Messaging, i.e. message authentication and /
or message encryption. It is intended to be used to either: (i) just encrypt the command data; (ii) just calculate a MAC
for the command header and command data; or (iii) both encrypt the command data and calculate a MAC for the
command header and encrypted command data.
The ICC session keys are derived using the method specified by Visa in reference [8] of Mark II.
Text Script Command Data that is included in the sent Script to ICC. (Length must be a multiple of 8.)
Offset For SC = 03, points to the start byte in ‘Script-Data’ where the encrypted ‘Text’ will be copied. An
‘Offset’ of zero points to the start of Script-Data.
This field is big endian. i.e. the byte order in this field is most significant byte first.
Script-Data Script Data is sent to ICC. (Length must be a multiple of 8). The script data length must be greater
than or equal to the sum of offset and the length of encrypted New PIN data.
eSKSMC(Text) Encrypted text in a variable length field. This is the same length as the specified input “Text” field.
If FM = 00 this is pure data and is not formatted the same as a Var field. If FM = 01 it is a standard
Var field.
Processing Steps
1. If SC is 1 or 3, derive the ICC MAC Master Key (MKSMC) using the Issuer Master Key (IMKSMC) and PAN Data,
according to the method specified in A1.4 of reference [5] of Mark II. Derive the ICC MAC Session Key (SKSMC)
using the derived MKSMC and ATC, according to the method specified in B.4 of reference [8] of Mark II.
2. If SC is 2 or 3, derive the ICC Encipherment Master Key (MKSMI) using the Issuer Master Key (IMKSMI) and PAN
Data, according to the method specified in A1.4 of reference [5]. Derive the ICC Encipherment Session Key
(SKSMI) using the derived MKSMI and ATC, according to the method specified in B.4 of reference [8] of Mark II.
3. If SC is 1 or 3, encrypt Text using SKSMC – ECB mode. If SC is 3, insert the resulting ciphertext in Script-Data at
the position specified by Offset.
4. If SC is 2 or 3, calculate the MAC for Script-Data using SKSMI.
EMV-VERIFY-AC-EMV-2000 (EF2010)
Request Length Type Description
IV 16 h Initialization Vector
AC/ CAP Token 8/Var h If FM = 00 this field contains the 8-byte Application
Cryptogram (AC).
If FM = 01 or 04 the field contains the variable length CAP
token
rc 1 h Return Code
This function verifies an Application Cryptogram (TC, AAC, ARQC) that has been produced by an ICC.
The ICC Session Key is derived using the method specified in the EMV2000 specification in reference [5] of Mark II.
FM = 00.
When the FM is set to 00 the Bitmap fields are not included.
When the FM is set to 01 or 04, the Bitmap field is included.
The setting of this field also affects the AC/CAP Token and the Transaction Data fields. For details
see the descriptions in the table above.
IV Initialization Vector
AC Application Cryptogram (TC, AAC or ARQC) Calculated by ICC as defined in reference [1] of Mark
II. This field is 8 bytes in length. This field is present when FM = 00.
CAP Token CAP Token (AAC or ARQC) that has been produced by an EMV ICC. This field is a Var field.
This field is present when FM = 01 or 04. When the function is used with FM = 01 or 04 support is
provided for a variable-length Application Cryptogram created as indicated by the set bits in the
Bitmap field. This modification supports the Chip Authentication Program as specified in reference
[31] of Mark II. The CAP Token field contains the bits of the Application Cryptogram to be verified as
indicated by the Bitmap (see below). If the length (in bits) of this field is greater than the number of
bits that are set to 1 in the Bitmap field, then the significant bits must be left-justified and padded to
the right with zero bits.
AC Data Data used in the calculation of the Application Cryptogram. Must be a multiple of eight bytes).
Bitmap The Bitmap field is a key specifier field. It specifies an HSM stored or host stored portion of the
Issuer Proprietary Bitmap (IPB) that relates to the Shortened AC. This field is not available when FM
is set to 00. The number of bits set must be ≤16 and ≥ 64 (note: there is no requirement that the
number of bits set is a multiple of 8).
Transaction Data signed to produce CAP Token. Only present when FM = 04. Must be a multiple of eight bytes.
Data
See EMV Function Examples for examples of request and response packages for this function.
Processing Steps
1. Derive the ICC Master Key (MKAC) using the Issuer Master Key and PAN Data, according to the method specified
in A1.4 of reference [5] of Mark II.
2. Derive the ICC Session Key (SK) using the derived MKAC, IV, h, b and ATC, according to the method specified in
A1.3 of reference [5] of Mark II.
3. Calculate the Application Cryptogram using SK and the data provided in AC Data, according to the method
specified in A1.2 of reference [5] of Mark II.
4. When FM=01, select only the bits indicated by the set bits in the bitmap to generate the reference Application
Cryptogram.
5. Compare the values of the calculated Application Cryptogram and that supplied in AC.
Function usage
The function is used during on-line transactions and batch processing of off-line transactions, or during card initialization
to test a card.
EMV-VERIFY-AC-GEN-ARPC (EE2018)
Request Length Type Description
MK Data Var h Data used with IMKAC to derive MKAC. The contents of this
field are dependent on the value of MK Method.
AC Key Data Var h Data used with MKAC to derive the session key SKAC. The
contents of this field are dependent on the value of AC Key
Method.
rc 1 h Return Code
Action The processing that the function must perform is specified in the Action request field, as
follows:
Value Action
01 Verify AC only
All fields in the request message are mandatory. Any field not used in a specific function call
must be in an appropriate format. That is, fixed length fields must have the required length and
variable-length fields must have a valid length. The content in an unused field is ignored,
therefore unused variable-length fields can have a length of zero.
00 Common [1-8]
01 SECCOS [34]
Value 00
Field Length Type Description
MK Data is a variable-length field that contains the concatenation of the PAN and PAN
Sequence Number. The function processing of the MK Data to form an 8-byte field is, in
summary, as follows:
Length Processing
Value 01
Field Length Type Description
01 SKD function using ATC and UN M/Chip 2.1 [31], SECCOS [34]
03 Tree of keys using ATC. Fixed IV, h and b. EMV 4.1 CCD [35]
Value 00
Field Length Type Description
Null 0
Value 01
Field Length Type Description
UN 4 h Unpredictable Number
Value 02
Field Length Type Description
IV 16 h Initialization Vector
Value 03
Field Length Type Description
Value 04
Field Length Type Description
Value 05
Field Length Type Description
R 8 h Random Number
The random number (R) is combined with MKAC to form SKAC as described in clauses 2.7.2
and 2.8 of [7]. The identical transformation is also described in the SECCOS specifications and
in the EMVCo Bulletin No 46.
Value 06
Field Length Type Description
ATC is padded and encrypted using MKAC to form a double-length SKAC as described in
11.1.3.1 of [48].
Value 08
Field Length Type Description
00 1 1
01 1 2 EMV [5]
ARPC Key Method The following values of ARPC Key Method are supported:
01 Method 1 All
Value 01
Field Length Type Description
Value 02
Field Length Type Description
Usage of Methods
The following table is a matrix of the common combinations of methods. A call to the function would typically use the
methods identified across a single row of the table.
Implementation Methods
AEIPS 00 00 02 00 01
Implementation Methods
CUPIC 00 06 03 00 01
J/Smart 00 04 02 00 01
M/Chip 2.1 00 01 03 01 01
NSICCS 00 08 03 00 01
SECCOS 01 01 03 00 01
EMV-VERIFY-AC-GEN-ARPC-AES (EE2022)
This function is used to generate AC and/or ARPC and verify AC for AES implementation of ICC cards.
AC Key Data Var h Data used with MKac to derive the Session key SKac.
The contents of this field are dependent on the value of AC
Key Method.
AC Method 1 h AC Method = 05
rc 1 h Return Code
Value 00
Field Length Type Description
Value 01
Field Length Type Description
Value 00
Field Length Type Description
R 16 h Random Number
Recommended value for EMV 4.3 AES; 2bytes of ATC appended with 14 bytes of 0x00
Value 01
Field Length Type Description
Processing Steps
• IMKxx will be used along with MK data length and method to derive card master/unique key. For EMV, refer to the
section A1.4, option C of Reference A [95]. For SECCOS, refer to the section 8.4.1.2 of Reference A [98].
• Card Master Key along with AC key data and AC key method to be used to derive Session key. For EMV, refer to
the section A1.3.1 of Reference A [95] and for SECCOS, refer to chapter 8 of Reference A [98].
• Session Key will be used over AC data and/or ARPC data to compute cryptograms. Refer to the section A1.2.2 of
Reference A [95].
• Compute an ARQC as described in section 8.1.2 of Reference A [95] to verify the Transaction ARQC. Then an
ARPC must be computed as described in section 8.2.2 of Reference A [95].
• For ARPC computation, refer to section 8.2.1 of Reference A [95] for method 1 and 8.2.2 of Reference A [95] for
method 2 but with respect to AES.
EMV-VERIFY-AC-VISA (EF2011)
Request Length Type Description
rc 1 h Return Code
This function verifies an Application Cryptogram (TC, AAC, ARQC) that has been produced by an ICC.
The ICC Master Key is used directly to calculate the Application Cryptogram, as specified by Visa in reference [8].
AC Application Cryptogram (TC, AAC or ARQC) Calculated by ICC as defined in reference [1] of Mark
II. This field is 8 bytes in length. This field is present when FM = 00.
Shortened AC Shortened Application Cryptogram (AAC or ARQC) that has been produced by an EMV ICC. This
field is a Var field. This field is present when FM=01.When the function is used with FM = 01
support is provided for a variable-length Application Cryptogram created as indicated by the set bits
in the Bitmap field. This modification supports the Chip Authentication Program as specified in
reference [31] of Mark II. The Shortened AC field contains the bits of the Application Cryptogram to
be verified as indicated by the Bitmap (see below). If the length (in bits) of this field is greater than
the number of bits that are set to 1 in the Bitmap field, then the significant bits must be left-justified
and padded to the right with zero bits.
AC Data Data used in the calculation of the Application Cryptogram (must be a multiple of eight bytes).
Bitmap The Bitmap field is a key specifier field. It specifies a HSM stored or host stored portion of the Issuer
Proprietary Bitmap (IPB) that relates to the Shortened AC. This field is not available when FM is set
to 00. The number of set bits must be ≤16 and ≥ 64 (note: there is no requirement that the number of
set bits is a multiple of 8).
See EMV Function Examples for examples of request and response packages for this function.
Processing Steps
1. Derive the ICC Master Key (MKAC) using the Issuer Master Key and supplied PAN Data, according to the method
specified in A1.4 of reference [5] of Mark II.
2. Calculate the Application Cryptogram using MKAC and the data provided in AC Data, according to the method
specified in A1.2 of reference [5] of Mark II.
3. When FM = 01, select only the bits indicated by the set bits in the bitmap to generate the reference Application
Cryptogram.
4. Compare the values of the calculated Application Cryptogram and that supplied in AC.
Function usage
The function is used during online transactions and batch processing of offline transactions, or during card initialization
to test a card.
ENCIPHER-2 (EE0800)
Request Length Type Description
CM 1 h Cipher Mode
00 = ECB
01 = CBC
rc 1 h Return Code
This function enciphers the supplied data using a host-stored or HSM-Stored session key (DPK) supplied within a key
specified.
The function performs single-DES or triple-DES encipherment, as determined by the length of the supplied key, and
supports both Electronic Code Book (ECB) and Cipher Block Chaining (CBC) modes of operation. The function
supports encipherment of large messages (or data files) either by one call to the function or by multiple calls. For CBC
encipherment using multiple calls, chaining values must be maintained between calls.
DPK-Spec Key specifier incorporating a single or double or triple length host-stored or HSM-stored DPK.
ICV Chaining value for CBC encipherment. For encipherment of a message or file using one call, or on the
first call of a multi-call encipherment, this field should be set to the required value of the Initialization
Vector (IV). On subsequent calls of a multi-call encipherment, the field should be set to the value of the
OCB provided by the previous call.
For ECB encipherment, this field will be ignored.
OCV Chaining value for CBC encipherment. For encipherment of a message or file using a multi-call
encipherment, the value in this field should be used as the ICV in the next call.
For ECB encipherment, this field will be set to zero.
Note:
- This function supercedes functions 80, 82.
- When the function modifier is missing, the function returns error code 24, missing function
code.
ENCIPHER-3 (EE0804)
Request Length Type Description
CM 1 h Cipher Mode
00 = ECB
01 = CBC
rc 1 h Return Code
This function enciphers the supplied Data using a session key (DPK) supplied within a key specifier.
The function performs DES or SEED encryption, as determined by the DPK key specifier and supports both Electronic
Code Book (ECB) and Cipher Block Chaining (CBC) modes of operation. The function supports encipherment of large
messages (or data files) either by one call to the function or by multiple calls. For CBC encipherment using multiple
calls, chaining values must be maintained between calls.
DPK-Spec Key specifier incorporating a single- or double or triple-length host-stored or HSM –stored DPK.
This field determines the encryption method.
DES - formats 00 – 03 (DES/TDES keys only), 10, 11, 12, 13, 14, 17 and 18
SEED- formats 00 – 03 (SEED keys only), 16, 17, and 18.
CM Specifies the mode of operation for the encipherment for the Response eDPK(Data):
0 - Electronic Code Book (ECB)
1 - Cipher Block Chaining (CBC)
ICV Chaining value for CBC encipherment. For encipherment of a message or file using one call, or on the
first call of a multi-call encipherment, this field should be set to the required value of the Initialization
Vector (IV). On subsequent calls of a multi-call encipherment, the field should be set to the value of the
OCB provided by the previous call.
For ECB encipherment the contents of this field will be ignored.
For DES processing this field must be 8 bytes in length while for SEED processing this field must be
16 bytes in length.
OCV Chaining value for CBC encipherment. For encipherment of a message or file using a multi-call
encipherment, the value in this field should be used as the ICV in the next call.
For ECB encipherment, the contents of this field will be set to zero.
For DES processing this field will be 8 bytes in length, while for SEED processing this field will be 16
bytes in length.
Data Plaintext data to be enciphered. For DES processing this field must be a multiple of 8 bytes long while
for SEED processing it must be a multiple of 16 bytes.
Note: When the FM = 00 is missing, the function returns error code 24, missing function code.
ENCIPHER-AES (EE0808)
Request Length Type Description
CM 1 h Cipher Mode
00 = ECB
01 = CBC
rc 1 h Return Code
This function enciphers the supplied data using a host-stored session key (DPK) supplied within a key specifier. The
function performs AES encipherment and supports both Electronic Code Book (ECB) and Cipher Block Chaining (CBC)
modes of operation.
The function supports encipherment of large messages (or data files) either by one call to the function or by multiple
calls. For CBC encipherment using multiple calls, chaining values must be maintained between calls.
DPK-Spec Key specifier incorporating 128-bit or 192-bit or 256-bit AES host-stored key DPK.
ICV Chaining value for CBC encipherment. For encipherment of a message or file using one call, or on the first
call of a multi-call encipherment, this field should be set to the required value of the Initialization Vector (IV).
On subsequent calls of a multi-call encipherment, the field should be set to the value of the OCB provided by
the previous call.
For ECB decipherment, this field will be ignored.
OCV Chaining value for CBC encipherment. For encipherment of a message or file using a multi-call
encipherment, the value in this field should be used as the ICV in the next call.
For ECB decipherment, this field will be set to zero.
ENCIPHER-KTM1 (EE0806)
Request Length Type Description
CM 1 h Cipher Mode
00 = ECB
01 = CBC
rc 1 h Return Code
This function enciphers the supplied KTM using a session key (DPK) supplied within a key specifier.
The function performs DES or SEED encryption, as determined by the DPK key specifier and supports both Electronic
Code Book (ECB) and Cipher Block Chaining (CBC) modes of operation.
ICV Chaining value for CBC encipherment. For encipherment of a message or file using one call, or on
the first call of a multi-call encipherment, this field should be set to the required value of the
Initialization Vector (IV). On subsequent calls of a multi-call encipherment, the field should be set to
the value of the OCB provided by the previous call.
For ECB or SEED processing the contents of this field will be ignored.
This field must be 8 bytes in length.
KTM-Spec Key specifier incorporating a single-length or double-length host-stored or HSM -stored KTM. When
DPK-Spec refers to an HSM or host stored SEED key the KTM must be either a double length DES
key or a single length SEED key.
OCV Chaining value for CBC encipherment. For encipherment of a message or file using a multi-call
encipherment, the value in this field should be used as the ICV in the next call. For ECB or SEED
processing, this field will be set to zero. This field will be 8 bytes in length.
eDPK(KTM) KTM key encrypted with DPK according to the algorithm specified.
Notes
– This function is an insecure one as it allows KTMs to be encrypted by DPKs. Its use is not recommended by
SafeNet.
– This function currently supports SEED encryption using ECB mode. It does not support SEED CBC mode.
– This function is not included as standard. It will only be available if selected as an order time option when
purchasing a HSM. Please contact SafeNet if you require this functionality or further details.
ERASE-OLD-KM (13)
Request Length Type Description
13 1 h Function Code
13 1 h Function Code
rc 1 h Return Code
This function is used to erase the old KM. It is enabled/disabled by a console operation.
ESTABLISH-KM (11)
Request Length Type Description
11 1 h Function Code
11 1 h Function Code
rc 1 h Return Code
This function is used to move the current KM to the old KM and move the new KM to the current KM.
This function can be enabled/disabled by a console operation.
EXPORT-CSCK (AA)
Request Length Type Description
AA 1 h Function code
AA 1 h Function code
rc 1 h Return code
This function causes a key to be returned encrypted under a KIS/KI (ZMK) specified by the index provided in the KIS/KI
specifier.
Notes
– Bidirectional Interchange key “KI” will be allowed only in format 08 in the request. Also, within format 08 only
format 0-3 will be allowed for KI.
– If KI will be received in the request, the CSCK in the response will be encrypted by KI. Therefore, the
Encrypted CSCK in the response will be either:
eKI(CSCK) if KI was received in the request field KIS/KI Spec.
eKIS(CSCK) if KIS was received in the request field KIS/KI Spec.
EXPORT-KEY-2 (EE3061)
This function is used to translate a key from encryption under Domain Master Key to encryption under specified KEK.
FM 1 h Function Modifier = 00
Mode of Encryption 1 h Encryption mode for encryption of output Key: eKEK (Key).
00 = ECB
01 = CBC
02 = CTR
rc 1 h Return Code
Processing Steps
1. Extract clear KEK Key.
2. Extract clear key, to be encrypted under KEK.
3. Calculate extracted clear key’s KVC.
4. Using encryption parameters received in request, encrypt extracted clear key under KEK.
5. Return the KEK encrypted key along with its KVC in response.
EXPORT-KEY-PACKAGE (EE3103)
Request Length Type Description
ReadOffset 4 h Offset into Key Package where this read will start
rc 1 h Return Code
This function extracts the current Export Key Package out of the HSM (if any). Developers should first call the KEY-
PACKAGE-STATUS function to determine if an Export Key Package is loaded and how large it is.
The Key Package is a (potentially) large image that is held inside the HSM. The image is created manually by the
administrator and Key Export Officer using Console operations. There is no way to create a Export Key Package from
Host functions.
After the image is extracted the host application may calculate and verify the CRC and then Acknowledge the
successful download by calling the function with Control=Acknowledge. The HSM will respond by 1) removing the
‘Pending’ flag from all HSM stored keys that are copied into the Key Package and 2) deleting the Key Package. Key
Packages can be transmitted across the network and imported into a remote HSM.
ReadOffset This field indicates the offset from the beginning of the Key Package where the next read
should start. For the first read, this field should have a value of zero. This field is ignored if
Control=’Acknowledge’
Length This field indicates the number of bytes to be extracted with this function call. This field is
ignored if Control=’Acknowledge’;
Package Segment This field holds the segment retrieved from the Key Export image. The number of bytes
extracted is indicated within the Var field, and may be less than the Length indicated in the
request (e.g. end of file or buffer length limitation). The field will be empty if
Control=’Acknowledge’
EXPORT-PIN-EMV (EE2050)
Request Length Type Description
PVK-Spec Var K-Spec Key Specifier for PVK and Dec. Table
(Formats: 0–3,11, 12, 13, 14, 17,18)
Validation Data. 8 h Data (usually a part of the PAN) used in the calculation of
the reference PIN.
PTK-Spec Var K-Spec Key Specifier for PIN Transport Key - HSM stored
(Formats: 0–3, 11, 12, 13, 14, 17,18)
rc 1 h Return Code
This function reproduces a previously generated PIN, formats it in an ANSI PIN block and encrypts the block for secure
transport.
Function Modifier Reserved for possible future use; must be set to zero.
PVK-Spec Key specifier for PIN Verification Key (PVK) (Formats 0 - 3, 11, 12, 13, 14, 17, 18).
Validation Data 8 bytes of PAN data used to recreate the reference PIN.
Offset 6 byte offset that is used to recreate the reference PIN. The offset is in bcd format – big
endian.
ANB The Account Number Block is used in the formation of the ANSI PIN block.
PIN_Data Variable length data from the host function request that is appended to the generated PIN
block, without a leading variable length prefix before being encrypted and returned in the
response as ePTK(PIN+PIN data).
Encryption Method ECB and CBC encryption methods represented using 00 or 01 respectively.
PTK-Spec Key specifier for PIN Transport Key (PTK) (formats 0 - 3, 11, 12, 13, 14, 17, 18). The PTK
is used to encrypt the return export PIN.
ePTK(PIN+PIN data) The return PTK-encrypted data block which contains the generated PIN and the
appended PIN data.
The function will fail with Error Code 78 if ANSI/ISO-0 PIN block format that is disabled.
The function performs a check that the ANB field and the Validation field contain a number of consecutive digits in
common. The number of digits to check is in the range 0 to 12, as may be specified using a console operation, and
defaults to 8. If the number of digits to check has been set to 0 the check is disabled. If the check fails, the function will
fail with Return Code 79.
Processing Steps
1. Reproduce the PIN, using the PVK, Decimalization Table, PAN and Offset.
2. Format the PIN and append the variable length PIN_data from the host function request so that the block of data as
input to encryption looks like:
– PIN
– VarLen || PIN_Data
3. Block of data as input to encryption method : [PIN || PIN_Data]
4. Encrypt the data_block containing the PIN and PIN Data using the PIN Transport Key.
Function usage
Called during card initialization: the encrypted PIN would be passed to the card personalization system. It could also be
passed to a separate PIN-mailing device.
FORMAT-STATUS (0007)
This request returns information on the usage of key specifier (K-spec) formats.
FC 1 x Format Code
rc 1 x Return Code
fc 1 x Format Code
dd 1 x Day (current)
mm 1 x Month (current)
hh 1 x Hour (current)
mm 1 x Minutes (current)
ss 1 x Seconds (current)
CLRES 4 bin Calls since last reset (mod 2**32) using this format
FUEL-CARD-PIN-VER (EE0621)
Request Length Type Description
rc 1 h Return Code
This function performs the verification of a PIN using fuel card algorithm (DKV) [71]. The PIN is supplied in encrypted
form, using any of the PIN Block formats.
PPK-Spec May be any valid key specifier for a PPK. Consequently, the function supports an encrypted PIN
Block encrypted using a single-length or double-length or triple-length HSM-stored or host-stored
key.
PF Supports PIN formats: 01, 02, 03, 08, 09, 10, 11 and 13
ANB Account Number Block, which are the right most 12 digits of the Primary Account Number (PAN).
Card Number Rightmost 16 digits of the card number – including the check digit
The function will fail with Error Code 78 if PF indicates a PIN block format that is disabled.
FUNCTION-STATUS (0005)
This request returns information on individual functions.
rc 1 x Return Code
dd 1 x Day (current)
mm 1 x Month (current)
hh 1 x Hour (current)
mm 1 x Minutes (current)
ss 1 x Seconds (current)
fs 1 x Function status
0 = active
1 = inactive
2 = invalid
GENERATE-DCV (EE2054)
Request Length Type Description
Mode 1 h 00 = ECB
01 = CBC
rc 1 h Return Code
This function generates a Data Check Value (DCV) based on the data passed in the function and returns it.
GENERATE-ICC-CRT-KEYPAIR (EE2058)
Request Length Type Description
Certificate Data Var h ICC Public Key Data, as specified in Table 7 or Table 19 in
[5]. (The ICC Public Key modulus will be inserted during
function processing.)
rc 1 h Return Code
eK(P) Var h Encrypted CRT parameters of ICC Private Key. Each field
eK(X) is individually encrypted and, dependent on the
request fields, comprises:
eKKTK(X)
eK(Q) Var h
or
eKKEK(X)
or
eK(PQ) Var h eKKEK(X | padding)
or
eKKEK(len | X | padding)
eK(DP1) Var h Each field length will be the next multiple of eight that is
equal to or larger than half the length Nxx of the modulus of
Sxx + 1.
eK(DQ1) Var h In case of eKKTK(X) and eKKEK(X), the CRT parameter will
be right justified and, if necessary, padded to the left with
zeroes.
ICC Public Key Certificate Var h Digital signature for the public key certificate. The field
length is equal to the length NI of the modulus of SI
This function generates the CRT parameters and calculates the digital signature for the ICC Public Key Certificate.
Notes
– In this description, the subscript 'XX' is used to denote either 'IC' or 'PE'.
– If the length of the modulus is not a multiple of 128 bits (16 bytes) then the CRT parameters will not be a
multiple of 64 bits in length, and so will require padding prior to encryption. Ex - If modulus length is 1984 bits
then the CRT parameters comprising 992 bits (124 bytes), will be padded to left with 4 bytes of zeroes.
SI-Spec Key specifier for the Issuer Private Key SK (Formats 0 - 3, 82). The Key specifier in formats 0 - 3
describes the location of the key to be loaded from the ESM. The Key specifier in format 82
describes the complete Issuer SK.
Certificate Data Variable length ICC PK certificate data as specified by EMV. Used to build the signature
together with the generated SK
KTK-Spec Key specifier for the Key Transport Key (KTK) (Formats 0 - 3, 11, 12, 13, 14, 17, 18, 50. 51,
Encrypted with KMV35).
PXX Flag 1 byte flag to represent whether to return a built PK Key specifier.
User Data Variable length user data for input to the PK/SK generation process. User data is inserted into
the clear PK and clear component of the SK. When no user data is being supplied, this field is 1
byte in length with a value of zero to represent a zero length variable field.
eK(P)
eK(Q)
The return encrypted CRT parameters. If FM = 1 or 2, the encrypted block containing a 1 byte
length concatenated with the modulus of Sxx concatenated with 7 bytes of padding, will be
eK(PQ)
returned.
eK(DP1) When FM=2, padding method shall be followed as specified in [33] .
When FM=3 , the encrypted block containing “0x80 00 00 00 00 00 00 00 “ is concatenated with
eK(DQ1) the modulus of Sxx .
ICC Public Key Variable length right-most digits of the ICC PK. Only present when (ICC_modLen > (ISS_
Remainder modLen - 42)). Length equals (ICC_modLen - (ISS_ModLen + 42)) or 1 (value=0, when no
remainder present).
PXX Key specifier for the return Public Key (Format 81). The Key specifier describes the complete
PK.
The return PK Key specifier is only present when PXX flag = 1.
When Pxx Flag=0, this field would contain '00'.
If S = md mod n, where m is the data to be signed, d is the private key exponent, and n is private key modulus
composed of two prime numbers p and q then P, Q, PQ, DP1 and DQ1 will be:
P, the prime factor p
Q, the prime factor q
PQ = q-1 mod p
DP1 = d mod (p - 1)
DQ1 = d mod (q - 1)
When all five components (P, Q, PQ, DP1and DQ1) of the key are set, the key is initialized and ready for use.
Processing Steps
1. Generate the ICC Public Key (PXX) and ICC Private Key (SXX), with a modulus of length NXX as specified in ICC
Public Key Length in Certificate Data. The ICC Public Key Exponent is as specified in Certificate Data.
2. Insert the generated ICC Public Key modulus into Certificate Data.
3. Calculate the hash result for the Certificate Data using the hash algorithm indicated by Hash Algorithm Indicator in
Certificate Data. [Currently, SHA-1 is the only approved hash algorithm, and is indicated by a value of hex '01'.]
4. Build the signature block using the calculated hash result and the leftmost bytes of Certificate Data, as defined in
A2.1.2 in [5].
5. Sign the signature block using SI and its associated asymmetric algorithm. [Currently, RSA is the only approved
asymmetric algorithm.]
6. Return the signature in ICC Public Key Certificate.
7. Return the rightmost part of the ICC Public Key modulus in ICC Public Key Remainder.
8. Encrypt the CRT parameters using the KEK specified by KEK-Spec and using the specified Encryption Method.
Return the result in eKTK(P), eKTK(Q), eKTK(PQ), eKTK(DP1) and eKTK(DQ1).
If KTK-Spec incorporates a format 50 key specifier, the CRT parameters are returned encrypted by the derived key
KKEK.
9. If indicated by PXX Flag, return PXX in a format 81 key specifier.
GENERATE-ICC-CRT-KEYPAIR-PKCS (EE205A)
Request Length Type Description
Certificate Data Var h ICC Public Key Data, as specified in Table 7 or Table 19 in
[5]. (The ICC Public Key modulus will be inserted during
function processing.)
rc 1 h Return Code
ICC Public Key Certificate Var h Digital signature for the public key certificate. The field
length is equal to the length NI of the modulus of SI
This function generates an RSA key pair for an EMV ICC, encrypts the private key and calculates the digital signature
for the Public Key Certificate. The function calculates the CRT parameters for the private key and, prior to encryption,
formats the private key as an ASN.1 type RSAPrivateKey as specified in section 11.1.2 of PKCS #1 v2.0 standards
[55].
The returned private key allows for its use by either using the mod/exp method or CRT method.
Note: The function fields, and associated processing, are as for function EE2058, with the
format of the returned encrypted private key being the sole difference.
Version y 0
Modulus y N
publicExponent y E
privateExponent y D
prime1 y P
prime2 y Q
The padding required to produce a multiple of 8 bytes for encryption, will be appended to the right as described in
section 10.3 (Note 2 ) of PKCS#7 [69]
Example:
Assuming the length to be multiple of k (8) octets, Pad the input at the trailing end with k - (l mod k) octets all having
value k - (l mod k), where l is the length of the input.
In other words, the input is padded at the trailing end with one of the following strings:
01 — if l mod k = k-1
02 02 — if l mod k = k-2
×
×
×
k k…k k — if l mod k = 0
GENERATE-ICC-KEYPAIR (EE2048)
Request Length Type Description
Certificate Data Var h ICC Public Key Data, as specified in Table 7 or Table 19 in
[5]. The ICC Public Key modulus will be inserted during
function processing.
rc 1 h Return Code
ICC Public Key Certificate Var h Digital signature for the public key certificate. The field
length is equal to the length NI of the modulus of SI
This function generates an ICC key pair (PIC / SIC or PPE / SPE) and calculates the digital signature for the ICC Public
Key Certificate. The key pair may be used in Dynamic Data Authentication and / or PIN Encipherment.
Note: In this description, the subscript 'XX' is used to denote either 'IC' or 'PE'.
SI-Spec Key specifier for the Issuer Private Key SK (Formats 0 - 3, 82).
The Key specifier in formats 0 - 3 describes the location of the key to be loaded from
the ESM.
The Key specifier in format 82 describes the complete Issuer SK.
Certificate Data Variable length ICC PK certificate data as specified by EMV. Used to build the
signature together with the generated SK
KTK-Spec Key specifier for the Key Transport Key (KTK) (Formats 0 - 3, 11, 12, 13, 14, 17, 18,
50, 51. Encrypted with KMV35).
Encryption Method ECB and CBC encryption methods represented using 00 or 01 respectively.
PXX Flag 1 byte flag to represent whether to return a built PK Key specifier.
User Data Variable length user data for input to the PK/SK generation process. User data is
inserted into the clear PK and clear component of the SK. When no user data is
being supplied, this field is 1 byte in length with a value of zero to represent a zero
length variable field.
eKTK(mod of Sxx ) The return encrypted modulus of Sxx . If FM = 1, or FM = 2, the encrypted block
or containing a 1 byte length concatenated with the modulus of Sxx concatenated with
eKKEK(mod of Sxx ) 7 bytes of padding, will be returned.
or When FM=3 , the encrypted block containing “0x80 00 00 00 00 00 00 00 “is
eKKEK(mod of Sxx | padding) concatenated with the modulus of Sxx .
or
eKKEK(len | mod of Sxx |
padding)
eKTK(exp of Sxx ) The return encrypted exponent of Sxx. If FM = 1, or FM=2 the encrypted block
or containing a 1 byte length concatenated with the exponent of Sxx concatenated
eKKEK(exp of Sxx ) with padding bytes returned.
or When FM=3 then “0x80 00 00 00 00 00 00 00 “ is concatenated with the exponent of
eKKEK(exp of Sxx | padding) Sxx .
or
eKKEK(len | exp of Sxx |
padding)
ICC Public Key Remainder Variable length right-most digits of the ICC PK. Only present when (ICC_modLen >
(ISS_modLen - 42)). Length equals (ICC_modLen - (ISS_ModLen + 42)) or 1
(value=0, when no remainder present).
PXX Key specifier for the return Public Key (Format 81). The Key specifier describes the
complete PK. The return PK Key specifier is only present when PXX flag = 1.
Processing Steps
1. Generate the ICC Public Key (PXX) and ICC Private Key (SXX), with a modulus of length NXX as specified in ICC
Public Key Length in Certificate Data. The ICC Public Key Exponent is as specified in Certificate Data.
2. Insert the generated ICC Public Key modulus into Certificate Data.
3. Calculate the hash result for the Certificate Data using the hash algorithm indicated by Hash Algorithm Indicator in
Certificate Data. [Currently, SHA-1 is the only approved hash algorithm, and is indicated by a value of hex '01'].
4. Build the signature block using the calculated hash result and the leftmost bytes of Certificate Data.
5. Sign the signature block using SI and its associated asymmetric algorithm. [Currently, RSA is the only approved
asymmetric algorithm].
6. Return the signature in ICC Public Key Certificate.
7. Return the rightmost part of the ICC Public Key modulus in ICC Public Key Remainder.
8. Encrypt the ICC Private Key using the KEK specified by KEK-Spec and using the specified Encryption Method.
Return the result in eKTK(mod of S ) and eKTK(exp of SIC). If KTK-Spec incorporates a format 50 key
IC
specifier, the private key is returned encrypted by the derived key KKEK.
9. If indicated by PXX Flag, return PXX in a format 81 key specifier.
Function usage
The function is used during card initialization. The public key certificate and the encrypted private key would be passed
subsequently to the card personalization system.
In addition to being provided in a certificate, PXX can optionally be provided in a key specifier, for subsequent use during
testing of the card.
GENERATE-ISSUER-KEY-PAIR (EE2040)
Request Length Type Description
rc 1 h Return Code
SI-Spec Var K-Spec Key specifier containing the private key encrypted by a KM
variant.
Key Type = Certificate, Data Signature
(Format: 82)
This function generates an issuer key pair and returns the keys for host storage.
Function modifier Reserved for possible future use; must be set to zero.
Key Length Modulus size in bytes for input to the PK/SK generation process.
Exponent Variable length exponent type for input to the PK/SK generation process.
Field length before prefix byte is 1 or 3.
User Data Variable length user data for input to the PK/SK generation process.
User data is inserted into the clear PK and clear component of the SK.
When no User data is being supplied, this field is 1 byte in length with value of zero to represent a
zero length variable field.
Return Code 00 indicates that the generation has completed successfully. The PI-Spec and SI-Spec fields are
present as described below.
3A indicates that the generation has not yet completed. The generation of the key pair may take a
few seconds to complete. The EE2040 request should be re-issued periodically (every 3 seconds)
until either 00 (success) or non-zero-value-other-than-3A (failure) return code has been received.
The PI-Spec and SI-Spec fields are not present.
Non-zero-value-other-than-3A indicates failure. See Error Codes in this guide for further details.
The PI-Spec and SI-Spec fields are not present.
PI-Spec Key specifier for the Issuer Public Key (format 81). The Key specifier describes the complete
Issuer PK.
SI-Spec Key specifier for the Issuer Private Key (format 82). The Key specifier describes the complete
Issuer SK. The encrypted component of SK, eKMv20(SK), is encrypted using KM variant 20.
Processing Steps
1. Generate an RSA key pair of the specified length and with the specified public exponent.
2. Return the generated keys.
Function usage
The function may be used as an alternative to the equivalent console operation. If the console operation is used, the key
pair will be stored in HSM secure memory.
GENERATE-KEY-DIEBOLD (EE9101)
Request Length Type Description
KBS Var h Key Block structure. Optional and must be present if 1KS-
Spec required in TR-31 Key block format .
rc 1 h Return Code
KKTM Var K-Spec Key specifier for generated key – as determined by Key len
(Formats: 10, 11, 12, 13, 14, 17, 18)
This function generates a random double-length KTM for initialization of a Diebold ATM. The generated key is returned
in encrypted form in a key specifier for host storage. Also, cryptograms are returned that are suitable for transfer to the
NCR ATM, i.e. the encrypted key Block and the digital signature of the encrypted key Block.
Notes
– The key specifiers 10, 11 under the Response, are generated when using the Legacy option.
– The key specifiers 10, 11, 13 under the Response, are generated based on the chosen operation on console
and FM. See, section Function Modifier Values.
– 2048 length public keys only.
– The formats of the encrypted key Block and signature are as described in RSAES-PKCS1-v1_5 and RSASSA-
PKCS1-v1_5 in [Reference [21] of Mark II].
GENERATE-KTM-NCR (EE9201)
Request Length Type Description
rc 1 h Return Code
This function generates a random double-length KTM for initialization of an NCR ATM. The generated key is returned in
encrypted form in a key specifier for host storage. Also, cryptograms are returned that are suitable for transfer to the
NCR ATM, i.e. the encrypted key Block and the digital signature of the encrypted key Block.
The formats of the encrypted key Block and signature are as described in sections 4.3 and 4.4 of [Reference [20] of
Mark II].
The key specifier 13 under the Response, are generated when using the Legacy option.
The key specifiers 11, 13 under the Response, are generated based on the chosen operation on console and FM. See
section, Function Modifier Values.
Notes
– 2048 length public keys only.
– As per NCR standards, this function support only public exponent 65537.
GENERATE-MAC-NDC-ATM (5530)
This function will calculate the MAC for a given message to be transmitted to an NDC+ ATM. The MAC shall be
computed in accordance with the NDC+ PRM (PRM 5.1-9).
rc 1 x Return Code
GENERATE-MD5-HASH (EE9007)
Request Length Type Description
Mode 1 h 00 = Only
01 = Initial
02 = Intermediate
03 = Last
Bit Count 8 h For chaining: initially zero, then as returned in previous call.
Hash Value 16 h For chaining: initially zero, then as returned in previous call.
rc 1 h Return Code
This function returns the result of MD5 hashing the supplied data.
GENERATE-RANDOM-PIN-EMV (EE204F)
Request Length Type Description
PVK-Spec Var K-Spec Key specifier for PVK and Dec. Table
(Formats: 0-3, 11, 12, 13, 14, 17, 18)
Validation Data 8 h Data (usually a part of the PAN) used in the calculation of
the reference PIN.
rc 1 h Return Code
This function generates a random PIN for storing in an ICC, formats it in an ANSI PIN block, encrypts it for secure
transport to a separate PIN-issuing device, and calculates 3624 offset data for use in subsequent online PIN
verification.
Function Modifier Reserved for possible future use; must be set to zero.
PVK-Spec Key specifier for PIN Verification Key (PVK) (Formats 0 - 3, 11, 12. 13, 14, 17, 18).
Validation Data 8 bytes of PAN data used to recreate the reference PIN.
ANB The Account Number Block is used in the formation of the ANSI PIN block.
PIN Data Variable length data from the host function request that is appended to the generated PIN
block, without a leading variable length prefix before being encrypted and returned in the
response as ePTK(PIN+PIN data).
Encryption Method ECB and CBC encryption methods represented using 00 or 01 respectively.
PTK-Spec Key specifier for PIN Transport Key (PTK) (Formats 0 - 3, 11, 12, 13, 14, 17, 18). Encrypted
with KMV36
Offset 6 byte offset that is used to recreate the reference PIN. The offset is in bcd format – big endian.
With the validation data and PIN length, the PIN can be recalculated.
ePTK(PIN+PIN The return PTK-encrypted data block which contains the generated PIN and the appended PIN
data) data.
Processing Steps
1. Generate a random PIN with the required number of digits.
2. Using the PVK, Decimalization Table and PAN, calculate the 3624 offset for the PIN.
3. Format the PIN and append the variable length PIN_data from the host function request so that the block of data as
input to encryption looks like:
a. PIN
b. PIN_Data
Block of data as input to encryption method : [PIN || PIN_Data]
4. Encrypt the data_block containing the PIN and PIN Data using the PIN Transport Key.
Function usage
Called during card initialization: the encrypted PIN would be passed to the card personalization system. It could also be
passed to a separate PIN-mailing device.
The function will fail with Error Code 78 if ANSI/ISO-0 PIN block format that is disabled.
The function performs a check that the ANB field and the Validation field contain a number of consecutive digits in
common. The number of digits to check is in the range 0 to 12, as may be specified using a console operation, and
defaults to 8. If the number of digits to check has been set to 0, the check is disabled. If the check fails, the function will
fail with Return Code 79.
GENERATE-RSA-KEY-PAIR (EE9001)
Request Length Type Description
Key Type 2 h Indicates the valid usage for the private key
1 Data Signature
2 Key Transport
4 Data Protect
User Data Var h Data to be stored in key specifier for SK. (May be zero-
length field.)
rc 1 h Return Code
PK Var K-Spec Key specifier containing the public key (PK). (Format: 80)
SK Var K-Spec Key specifier containing the private key (SK) encrypted by
a KM variant.
(Format: 82)
This function generates an RSA key pair (PK, SK) with the specified modulus length and public exponent and returns
the keys for host storage.
The Key Type is stored in the key specifier for the private key (SK) and may be used to restrict usage of the private key.
The public key is deemed unauthenticated so it is returned in a Format 80 key specifier.
Processing Steps
1. Generate an RSA key pair of the specified type and length, and with the specified public exponent.
2. Ensure that the modulus is compatible with the specified public exponent.
Function usage
The public key may subsequently need to be authenticated for local use (see Authentication of Public Keys), and/or
sent to a CA for insertion into a Public Key Certificate.
PK SK
NCR
The generated PK-HSM must be taken to NCR using a secure channel and will be signed using SK-NCR giving (PK-
HSM)*SK-NCR. The signed public key can be verified using the Import public key certificate function
Diebold
The Host public key must be submitted to the CA in a self-signed message. Although the message format is not within
the scope of the Diebold specifications it is probable that this function will be suitable.
PK SK
GENERATE-SHA-HASH (EE9008)
Request Length Type Description
Algorithm 1 h 00 = SHA-1
01 = SHA-224
02 = SHA-256
03 = SHA-384
04 = SHA-512
Mode 1 h 00 = Only
01 = Initial
02 = Intermediate
03 = Last
Bit Count 8 h For chaining: initially zero, then as returned in previous call.
Hash Value Var h For chaining: initially zero, then as returned in previous call.
rc 1 h Return Code
This function returns the result of SHA hashing the supplied data.
GEN-KM-ENC-PIN (EE0640)
Request Length Type Description
rc 1 h Return Code
This function generates a random PIN of the specified length and creates a format 1A key specifier, as defined in
Function Construction.
The function will fail with Error Code 78 if PIN block format ISO-3 is disabled.
GEN-RANDOM (EE0002)
Request Length Type Description
rc 1 h Return Code
This function generates and returns a random number of the specified length.
The return code (rc) for this function indicates the success or failure of the function call. See Error Codes for a complete
listing of return codes.
Processing Steps
1. Generates a random number with the number of bytes as specified in Length of Random Number.
2. Returns the generated number in the Response field Random Number.
Note: The generated random number is not 'massaged' in any way, e.g. the bytes are not
adjusted for odd parity as is sometimes required for DES keys.
GEN-TERMINAL-KEY (EE0628)
Request Length Type Description
Key Usage 2 h Valid values are described in the field description following
this table.
rc 1 h Return Code
Host key Var K-Spec Key specifier incorporating an encrypted key or a key Block
(as indicated by Host key format in the request)
Formats: (11, 13, 18)
This function generates a key for sending to a terminal and is sent KTM encrypted. The generated key can also be sent
to a host KM encrypted for storage. A KVC for the generated key may also be requested for the response.
Note:
- The key specifiers 13, 18 under the Response, are generated when using the Legacy option.
- The key specifiers 11, 13 under the Response, are generated based on the chosen operation
on console and FM. See section, Function Modifier Values.
The generated key may be provided in simple encrypted form or incorporated in a secure key Block. See references
[25], [26] and [27] for details on secure key Block formats.
FM = x0
The Host Key Protection using Function Modifier can be in the range of x0, where x= 0 , 1, or
2.
KTM The key specifier used to protect the key being generated.
Valid values are key specifier formats 0-3, 11 12, 13 (3DES only), and 14.
Crypto algorithm Identifies the cryptographic algorithm used to generate the key.
Valid values are:
‘01’=3DES. May only be used if the specified KTM is a 3DES key
‘03’=HMAC-SHA-1. May only be used if the specified KTM is a 3DES key
Key length Specifies the length of the key to be generated. Valid key lengths for each supported
algorithm are as follows:
3DES - 128
HMAC-SHA-1 - 128, 160, 192
Key type Specifies the key type. Key types supported for each algorithm are as follows:
Algorithm 3DES - PPK, MPK
Algorithm HMAC-SHA-1 - MPK
Terminal key format Identifies the format in which the key is to be transmitted to the terminal. Valid formats are as
follows:
‘01’ - ECB encrypted using a variant of KTM,
‘05’ - Verifone key Block (based on GISKE)
Host key format Identifies the format in which the key is to be stored on the host. Formats are as follows:
‘01’ - CBC encrypted using a variant of KM and supports 3DES key only. The key is returned
in a format 13 key specifier
‘02’ - binary key Block in a format 18 key specifier
Key usage, For Key usage, ‘00 to 60’ for MPK and ‘K0’ for KTM is supported.
Mode of use, Note that the highlighted values are valid for Verifone key block only.
Key version number The fields Key usage, Mode of use, and Key version number must be specified to create a
secure key Block. Valid combinations of these three fields for each key type are as follows:
MPK M0 C,G,N,V 00
PPK P0 N 00
KTM K0 D, G 00
NOTE: Other key Block fields will be created using Algorithm, Key Length and key type host
function request fields.
Exportability ‘N’ (not exportable) - for Verifone key Block. 00 (Null) - for Binary key Block.
Padding indicator For DES/3DES only , indicates how the encrypted key field (in the key Block) should be
padded so that its length is indistinguishable, as follows:
00 - do not pad
Note: The function field Padding Indicator is not applicable in Verifone key block and will be
ignored.
Optional fields These support the optional fields of key Blocks. Currently not implemented.
GET-CLOCK (0016)
This function gets the date and time from Luna EFT.
rc 1 x Return Code
GET-KEY-DETAILS (EE0202)
Request Length Type Description
Key Spec Var K-Spec Key specifier for the host stored key
(Formats: 10,11,12,13, 14,15,16,17,18,20,50, 93)
1C (support only CCMK and MKDK)
Key Type 1 d Indicates the KM-variant with which the key K is encrypted
rc 1 h Return Code
Parity 1 h For DES/3DES keys, indicates whether the key has odd,
even or mixed parity.
For AES keys, value is set to zero.
This function provides non-sensitive details of a host stored key that is stored in simple KM encrypted form.
Key For key specifiers that contain an authenticated key Block incorporating the key type, this field must be set to
Type zero (i.e. for key specifier formats 15, 17 and 18).
For key specifier incorporating encryption counter as zero in KSN (i.e. for key specifier format 20), the KVC
shall be calculated on initial key and key type shall be ignored.
Otherwise, following keytypes shall be used with format 20 key specifier to calculate KVC on transaction
keys.
00: DPK
01: PPK
02: MPK
For key specifier formats 10, 11, 13, 14, 16 and 50 this field indicates the KM-variant with which the key is
encrypted as follows:
00: DPK 07: KPV,DT 24: BDK 36: PTK 48: CCMK 55:
01: PPK 08: KPVV 30: IMKAC 37: KMC 49: IMKCL CMKCLIDN
02: MPK 09: KCVV 31: IMKSMI 38: IMK-CVC 50: IMKRP 56: MPPK
03: KIS 10:KI 32:IMKSMC 40:DK-DPK 51: CMKCLMD 57: MKDK
04: KIR 16: ZKA KGK 33: IMKDAC 44:DK-KIR 52: CMKCLUMD
05: KTM 17: ZKA KKBLZ 34: IMKDN 41:DK-PPK 53: CMKRPMD
06: CSCK 18: ZKA MK 35: KTK 42:DK-MPK 54: CMKRPUMD
43: DK-KIS
KVC Specifies the method used to calculate the KVC. Values supported are :
Type 0x00 for standard method
0x01 for MDC2 Method (This value is only valid when the key passed to the function is PPK or MPK)
0x02: SHA256
0x03: ZL8
Parity For DES/3DES keys, this field indicates whether the plain text key has odd, even or mixed parity, as follows:
01: Odd parity
02: Even parity
03: Mixed parity
For AES keys, value is set to zero.
KVC For DES/3DES keys, the field contains the 3-byte 'standard ' KVC
If the KVC type is 0x01 the MDC2 method for KVC calculation will be used. The KVC returned will be a 16
byte hexadecimal value.
GET-KVC (EEBF29)
This function allows an operator to verify the existence and obtain the KVC of keys stored in the Secure Memory of the
HSM device.
KVC methods vary depending on the key type.
FM 1 x Function Modifier = 00
00 = Get details on specified Key or
01 = Get details on next HSM-stored key.
(For example, if FM = 01, index is 01 and the HSM key is stored at
index 1; and if index 2 , 3 is empty and index 4 has a key, in this case
GetKVC will find KVC for key at index 4.)
rc 1 x Return Code
GETPUBLICKEY (EE3030)
Request Length Type Description
PK-Spec Var K-Spec Key specifier for HSM Public key pair.
(Formats: 0 - 3)
rc 1 x Return Code
PKi HSM Var K-Spec Key specifier for HSM stored public key
(Format: 80)
This function returns an HSM stored public key and its PVC.
GP-CALC-CARD-CRYPTOGRAM (EE2060)
Request Length Type Description
FM 1 h Function Modifier
Session S-ENC Var K-spec Key specifier for derivation of Session S-ENC from KMC.
(Formats: 50, 51), (KMC: 0 - 3, 13, 17, 18)
Host Challenge 8 x
Card Challenge 8 x
rc 1 h Return Code
Card Cryptogram 8 x
This function generates the card cryptogram that is part of the mutual authentication of an ICC card and the off-card
entity. The function includes the derivation of the card static keys and session keys used in the calculation of the
cryptogram.
The function supports both SCP01 and SCP02. In the latter, the Card Challenge would comprise the concatenation of a
2-byte sequence counter and a 6-byte challenge.
Processing Steps
1. Derive card session S-ENC using KMC and data in a format50 or 51 key specifier, as explained in sections D.3.1
and E.4.1 of [37].
2. Calculate card cryptogram using session S-ENC, Host Challenge and Card Challenge, as explained in sections
D.3.2.1 and E.4.2.1 of [37].
GP-MUTUAL-AUTHENTICATION (EE2059)
Request Length Type Description
FM 1 h Function Modifier
Session S-ENC Var K-spec Key specifier for derivation of Session S-ENC from KMC.
(Formats: 50, 51), (KMC: 0 - 3, 13, 17, 18)
Host Challenge 8 x
Card Challenge 8 x
Card cryptogram 8 x
rc 1 h Return Code
Host Cryptogram 8 x
This function supports the mutual authentication of an ICC card and the off-card entity by verification of the card
cryptogram and generation of the host cryptogram. The function includes the derivation of the card static keys and
session keys used in the calculation of the cryptograms.
The function supports the Secure Channel Protocols, SCP01 and SCP02. In SCP02, the Card Challenge would
comprise the concatenation of a 2-byte sequence counter and a 6-byte challenge.
Processing Steps
1. Derive card session S-ENC using KMC and data in a format50 or 51 key specifier, as explained in sections D.3.1
and E.4.1 of [37].
2. Calculate and verify card cryptogram using session S-ENC, Host Challenge and Card Challenge, as explained in
sections D.3.2.1 and E.4.2.1 of [37].
3. If step 2 is successful, calculate host cryptogram using session S-ENC, Host Challenge and Card Challenge, as
explained in sections D.3.2.2 and E.4.2.2 of [37].
GP-MUTUAL-AUTHENTICATION-SCP03 (EE2065)
Request Length Type Description
Session S-ENC Var K-spec Key specifier for derivation of Session S-ENC from KMC.
(Formats: 52, 53)
Host Challenge 8 x Host random unique data for each secure channel session
Card Challenge 8 x Card random unique data for each secure channel session
rc 1 h Return Code
This function supports the SCP03 mutual authentication of an ICC card and the off-card entity by verification of the card
cryptogram and generation of the host cryptogram.
The function includes the derivation of the card static keys and session keys used in the calculation of the cryptograms.
Processing Steps
1. Derive card session S-ENC using KMC and data in a format-52 or -53 key specifier (as in section 4.1.5 of [75]).
2. Calculate and verify card cryptogram using session S-ENC, Host Challenge and Card Challenge (as in section
6.2.2 of [75]).
3. If step 2 is successful, calculate host cryptogram using session S-ENC, Host Challenge and Card Challenge (as in
section 6.2.3 of [75]).
Only left most 8 bytes of output from CMAC will be used as Cryptogram.
Note: Encrypted data (concatenation of Host challenge and Card challenge) will not be padded
prior to encryption, as it was in EE2059.
GP-SCP10-CALC-HASH-OF-KEY (EE2064)
Request Length Type Description
Session S-ENC Var K-spec Key specifier for session key 1 Keys for Command
(Formats: 11, 12, 13, 14, 17,
18, 50, 51)
Session S-MAC Var K-spec Key specifier for session key 2 Keys for Command
(Formats: 11, 12, 13, 14, 17,
18, 50, 51)
Session DEK Var K-spec Key specifier for session key 3 Keys for Command
(Formats: 11, 12, 13, 14, 17,
18, 50, 51)
Session S-ENC Var K-spec Key specifier for session key 1 Keys for Response
(Formats: 11, 12, 13, 14, 17,
18, 50, 51)
Session S-MAC Var K-spec Key specifier for session key 2 Keys for Response
(Formats: 11, 12, 13, 14, 17,
18, 50, 51)
RFU Var K-spec Key specifier for session key 3 Keys for Response
Plaintext Block Var H Block containing 'empty' CRTs (or empty space) and
challenge
rc 1 H Return Code
This function calculates the hash of a block containing the session keys and a challenge.
The function decrypts or derives up to 5 keys, inserts them at specified offsets in the plaintext block and calculates the
hash of the block. The keys must be the same values as calculated in session key transport function (EE2063) but the
block format is different.
If less than 5 keys are required, any unused key specifier fields should be set to a zero-length Var field and the
associated offset field should be set to zero.
The Plaintext Block must be sufficiently large to accommodate the specified session keys.
Function Usage
The function can be used in entity authentication of both the card and the OCE.
1. In OCE authentication, the block would contain empty CRT and the card challenge. The resulting hash may then be
formatted and RSA-signed for sending to the card in the EXTERNAL AUTHENTICATE command (see F.4.1 in
[37]). The digital signature can be calculated using RSASSA-PKCS-V1_5 in the EE9005 host function.
2. In card authentication, the block would contain empty space and the OCE challenge. The resulting hash may then
be formatted and used in the EE9006 host function to verify the signature from the card.
GP-SCP10-SESSION-KEY-TRANSPORT (EE2063)
Request Length Type Description
Session S-ENC Var K-spec Key specifier for session key 1 Keys for Command
(Formats: 11, 12, 13, 14, 17, 18,
50, 51)
Session S-MAC Var K-spec Key specifier for session key 2 Keys for Command
(Formats: 11, 12, 13, 14, 17, 18,
50, 51)
Session DEK Var K-spec Key specifier for session key 3 Keys for Command
(Formats: 11, 12, 13, 14, 17, 18,
50, 51)
Session S-ENC Var K-spec Key specifier for session key 1 Keys for Response
(Formats: 11, 12, 13, 14, 17, 18,
50, 51)
Session S-MAC Var K-spec Key specifier for session key 2 Keys for Response
(Formats: 11, 12, 13, 14, 17, 18,
50, 51)
RFU Var K-spec Key specifier for session key 3 Keys for Response
rc 1 h Return Code
This function decrypts or derives up to 5 keys, inserts them at specified offsets in a plaintext key block and encrypts
the block using RSAES-PKCS-v1.5 [40] and the provided RSA public key. The function supports the PERFORM
SECURITY OPERATION (decipher) command of SCP10 (see F.4.6 in [37].
If less than 5 keys are required, any unused key specifier fields should be set to a zero-length Var field and the
associated offset field should be set to zero.
The Plaintext Block must be sufficiently large to accommodate the specified session keys but must be at least 11
bytes smaller than the modulus of the public key.
GP-SECURE-MESSAGING-COMMAND (EE2061)
Request Length Type Description
SC 1 h Select Code
01 = Encrypt data only
02 = Calculate MAC only
04 = Calculate MAC and encrypt data
rc 1 h Return Code
This function performs the cryptographic processing required for Secure Messaging of a command to be sent to the
card, i.e. message authentication and /or data encryption.
The function supports SCP01, SCP02 and SCP10. In these protocols, data encryption follows MAC calculation so
there is no requirement to place ciphertext into the MAC data.
Notes
– In support of command sequence integrity in SCP01 and SCP02, the ICV should be set to the C-MAC of the
previous command. The ICV Flag indicates whether ICV Encryption is being used.
– In support of command sequence integrity in SCP10, the ICV should be set to the value of the sequence
counter. As the value must be encrypted, the ICV Flag is set.
for formats 50, 51, derive card session S-ENC using KMC and data;
for formats 11 – 14, recover key (DPK) from key specifier.
2. If SC = 02 or 04, obtain S-MAC:
for formats 50, 51, derive card session S-MAC using KMC and data;
for formats 11 – 14, recover key (MPK) from key specifier.
3. If SC = 01 or 04, encrypt the Text using session S-ENC and the method specified in Enc Method as explained in
section D.3.4 of [36].
4. If SC = 02 or 04, calculate C-MAC using session S-MAC, ICV Flag, ICV, MAC Method and MAC Data as
explained in section D.1.3, D.1.5, and D.3.3 of [36].
GP-SECURE-MESSAGING-COMMAND-SCP03 (EE2066)
Request Length Type Description
SC 1 h Select Code
01 = Encrypt data only
02 = Calculate MAC only
03 = Encrypt data and calculate MAC
rc 1 h Return Code
This function performs the cryptographic processing required for Secure Messaging of a command to be sent to the
card. For example:
• Message authentication and / or data encryption, and
• Data encryption and / or generation of the C-MAC.
The function supports SCP03. In this protocol:
• Encryption is performed using AES in CBC mode and with an encrypted counter as the ICV;
• MACing is performed using CMAC, with S-MAC and a MAC Chaining Value;
• Data encryption precedes MAC calculation so there is a requirement to place ciphertext into the MAC data.
Processing Steps
1. If SC = 01 or 03, obtain S-ENC for formats 52, 53 and derive card session key S-ENC using KMC and data (as in
section 4.1.5 of [75]).
2. If SC = 02 or 03, obtain S-MAC for formats 52, 53 and derive card session key S-MAC using KMC and data (as in
section 4.1.5 of [75]).
3. If SC = 01 or 03, AES-CBC-encrypt the Text using session S-ENC. The plaintext value specified in counter will be
encrypted prior to use as the ICV in the encryption operation (as in section 6.2.6 of [75]).
4. If SC = 03, insert encrypted text into MAC Data at Offset.
GP-SECURE-MESSAGING-RESPONSE (EE2062)
Request Length Type Description
SC 1 h Select Code
01 = Decrypt data only
02 = Verify MAC only
04 = Decrypt data and verify MAC
rc 1 h Return Code
This function performs the cryptographic processing required for secure messaging of a response message received
from the card.
for formats 50, 51, derive card session S-ENC using KMC and data;
for formats 11 – 14, recover key (DPK) from key specifier.
2. If SC = 02 or 04, obtain S-MAC:
for formats 50, 51, derive card session S-MAC using KMC and data;
for formats 11 – 14, recover key (MPK) from key specifier.
3. If SC = 01 or 04, decrypt the EncrypedText using session S-ENC and the method specified in Enc Method.
4. If SC = 02 or 04, calculate R-MAC using session S-MAC, ICV Flag, ICV, MAC Method and MAC Data.
HSM-STATUS (0001)
The HSM-STATUS request notifies the host of exception conditions at Luna EFT.
rc 1 h Return Code
The only two possible conditions are shown in the return code.
• A 00 code will denote successful completion and the data field will return with the software ID.
• A 08 code will denote a DES Cipher Processor Error. In this case, the software ID will not be returned.
This host function is used for Australian Major Bank (AMB).
HSM-STATUS (01)
This function activates the self-tests and returns the results to the host.
01 1 h Function Code
01 1 h Function Code
rc 1 h Return Code
ROM Status 1 h This is the result of performing a CRC check on the ROM. A
failure indicates ROM corruption or tampering.
0 = Passed
1 = Failed
*Hard Disk Status 1 h Read IDE status port to ensure no IDE errors are reported.
0 = Passed
1 = Failed
Reset Count 2 h Number of time the HSM has been reset since
manufacture.
If the reset count is either unknown or not applicable, a
value of 0 is returned.
Calls in last minute 4 h Number of function calls to the host made in the last minute.
If the number of calls is either unknown or not applicable, a
value of 0 is returned.
Calls in last 10 mins. 4 h Number of function calls to the host made in the last 10
minutes.
If the number of calls is either unknown or not applicable, a
value of 0 is returned.
* The values are as per the last selftest run on the HSM.
HSM-STATUS-EXTN (0002)
This request notifies the host of exception conditions at Luna EFT.
rc 1 x Return Code
dd 1 x Current Day
mm 1 x Current Month
hh 1 x Current Hour
mm 1 x Current Minute
ss 1 x Current Second
PL 2 x Performance level
Note:
This function supersedes function 0001.
All binary fields are little endian representation with least significant byte first.
HSM-STATUS-REV2 (EE0003)
This function activates the self-tests and return the results to the host. It also check and returns the status of AES
processor and Firmware Version.
rc 1 h Return Code
Reset Count 2 h Number of time the HSM has been reset since
manufacture.
If the reset count is either unknown or not applicable, a
value of 0 is returned.
Calls in last minute 4 h Number of function calls to the host made in the last minute.
If the number of calls is either unknown or not applicable, a
value of 0 is returned.
Calls in last 10 mins. 4 h Number of function calls to the host made in the last 10
minutes.
If the number of calls is either unknown or not applicable, a
value of 0 is returned.
* The values are as per the last selftest run on the HSM.
II-KEY-GEN (EE0402)
Request Length Type Description
Following fields must be present if 13th and 12th bit of Key Flags field is set to 10, i.e. response 1eKISn(KS) needed
in TR-31 format.
1Following fields must be repeated n times for each set of keys starting from the least bit (right most) of Key Flags
field.
Mode of use 1 h Any Valid values as described in the table Key Block
Header Fields for Key Block Format Keys
Exportability 1 h Any valid value as described in the table Defined Values for
Exportability Byte.
rc 1 h Return Code
1 This set of fields will occur ‘n’ times in the response. Value of n can be at max 4.
Notes
– The key specifiers 10, 11, 13 under the Response, are generated when using the Legacy option.
– The key specifiers 10, 11, 13 under the Response, are generated based on the chosen operation on console
and FM. See section, Function Modifier Values.
*KBS field must be provided when key is needed in 17 or 18 formats. This field will repeat for each key to be generated.
When only host stored keys are needed in TR-31, KBS should be formed as:
Optional field 0 … n Var h Number of optional field as defined in above filed. First byte of
optional field will be treated as Optional Block ID.
When both KTM encrypted key and key spec is need in TR-31 then KBS should be provided is mentioned below:
Algorithms 1 h = 00
Algorithm will be determined from request TR-31 key block
Mode of use 1 h = 00
Mode of usage will be determined from request TR-31 key block
Key Version No. 2 h = 00 Key Version Number will be determined from TR31-key block
This function generates a set of random DES or 3DES keys for an interchange. The key set may include any of the
session keys, PPK, MPK and DPK, and may also include a new key-encrypting key, KIS/KI.
If a key flag bit 3 or 7 or 11 is set then the following cases are possible:
• A bidirectional interchange key (KI) will be generated in the response if KIS/KI-Spec in request is in format 8.
• An interchange key send (KIS) will be generated in the response if the KIS/KI-Spec is any valid format other than
format 8.
HMAC-SHA MPK can exist either inside the HSM or in the form of TR-31 key block protected under a transport key or
in key spec format 17 and 18 protected under KM for host storage. This function supports generation and distribution of
HMAC-SHA MPK.
For transmitting to the receiving institution, the generated keys are returned encrypted under the appropriate variant of
the Interchange Sending Key (KIS/KI) indicated by the 'KIS/KI-Spec' field in the function request. Exceptionally, if a
new KIS/KI is to be generated by the function, any session keys that are also generated are returned encrypted by that
new KIS/KI. For double-length keys, either ECB or CBC encryption modes may be selected.
The generated keys are also returned encrypted under the appropriate *KM variant for storage within the host. The
function also returns the KVCs of the generated keys.
The function response will contain one or more sets of encrypted key fields as shown: one set for each appropriate bit
set in the 'Key Flags' field. That field also indicates the encryption mode for any double-length keys that are generated.
FM = x0
The Host Key Protection using Function Modifier can be in the range of x0, where x = 0, 1, 2, 3, or
4.
Key Flags Indicates the received encrypted keys and the encryption mode. The bit positions are allocated as
follows:
Bit Indicates
Failure caused due to any of the previous 3 occurrences will result in error 0x0C (Inconsistent request fields)
being returning as the return code
6. When the Key Flags specify that a KIS/KI is to be generated this new KIS is returned encrypted with the old
KIS/KI. The encryption mode depends upon the Key Flags mode bit.
Error Conditions
The following settings for the Key Flags field will result in a Return Code of 0C.
1. A request for a double-length key to be generated, though the KIS/KI indicated in the request is a single-length key
2. A request to generate a DPK, though this is disabled for the (HSM-stored) KIS/KI.
3. A request to generate a single-length KIS/KI, though the KIS indicated in the request is a double-length key
4. A reserved bit not set to zero.
5. A request to generate more than one of the same key type (regardless of key length, e.g. Single DPK/Double DPK).
Also see point 5 under "Details and Restrictions" above.
Notes
– The encryption mode for eKIS/KInvx(KS) and KS/KI-Spec is ECB unless otherwise specified.
– This function will check the length of KIS/KIn and use the appropriate encryption method.
– When there is no variant scheme chosen for the KIS/KI, this function will automatically disable the ability to
generate a DPK. This part of the function can be manually enabled from the console by selecting “Enable
function for data key generation” under the KIS Options dialog.
– The AS2805 variant for KIS is chosen during key input at the HSM console.
– When the AS2805 variant scheme is used, the double length session key encrypted under KIS is output using
CBC. Please refer to the Console Guide for directions on how to set options for the KIS.
– This function supercedes function 51, 52, 53.
– Bits 13-15 of the key flags are reserved.
– Single length KIS/KI is not supported if generated Key is requested in TR-31 Key Block. i.e. Format 10 is not
supported for KIS-Spec. For format 0-3 HSM stored Single length KIS/KI Keys are also not supported.
– Allowed algorithms for Key Usage ‘M1’ will be ‘D’. Refer [45] of Mark II.
II-KEY-RCV (EE0403)
Request Length Type Description
*1KBS Var h Key Block structure. Optional and must be present if 1KS-
Spec required in TR-31 Key block format.
rc 1 h Return Code
1 This set of fields will occur ‘n’ times. Value of n can be at max 4.
Notes
– The key specifiers 10, 11 under the Response, are generated when using the Legacy option.
– The key specifiers 10, 11, 13 under the Response, are generated based on the chosen operation on console
and FM. See, Function Modifier Values.
*KBS field must be provided when key is needed in 17 or 18 formats. This field will repeat for each key received.
When incoming key is not in TR-31, KBS should be formed as:
Optional field 0 … n Var h Number of optional field as defined in above filed. First byte of
optional field will be treated as Optional Block ID.
Algorithms 1 h = 00
Algorithm will be determined from request TR-31 key block
Mode of use 1 h = 00
Mode of usage will be determined from request TR-31 key block
Key Version No. 2 h = 00 Key Version Number will be determined from TR31-key block
This function re-encrypts a received set of encrypted DES or 3DES keys for host storage. The key set may include any
of the session keys, PPK, MPK and DPK, and may also include a new key-encrypting key, KIR/KI.
If a key flag bit 3 or 7 or 11 is set then the following cases are possible:
• The new key-encrypting will be a bidirectional interchange key (KI), if the KIR/KI-Spec in request is in format 8.
• The new key-encrypting will be an interchange key receive (KIR),if the KIR/KI-Spec is any valid format other than
format 8.
As received from the sending interchange institution, the keys are encrypted under the appropriate variant of the
Interchange Receive Key (KIR/KI) indicated by the 'KIR/KI-Spec' field in the function request. Exceptionally, if a new
KIR/KI is included in the set, any session keys that are also included must be encrypted by that new KIR/KI. For
double-length keys, either ECB or CBC encryption modes are supported.
The received keys are returned encrypted under the appropriate *KM variant for storage within the host. The function
also returns the KVCs of the received keys.
The function request and response will contain one or more sets of encrypted key fields as shown: one set for each
appropriate bit set in the 'Key Flags' field. That field also indicates the encryption mode for any double-length keys that
are received.
FM = x0
The Host Key Protection using Function Modifier can be in the range of x0, where x = 0, 1, or 2.
Key Flags Indicates the received encrypted keys and the encryption mode. The bit positions are allocated as
follows:
Bit Indicates
KVC Key Verification Code for the key. Depends upon the key flag and is calculated depending upon the
key flag.
Error conditions
The following settings for the 'Key Flags' field will result in a Return Code of 0C.
1. A request for a double-length key to be re-encrypted, though the KIR/KI indicated in the request is a single-length
key
2. A request to re-encrypt a DPK, though this is disabled for the (HSM-stored) KIR/KI.
3. A request to re-encrypt a single- and double-length key of same type.
4. A reserved bit not set to zero.
Notes
– The encryption mode for eKIR/KInvx(KS) and KS-Spec is ECB unless otherwise specified.
– This function will check the length of KIR/KIn and use the appropriate encryption method.
When there is no variant scheme chosen for the KIR/KI, this function will automatically disable the ability to
generate a DPK. This part of the function can be manually enabled from the console by selecting “Enable
function for receiving of data keys” under the KIR/KI Options dialog.
The AS2805 variant for KIR is chosen during key input at the HSM console. When the AS2805 variant scheme
is used, the eKIRnvx(KS) must be encrypted using CBC. Please refer to the Console Guide for directions on
how to set options for the KIR.
This function supercedes functions 54, 55, 56. Bits 13-15 are reserved.
– Input Key 1eKIR/KIn(KS) may be in TR-31 Key Block. If input key is in TR-31 Key Block format Key Usage of
1eKIR/KI (KS)must be matched for Key Type for each set of keys starting from the least bit (right most) of Key
n
Flags field.
– Single length KIR/KI is not supported if incoming Key in TR-31 Key Block. i.e. Format 10 is not supported. For
format 0-3 HSM stored Single length KIR/KI Keys are also not supported.
IMP-ENC-PUB-KEY (EE4008)
Request Length Type Description
FM 1 h Function Modifier
PK Var K-spec Key specifier for unauthenticated public key. (Format: 80)
User Data Var h Data to be stored in key specifier for PK. (May be zero-
length field)
rc 1 h Return Code
ePK Var K-spec Key specifier for encrypted authenticated public key.
(Format: 83)
This function accepts a RSA public key, encrypts it and places the result in a format-83 key specifier, thereby
producing an authenticated and confidentiality-protected public key. The function is used to import PCA-TM.
Note: The function is disabled, by default and to prevent unauthorized public keys from being
introduced, it is recommended to be kept in a disabled state.
IMPORT-CSCK (AB)
Request Length Type Description
AB 1 h Function code
CSCK-Storage Indicator 1 h This field specifies whether the imported key is to be stored
in the host database or in HSM secure memory.
Currently only the value 0 is supported which means
storage on the host.
AB 1 h Function code
rc 1 h Return code
This function causes a key to be returned encrypted under the HSM’s KM variant 6 for storage on the host database.
Notes
– The key specifier 11 under the Response, are generated when using the Legacy option.
– The key specifiers 11, 13 under the Response, are generated based on the chosen operation on console and
FM.
– The KVC returned in the response is calculated as the leftmost 24 bits of the result of triple-DES encrypting a
64-bit Block of zeros with the double-length key.
– Bidirectional Interchange key “KI” will be allowed only in format 08 in the request. Also, within format 08 only
format 0-3 will be allowed for KI.
– The Encrypted CSCK in the request can be:
eKIR (CSCK) if KIR was received in the request field KIS/KI Spec.
eKI(CSCK) if KI was received in the request field KIS/KI Spec.
IMPORT-EMV-CERTIFICATE (EE9011)
Request Length Type Description
Public Key Remainder Var h Used to validate the recovered certificate data.
Key Type 2 h Indicates the valid usage for the private key
0 Certificate
1 Data Signature
2 Key Transport
4 Data Protect
User Data Var h Optional user data to be included in key specifier for the
public key.
rc 1 h Return Code
PK Var K-Spec Key specifier for authenticated public key. (Format: 81)
Certificate Data Var h The data recovered from Certificate, of length equal to the
length of the CA Public Key Modulus ( NCA)
This function verifies an EMV certificate. If successful, it returns the public key in a key specifier and also provides the
data recovered from the certificate.
Processing Steps
1. Verify public key certificate
– Recover contents of certificate using PKCA
– Calculate hash of certificate using data in certificate, public key remainder and public key exponent under
SHA-1
– Verify certificate using hash calculated in step 1b and hash result recovered from certificate.
2. Retrieve public key from Certificate data.
3. Concatenate Public key remainder to the public key modulus (retrieved from certificate).
4. Calculate response PK (Key specifier for authenticated public key) using public modulus, public exponent, Key
type, and user data.
Note: Table 9 in reference [5] is used for format of the Data Recovered from the Issuer Public
Key Certificate.
IMPORT-KEY-PACKAGE (EE3104)
Request Length Type Description
rc 1 h Return Code
This function is used to load an Export Key Package to the HSM from the host. To load the files many calls may be
required. On success, the function returns a 4-byte value in cumulative length field to show the length of the file that has
been received so far, and this value must be included in the File Length / Offset field in the next function call.
Once the package is fully loaded the HSM will automatically begin the verification and key import operation. Depending
on the size of the package it may take some time in the verification and import process.
Control 01 – First segment of Key Package is being presented. If a Key Package (or part of key
Package) is already in the HSM then this function will cause the old package to be deleted.
02 – Add this segment to the end of the Key Package.
FileLength/Offset This field acts like a dual variable which holds the value of the total Key Package length
when function is being called for the first time (control=1) and the Offset for other function
calls (control=2).
DataSegment This field has a variable data length and contains the next data segment of the Key
Package.
Cumulative Data On success function return 4 bytes value to show the length of the Key Package that has
Length been received so far and this value must be included into the FileLength/Offset field of the
next function call.
IMPORT-PUBLIC-KEY (EE9003)
Request Length Type Description
Key Type 2 h Indicates the valid usage for the private key
0 Certificate
1 Data Signature
2 Key Transport
4 Data Protect
PK Var K-Spec Key specifier for unauthenticated public key. (Format: 80)
User Data Var h Data to be stored in key specifier for PK. (May be zero-
length field.)
rc 1 h Return Code
PK Var K-Spec Key specifier for authenticated public key. (Format: 81)
IMPORT-PUBLIC-KEY-CERTIFICATE (EE9004)
Request Length Type Description
Key Type 2 h Indicates the valid usage for the private key
0 Certificate
1 Data Signature
2 Key Transport
User Data Var h Optional user data to be included in Public Key Specifier.
rc 1 h Return Code
PK Var K-Spec Key specifier for authenticated public key. (Format: 81)
This function verifies the signature on the public key certificate and returns the public key in an authenticated key
specifier. The key type of the key will be set in the key specifier as specified in the Key Type request field.
1. Import of Host’s public key, PK-HSM, from the signed public key: PK-HSM +
(PK-HSM)*SK-NCR. The signature is as generated by the RSASSA-PKCS-v1_5 scheme of [Reference [21] of
Mark II].
Note:
- The authenticated key specifier may not be required and may be discarded.
- The function may be used just to verify that the signed public key corresponds with the public
key sent to NCR. The Verify signed data function may be used instead.
Certificate If equal to 03 (NCR), the data in the Certificate field takes the format:
Format modulus (256 bytes) concatenated with signature (256 bytes).
The following table illustrates a certificate in the PKCS#1, ASN.1 type RSAPublicKey (i.e. Certificate format = 04 -
NCR2 ).
Component Example
ASN.1 Modulus (257 bytes – 256 byte modulus preceded by leading zero 009F9C7EAD…
byte
The ASN.1 integer type with length of 3 and then the exponent data 0203010001
Note:
- The certificate field is a Var field.
- The ASN.1 format described in the example above must be preceded by the variable length
prefix described in Function Construction.
IMPORT-RSA-ENC-KEY (EE3060)
This function is used to translate a key from encryption under an asymmetric key to encryption under AES Domain
Master Key.
FM 1 h Function Modifier = 00
Private Key Var K-Spec Key specifier containing the private key encrypted by a KM
variant
Format: 82
Key Type: Key Transport
rc 1 h Return Code
Key Details
Format 1C
KM-index 1 h Index of KM
Algorithm 1 h Algorithm
Processing Steps
1. Extract Private Key
2. Use extracted Private Key to decrypt key encrypted under Public Key and extract clear key.
3. Calculate extracted clear key’s KVC.
4. Using format and key details received in request, encrypt the extracted clear key (in step 2) under Domain Master
Key.
5. Return the KM encrypted key along with its KVC in response.
IMPORT-RSA-PRIVATE-KEY (EE9013)
This function imports an encrypted RSA key private key.
Private key structure Var Var Variable length private key structure
Key Type 2 h Indicates the valid usage for the private key
KM id 1 h Only 00 is supported
rc 1 h Return Code
SK Var K-Spec Key specifier containing the private key (SK) encrypted by a
KM variant.
Format: 82
This function imports RSA private key from PKCS#12 format to KM encrypted RSA keys. PKCS#12 format relies on
password for RSA key protection and comparatively less secure then HSM keys. Therefore, by default this function is
disabled.
Processing Steps
1. Extract Private Key from PKCS12 archive store. Use passphrase provided as password for decryption.
Note: The function will not check for validity of certificates stored inside the key store.
2. Validate RSA modulus size. Only 1024 bit and 2048 bit keys are supported.
3. Create format 82 key spec using private key extracted in step 1. Use input request parameters (KM id, key type,
user data).
4. Return private key in response.
IMPORT-TRANSPORT-KEY (EE9203)
Request Length Type Description
FM 1 h Function Modifier = x0
Private Key Var K-Spec Key specifier containing the private key (SK) encrypted by a
KM variant.
(Format: 82)
rc 1 h Return Code
This function decrypts the padded KTM using RSA’s private key. Actual KTM will be retrieved depending on the correct
padding scheme. The retrieved KTM encrypted with KMv5 will be sent in response field. KTM is encrypted with KMv5,
so that it can be used directly in function EE040C.
FM The Host Key Protection using Function Modifier can be in the range of x0, where x= 0, 1, or 2.
00 : Global
10 : ECB
20: CBC
Private Key Format 82 (Key Type field will only support Key Transport)
Transport Key Type 1 The transport key type. It shall have the following value:
0 – Double length triple DES key
KCV Data 8 The value used for the generating the KCV. This shall currently be all zeros.
KCV 3 or 4 The first 3 or 4 bytes of the KCV Data encrypted using the Transport Key
NOTE:
• Key Type (T) field will only support 0
• KTM can only be double length
• KCV Data can only be 8 zeros
• KCV is left most 3 or 4 bytes of eKTM(KCV Data)
Processing Steps
1. Validate the Private Key.
2. Validate the Padding Scheme. Only PKCS#11v1.5 and OAEP is supported. Any other value would result in error.
3. Decrypt the public key encrypted Transport key using given Private Key and Padding Scheme.
4. If Transport Key length is 28, KCV will be of 3 bytes and if Transport Key length is 29, KCV will be of 4 bytes. Any
other transport key length would result in error.
5. Validate the contents of Transport Key:
– First byte should be 00 to signify double length key. Any other value would result in error.
– Next 16 bytes is actual transport key (or KTM).
– Next 8 bytes of KCV Data would be all zeros. Any other value would result in error.
– Next 3 or 4 bytes is the retrieved KCV.
– Calculate the KCV using Transport Key (step 5b) and KCV Data (step 5c).
– Compare the calculated KCV with the retrieved KCV. Any mismatch would result in error.
6. Encrypt the retrieved KTM (step 5b) with KMv5 and return in response.
INIT-KEY-EXCH (EE4005)
Request Length Type Description
FM 1 h Function Modifier
STAN 6 h
Terminal ID 8 h
Issuer ID 4 h
rc 1 h Return Code
This function performs the processing described in section 2.2 of [72], and as listed below.
• Verify terminal cryptogram according to appendix C.1 of [72].
• Create session keys according to chapter 4.4.3 of [72].
• Create cryptogram with terminal initial key according to appendix C.2 of [72].
Processing Steps
1. Recover KE and KF.
2. Calculate SENC and SMAC as specified in 4.4.3 of [73].
3. Decrypt the terminal cryptogram using SENC. (CBC with IV = 0. Include the (encrypted) MAC field in the decryption
process.)
4. Check the STAN and Terminal ID fields against those fields in the request message.
5. Calculate a MAC using SMAC and the first 32 bytes of the plaintext, and check the result with the MAC field in the
plaintext.
6. Extract random number RNE.
7. Calculate DUKPT IK (TIK) using BDK and left 64 bits of SMID.
8. Create FEP Cryptogram, as specified in Appendix C2 of [73].
– Insert SMID, TIK, RNE and Pad Pattern.
– Calculate MAC using SMAC and insert result.
– Encrypt cryptogram data using SENC. (CBC with IV = 0. Include the MAC field in the encryption process.)
INITIAL-KEY-REC (B580)
This function returns the initial key (KI), PIN Pad Identification Number, Date-Time-Stamp, Random Number and user
data from the Initialize Request Message.
sSKtcu[cPKsp Var S-Block Signed initial key, PPID, Date and time stamp, Random
(KI,PPID,DTS,RN,data)] number and user data
RN 8 x Random Number
rc 1 x Return Code
Note:
- The User Data field is left justified and right zero filled.
- The function verifies the Random Number. An error code of 40 - RANDOM NUMBER
VALIDATION ERROR - is returned if the validation fails.
- The TCU key pair has a length of 960 bits and the SP key pair has a length of 896 bits.
- The KI.PPID.DTS.RN.data clear text is formatted as DFormat 1 before encrypting with
PKSP. The output produced is then formatted again using DFormat 1 before signing by the
SKTCU.
- For RSA key encryption by a KM, the Format 42 is applied.
- 'data' may be variable length in the range 0 - 16. If less than 16 bytes, data will be left justified
and padded with zeros.
IPEK-DERIVE (EE040A)
Request Length Type Description
rc 1 h Return Code
This function derives the initial key for a DUKPT PIN Entry Device and returns it encrypted by a Key Transport Key
(KTK).
FM Must = 00
IK A format-20 key specifier that provides the BDK and KSN used to derive the initial key for PIN Entry
Device. The Encryption Counter part of the KSN (i.e. the least significant 21 bits) must be zeroes
KBS Key Block structure. KBS must be present when encryption mode is 02.
Note:
- The derived key will be a double length key – as only that key length is currently supported by
the format 20 key specifier. It is returned in a Var field to accommodate any future extensions.
- The KTK is the key type from the CI functionality. It can also be used to transport keys to an
EMV chip card. (It is not the ZKA KTK).
IPEK-DERIVE-2 (EE040C)
Request Length Type Description
rc 1 h Return Code
This function derives the initial key for a DUKPT PIN Entry Device and returns it encrypted by a Key Terminal Master
Key (KTM).
FM Must = 00
KTM Key specifier for HSM and host stored Terminal Master Key.
IK A format 20 key specifier that provides the BDK and KSN used to derive the initial key for PIN Entry
Device. The Encryption Counter part of the KSN (i.e. the least significant 21 bits) must be zeroes
KBS Key Block structure. KBS must be present when encryption mode is 02.
The following TR-31 field definition requires to be put in practice for use.
TR-31 Fields
Key Usage 2 h B1
Algorithms 1 h T
Mode of use 1 h X
Exportability 2 h S
Note:
- The derived key will be a double length key, as only that key length is currently supported by
the format 20 key specifier. It is returned in a Var field to accommodate any future extensions.
- The TR31 Key usage should be set to “B1” which is defined as DUKPT IPEK.
- The TR31 mode of use should be set to “X”, which is defined as key used to derive other keys.
- The TR31 exportability should be set to “S”, defined as a sensitive key.
IT-KEY-GEN (EE0400)
Request Length Type Description
Following fields must be present if 13th and 12th bit of Key Flags field is set to 10, .i.e. response 1eKTM(KS) is
needed in TR-31 format.
1Following fields must be repeated n times for each set of keys starting from the least bit (right most) of Key Flags
field.
Mode of use 1 h Any Valid values as described in the table Key Block
Header Fields for Key Block Format Keys.
Exportability 1 h Any valid value as described in the table Defined values for
exportability byte.
rc 1 h Return Code
1 This set of fields will occur ‘n’ times in the response. Value of n can be at max 3.
This function generates a set of random session keys for an EFT terminal. For distribution to the terminal the session
keys are encrypted by the Terminal Master Key (KTM), and for host storage and subsequent use with other functions
they are encrypted by variants of the Domain Master Key. The function also returns the KVC of the session keys.
If a new KTM is to be generated by the function, any session keys that are also generated are returned encrypted by the
new KTM. For double-length DES session keys, either ECB or CBC modes may be selected.
When the request field KTM-Spec refers to a HSM or host stored SEED key (Format 16) the response field(s) KS-Spec
will be Format 16, the session key(s) will be encrypted according to the SEED algorithm and the KVC will be calculated
according to the SEED KVC method.
*KBS field must be provided when key is needed in 17 or 18 format. This field should repeat for each new key to be
generated.
When only host stored keys are needed in TR-31, KBS should be formed as :
Optional field 0 … n Var h Number of optional field as defined in above filed. First byte of
optional field will be treated as Optional Block ID.
When both KTM encrypted key and key spec is need in TR-31 then KBS should be provided is mentioned below:
Algorithms 1 h = 00
Algorithm will be determined from request TR-31 key block
Mode of use 1 h = 00
Mode of usage will be determined from request TR-31 key block
Key Version No. 2 h =00 Key Version Number will be determined from TR31-key block
Notes
– The key specifiers 10, 11, 13, 16 under the Response, are generated when using the Legacy option.
– The key specifiers 10, 11, 13 under the Response, are generated based on the chosen operation on console
and FM. See, section Function Modifier Values.
FM = x0
The Host Key Protection using Function Modifier can be in the range of x0, where x= 0, 1, or 2.
KTM-Spec A key specifier, which incorporates an index to a HSM-stored or host-stored single length or double
length KTM. Formats 00 – 03, 10, 11, 12, 13, 14, 16, 17 and 18 accepted.
Key Flags Indicates the session keys to generate. The function response will contain one or more sets of
encrypted key fields as shown: one set for each bit set in the flags. The bit positions are allocated as
follows:
eKTM(KS) These fields form a key set. The response incorporates a key set for each bit (validly) set in the Key
KS-Spec Flags field. The order of the returned key sets is the same order that the keys are specified in the
KVC Key Flags field.
0C An inconsistency is present in the setting of the Key Flags field. Seven conditional returns currently
exist:
- Double length session keys required with single length KTM.
- Single and double length session key of same type requested.
- Reserved bit not set to zero.
- Single length KTM required with double length KTM (Format 16 KTM-Spec).
- Single length MPK requested with SEED KTM (Format 16 KTM-Spec).
- Double length session keys requested with SEED KTM (Format 16 KTM-Spec).
- CBC mode requested with SEED KTM (Format 16 KTM-Spec).
Notes
– For key specifier formats, refer to Function Construction.
– This function supercedes functions 41, 42, 43, 4A
– Bit 7 and Bits 13-15 of the key flags are reserved.
– Error will be returned if request KTM-Spec refers to a HSM or host stored SEED key (Format 16) and response
eKTM(KS) requested into TR-31.i.e. Key Flag 12th and 13th bit has value 10.
– To generate a double-length PIN encrypting key and a single-length MAC key, and eKTM(KS) needed in TR-31
key block format the Key Flag field must be set to X’2204’.
JAPPINTRAN (EF0601)
This function allows translation of PIN block format and PIN encryption key.
rc 1 h Return Code
PFi and PFo High and low nibble respectively of the PIN format input and output. These specify the format of the
supplied PIN block and of the required PIN block. If format translation is not required, the PFi and
PFo fields must be set to the same value.
The valid field values are:
0 = Clear PIN format
1 = AS/ANSI format
3 = IBM 3624 format
Examples: PFi = 3, PFo = 0
The above will take a PIN in IBM 3624 format and return the PIN in the clear.
e*PPKi(PIN) This value is dependent on the type of translation being performed as specified by PFi.
or PIN If PFi = 0, this value will be the PIN value in the clear.
If PFi = 1 or 3, this value must be the PIN encrypted by the PIN Protect Key.
ANB Is the 12-digit Account Number Block used in the formation of the clear AS/ANSI PIN Block.
e*PPKo(PIN) This value is dependent on the type of translation being performed as specified by PFo.
or PIN If PFo = 0, this value will be the PIN value in the clear.
If PFo = 1 or 3, this value will be the PIN encrypted by the PIN Protect Key.
KB-MAC-GEN (73)
Request Length Type Description
73 1 h Function Code
n 1 d KTM-Index
73 1 h Function Code
rc 1 h Return Code
This function generates a 32-bit Message Authentication Code (MAC) for the supplied DATA using the Base Key (KBn)
indicated by the supplied KB-index, in accordance with AS2805.4. Note that only the first 99 KBs may be used with this
function.
The function may be used for both MAC generation and MAC verification.
KB-PIN-VER (64)
Request Length Type Description
64 1 h Function Code
64 1 h Function Code
rc 1 h Return Code
This function performs the verification of a PIN in an AS/ANSI formatted PIN Block using the IBM 3624 method. The
PIN Block is supplied encrypted by a SafeNet HSM stored Base Key.
PVK-index identifies the PVKn, DTn, and MINPINn appropriate to the PIN verification procedure.
KTM-Index identifies the Terminal Master Key (KTMn) with which the PIN Block is encrypted.
AS-PIN is the AS/ANSI formatted PIN Block containing the PIN to be verified.
PAN is the Primary Account Number (or other card data) used in the verification procedure. It must be
padded appropriately prior to input to this function.
ANB is the 12-digit Account Number Block used in the formation of the clear AS/ANSI PIN Block.
Offset consists of up to 12 digits of offset data. The significant digits must be left-justified in the field. Unused
digits are ignored. If offsets are not used, the significant digits must be zeros.
The function returns no response data. An Error Code of 00 indicates successful verification, while 08 indicates a
verification failure.
The function will fail with Error Code 78 if an ISO-0 PIN block is disabled.
KEY-EXPORT (EE0201)
Request Length Type Description
KIS/KI Spec Var K-Spec Key specifier for the KIS/KI, (Formats: 0–3, 8, 10, 11, 12,
13, 14, 15, 17, 18)
Following fields must be present if Enc Mode is 02, i.e. the Outgoing Key eKIS/KI(K) is in TR-31 format.
Key Usage 2 h Any Valid values as described in the table Key Block
Header Fields for Key Block Format Keys
Key usage must be matched correctly with the Key type
field.
Mode of use 1 h Any Valid values as described in the table Key Block
Header Fields for Key Block Format Keys
Exportability 1 h Any valid value as described in the table Defined values for
exportability byte.
Y = 0 (Don’t pad)
Y = 3 (Pad to triple length)
rc 1 h Return Code
This function re-encrypts a host-stored encrypted DES or 3DES key under a specified KIS/KI.
As stored on the host, the keys are encrypted under the appropriate variant of the Domain Master Key (KM). The keys
are returned encrypted under the appropriate KIS variant. The function also returns the KVC of the key.
Keys export from Key block form to variant form is allowed only if Enabled from console i.e. check box: Translation of
Keys Migration, import and export is enabled.
When Key Spec is provided in 17 & 18 ,key usage and mode of use must match with the key type.
KIS/KI Spec A key specifier for a HSM-stored or host-stored, single length or double or triple length KIS/KI.
Accepts key spec formats 0 - 3, 8, 10, 11, 12, 13, 14 and 15.
Host stored or HSM stored KI will be in key spec format 08 only.
03: KIS 16: ZKA KGK 34: IMKDN 45: DK-KTM 55:
CMKCLIDN
04: KIR 17: ZKA KKBLZ 35: KTK 48: CCMK 56: MPPK
Enc Mode Indicates the mode of operation used for encrypting the outgoing key:
00 : ECB
01 : CBC
02 : Outgoing key is in TR-31 Key Block format.
Key Spec Key Specifier incorporating an encrypted key. (Formats 10, 11, 12, 13, 14, 17, and 18).
Error conditions
If a double-length host-stored key is provided, but a single length KIS/KI is specified, this will result in an error condition
‘0C’ – Inconsistent Request Fields.
Notes
– This function will check the length of KIS/KI and use the appropriate encryption method (Single-DES or Triple-
DES).
– When the AS2805 variant scheme is used, the eKIS/KIvx(K) is always encrypted using CBC (it will ignore the
encryption mode specified in the ‘Enc Mode’ field). Please refer to Console Guide for directions on how to set
options for the KIS/KI.
– Single length BDKs and IMKs are not supported.
– PIN Verification Key, Decimalization Table (PVK, DT). (KMv7) support format 0- 3 and 13,14
– Function will return error code 19 for key-type not supported by “SafeNet Variant scheme” if “Use ‘No Variant’ “
is not-checked for Host-Stored KIS/KI.
– Function will return error code 19 for key-type not supported by “SafeNet Variant scheme” if variant scheme is
selected “SafeNet” for HSM stored KIS/KI.
– If outgoing key is in TR-31 Key Block format Key type must be matched correctly with the Key usage field.
– Single length KIS/KI is not supported if outgoing Key is in TR-31 Key Block. I.e. Format 10 is not supported for
KIS spec. For format 0-3 HSM stored Single length KIS/KI Keys are also not supported.
– AES keys are not supported in TR-31 format.
KEY-EXPORT-AES (EE0206)
This function is used to export AES Keys.
rc 1 h Return Code
Wrapping method = 00
Wrapping method = 0A
Wrapping method = 0B
ICV It has not been fixed to 8 bytes as NIST SP 80038F used as underlying layer for Schlüsselausgabe_AES_
Schlüssel_v1.5 doesn’t mentions it to be mandatorily 8 bytes.
Function Considerations
• This host function is similar to EE0201.
• Encryption and MAC key is derived using key spec 54.
• This function supports only Method 00 with key spec 54.
• KI spec 17 and 18 are RFU as of now, hence usage will return error.
• Wrapping Method 0A implies wrapping as defined in section 6.2 of NIST SP800-38F, Reference A [93].
• Padding Method for 192 bit keys is ISO 9797-1 pad 4.
• The output eKIvx(K) is always hex packed.
Processing Steps
1. KI and/or intermediary KI’s (KIENC and KIMAC) are derived using key spec. Only Method = 00 is applicable with
Key Spec 54.
2. KIvx/Input data is decrypted using algorithm, encryption mode and other data by KM as per required variant and
supplied Key spec.
3. KIvx is encrypted and/or authenticated using the KI and/or intermediate KI’s using wrapping method and encryption
parameters.
4. Output KVC as per KVC Method.
Wrapping Method
• For wrapping method = 00, use AES ECB mode to encrypt the key using KI.
• For wrapping method = 01, use AES CBC mode to encrypt the key using KI eKI(Key) with IV provided.
• For wrapping method = 02, use AES CTR mode to encrypt the key using KI eKI(Key) with IV provided.
• For wrapping Method = 0B
– ICV must always be multiple of 8 bytes.
– Encrypt key using NIST SP 800-38F 6.2 Algorithm 3 (Reference A [93]) and ICV.
• For wrapping Method = 0A
– When MAC algorithm is 00
– There must be no AD={AD1,AD2}.
KEY-IMPORT (EE0200)
Request Length Type Description
KBS Var h Key Block structure. Optional and must be provided when
key in response is needed in key block format.
rc 1 h Return Code
This function re-encrypts a received encrypted DES or 3DES key for host storage.
As received, the keys are encrypted under the appropriate variant of the Interchange Receive Key (KIR/KI) indicated by
the 'KIR/KI-Spec' field in the function request.
The mode of encryption for the key sent in the function request (eKIR/KIvx(K)) may be ECB for single-length keys and
ECB or CBC for double-length keys.
The received key is returned CBC encrypted under the appropriate *KM variant for storage within the host. The function
also returns the KVC of the received key.
Notes
– The key specifiers 10, 11, 13, 14 under the Response, are generated when using the Legacy option.
– The key specifiers 10, 11, 12, 13, 14 under the Response, are generated based on the chosen operation on
console and FM. See Function Modifier Values.
FM The Host Key Protection using Function Modifier can be in the range of x0, where x= 0 , 1, or 2.
KIR/KI A key specifier for a HSM-stored or host-stored, single-length or double-length or triple-length KIR/KI.
Spec Accepts key spec formats 0 - 3, 8, 10, 11, 12, 13, 14, 15, 17 and 18.
00: DPK 07: KPV, DT 24: BDK 36: PTK 48: CCMK 55:
01: PPK 08: KPVV 30: IMKAC 37: KMC 49: IMKCL CMKCLIDN
02: MPK 09: KCVV 31: IMKSMI 38: IMK-CVC 50: IMKRP 56: MPPK
03: KIS 10: KI 32:IMKSMC 40: DK-DPK 51: CMKCLMD 57: MKDK
04: KIR 16: ZKA KGK 33: IMKDAC 41: DK-PPK 52: CMKCLUMD
05: KTM 17: ZKA 34: IMKDN 42: DK-MPK 53: CMKRPMD
06: CSCK KKBLZ 35: KTK 45: DK-KTM 54: CMKRPUMD
18:ZKA MK
Enc Mode Indicates the mode of operation used for decrypting the incoming key:
0 : ECB
1 : CBC
2 : Incoming key is in TR-31 Key Block format.
Key Spec Key Specifier incorporating an encrypted key. Single length ECB and double length CBC encrypted
keys (Formats 10, 11, 12, 13, 14, 17, 18).
KBS Must be present if key in response needed in TR-31 K-Spec format is 17 and 18 for Host-storage.
Key Usage value into KBS must be matched to the correct Key Type field value.
Application Notes
When key in request is in variant form and resultant key is expected in TR-31, KBS fields will be used as below :
Optional field 0 … n Var h Number of optional field as defined in above filed. First byte of
optional field will be treated as Optional Block ID.
When the key in request is in TR-31 form KBS must be provided as below:
Algorithms 1 h = 00
Algorithm will be determined from request TR-31 key block
Mode of use 1 h = 00
Mode of usage will be determined from request TR-31 key block
Key Version No. 2 h =00 Key Version Number will be determined from TR31-key block
• If a host-stored KIR/KI is provided in the request in a format 8(only for KI), 10, 11, 12, 13, 14 key specifier, no
variants will be used when decrypting the incoming key.
Error conditions
When a double length received key is provided, but a single length KIR/KI is specified this will result in an error
condition ‘0C’ – Inconsistent Request Fields.
Notes
– This function will check the length of KIR/KI and use the appropriate encryption method (Single-DES).
– When the AS2805 variant scheme is used, the eKIRvx(K) is always received at the function encrypted using
CBC (the function will ignore the encryption mode specified in the ‘Enc Mode’ field).
– Single length BDKs and IMKs are not supported.
– PIN Verification Key, Decimalization Table (PVK, DT). (KMv7) support format 0-3 and 13, 14
– Function will return error code 19 for key-type not supported by “SafeNet Variant scheme” if “Use ‘No Variant’ “
is not-checked for Host-Stored KIR.
– Function will return error code 19 for key-type not supported by “SafeNet Variant scheme” if variant scheme is
selected “SafeNet” for HSM stored KIR .
– If input key is in TR-31 Key Block format Key type must be matched correctly with the Key usage of eKIR/KI
(KB).
– Single length KIR/KI is not supported if incoming Key in TR-31 Key Block. I.e. Format 10 is not supported. For
format 0-3 HSM stored Single length KIR Keys are also not supported.
– AES keys are not supported in TR-31 format.
KEY-IMPORT-AES (EE0205)
This function is used to import AES Keys.
Encrypted key material Var h Encrypted key material depends on wrapping mode. See
Encrypted key material table below.
rc 1 h Return Code
08 = If authentication of key fails
Key Details
Key detail field contains following details pertaining to 17 and 18 key format.
KM-index 1 h Index of KM = 00
Optional field 0 … n Var h If the Number of optional fields = 00, then no optional field
else, the Number of optional field as defined in above filed.
First byte of optional field will be treated as Optional Block ID.
Wrapping method = 00
Wrapping method = 0A
Associated Data (AD)1 + Var h AD1 + encrypted and/or authenticated key material + AD2
eKI(Key) + AD2
Encryption key material 2 h Offset for encrypted and/or authenticated key material
offset
Wrapping method = 0B
ICV It has not been fixed to 8 bytes as NIST SP 80038F used as underlying layer for Schlüsselausgabe_AES_
Schlüssel_v1.5 doesn’t mentions it to be mandatorily 8 bytes.
Function Considerations
• This host function is similar to EE0200.
• Encryption and MAC key is derived using key spec 54.
• This function supports only Method 00 with Key spec 54.
• KI spec 17 and 18 are RFU as of now, hence usage will return error.
• Wrapping Method 0A and 0B implies unwrapping as defined in section 6.2 of NIST SP800-38F, Reference A [93]
• Padding Method for 192 bit keys is ISO 9797-1 pad 4.
• eKI(Key) is always packed in hexadecimal for consistency across API’s.
Processing Steps
1. KI and/or intermediary KI’s (KIENC and KIMAC) are extracted/derived using key spec. Only Method = 00 is
applicable with Key Spec 54.
2. KIvx is decrypted and/or verified using the KI and/or intermediate KI’s using wrapping method and encrypted key
material.
3. KIvx is encrypted using key details per required variant identified by Key type.
4. Output KVC as per KVC Method.
Wrapping method
• For wrapping method = 00, use AES ECB mode to decrypt the encrypted key material eKI(Key) using KI.
• For wrapping method = 01, use AES CBC mode to decrypt the encrypted key material using KI eKI(Key) with IV
provided.
• For wrapping method = 02, use AES CTR mode to decrypt the encrypted key material using KI eKI(Key) with IV
provided.
• For wrapping Method = 0B,
– ICV must always be multiple of 8 bytes.
– Decrypt eKI(Key) using NIST SP 800-38F 6.2 Algorithm 4.
– Compare ICV. If fails, return error (08).
Note: In PCI mode, the strength of the KM with respect to imported key should be greater or
equivalent.
KEY-MAILER (EE0E01)
Request Length Type Description
Line No. 1 h
Column No. 1 h
Data Var h
Line No. 1 h
Column No. 1 h
Data Var h
Key Type 1 h Indicates the KM-variant with which the key K is encrypted
rc 1 h Return Code
eKMvX(key) Var Key-Spec Encrypted key (Formats: 10, 11, 12, 13, 14, 17,18)
This function generates a random key for an EFT terminal. The available key types are - DPK, PPK, MPK, KIS, KIR,
KTM, KPVV, KCVV, KI. The key is supplied in the response, encrypted by a variant of the Domain Master Key (KM),
for host storage and subsequent use with other functions (e.g. Generate session keys). The key is also printed in split
form on two envelopes (A and B) for subsequent entry into the terminal.
KBS: Key Block structure, must be present if output Key is expected in Key Spec format 0x17 or 0x18 i.e. Key
Protection method chosen for output key is TR-31 ASCII Key Spec format 0x17 or Binary TR-31 Key Spec format 0x18
on console.
Key usage field value passed into KBS structure must match correctly with the Key Type field value.
Notes
– The key specifiers 10, 13 under the Response, are generated when using the Legacy option.
– The key specifiers 10, 11, 12, 13, 14 under the Response, are generated based on the chosen operation on
console and FM. See, Function Modifier Values.
The function is controlled by an associated set of console operations that determine various options, including the key
type and whether the generated key is single or double or triple length.
Line No. This is the number of the line on which the ‘Data’ is to be printed. It must be in the range of 1 to 40.
Column No. This is the number of the column from which the ‘Data’ is to be printed. It must be in the range of 1 to
120.
Data This is a variable length field that contains the data to be printed.
Key Type This field specifies the type of key that is to be printed and confirms the key type as input at the
console. It indicates the KM-variant with which the key is encrypted, as follows:
In order to use the value input at the console, with no confirmation, this field must be set to X’FF’.
If key type specified in this field conflicts with that entered at the console, the function will fail with rc
= X’28’
This field is only present with FM value 02 and 03.
KVC Type Specifies the method used to calculate the KVC. Initially only a value of zero is supported, indicating
the use of the standard method. This field is only present with FM value 02 and 03.
eKMvX(key) “key” may be any of DPK, PPK, MPK, KIS, KIR, KTM, KPVV, KCVV, KI
The particular variant used “X” is dependent upon the key type. See the section Variants in Function
Construction for details.
Generated key formats are 10, 11, 12, 13, and 14.
ESMID Part of the PTK-EFT function call. The ESMID is a pointer to a NULL terminated string that identifies
the name of the SafeNet HSM (ESM) to which functions are directed. The SafeNet HSM name is set
using the wincommsconfig utility provided as part of the PTK-EFT product suite.
rc Returns value 28 if the Key Type field conflicts with the key type entered at the console
KVC Key Verification Code of the printed key calculated using the method specified in request field KVC
Type. This field is only present with FM value 02 and 03.
Note that each optional item to be printed is defined by appending a set of the fields ‘Line no.’, ‘Column no.’, and ‘Data’
to the host request. Each ‘Data’ character must be printed within the area defined by the size of the key mailer
envelope. Also, each ‘Data’ character must not overprint any other defined area (including other defined ‘Data’ areas).
02 Illegal Function Code (that is, the Key Mailer facility was not enabled when the Key Mailer request
was received).
Note: The console operator must exit the key print parameters display in order for the function
to execute correctly. An error code of 0B may otherwise be returned.
KEY-PACKAGE-STATUS (EE3102)
Request Length Type Description
rc 1 h Return Code
This function returns the status of any Export Key Packages currently stored in the HSM.
Length 32 bit Big Endian integer – total length of the Key Package
If no Key Package is present in the HSM then the ‘rc’ will be zero and Status will be 4, Length=0, Name=empty and
Checksum=0
KEY-RETRIEVE-OPERATION (EE9012)
Request Length Type Description
Key Format 1 h Format of the key that indicates the length of the key to be
retrieved from the provided data.
(Formats: 10, 11, 12, 13, 14)
rc 1 h Return Code
This function retrieves the key from the provided data. By default, this function is disabled.
FM The Host Key Protection using function modifier can be in the range of x0, where x= 0, 1, or 2.
SK Key specifier incorporating the Private Key for RSA operations. The key type of the private key
must be consistent with the operation.
The mode of operation is 00-Retrive Transport then the Key Transport flag must be set in Key
Type.
Bit 1 may be set alone or along with bits 0, 2 or 4, but bits 0, 2 and 4 are mutually exclusive.
Key Format Format of the key that indicates the length of the key to be retrieved from the provided data.
(Formats: 10,11,12,13,and 14)
Offset Position from where the key is to be retrieved as part of the decrypted data.
Processing Steps
1. Decrypt the ‘Data’ using the key, SK.
2. Retrieve the key at the offset position. The length of the retrieved key is determined by Key Format.
3. Encrypt the key again using the KM variant, as specified by Key Type.
4. Fill Key Bytes with 0x00.
5. Return decrypted ‘Data’ and Key Specifier.
KIR-REC (EE3032)
Request Length Type Description
*KBS Var h Key Block structure. Optional and present only if KIR is
needed in TR-31 Key Block Form for host- storage.
rc 1 x Return Code
This function recovers an Interchange Key, which has been transferred from another HSM as part of the Interchange
Sending Key transfer procedure. The recovered key is used and denoted as an Interchange Key (KIR).
The KIR is transferred in a DEA 2 ciphertext Block as produced by the KIS-SEND function and deciphers this result.
The function returns KIR in a key specifier.
Notes
– The KIR spec Format 15 must contain the attributes specific to AS2805.6.3 2000.
– *KBS field must be provided when KIR is needed in TR-31 Key Block form (formats 17, 18) for host- storage.
KIS-SEND (EE3031)
Request Length Type Description
*KBS Var h Key Block structure. Optional and present only if KIS is
needed in TR-31 Key Block Form for host- storage.
rc 1 x Return Code
This function generates a random interchange sending key (KIS) and prepares it for transfer to another HSM.
The function signs the generated KIS under a HSM private key (SK HSM s ) and enciphers it under the public key (PKr)
provided by the intended receiver of the KIS. The function also returns the KIS in a key specifier.
Note: The KIS spec Format 15 must contain the attributes specific to AS2805.6.3 2000.
KM-MIGRATE (12)
Request Length Type Description
12 1 h Function Code
i 1 h KM Variant Used
n 1 h Number of Keys
1Key Spec Var K-Spec A key specifier for type of host-stored key used (Formats:
10, 11, 12, 13, 14, 18, 81, 82)
1KBS Var h Key Block structure. Optional.
12 1 h Function Code
rc 1 h Return Code
n 1 h Number of Keys
1Key Spec Var K-Spec A key specifier for key encrypted under Current KM
(Formats: 10, 11, 12, 13, 14, 17, 18, 81, 82)
This function translates keys from encryption under the old Domain Master Key to encryption under the current KM.
This function is enabled/disabled by a console operation.
KBS : Key Block structure. KBS must be present if input key Spec is other than 0x17 and 0x18 and output Key is
expected in Key Spec format 0x17 or 0x18, i.e. Key Protection method chosen for output key is TR-31 ASCII Key Spec
format 0x17, or Binary TR-31 Key Spec format 0x18 on console.
Notes
– The key specifiers 10, 11, 12, 18, 81, 82 under the Response, are generated when using the Legacy option.
– The key specifiers 10, 11, 12, 13, 14 under the Response, are generated based on the chosen operation on
console and FM. See, section Function Modifier Values.
– Keys migration from Variant form to Key block form is allowed only if Enabled from console.
– Variant field value will be matched against correct key usage passed.
– Use the value of KM variant as 00, when key is sent using format 18.
Definitions
KM-STATUS (0006)
This request returns information on the usage of Master key versions.
kv 2 h KM Version.
Values = 00 - 0F
rc 1 x Return Code
kv 2 x KM Version
dd 1 x Day (current)
mm 1 x Month (current)
hh 1 x Hours (current)
mm 1 x Minutes (current)
ss 1 x Seconds (current)
ks 1 x KM status
0 = valid
1 = invalid or not initialized
KTK-KEY-EXPORT (EE2051)
Request Length Type Description
Following fields must be present if Enc Mode is 02 i.e. the Outgoing Key eKIS(K) is in TR-31 format.
Exportability 1 h Any valid value as described in the table Defined values for
exportability byte.
rc 1 h Return Code
This function re-encrypts a host stored encrypted 3DES key under a specified KTK. The function is similar to the
existing Key Export function, but uses a KTK rather than a KIS as the encryption key. The Enc. Mode is the mode of
operation for encrypting the outgoing key. The possible values are:
00 : ECB
01 : CBC
02 : Outgoing key is in TR-31 Key Block format
Keys export from Key block form to variant form is allowed only if enabled from console i.e. check box: Translation of
Keys Migration, import and export is enabled.
When Key Spec is provided in 17 & 18 ,key usage and mode of use must match with the key type.
LOAD-CHARSET (EE0E07)
Request Length Type Description
rc 1 h Return Code
This function retrieves inputs from the user for language characters to support PIN printing in words. The ASCII
characters for the retrieved inputs are stored in a file created in the KMS.
LOAD-PS (EE0E02)
Request Length Type Description
This function is used to copy the data to be printed to Luna EFT, in a postscript template file (20 MB maximum).
Processing Steps
1. Divide the post script template file into a chunk of N bytes.
2. Send the first file with mode 00 and thereafter send files with 01, and 02 modes. Indicate the end of file mode.
3. The function concatenates the data sent in files and creates a postscript template file for future use.
LOAD-PUBLIC-KEY (C6A0)
This function encrypts a public key under the appropriate variant of KM for storage.
rc 1 x Return Code
eKMvAC(PKr) Var K-Spec Public Key encrypted under the appropriate variant of KM.
Format 42
Note:
- PKGP is used in interchange functions; refer NODEKEKSEND-EXPORT and
NODEKEKREC-EXPORT.
- This is a general-purpose function. Where this function is used to encrypt the manufacturer's
Public Key for TCU initialization purposes, this key would be represented as PKMAN.
CAUTION: Care needs to be taken with this function to prevent the introduction of
unauthenticated public keys.
Note: Please note that in all these functions we are denoted as the “Sender” (s) and our partner
as the “Receiver” (r). Our “Send” key becomes the partner’s “Receive” key and vice versa.
Therefore we generate “Send” keys and get the “Receive” key from our partners on the link.
rc 1 x Return Code
eKMVAC(PK-EPP) Var K-Spec Public Key enciphered under the appropriate variant of KM.
Format 42
modulus D6047DC50D774CB00A8572AF2C165EB953FDEF43FE25D3A84E7D58288A0A3652
36D82EA8BEC135E7D89711D4FE357A396AD5C464B65339355696958498E4376D
D7BE489DBDA9DC74F0C7DC1DD5048357BFF1E6E7AFC67DB78C98C4F2A74EF170
E0714BFCC9894614581C697C0624E61493E2BC719FE3145392894F352665FD05
E800E411EC7AC6B00205030EF01BCB92E71F95F95492CF8C39AF6954E5C8B3A0
975BB8872751C94C39BAFAA921851855FA4EFDDCB51E0C05962E236FEB0165B6
84ED6D86FBCDC506E8CD6CEBAA8B53685D3F02B79331589F5C1FA32269DBFC88
C8169F3588E840AD758C1B91FC11A1A418D081F368722ACDB2A937ADE0DF5B61
exponent 0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000010001
modulus 00D6047DC50D774CB00A8572AF2C165EB953FDEF43FE25D3A84E7D58288A0A36
5236D82EA8BEC135E7D89711D4FE357A396AD5C464B65339355696958498E437
6DD7BE489DBDA9DC74F0C7DC1DD5048357BFF1E6E7AFC67DB78C98C4F2A74EF1
70E0714BFCC9894614581C697C0624E61493E2BC719FE3145392894F352665FD
05E800E411EC7AC6B00205030EF01BCB92E71F95F95492CF8C39AF6954E5C8B3
A0975BB8872751C94C39BAFAA921851855FA4EFDDCB51E0C05962E236FEB0165
B684ED6D86FBCDC506E8CD6CEBAA8B53685D3F02B79331589F5C1FA32269DBFC
88C8169F3588E840AD758C1B91FC11A1A418D081F368722ACDB2A937ADE0DF5B
61
exponent 010001
padding 0001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00
Digestinfo 3021300906052B0E03021A05000414
tag
SHA-1 0622B140A0D61AD518388314115350D0A34D3958
hash
M-DPK-GEN (49)
Request Length Type Description
49 1 h Function Code
49 1 h Function Code
rc 1 h Return Code
This function generates a random communications key (DPK) for an IBM 3624 Consumer Transaction Facility.
For transmitting to the 3624, the key is returned encrypted under the Terminal Master Key (KTM) indicated by the
specified index (TKSI) which is stored in the HSM. It is also returned encrypted under KM, for storage within the host.
MAC-GEN-FINAL (EE0701)
Request Length Type Description
Right nibble:
For single length MPK – this nibble must be zero
For double length MPK:
= 0 : ISO 9807 method
= 1 : triple-DES CBC method
rc 1 h Return Code
This function is provided for MAC generation, using the supplied MAC Protect Key (MPK), in accordance with
AS2805.4 1985. The long message support is integrated whereby the OCD from MAC-UPDATE is passed as the ICD.
When the MPK is a HSM stored HMAC-SHA MPK, the HMAC-SHA MAC algorithm will be used for message
authentication depending on the attributes of the MPK.
For HMAC-SHA algorithm, valid range for requested MAC length will depend on the attributes of the HSM-stored MPK.
A format 17 and 18 key specifier (secure key block) containing a host stored HMAC-SHA MPK key may also be used
for HMAC-SHA message authentication. Note that Alg field is not applicable to the function processing if the MPK is an
HMAC-SHA MPK.
HMAC-SHA MPK key length can be 128, 160 or 192 bits.
NOTE:
• When single length key is used with algo 0 it is same as MAC algorithm 1 (ISO 9797).
• When double length key is used with algo 0 it is same as MAC algorithm 3 (ISO 9797).
• When double and triple length keys are used with algo 1 then it is TDES CBC MAC.
MAC-GEN-FINAL-AES (EE0713)
Request Length Type Description
Right nibble:
= 0x02 : CMAC
= 0x03 : AES CBC Mac
rc 1 h Return Code
This function is provided for MAC generation, using the supplied MAC Protect Key (MPK), in accordance with
AS2805.4 1985. The long message support is integrated whereby the OCD from MAC-GEN-UPDATE-AES (EE0712)
is passed as the ICD. AES MPK key length can be 128, 192 or 256 bits.
MAClength Specifies the length of the output MAC. Its value can be between 8-16 bytes
MAC-GEN-UPDATE (EE0700)
Request Length Type Description
Right nibble:
For single length MPK – this nibble must be zero
For double length MPK:
= 0 : ISO 9807 method
= 1 : triple-DES CBC method
rc 1 h Return Code
This function is provided for long message MAC generation and verification, whereby a message authentication Block
(OCD) is generated for the supplied DATA, using the supplied MAC Protect Key (MPK), in accordance with AS2805.4
1985. The long message support is integrated whereby the OCD is passed back to the function as the ICD after each
cycle that the function performs. On the final Block of data the function MAC-GEN-FINAL (EE0701) should be called.
This function is also used during long message MAC verification, whereby the OCD is passed back as the ICD until the
last data Block. To finalize the MAC verification, the function MAC-VER-FINAL (EE0702) should be called.
MAC-GEN-UPDATE-AES (EE0712)
Request Length Type Description
rc 1 h Return Code
This function is provided for long message MAC generation and verification, whereby a message authentication Block
(OCD) is generated for the supplied DATA (whose length is multiple of 16 bytes), using the supplied MAC Protect Key
(MPK), in accordance with AS2805.4 1985. The long message support is integrated whereby the OCD is passed back
to the function as the ICD after each cycle that the function performs. On the final Block of data the function MAC-
GEN-FINAL-AES (EE0713) must be called.
This function is also used during long message MAC verification, whereby the OCD is passed back as the ICD until the
last data Block. To finalize the MAC verification, the function MAC-VER-FINAL-AES (EE0714) must be called.
MAC-VER-FINAL (EE0702)
Request Length Type Description
rc 1 h Return Code
This function verifies that the MAC is valid for the supplied DATA using the supplied MAC Protect Key (MPK), in
accordance with AS2805.4 1985.
When the MPK is a HSM stored HMAC-SHA MPK, the HMAC-SHA MAC algorithm will be used for message
authentication depending on the attributes of the MPK.
For HMAC-SHA algorithm, valid length range for requested MAC verification will depend on the attributes of the HSM-
stored MPK and is given below:
• HMAC-SHA-1 = 04 - 20 bytes
• HMAC-SHA-224 = 04 – 28 bytes
• HMAC-SHA-256 = 04 – 32 bytes
• HMAC-SHA-384 = 04 – 48 bytes
• HMAC-SHA-512 = 04 – 64 bytes
A format 18 key specifier (embedded binary secure key Block) containing a host stored HMAC-SHA MPK key may also
be used for HMAC-SHA message authentication. Note that Alg field is not applicable to the function processing if the
MPK is an HMAC-SHA MPK.
HMAC-SHA MPK key length can be 128, 160 or 192 bits.
MAC-VER-FINAL-AES (EE0714)
Request Length Type Description
rc 1 h Return Code
This function verifies that the MAC is valid for the supplied DATA using the supplied AES MAC Protect Key (MPK), in
accordance with AS2805.4 1985.
AES MPK key length can be 128, 192 or 256 bits. The MAC-VER-FINAL (EE0702) function returns no response data.
An Error Code of 00 indicates successful verification, while 08 indicates a verification failure.
Note: In EE0712, EE0713 and EE0714, only AES keys are allowed hence 52, 53 and 1C
formats must contain AES keys only.
MAM-ACTIVATE (EE040D)
Request Length Type Description
FM 1 h Function Modifier
Session ID 8 h Session ID
rc 1 h Return Code
This function generates an encrypted reply to challenge using the following steps :
1. Derive keys K1 and K2 using the format-20 key specifier.
K1 is a variant of the current DUKPT PIN Encryption Key (Key XOR F0F0 F0F0 F0F0 F0F0 F0F0 F0F0 F0F0
F0F0). K2 is a variant of the current DUKPT PIN Encryption Key (Key XOR 3C3C 3C3C 3C3C 3C3C 3C3C 3C3C
3C3C 3C3C).
2. Decrypt eK1 (Challenge 1) using K1, thereby recovering the 6-byte random number and the rightmost 2 bytes of
KSN.
If KSN2 is not a zero-length field, compare it with the recovered two bytes of KSN. If they are not identical then
abort with error code (0x08 error). Create the reply to the challenge as the concatenation of the 6-byte random
number and the 2-byte Time.
3. Encrypt the reply using K2, to give eK2(Reply).
4. Encrypt the Session ID using K2, to give eK2(Session ID).
MAM-DEACTIVATE (EE040E)
Request Length Type Description
FM 1 h Function Modifier
rc 1 h Return Code
This function generates an encrypted reply to challenge using the following steps :
1. Derive keys K1 and K2 using the format-20 key specifier. (K1 is a variant of the current DUKPT PIN Encryption
Key (Key XOR F0F0 F0F0 F0F0 F0F0 F0F0 F0F0 F0F0 F0F0).) (K2 is a variant of the current DUKPT PIN
Encryption Key (Key XOR 3C3C 3C3C 3C3C 3C3C 3C3C 3C3C 3C3C 3C3C)).
2. Decrypt eK1(Challenge 2) using K1.
3. Create the reply to the challenge as the concatenation of the left seven bytes of Challenge 2 and the 1-byte
Increment Flag.
4. Encrypt the response using K2, to give eK2(Reply).
MD5-GENERATOR (0020)
This function returns the MD5 hash value of the input data, to a maximum length as specified by the supplier. It can be
used to generate a PVC of a public key (see section Verification Codes - DEA 2 keys (PVC)).
Bit Count 8 bin Initially zeroes, then returned value from previous call
rc 1 x Return Code
Note: MD5 is defined for compatibility with heritage applications. For other applications the
use of SHA1 is preferred.
MIGRATE-KM-ENC-PIN (EE0644)
Request Length Type Description
rc 1 h Return Code
This function re-encrypts a KM-encrypted PIN from the old KM to the current KM.
The function will fail with Error Code 78 if PIN block format ISO-3 is disabled.
MIGRATEPIN (EE0601)
Request Length Type Description
rc 1 h Return Code
PVK1-Spec Key specifiers that incorporate an index to an HSM-stored PVK and associated Decimalization
PVK2-Spec Table. The values specified must be as previously set in the controlling console operation,
PAN The ‘validation data’ that is used with the PVK and Decimalization table to produce the Offset.
Offset1 Existing and replacement PIN offset data. The significant digits are left-justified in the field.
Offset2
PINLEN Identifies the number of digits in the PIN, and hence the length of the Derived PIN
For additional details regarding the 3624 PIN verification method, please refer to IBM 3624 PIN Verification.
Note for users of CHKLEN during PIN verification:
If CHKLEN < PINLEN and only CHKLEN digits of the existing PIN offset are available, then these digits need to be
provided, positioned appropriately in the Offset1 field. The significant digits of the new PIN offset will be in the same
position in the Offset2 field.
Function Specific Return code.
02 - Signifies that PVK 1 or PVK 2 has not been initialized for PIN migration via the console.
M-KEY-GEN (3B20)
This function generates a random ATM Master Key and returns it encrypted under KMv42, KMvAA and the ATM A-key.
KL 1 x Key length:
1 = Single
2 = Double
3 = Triple
CM 1 x Cipher mode:
0 = ECB
1 = CBC
rc 1 x Return Code
MT-KPE-GEN (A0)
Request Length Type Description
A0 1 h Function Code
A0 1 h Function Code
rc 1 h Return Code
This function generates a random PIN Encryption Key (KPE). For transmitting to the receiving institution, it is returned
encrypted under the Key Exchange Key (KEK) that is indicated by the specified index (MT-index). It is also returned
encrypted under the appropriate Domain Master Key (KM) variant for storage within the host. The Key Check Value
(KCV) for the generated key is also returned.
MT-Index This field has the range of 1 to 2 and indexes a KEK. The KEK is used to encrypt the KPE
eKEKn(KPE) The random PIN Encryption Key is returned encrypted under the Key Exchange Key indicated by
the specified index
eKMv1(KPE) The random PIN Encryption Key is returned encrypted under variant 1 of the Domain Master Key
for storage within the host
This function is not required by member institutions. For online key exchange, the PIN Encryption Keys (KPE) are
generated and distributed by the MasterCard Switch center. This function is included for testing purposes only.
MT-KPE-RCV (A1)
Request Length Type Description
A1 1 h Function Code
A1 1 h Function Code
rc 1 h Return Code
This function allows a received PIN Encryption Key (KPE) that has been encrypted under the Key Exchange Key
(KEKn) indicated by the supplied Index (MT-Index), to be further encrypted under Domain Master Key (KM) Variant1 for
storage within the host.
The Key Check Value (KCV) for the received key is also returned to allow verification of key synchronization.
MT-Index This field has the range of 1 to 2 and indexes a KEK. The KEK is used to encrypt the KPE.
eKEKn(KPE) The PIN Encryption Key is received encrypted under the Key Exchange Key indicated by the
supplied index.
eKMv1(KPE) The PIN Encryption Key is returned encrypted under variant 1 of the Domain Master Key for
storage within the host.
This function is provided for an acquirer / issuer member using the online key exchange procedure. As the received
KPE is re-encrypted by KM1, it may be used with the standard HSM PIN management functions. In this case, the KPE
is equivalent to the HSM notation of the PPK.
MT-PIN-TRAN (A2)
Request Length Type Description
A2 1 h Function Code
PF 1 h PIN Format
A2 1 h Function Code
rc 1 h Return Code
This function translates a PIN Block from encryption under a host stored PIN Protect Key (PPK) to encryption under a
HSM stored PIN Encryption Key (KPE). If appropriate, the PIN Block format is changed to AS/ANSI format.
PF This field specifies the format of the supplied PIN Block. The valid field values are:
1 = AS/ANSI format (no conversion required)
3 = IBM 3624 format (format conversion required)
eKMv1(PPK) The PIN Protect Key encrypted by a variant 1 of the Domain Master Key.
MT-Index This field has the range of 1 to 2 and indexes a KPE. The KPE is used to re-encrypt the PIN Block.
ANB The 12-digit Account Number Block used in the formation of the clear AS/ANSI PIN Block.
eKPE(AS-PIN) The AS/ANSI formatted PIN Block containing the PIN to be verified is supplied encrypted by an
HSM stored PIN Encryption Key.
This function is provided for use by an acquirer employing manual key management.
The function will fail with Error Code 78 if PF indicates a PIN block format that is disabled or conflicts with the
reformatting restrictions.
MT-PIN-VER (A3)
Request Length Type Description
A3 1 h Function Code
A3 1 h Function Code
rc 1 h Return Code
This function performs the verification of a PIN in an AS/ANSI formatted PIN Block, using the IBM 3624 method.
PVK-Index This field has the range of 01 to 99 and indexes the PIN Verification Key (PVKn) and the
Decimalization Table (DTn) to be used in the PIN calculation process.
eKPE(AS-PIN) The AS/ANSI formatted PIN Block containing the PIN to be verified is supplied encrypted by an
HSM stored PIN Encryption Key.
PAN The Primary Account Number (or other card data) used in the verification procedure.
ANB The 12-digit Account Number Block used in the formation of the clear AS/ANSI PIN Block.
Offset Up to 12 digits of offset data. The significant digits must be left-justified padded with zeros.
No response data is returned by this function, and it is only provided for use by an issuer employing manual key
management. An Error Code of 00 indicates successful verification, while 08 indicates a verification failure.
The function will fail with Error Code 78 if the ANSI PIN block format is disabled.
MT-PIN-VER-PVV (A7)
Request Length Type Description
A7 1 h Function Code
A7 1 h Function Code
rc 1 h Return Code
This function performs the verification of a PIN in an AS/ANSI formatted PIN Block, using the PVV method.
The PVVK-index has a range of 1 to 36. The PVKI has a range of 1 to 6.
PVVK-Index Identifies the PVK-A/B pair that is to be used in the derivation of the PVV and must be in BCD
format.
eKPE(AS-PIN) The AS/ANSI formatted PIN Block containing the PIN to be verified is supplied encrypted by an
HSM stored PIN Encryption Key as specified by the MT-index.
ANB The 12-digit Account Number Block used in the formation of the clear AS/ANSI PIN Block.
TSP12 The leftmost 12 digits of the TSP and consists of 11 PAN digits followed by the appropriate one
digit PVKI.
PVV The PIN Verification Value used to verify the calculated PVV.
The function returns no response data. A Return Code of 00 indicates that the PIN is verified. A 07 indicates that the
format of the PIN Block in the request is incorrect, and a 08 indicates PIN verification failure.
The function will fail with Error Code 78 if the ANSI PIN block format is disabled.
NI-KEY-GEN (EE0404)
Request Length Type Description
Following fields must be present if 13th and 12th bit of Key Flags field is set to 10 i.e. response 1eKSn(KSn+1) needed
in TR-31 format.
1Following fields must be repeated n times for each set of keys starting from the least bit (right most) of Key Flags
field.
Mode of use 1 h Any Valid values as described in the table Key Block
Header Fields for Key Block Format Keys
Exportability 1 h Any valid value as described in the table Defined values for
exportability byte
Y = 0 (Don’t pad)
Y = 3 (Pad to triple length)
rc 1 h Return Code
1This set of fields will occur ‘n’ times. Value of n can be at max 3.
Notes
– The key specifiers 10, 11 under the Response, are generated when using the Legacy option.
– The key specifiers 10, 11, 13 under the Response, are generated based on the chosen operation on console
and FM. See, section Function Modifier Values.
*KBS field must be provided when key is needed in 17 or 18 format. This field should repeat for each new key to be
generated.
When only host stored keys are needed in TR-31, KBS should be formed as:
Optional field 0 … n Var h Number of optional field as defined in above filed. First byte
of optional field will be treated as Optional Block ID.
When both Session key encrypted key and key spec is need in TR-31 then KBS should be provided is mentioned
below:
Algorithms 1 h = 00
Algorithm will be determined from request TR-31 key block
Mode of use 1 h = 00
Mode of usage will be determined from request TR-31 key
block
Key Version No. 2 h = 00 Key Version Number will be determined from TR31-key
block
This function generates a set of new random DES or 3DES Session Keys (KSn+1-Spec) for an Interchange. For
transmitting to the receiving node, the generated keys are returned encrypted under the supplied previous Session Key
(KSn). For double-length keys, either ECB or CBC encryption modes may be selected.
The generated keys are also returned encrypted under the appropriate variant of the Domain Master Key (*KM), for
storage within the host system. This function also returns the KVCs of the session keys.
The function response will contain one or more sets of encrypted key fields as shown: one set for each appropriate bit
set in the 'Key Flags' field. That field also indicates the encryption mode for any double-length keys that are generated.
FM = x0
The Host Key Protection using Function Modifier can be in the range of x0, where x= 0, 1, or 2.
Key Flags Indicates the keys to generate and the encryption mode. The bit positions are allocated as follows:
Bit Indicates
KSn-Spec A key specifier incorporating a session key encrypted by a variant of the Domain master key
eKSn(KSn+1) The new session key encrypted by the supplied session key
Notes
– The encryption mode for eKSn(KSn+1) and KSn spec is ECB unless otherwise specified.
– This function supercedes functions 57, 58, 59.
– Bit 3, Bit 7, Bit 11 and Bits 13-15 of the key flags are reserved.
– Single length KSn is not supported if generated Key requested in TR-31 Key Block. i.e.
Format 10 is not supported for 1KSn Spec.
NI-KEY-RCV (EE0405)
Request Length Type Description
rc 1 h Return Code
Notes
– The key specifiers 10, 11 under the Response, are generated when using the Legacy option.
– The key specifiers 10, 11, 13 under the Response, are generated based on the chosen operation on console
and FM.
*KBS field must be provided when key is needed in 17 or 18 formats. This field will repeat for each key received.
When incoming key is not in TR-31, KBS should be formed as:
Optional field 0 … n Var h Number of optional field as defined in above filed. First byte of
optional field will be treated as Optional Block ID.
Algorithms 1 h = 00
Algorithm will be determined from request TR-31 key block
Mode of use 1 h = 00
Mode of usage will be determined from request TR-31 key block
Key Version No. 2 h =00 Key Version Number will be determined from TR31-key block
This function allows a Session Key rollover for the interchange. It re-encrypts a received set of encrypted DES or 3DES
keys for host storage. The key set may include any of the session keys, PPK, MPK and DPK.
The node receives a set of new Session Keys (KSn+1) encrypted under the current one (KSn) and sends them together
with the current Session Key encrypted under the appropriate *KM Variant to the HSM. For double-length keys, either
ECB or CBC encryption modes are supported.
The HSM returns the new Session Keys encrypted under the appropriate *KM Variant, for storage within the host. This
function also returns the KVCs of the session keys.
FM = x0
The Host Key Protection using Function Modifier can be in the range of x0, where x = 0, 1, or 2.
Key Flags Indicates the keys to generate and the encryption mode. The bit positions are allocated as follows:
Bit Indicates
Notes
– The encryption mode for eKSn(KSn+1) and KSn spec is ECB unless otherwise specified.
– This function supercedes functions 5A, 5B, 5C.
– Bit 3, Bit 7, Bit 11 and Bits 14-15 of the key flags are reserved.
– Single length KSn is not supported if incoming Key in TR-31 Key Block. I.e. Format 10 is not supported for
1KSn Spec.
– If input key is in TR-31 Key Block format Key Usage of 1eKIRn(KS) must be matched for Key Type for each
set of keys starting from the least bit (right most) of Key Flags field.
NODE-KEK-REC-EXPORT (C710)
This function recovers a Cross Domain Receive Key (KEKr) which has been transferred from another Luna EFT.
eKMvA0(SKsGP) Var K-Spec Encrypted receiver’s secret key (format 42) – our SK
eKMvAC(PKrGP) Var K-Spec Encrypted sender’s public key (format 42) – partner’s PK
sSKrGP(hash(key data)) Var S-Block Hash of key data signed with SKrGP – partner’s PK
cPKsGP(key data) Var S-Block Key data encrypted with PKSGP – our PK
rc 1 x Return Code
The recovered key is used and denoted as a Cross Domain Receive Key (KEKr). The function recovers KEKr by
decrypting the key data with the secret key (SKsGP), and authenticates the KEKr by verifying the hash data under the
public key (PKrGP) provided by the sender.
The function returns KEKr encrypted under the Domain Master Key and the KVC of the KEKr.
This host function is used for Australian Major Bank (AMB).
NODEPROOF (EE3033)
Request Length Type Description
rc 1 x Return Code
This function generates the random number to be forwarded to the remote node as part of the internodal proof-of-
endpoint processing.
The Random Number (RNs) is inverted to form RNr. RNs and RNr are returned to the host enciphered by the KIS.
Notes
– The Random Number is not adjusted for parity
– The length of the response random numbers can be determined from the Var field header.
– The encryption mode is CBC with an IV of zero.
– When Format 15 is used for the KIS-Spec, it must contain the attributes specific to AS2805.6.3 2000.
– When formats 00 – 03 are used for the KIS-Spec, the HSM stored KIS must be a double length key with the
variant scheme AS2805 1985 selected.
NODERESP (EE3034)
Request Length Type Description
rc 1 x Return Code
This function performs the response part of the internodal proof-of endpoint processing.
The function deciphers a number (RNs) using the KIR in the request. RNr is formed by inverting RNs and is returned
enciphered under KIR.
Notes
– Encryption mode is CBC for B128 length.
– The length of the response random numbers can be determined from the Var field header.
– When Format 15 is used for the KIR-Spec, it must contain the attributes specific to AS2805.6.3 2000.
– When formats 00 – 03 are used for the KIR-Spec, the HSM stored KIR must be a double length key with the
variant scheme AS2805 selected.
NT-KEY-GEN (EE0401)
Request Length Type Description
Following fields must be present if 13th and 12th bit of Key Flags field is set to 10, i.e. response 1eKSn(KSn+1)is
needed in TR-31 format.
1Following fields must be repeated n times for each set of keys starting from the least bit (right most) of Key Flags
field.
Mode of use 1 h Any Valid values as described in the table Key Block
Header Fields for Key Block Format Keys.
Exportability 1 h Any valid value as described in the table Defined values for
exportability byte.
Y = 0 (Don’t pad)
Y = 3 (Pad to triple length)
*KBS Var h
rc 1 h Return Code
1This set of fields will occur ‘n’ times. Value of n can be at max 3.
This function generates a set of new random Session Keys (KSn+1) for an EFT Terminal.
For transmitting to the EFT Terminal, the keys are returned encrypted under the supplied previous Session Keys (KSn).
They are also returned encrypted under the appropriate KM variant, for storage within the host system. The function
also returns the KVCs of the Session Keys.
*KBS field must be provided when key is needed in 17 or 18 format. This field will repeat for each key to be generated.
When both KTM encrypted key and key spec is need in TR-31 then KBS should be provided is mentioned below:
Algorithms 1 h = 00
Algorithm will be determined from request TR-31 key block
Mode of use 1 h = 00
Mode of usage will be determined from request TR-31 key block
Key Version No. 2 h =00 Key Version Number will be determined from TR31-key
block
When only host stored keys are needed in TR-31, KBS should be formed as :
Optional field 0 … n Var h Number of optional field as defined in above filed. First byte of
optional field will be treated as Optional Block ID.
Notes
– The key specifiers 10, 11 under the Response, are generated when using the Legacy option.
– The key specifiers 10, 11, 13 under the Response, are generated based on the chosen operation on console
and FM. See section, Function Modifier Values.
FM The Host Key Protection using Function Modifier can be in the range of x0, where x= 0, 1, or 2.
Key Flags Indicates the session keys to generate. The function response will contain one or more sets of
encrypted key fields as shown: one set for each bit set in the flags. The bit positions are allocated
as follows:
KS Spec A key specifier incorporating a session key, encrypted by a variant of the Domain master key
eKSn(KSn+1) The new session key encrypted by the supplied session key
Notes
– For key specifier formats, refer to the section "Key specifier formats for HSM-stored keys" earlier in this
chapter.
– The encryption mode for eKSn(KSn+1) and KSn spec is ECB unless otherwise specified.
– This function supercedes functions 44, 45, 46
– Key flag bits 3, 7, 11 and 14-15 are reserved.
– Single length 1KSn is not supported if generated Key requested in TR-31 Key Block. I.e. Format 10 is not
supported for 1KSn Spec.
– Allowed algorithms for Key Usage ‘M1’ will be ‘D’.
OAEP-ENCRYPT (EE9205)
Request Length Type Description
FM 1 h Function Modifier
KTM-Spec Var K-Spec Key Specifier for Terminal Master Key (KTM)
(Formats: 11, 12, 13, 14, 17, 18)
PK Var K-Spec Key Specifier for Public Key (Format 80, 81)
[Format: 81: Key Type – Data Protect]
rc 1 h Return Code
This function encrypts KTM using RSA-OAEP encryption detailed in PKCS#1v2.1, using the following steps:
1. Extract KTM from KTM-Spec.
2. Add 4 byte Miura key header to the KTM wherein, first 2 bytes is Key Type and second 2 bytes is Key length in bits.
3. New KTM = Key Type (2 bytes) + Key Length in bits (2 bytes) + KTM.
4. Fetch the Public Key’s modulus and exponent from PK.
5. Encrypt the New KTM with PK using specified encryption scheme (OAEP).
6. Return the encrypted KTM in response.
To enable PKCS#1 parameter string P, to specify the hash algorithm used in OAEP encoding, P can be in one of the
following formats:
– Variable length string without any formatting
– Variable length string in following format
Header 2 h = X’5A5A’
Format 1 h =1
Trailer 2 h = X’A5A5’
If the Header and Trailer fields do not match then P is treated as an unstructured variable length string encoded using
SHA-1 and MGF1 SHA1. If they do match but any other fields are not as specified, then an appropriate error code is
returned.
Notes
• P can be either empty or a string of 32 hex digits (16 bytes)
• “Key Type” allowed values is 00
• The following error code is introduced:
Error Description
Code
0x84 OAEP Message Too Long (As in Reference [82]: If mLen > k – 2hLen – 2, output “message too long” and
stop). Where;
• mLen is "length of KTM to be encrypted",
• k is "length of PK modulus",
• and hLen is "length of OAEP Hash".
OBM-CHANGE-PIN-3264 (EE3003)
Request Length Type Description
PVK-Spec1 Var K-Spec Key specifier for PVK and Decimalization Table (Formats:
0–3, 11, 12, 13, 14, 17, 18)
PVK-Spec2 Var K-Spec Key specifier for PVK and Decimalization Table (Formats:
0–3, 11, 12, 13, 14)
rc 1 h Return Code
This function extracts the old PIN and new PIN from a RSA-encrypted PIN Block, verifies the old PIN and calculates a
PIN offset for the new PIN.
Notes
– This function only supports PINs in PIN Format 12
– This function only supports messages containing two PIN Block.
Processing Steps
1. Decrypt and decode the RSA-encrypted PIN Block using EPB PU to recover the PIN Block, M. If the resulting
Error Code is non-zero then end function processing and return appropriate value in Return Code.
2. Calculate the reference PIN, using the PVK and Decimalization Table indicated by PVK-Spec1, Validation Data1
and Offset1.
3. Compare the reference PIN with the transaction old PIN (from PB1 in the recovered PIN Block, M). Store the result
of the comparison in Return Code.
4. If the PIN verification succeeds, calculate the PIN offset for the transaction new PIN (from PB2 in the recovered
PIN Block, M) using PVK-Spec2 and Validation Data2.
5. Return the PIN offset in Offset2.
OBM-CHANGE-PIN-HASH (EE3006)
Request Length Type Description
CTPV 1 Struct PU Calculate TPV (Formats: 0–3, 10, 11, 13, 17, 18)
CTPV 2 Struct PU Calculate TPV (Formats: 0–3, 10, 11, 13, 17, 18)
rc 1 h Return Code
This function extracts the old password and new password from a RSA-encrypted password Block, verifies the old
password and calculates a TPV for the new password.
OBM-DECRYPT-DATA-RSA (EE3022)
Request Length Type Description
FM 1 h Function Modifier
rc 1 h Return Code
This function recovers the user data from the cipher text.
Processing Steps
1. Retrieve the index from the key specifier: SK. Read the RSA private key (SK) from the entry in the RSA Key Pair
table indicated by the index.
2. Decrypt the RSA-encrypted Data, C, using SK.
3. Decode the resulting decrypted Data, in accordance with PKCS #1 and using parameter string P, and thereby
recovering the message M.
4. Check that the first header byte of message M is equal to 3. If first header byte is not equal to 3, then send an error
OAEP_INVALID_HEADER_BYTE (Error code: 81) in response.
5. Extract the Data field from M and return it in response field Data.
OBM-DECRYPT-DATA-SYMMETRIC (EE3023)
Request Length Type Description
FM 1 h Function Modifier
rc 1 h Return Code
Alg 1 h = 1: 3DES
Mode 1 h = 1: ECB
= 2: CBC
This function processes an RSA-encrypted key block, recovering the parameters of the symmetric algorithm from the
ciphertext. It uses those parameters to decrypt the supplied encrypted data.
The parameters of the symmetric algorithm are returned in the response so that a check can be made that an
appropriate encryption method was used. (The key length is provided, not the key value.)
The symmetric key (K) will be used to derive K1 (which encrypted the data) and a second key K2.
This key (K2) is returned in a form that enables its use with an appropriate data encryption host function, so that
encrypted data can be sent back to the browser.
Processing Steps
1. Retrieve the index from the key specifier: SK. Read the RSA private key (SK) from the entry in the RSA Key Pair
table indicated by the index.
Control 1 H =4
Alg 1 H = 1: 3DES
Mode 1 H = 1: ECB
= 2: CBC
OBM-GENERATE-RANDOM-PIN (EE3017)
Request Length Type Description
CTPV Struct CTPV Calculate TPV (Formats: 0–3, 10, 11, 13, 17, 18)
Processing
Unit
Print Token 8 h Print Token of the Remote HSM which will be printing out
this generated PIN
rc 1 h Return Code
OBM-GENERATE-RANDOM-PIN-2 (EE3021)
Request Length Type Description
Restricted Characters Var h String of the characters that will be restricted in the PIN
to be generated.
Print Token 8 h Print Token of the Remote HSM which will be printing out
this generated PIN
rc 1 h Return Code
The Random PIN Generation adheres to the password restrictions as described in the section Online Banking Module
Password Restrictions.
Notes
– The function returns an error code 9F for any failure in PIN generation.
– The function returns error 0x07 (INVALID PIN BLOCK CONTENT), if the PIN Type is 1, 2 or 3 and the sum of
minimum numeric and alphabetic characters in the Password Restrictions Entry dialog on the Luna EFT
console exceeds the maximum PIN/Password length.
OBM-GEN-RANDOM-NUMBER (EE3001)
Request Length Type Description
rc 1 h Return Code
This function generates and returns a random number of the specified length.
OBM-GET-PRINT-TOKEN (EE3016)
Request Length Type Description
rc 1 h Return Code
This function generates 8 bytes of random data, also known as a Print Token and
• stores the Print Token in Secure Memory, overwriting any prior Print Token
• returns the 8 byte Print Token in the clear to the host
OBM-GET-PUBLIC-KEY (EE3000)
Request Length Type Description
rc 1 h Return Code
This function retrieves a Public Key from the HSM stored RSA Key Pair table in secure memory and returns it in a clear
form in a key specifier along with the PVC for the key.
OBM-MIGRATE-PIN-3624-TPV (EE3009)
Request Length Type Description
PVK-Spec Var K-Spec Key specifier for PVK and Decimalization Table. (Format 0–
3, 11, 12, 13, 14, 17, 18)
Validation Data 8 h Data (usually the PAN) used to derive the password.
CTPV Struct PU Calculate TPV (Formats: 0–3, 10, 11, 13, 17, 18)
rc 1 h Return Code
This function calculates the reference password from the keys and data of the 3624 Offset method, then calculates a
Reference TPV for storage and subsequent use in password verification.
OBM-PRINT-ENCRYPTED-PIN (EE3018)
Request Length Type Description
Data Sets 1 h A data set contains a Line No field, Column No field and
Data field. The data sets field specifies the number of data
sets that follow.
Line No1 1 h The line number for the data to be printed at.
Column No1 1 h The column number for the data to be printed at.
rc 1 h Return Code
1This set of fields repeats 0 or more times as specified by the Data Sets field.
This function decrypts an encrypted OBM Print PIN Block, verifies the Print Token and prints the PIN along with the
specified data on an attached serial printer. The function is normally disabled, and is controlled by the associated set of
console operations. Enabling PIN Printing enables this function.
Before using this function print parameters and a print control string must be entered from the main PIN mailer menu. If
print parameters or a print control string have not been entered a PIN mailing not enabled error (error code 02) will be
returned to the host.
Processing Steps
1. Check that the Print Token in Secure Memory is valid (i.e. not equal to 0x0000000000000000), otherwise return
error code Invalid Print Token (0x7F).
2. Decrypt the Encrypted OBM Print PIN block with the PPK specified.
3. Extract the Print Token (1st 8 bytes) from the OBM Print PIN Block.
4. Verify the extracted Print Token with the Print Token stored in Secured Memory. If both Print Tokens are not the
same, return error code Invalid Print Token (0x7F).
OBM-PRINT-PIN (EE3008)
Request Length Type Description
CTPV Struct CTPV Calculate TPV (Formats: 0–3, 10, 11, 13, 17, 18)
Processing
Unit
Data Var h The set of fields is optional and may be repeated multiple
times, as specified by the Data sets field, causing 0, 1 or
more data fields to be printed.
rc 1 h Return Code
This function generates a random (numeric or alpha-numeric) password, prints the password along with specified data
on an attached serial printer, and returns a reference TPV for storage and subsequent verification of the password.
The function is normally disabled, and is controlled by the associated set of console operations.
Notes
– Before using this function print parameters and a print control string must be entered via the SafeNet HSM
console. If print parameters or a print control string have not been entered a PIN mailing not enabled error (error
code 02) will be returned to the host.
– The function returns error 0x07 (INVALID PIN BLOCK CONTENT), if the Password Type is 1, 2 or 3 and the
sum of minimum numeric and alphabetic characters in the Password Restrictions Entry dialog on the Luna
EFT console exceeds the maximum Password length.
OBM-SET-PIN (EE3004)
Request Length Type Description
CTPV Struct PU Calculate TPV (Formats: 0–3, 10, 11, 13, 17, 18)
rc 1 h Return Code
This function extracts the (numeric or alpha-numeric) password from a RSA-encrypted password Block and calculates
a Reference TPV for storage and subsequent use in password verification.
OBM-SET-PIN-TPV (EE3020)
Request Length Type Description
CTPV Struct PU Calculate TPV (Formats: 0–3, 10, 11, 13, 17, 18)
rc 1 h Return Code
This function extracts the numeric PIN from a PPK-encrypted PIN Block and calculates a reference TPV for storage
and subsequent use in PIN verification.
Notes
– This function only works for numeric PINs which are of length 04 to 12.
– This function has a potential for a brute force attack on a known reference TPV, so it has to be configurable at
the HSM console's function control menu whether this function is enabled or disabled.
– The function will fail with Error Code 78 if PFo indicates a PIN block format that is disabled or conflicts with the
reformatting restrictions.
OBM-TRANSLATE-PIN (EE3019)
Request Length Type Description
rc 1 h Return Code
This function decrypts an OBM RSA-encrypted, format 12 PIN Block, changes the PIN Block format to that specified
by the output PIN Block format and returns it encrypted by the specified PPK.
Notes
– This function only works for numeric PINs which are of length 04 to 12.
– This function has a potential to export a user PIN, so it has to be configurable at the HSM console's function
control menu whether this function is enabled or disabled.
– The function will fail with Error Code 78 if PFo indicates a PIN block format that is disabled or conflicts with the
reformatting restrictions.
OBM-VERIFY-PIN-3624 (EE3002)
Request Length Type Description
PVK-Spec Var K-Spec Key specifier for PVK and Decimalization Table (Formats:
0–3, 11, 12, 13, 14, 17, 18)
rc 1 h Return Code
This function extracts the PIN from a RSA-encrypted PIN Block and verifies the PIN using the 3624 Offset method.
Notes
– This function only supports PINs in PIN Format 12
– This function only supports messages containing one PIN Block.
Processing Steps
1. Decrypt and decode the RSA-encrypted PIN Block using EPB PU to recover the PIN Block, M. If the resulting
Error Code is non-zero then end function processing and return appropriate value in Return Code.
2. Calculate the reference PIN, using the PVK and Decimalization Table indicated by PVK-Spec, Validation Data and
Offset.
3. Compare the reference PIN with the transaction PIN (from recovered PIN Block, M). Return the result of the
comparison in Return Code.
OBM-VERIFY-PIN-HASH (EE3005)
Request Length Type Description
CTPV Struct PU Calculate TPV (Formats: 0–3, 10, 11, 13, 17, 18)
rc 1 h Return Code
This function extracts the (numeric or alpha-numeric) password from a RSA-encrypted password Block, and verifies
the password by using the extracted password to calculate a transaction TPV and comparing the result with the
Reference TPV.
PAN-KEY-EXCH (EE4006)
Request Length Type Description
FM 1 h Function Modifier
STAN 6 h
Terminal ID 8 h
Issuer ID 4 h
rc 1 h Return Code
This function performs the processing described in section 2.2 of [72], and as listed below.
– Verify terminal cryptogram according to appendix C.1 of [72].
– Create session keys according to chapter 4.4.3 of [72].
– Create cryptogram with terminal initial key according to appendix C.2 of [72].
Processing Steps
1. Recover KE and KF.
2. Calculate SENC and SMAC as specified in 4.4.3 of [73].
3. Decrypt the terminal cryptogram using SENC. (CBC with IV = 0. Include the (encrypted) MAC field in the decryption
process.)
4. Check the STAN and Terminal ID fields against those fields in the request message.
5. Calculate a MAC using SMAC and the first 32 bytes of the plaintext, and check the result with the MAC field in the
plaintext.
PIN-FROM-OFF (EE0609)
Request Length Type Description
PVK Var K-Spec Key specifier for PVK/DT used in the regeneration of the
reference PIN.
(Formats: 0–3, 11, 12, 13, 14, 17, 18)
rc 1 h Return Code
This function calculates a PIN from a supplied IBM 3624 Offset and returns the PIN encrypted using the supplied PPK
from the request. The PIN is returned in encrypted form, using the PIN format specified in the request (PFo). The PIN
Block format for output is represented in the request using PFo and can be any of the PIN Block formats indicated
below.
PVK PVK-Spec may be key specifier formats: HSM-stored (0-3) and Host-stored 11, 12, 13, 14, 17 and
18. When the key specifier format is Host-stored 11, 12, 13, 14, 17 and 18, then PVK is encrypted
with KMv7. PVK key specifier represents the PVK and associated Decimalization Table and is
used with the IBM offset supplied in the request to regenerate the PIN.
Validation data Validation Data, which is usually a part of the Primary Account Number (PAN), and is used in the
calculation of the reference PIN.
Offset Offset, consists of up to 12 nibbles of offset data. The significant nibbles must be left-justified in
the field. For example, if the offset to be used is 0x1234, this should be formatted as
0x123400000000 in this field. Unused nibbles are ignored.
PIN Length PIN Length, identifies the number of digits in the PIN, and hence the length of the PIN.
PPK PPK-Spec may be key specifier formats: HSM-stored (0-3) and Host-stored 11, 12 , 13, 14, 17 and
18. When the key specifier format is Host-stored 11, 12, 13, 14, 17 or 18, then PPK is encrypted
with KMv1.The function supports HSM-stored single-length, double-length and triple length
DES/TDES keys, host-stored double-length and triple-length DES/TDES keys
ANB Account Number Block, which is the right-most 12 digits of the Primary Account Number (PAN),
excluding the check digit.
The function will fail with Error Code 78 if PFo indicates a PIN block format that is disabled.
Notes
– Calculation of an IBM offset is unrelated to PIN Block formats.
– A Derived PIN may also be generated by this method if an Offset of all zeros is used.
PIN-GENERATE (EE0E04)
Request Length Type Description
rc 1 h Return Code
This function generates a random PIN, formats and encrypts it for host storage.
Processing Steps
1. Generate a random PIN of the specified length.
2. Format the PIN into an ISO Format 0 or 3 PIN Block.
3. Encrypt the PIN Block using the PPK.
The function will fail with Error Code 78 if PF indicates a PIN block format that is disabled.
PIN-GENERATION (EF0616)
Request Length Type Description
DT 8 d Decimalization Table
PPK-Spec Var K-Spec Key specifier for PPK (Formats: 0–3, 10, 11, 12, 13, 14, 17,
18)
rc 1 h Return Code
This function generates Italian 5 digit PIN according to IBM 3624 method (for derived PINs).
The function will fail with Error Code 78 if PF indicates a PIN block format that is disabled except for format 00 which is
always enabled for this function.
Note: For PVK in format 17, or 18 – the key in the key block is single length PVK followed by 8
bytes of DT and the external DT field is all 0s.
PIN-MAIL (E2)
Request Length Type Description
E2 1 h Function Code
E2 1 h Function Code
rc 1 h Return Code
This function generates a PIN that has a length equal to PIN Len. If a random PIN is generated an Offset associated
with this PIN is returned with the HSM response.
PVK-Index This field identifies the PVKn and DTn to be used in the PIN calculation process. This index should
equal the institution index used in the access of the PIN Mailer console operations.
PAN This is the Primary Account Number used in the generation of the PIN. It must be padded
appropriately prior to input to this function.
PIN Len This field specifies the number of PIN digits to be printed. It must be in the range 4 to 12 and be less
than or equal to the number of PIN digits entered on the PIN Mailer Print Parameters screen.
PIN Type This field is an indicator for the type of PIN that is to be printed. The valid values are:
0: Use the derived PIN as the customer PIN and do not return an Offset in the response data; or
non-0: Use a randomly generated number as the PIN and return an Offset which equals the randomly
generated PIN minus the derived PIN.
Line No This is the number of the line on which Data is to be printed. It must be in the range 1 to 40.
Column No This is the number of the column from which Data is to be printed. It must be in the range 1 to 120.
Data Len This refers to the length of the Data. The maximum length of the data depends on the Ignore Optional
data length check check box on the print parameter screen. If the check box is not selected, the
length is greater than zero and must not extend beyond the end of an envelope line. If the check box is
selected, then the data length check is ignored.
Offset This field consists of 12 digits of offset data. The significant digits are left-justified in the field.
ESMID Part of the PTK-EFT function call. The ESMID is a pointer to a NULL terminated string that identifies
the name of the SafeNet HSM (ESM) to which functions are directed. The SafeNet HSM name is set
using the wincommsconfig utility provided as part of the PTK-EFT product suite.
PIN-MAIL-2 (EE0E06)
Request Length Type Description
PVK Var K-Spec PVK (Formats: 0–3, 11, 12, 13, 14)
rc 1 h Return Code
This function is enhanced version of host-function E2. Functionality of function will be same as host function E2 with
FM value 00.
Notes
– *=Fields only present if FM=01.
– If FM =00, PIN and PAN line number and column number must be set to 0. PIN and PAN line number and
column number values will be taken from console.
– If FM =01, PIN line number and column number must be present.
– PAN line number and column number values must be present if Print 16-digit PAN setting is enabled on
console. If Print 16-digit PAN setting is disabled PAN line number and column number field value must be 0.
– The function will use PIN and PAN line number and column number values provided with the host function and
values entered on console will be ignored.
PVK This field identifies the PVK and DT to be used in the PIN calculation process. If HSM-stored PVK key
is used, PVK index should equal the institution index used in the access of the PIN Mailer console
operations. Supported K-Spec formats are: 0-3, 11,12,13,14.
PIN-OFF (EE0604)
Request Length Type Description
rc 1 h Return Code
This function calculates an IBM 3624 Offset for a PIN and also provides the length of the PIN. The PIN is supplied in
encrypted form, using any of the PIN Block formats specified under IBM 3624 PIN Verification Methods. See, IBM
3624 PIN Verification.
PPK-Spec May be any valid key specifier for a PPK. Consequently, the function supports an encrypted PIN
Block encrypted using a single-length or double-length or triple –length HSM-stored or host-stored
key.
PF Supports PIN Formats: 01, 03, 08, 09, 10, 11, and 13.
ANB Account Number Block, which is the right most 12 digits of the Primary Account Number (PAN),
excluding the check digit.
Validation Data Data, which is usually a part of the PAN, and is used in the calculation of the reference PIN.
The function will fail with Error Code 78 if PF indicates a PIN block format that is disabled.
The function performs a check that the ANB field and the Validation field contain a number of consecutive digits in
common. The number of digits to check is in the range 0 to 12, as may be specified using a console operation, and
defaults to 8. If the number of digits to check has been set to 0 the check is disabled, and in this case the function will
accept any supported PIN block format that is enabled. If the number of digits to check is greater than 0, then only ISO-
0 and ISO-3 PIN blocks are allowed, if enabled. If the check fails, the function will fail with Return Code 79.
Note: This function includes all the capabilities of the following existing functions, and
therefore supercedes the following:
PIN-OFF-AS (6A), PIN-OFF-PP (6B)
PIN-PRINT (EE0E05)
Request Length Type Description
rc 1 h Return Code
This function prints a previously generated PIN. It is normally disabled and is controlled by the PIN Mailer console
operations.
Notes
– *= Fields only present if FM=01.
– If FM=01, PIN line number and column number must be present.
– PAN line number and column number values must be present if Print 16-digit PAN setting is enabled on
console.
– If Print 16-digit PAN setting is disabled PAN line number and column number field value must be 0.
– The function will use PIN and PAN line number and column number values provided with the host function and
values entered on console will be ignored.
ESMID Part of the PTK-EFT function call. The ESMID is a pointer to a NULL terminated string that identifies
the name of the SafeNet HSM (ESM) to which functions are directed. The SafeNet HSM name is set
using the wincommsconfig utility provided as part of the PTK-EFT product suite.
Processing Steps
1. Decrypt the supplied encrypted PIN Block using PPK.
2. Extract the PIN from the ISO PIN Block.
3. Build a print image using the PIN, PAN and optional data.
The function will fail with Error Code 78 if PF indicates a PIN block format that is disabled.
PIN-TRAN-2 (EE0602)
This function performs translation of both the PIN Block format and the PIN encryption key.
FM =00
Request Length Type Description
rc 1 h Return Code
PFi Specifies the format of the input PIN Block format and supports PIN formats, 01, 02, 03, 08,
09, 10, 11, and 13 specified under PIN Block Formats.
ANB Account Number Block, which is the rightmost 12 digits of the Primary Account Number
(PAN), excluding the check digit.
PFo Specifies the output PIN Block format and supports PIN formats: 01, 02, 03, 08, 09, 10, 11,
12, and 13 specified under PIN Block Formats. The following restriction applies:
formats 02, 08 (Docutel) and 11 (ISO Format 1) are valid only in the case that PFo = PFi – i.e.
that the clear text PIN Block format is not changed. If PIN format translation is not required,
PFo must be set to the same value as PFi.
Specific restrictions on reformatting are specified under Function Construction.
PPKo and PPKi The key specifiers, PPKi-Spec and PPKo-Spec, may be any valid key specifier for a PPK.
Consequently, the function supports all combinations of single-length , double-length and
triple length, HSM-stored and host-stored keys. For example, the input key could be a single-
length, host-stored key and the output key could be a double-length, HSM stored key.
ePPKo (PIN+PIN Variable length field of either 8 or 16 bytes dependent upon length of PIN Data supplied.
Data)
PIN Data Data to incorporate with PIN in encrypted result. The data Block would typically incorporate
the PIN Try Counter and PIN Try Limit, as specified in reference of Mark II, but no checks
are applied to the data content. The field can contain 0 or 8 bytes. If the length is 0, this
function performs identically to the PIN_TRANSLATE function. If the length is 8, the data
Block is concatenated to the right of the (re-)formatted, plaintext PIN Block and the resulting
16-byte character sequence is CBC-encrypted using the PPKo.
The function will fail with Error Code 78 if PFi or PFo indicates a PIN block format that is disabled or conflicts with the
reformatting restrictions.
Note: This function includes all the capabilities of the following existing functions, and
therefore supercedes the following:
PIN- TRAN (60), D51-PIN-TRAN (65), PIN-TRAN-1 (94), PIN-TRAN-2 (95).
FM = 01
Provides support for Visa Data Secure Platform (VDSP) P2PE.
Algorithm 1 h 01=TDES(Generic)
Padding Method 1 h XY
X = 0 : pad with all zeroes to make last block multiple of
block size of cipher algorithm
X = 1: data to be encrypted not multiple of block size add
0x80 and then as many zeroes as required.
X = 2 Add with random number to make last block multiple
of block size of cipher algorithm
Y = 0 left padded
Y= 1 right padded
rc 1 h Return Code
Processing Steps
1. Decrypt ePPKi(PIN) using PPKi to retrieve PIN block.
2. Decrypt ANB using Algorithm, Encryption Method, ICV and DPK.
– Encryption Method = CBC/ECB implies data with no special formatting except padding (as defined in Padding
Method). In this scenario, after the data is decrypted and padding removed, the retrieved data is a PAN. The
format of the PAN depends on the number of bytes used for extracted PAN.
– If the number of bytes are less than 11, it implies PAN is in BCD format.
– If number of bytes are greater than 11, it implies the PAN is in ASCII format.
A secondary check should be applied for each digit in the extracted data, i.e., all the elements should be a digit
between 0-9.
– Encryption Method = VDSP implies with PAN formatted as defined in section 6 of reference [90] of Mark II.
The PAN needs to be extracted as is from the formatted data as per rules.
3. The check digit which is the last digit of the PAN is removed based on the values of Check Digit field.
4. Extract ANB.
ANB content is the 12 rightmost digits of the primary account number (PAN) excluding the check digit. If the PAN
excluding the check digit is less than 12 digits, the digits are right justified and padded to the left with zeroes.
Permissible values are 0000 (zero) to 1001 (9). Use Check digit field to discard or include last digit while deriving
PAN.
5. Extract the PIN using the PFi and decrypted PIN and ANB.
6. Prepare the output PIN block as specified by PFo using decrypted PIN and ANB.
7. Encrypt the PIN block using PPKo.
PIN-TRAN-8 (EE0608)
Request Length Type Description
PIN Data Var h Data to incorporate with PIN in encrypted result. The length
must be 0 or 8.
rc 1 h Return Code
FM When FM=01, an additional Field (Session Method, see below for details) is incorporated into the
function. If FM = 00 the function remains as per EE0602.
ANB Account Number Block, which is the rightmost 12 digits of the Primary Account Number (PAN),
excluding the check digit.
PFo specifies the output PIN block format and supports PIN formats: 01, 03, 08, 09, 10, 11, 12, and 13.
The following restriction applies: formats 08 (Docutel) and 11 (ISO Format 1) are valid only in the
case that PFo = PFi – i.e. that the clear text PIN block format is not changed. If PIN format
translation is not required, PFo must be set to the same value as PFi.
PPKo and The key specifiers, PPKi-Spec and PPKo-Spec, may be any valid key specifier for a PPK.
PPKi Consequently, the function supports all combinations of single-length, double-length or triple-length,
HSM-stored and host-stored keys. For example, the input key could be a single-length, host-stored
key and the output key could be a double-length, HSM stored key.
Encryption Used when FM = 01. Encryption Method encrypts ePPKo(PIN + PIN Data) as per selected
Method method. 00 = ECB, 01 = CBC,11=Pad+CBC.
ePPKo Variable length field of either 8 or 16 bytes dependent upon length of PIN Data supplied.
(PIN+PIN
Data)
PIN Data Data to incorporate with PIN in encrypted result. The data block would typically incorporate the PIN
Try Counter and PIN Try Limit, as specified in reference [29] of CI, but no checks are applied to the
data content. The field can contain 0 or 8 bytes. If the length is 0, this function performs identically
to the PIN-TRAN-2 (EE0602). If the length is 8, the data block is concatenated to the right of the
(re-)formatted, plaintext PIN block and the resulting 16-byte character sequence is CBC-encrypted
using the PPKo.
The function will fail with Error Code 78 if PFi or PFo indicates a PIN block format that is disabled.
Note: The Session Method field has been renamed as Encryption Method.
For Encryption Method = 11, the PIN block will be padded as shown in following table. The 16- or 24-byte plaintext
padded block will be encrypted using the CBC mode of operation. This will produce a 16- or 24-byte encrypted PIN
block, which will be returned in the Var field in the response.
PIN-TRAN-3624 (63)
Request Length Type Description
63 1 h Function Code
63 1 h Function Code
rc 1 h Return Code
This function translates both the format and the encryption key of a PIN Block which is supplied encrypted by a HSM
stored PIN Verification Key (PVK).
PP-PIN is the IBM 3624 formatted PIN Block. It must be supplied encrypted by a HSM stored PIN Verification
KEY (PVK).
PVK-index identifies the PVKn with which the supplied PIN Block is encrypted.
eKMv1 is the host stored encrypted session key with which the resultant AS/ANSI PIN Block is returned
(PPK) encrypted.
ANB is the 12-digit Account Number Block used in the formation of the clear AS/ANSI PIN Block.
The function will fail with Error Code 78 if IBM 3624 or ISO-0 PIN block is disabled or reformatting of IBM 3624 to ISO-0
PIN block is disabled.
PIN-TRANS-SEED-DES (EE0615)
Request Length Type Description
rc 1 h Return Code
This function performs a translation from SEED to DES of the PIN Block format.
The incoming PIN Block format is verified. Please note that only the first 8 bytes of the PIN Block are verified. For
example, if the PFi field indicates an ANSI PIN Block the first 8 bytes of the PIN Block are verified according to the
ANSI format while the last 8 bytes are ignored.
The function will fail with Error Code 78 if PFi or PFo indicates a PIN block format that is disabled or conflicts with the
reformatting restrictions.
PFi and PFo Specify the format of the supplied PIN Block and of the required PIN Block. If PIN format translation
is not required, PFo must be set to the same value as PFi. Supports PIN Formats 01, 03, 08, 10, 11
and 13.
PPKi The key specifier PPKi-Spec. Format 00 – 03, 16, 17 and 18 accepted. Where a HSM stored PPK
is indicated (formats 00 – 03) the key must have been stored as a SEED key.
PPKo The key specifier PPKo-Spec. Formats 00 – 03, 10, 11, 12 , 13, 14, 17 and 18 are accepted.
ePPKi(PIN) PIN Block encrypted using the SEED algorithm1 by PPKi. This Var field must be 16 bytes in length.
1A 128-bit block cipher that has been widely used in Korea for confidential services such as ecommerce, email,
financial services, data storage, electronic toll collection, VPN and digital rights management.
PIN-VER-IBM-MULTI (EE0603)
Request Length Type Description
rc 1 h Return Code
This function performs the verification of a PIN using the IBM 3624 Offset method. The PIN is supplied in encrypted
form, using any of the PIN Block formats.
PPK-Spec May be any valid key specifier for a PPK. Consequently, the function supports an encrypted PIN
Block encrypted using a single-length or double-length or triple-length HSM-stored or host-stored
key.
PF Supports PIN Formats: 01, 02, 03, 08, 09, 10, 11, 13
ANB Account Number Block, which are the right most 12 digits of the Primary Account Number (PAN),
excluding the check digit.
Validation Data Data (usually a part of the PAN) used in the calculation of the reference PIN.
Offset Up to 12 digits of offset data. The significant digits must be left justified in the field. Unused digits
are ignored. If offsets are not used, the significant digits must be zeros.
Check-Len The number of PIN digits to be checked. This may be less than or equal to the actual length of the
PIN. The significant Offset digits must be supplied left aligned and right padded in the Offset field.
The function will fail with Error Code 78 if PF indicates a PIN block format that is disabled.
Note: This function includes all the capabilities of the following existing functions, and
therefore supercedes the following:
PIN-VER (61), PIN-VER-PP (62), D51-PIN-VER (66), VAR-PIN-VER (67), VAR-PIN-VER-PP
(68).
PPID-ENCRYPT (E550)
This function is the reverse of the function E540 – VERIFY PPID.
rc 1 x Return Code
eKIA(PPID) 4 x Left hand 32 bits of the PPID encrypted under the Acquirer
Initialization Key
PRINT-KM-ENC-PIN (EE0641)
Request Length Type Description
rc 1 h Return Code
Notes
– *=Fields only present if FM=01.
– If FM=01, PIN line number and column number must be present.
– PAN line number and column number values must be present if Print 16-digit PAN setting is
enabled on console.
– If Print 16-digit PAN setting is disabled PAN line number and column number field value must be 0.
– The function will use PIN and PAN line number and column number values provided with the host function and
values entered on console will be ignored.
– The function will fail with Error Code 78 if PIN block format ISO-3 is disabled.
The function performs the same process as PIN-PRINT (EE0E05). The only difference is the form of the encrypted PIN
input to the function.
PRINT-PS (EE0E03)
Request Length Type Description
PPK Spec Var Key-Spec Key specifier for PPK (Formats: 0–3, 10, 11, 12, 13, 14)
rc 1 h Return Code
Once the USB printer is configured, and the Postscript PIN Mailer option is enabled through the console interface, this
function is used to read the postscript template file copied on to Luna EFT by host function EE0E02. The function
replaces the place holder with actual PIN, and other sensitive information and generates the final format before printing
it using a postscript printer connected on a USB port.
PRIVATE-KEY-OPERATIONS (EE9010)
Request Length Type Description
SK Var K-Spec Key specifier to perform RSA operations (Format 82, Key
Type: Data Protect, Data Signature)
rc 1 h Return Code
This function performs RSA Private key Operations as decrypt/sign as specified in the mode of operation.
Processing Steps
1. Check the field ‘Mode of Operation’ field to retrieve the type of operation to be performed.
2. In case of Decrypt Operation.
PROTECT-CLEAR-MOBILE-PIN (EE3056)
This function is used to encrypt the clear Mobile PIN.
FM 1 h Function Modifier = 00
rc 1 h Return Code
Processing Steps
1. Check Mobile PIN value for length >=4 and <=8. Any length outside the range is error condition.
2. Prepare PIN Block as specified by Pfo using:
a. ANB
b. Clear PIN
3. Apply padding to PIN Block data with respect to Padding Mode
4. Extract MPPK for PIN Encryption using MPPK spec
5. Encrypt padded/unpadded PIN Block by MPPK using encryption mode and IV.
PROTECT-DC-FILE (EE305C)
This function is used to prepare the file containing keys used for AC generation in cloud based payments.
FM 1 h Function Modifier = 00
CCMK-Spec key Spec h Key spec for key details for CCMK
Formats: 0-3, 1C
Binding Method 1 h Indicates the method for binding the data to the SUK_Info
and the ATC.
00 = SHA256 (Refer SHA256 method defined in
MCBPv1.0)
01 = Data supplied in DC_CP data will be used as is.
Decryption Key Details Var h Decryption details for SUK for CLUMD.
Must be zero length if random placeholder data is used in
place of SUK for CLMD
Decryption Key Details Var h Decryption details for SKs for RPMD.
Must be zero length if random placeholder data is used in
place of SUK for RPMD
rc 1 h Return Code
KTK Spec Var K-Spec Transport Key used for key decryption.
Key Spec for Key Transport Key
Formats: 0-3, 11, 12, 13, 14, 17, 18
Processing Steps
1. Calculate Hash for DC_CP as SHA256 over DC_CP data.
2. Key information field will be used for identifying whether the DC file will contain specific key or random data.
Based on Key information values, which explains whether the encrypted key is present or a random data is there,
check and perform as given:
Key information values&0x01=0x01 Decrypt all the keys from Array for SK for CLMD
using decryption key details.
Store them in ArrayCLMDSK
Key information values&0x01=0x00 Parse array of random place holder data and store
them in ArrayCLMDSK
Key information values&0x02=0x02 Decrypt all the keys from Array for SUK for CLUMD
using decryption key details.
Store them in ArrayCLUMDSUK
Key information values&0x02=0x00 Parse array of random place holder data and store
them in ArrayCLUMDSUK
Key information values&0x04=0x04 Decrypt all the keys from Array for SK for RPMD
using decryption key details.
Store them in ArrayRPMDSK
Key information values&0x04=0x00 Parse array of random place holder data and store
them in ArrayRPMDSK
Key information values&0x08=0x08 Decrypt all the keys from Array for SUK for RPUMD
using decryption key details.
Store them in ArrayRPUMDSUK
Key information values&0x08=0x00 Parse array of random place holder data and store
them in ArrayRPUMDSUK
}
8. Increment ATC and loop iteration counter by 1.
9. Encrypt the buffer with KM48 for CCMK in specified key details.
PROTECT-ENCRYPTED-MOBILE-PIN (EE3057)
This function is used to translate the encrypted mobile PIN from one set of protection key to another.
FM 1 h Function Modifier = 00
Encrypted Mobile PIN Var h Structure for Encrypted Mobile PIN Details
Details
MPPKo Var K-Spec Key spec for key to translate mobile PIN
Formats: 0-3, 11, 13, 17, 18, 1C
rc 1 h Return Code
MPPK –spec Var K-spec Key specifier to denote the MPPK to be used to
decrypt Mobile PIN
Formats: 0-3, 11, 13, 17, 18, 1C
Processing Steps
1. Decrypt the Mobile PIN using parameters from Encrypted Mobile PIN details. Padding Method is used to extract
the PIN Block.
2. Prepare PIN Block as specified by Pfo using:
a. ANB
b. Clear PIN
3. Apply padding to PIN Block data with respect to Padding Mode.
4. Extract MPPKo for PIN Encryption using MPPK spec.
5. Encrypt padded/unpadded PIN Block by MPPK using encryption mode and IV.
PRV-GENERATION (EF0E02)
This function generates a PIN Reference Value (PRV).
FM 1 h Function Modifier = 00
PIN Encryption key spec Var Key Spec Key specifier for the incoming PIN encryption key which will
be PPK.
Formats: 11, 13
PIN Block Data 6 h The incoming PIN-Block-Data. The PIN Block Data for the
ISO-0 PIN-Block.
PRV PAC key spec Var K-Spec Key specifier for PPK which will be used in calculation of
the PRV
Formats: 11, 13
PIN Identification Data 16 h The PID is a concatenated value. This field is a 32-digit (16-
(PID) Byte) hexadecimal value and is the data that is a part of the
PRV calculation.
rc 1 h Return Code
PIN Encryption key Key specifier for the incoming PIN encryption Key.
spec Formats: 11, 13
ePPK(PIN-Block) Is the input formatted PIN Block containing the PIN. It must be supplied encrypted by a KPE.
PIN Block Data Refers to the incoming PIN-Block-Data. It is a 12 digit BCD value whose permissible digits
range in between 0-9, or the rightmost PAN digits. This field is used for the following:
• To calculate the clear PIN-Block in case of input PIN-Block-Format is ISO-0.
• Creation of the intermediate ISO-0 PIN block as part of the PRV calculation.
• To verify the 12 digit PAN incorporated in the PID field.
PRV PAC key Key specifier for the PPK to encrypt /decrypt the ISO-0-PIN-Block as part of the PRV
spec calculation.
Formats: 11, 13
0x07 (FN_INVALID_PIN_ The length of the incoming PIN is out of the range, as specified between the
BLOCK_CONTENT) Minimum and Maximum length.
0x0C (FN_INCONSISTANT_ The PIN_Block_Data sent in the request does not match the 12 digits from digit 3 to
REQ_FIELDS) 14 of the PIN Identification Data (PID) field.
PRV-VERIFICATION (EF0E03)
This function verifies a PIN Reference Value (PRV).
FM 1 h Function Modifier = 00
PIN Encryption key spec Var Key Spec Key specifier for the incoming PIN encryption Key which
will be PPK.
Formats: 11, 13
PIN Block Data 6 h The incoming PIN-Block-Data. The PIN Block Data for the
ISO-0- PIN-Block.
PRV PAC key spec Var K-Spec Key specifier for PPK which will be used in calculation of
the PRV
Formats: 11, 13
PIN Identification Data 16 h The PID is a concatenated value. This field is a 32-digit (16-
(PID) Byte) hexadecimal value and is the data that is a part of the
PRV calculation.
rc 1 h Return Code
This function picks up an encrypted PIN Block and a PRV as input besides other inputs and calculates a PRV and
matches this calculated value against the supplied PRV. It returns a Validation Error (0x08) if the calculated PRV does
not match the supplied PRV.
PIN Block Format Specifies the format of the supplied PIN Block.
Formats: 01, 02, 03, 08, 09, 10, 11, and 13, if enabled.
PIN Encryption key spec Key specifier for the incoming PIN encryption Key. (Formats: 11, 13)
eKPE(PIN-Block) Refers to the input formatted PIN Block containing the PIN. It must be supplied
encrypted by a KPE.
PIN Block Data Refers to the incoming PIN-Block-Data. It is a 12 digit BCD value whose permissible
digits range in between 0-9, or the rightmost PAN digits. This field is used for the
following:
• To calculate the clear PIN-Block in case of input PIN-Block-Format is ISO-0.
• Creation of the intermediate ISO-0 PIN block as part of the PRV calculation.
• To verify the 12 digit PAN incorporated in the PID field.
PRV PAC key spec Key specifier for the PPK to encrypt /decrypt the ISO-0-PIN-Block as part of the PRV
calculation.
Formats: 11, 13
0x07 (FN_INVALID_PIN_ The length of the incoming PIN is out of the range, as specified between the
BLOCK_CONTENT) Minimum and Maximum length.
0x08 (FN_VALIDATION_ The PRV supplied in the request does not match the calculated PRV.
ERROR)
0x0C (FN_INCONSISTANT_ The PIN_Block_Data sent in the request does not match the 12 digits from digit 3 to
REQ_FIELDS) 14 of the PIN- Identification-Data (PID) field.
PUBLIC-KEY-OPERATIONS (EE9009)
Request Length Type Description
Symmetric key Var K-Spec Key specifier for key to be included in operation, this can be
a zero-length field (as below).
(Formats: 10, 11, 12, 13, 14, 20)
rc 1 h Return Code
This function performs RSA operation using public key as encrypt/recover/key transport specified by the mode of
operation.
FM Function Modifier = 00
Symmetric Key The key specifier for key to be included in the operation at the supplied offset. When Symmetric
key is in format-20, only initial key can be derived, not transaction key. So, 21-bits of transaction
counter in KSN must be zero.
Note: If Mode of operation is not Key Transport then only this field can be zero length. This filed
will be ignored.
Key Type Indicates the KM-variant that will be used to retrieve the key from ‘Symmetric key’.
Note: When Symmetric key is in format-20 then Key Type will be ignored. A terminal initial key
will be derived from the BDK and KSN present in key spec 20 in this case and placed in the data.
Offset Supplies the offset position at which key will be Overwrite the data. A value of 0 – 255 is sufficient
for a modulus length of up to 2048 bits.
Output Data This field will specify the result of the operation.
Processing Steps
1. Check the field ‘Mode of Operation’ field to retrieve the type of operation to be performed.
• In case of Encrypt Operation
– Data will be encrypted by the key PK.
– The resultant will be returned in ‘Output Data’ in response.
• In case of Recover Operation
– Return recovered data response
• In case of Key Transport Operation
– Include the Symmetric key into Data at Offset position.
– Resultant data will be encrypted by the key PK.
– The encrypted will be returned in ‘Output Data’ in response.
PVV-CALC (EE0607)
Request Length Type Description
rc 1 h Return Code
This function calculates a Visa PVV for a PIN and also provides the length of the PIN. The PIN is supplied in encrypted
form, using any of the PIN Block formats specified in Function Construction.
PPK-Spec This may be any valid key specifier for a PPK. Consequently, the function supports an encrypted
PIN Block encrypted using a single-length or double-length or triple-length HSM-stored or host-
stored key.
ANB Account Number Block, which are the 12 right most digits of the Primary Account Number (PAN),
excluding the check digit.
The function will fail with Error Code 78 if PF indicates a PIN block format that is disabled.
The function performs a check that the ANB field and the TSP12 field contain a number of consecutive digits in
common. The number of digits to check is in the range 0 to 12, as may be specified using a console operation, and
defaults to 8. If the number of digits to check has been set to 0 the check is disabled, and in this case the function will
accept any supported PIN block format that is enabled. If the number of digits to check is greater than 0, then only ISO-
0 and ISO-3 PIN blocks are allowed, if enabled. If the check fails, the function will fail with Return Code 79.
Note: This function includes all the capabilities of the following existing functions, and thereby
supercedes the following:
PVV-CHANGE (9A)
PVV-CALC-3624 (EE0606)
Request Length Type Description
rc 1 h Return Code
This function calculates a Visa PVV from a PIN’s IBM Offset data. The four leftmost digits of the derived or random PIN
are appended to the TSP12 to form the TSP.
Validation Data Data which is usually part of the PAN and used in the calculation of the reference PIN.
Offset4 Leftmost 4 digits of the PIN offset. If an offset is not used, the digits must contain zeros.
Note: This function includes all the capabilities of the following existing functions, and thereby
supercedes the following:
PVV-GEN-1 (90), PIN-GEN-2 (96).
PVV-VER (EE0605)
Request Length Type Description
rc 1 h Return Code
This function performs the verification of a PIN using the Visa PVV method. The PIN is supplied in encrypted form,
using any of the PIN Block format specified in Function Construction.
PPK-Spec May be any valid key specifier for a PPK. Consequently, the function supports an encrypted PIN
Block encrypted using a single-length or double-length or triple-length HSM-stored or host-stored
key.
ANB Account Number Block, which are the 12 right most digits of the Primary Account Number (PAN),
excluding the check digit.
The function will fail with Error Code 78 if PF indicates a PIN block format that is disabled.
Note: This function includes all the capabilities of the following existing functions and hence
supercedes PVV-VER-1 (91), PVV-VER-2 (92), PVV-VER-3 (93), PVV-VER-4 (97), PVV-VER-
5 (98), PVV-VER-6 (99)
RAND-GEN (B570)
This function generates a 64 bit random number and returns it in the clear.
rc 1 x Return Code
rn 8 x Random Number
RANDOM-KEY-GENERATION (EF0618)
Request Length Type Description
KF 1 h Key Format
(Formats: 10, 11, 12, 13, 14, 17, 18)
rc 1 h Return Code
eKMvX(Key) Var K-Spec Key specifier encrypted under current KM (Formats: 10, 11,
12, 13, 14, 17, 18)
This is a generic function allowing the random generation of any key type and encryption under the respective KM
variant. This is required by the function PIN-GENERATION (EF0616). To create an eKMv7 PVK, the following
parameters are to be passed in, KF = 10, KMVar= 7.
READ-USER-STORE-DATA (EE4103)
Request Length Type Description
FM 1 h Function Modifier
rc 1 h Return Code
This function reads the variable-length data from the specified location. If the entry contains a key item, it will be read
and returned.
See Also
READ-USER-STORE-KEY (EE4101)
Request Length Type Description
FM 1 h Function Modifier
rc 1 h Return Code
This function stores a KM-encrypted key at the specified location. Although, the key specifier is returned as read
initially, the encrypted key is decrypted and the KVC of the key is calculated and returned.
The function fails if the entry contains a data item and not a key specifier.
See Also
RETRIEVE-KEY (21)
Request Length Type Description
21 1 h Function Code
KXT Spec Var K-Spec Key specifier for Key Transfer Table (Formats: 0–3)
21 1 h Function Code
rc 1 h Return Code
This function is used to retrieve a key from the key transfer table. The key is deleted from the table if the retrieval is
successful.
The KVC/KCV of the key is also returned. 4-digit KVC/KCVs are returned with two trailing zeroes. KVC is returned for
KIS or KIR or KI key types, and KCV is returned for ZCMK key.
Notes
– The key specifiers 10, 11,15 under the Response, are generated when using the Legacy option.
– The key specifiers 10, 11, 13 under the Response, are generated based on the chosen operation on console
and FM. See, Function Modifier Values.
– The key specifier returned will depend on the key type stored in the transfer table. Single length keys will result
in key specifier Format 10, double length keys will result in key specifier Format 11 and 13, and triple length in
12 & 14. Keys that have been stored as Format 15 through the STORE-KEY function will result in Format 15
being returned as the key specifier response field.
– Keys that have been stored as Format 15, 17, 18 through the STORE-KEY (22) function will result
correspondingly in Format 15, 17 and 18 only.
– The chosen Key Protection method Legacy on console will not affect keys stored in 0x17 and 0x18 format by
STORE-KEY function.
– When the Key Spec is returned as a Format 10, 11, 12, 13, 14 the specific KM variants are used. KM variant 4
is used for ZCMK's and KIR. KM variant 3 is used for KIS and the KM variant 10 is used for KI.
RNS-MESSAGE (EE305F)
This function is used to prepare Remote Notification Service Message and provide DPK encrypted Session Id to be
used in CBP as derivation n/verification data.
FM 1 h Function Modifier = 00
rc 1 h Return Code
D4 Plain diversifier data to be concatenated before encrypted and authenticated session data.
NOTE: Concatenation has to be done after the Session Data has been encrypted and authenticated.
MCBP v1.0 set it to RNSMsgID.
Processing Steps
1. Check for the value of Session ID (=SID). If Session ID is zero length, generate an N byte random number
(=RND=SID) where N= Session id length
2. Calculate Session ID as SID = D1 || SID || D2
3. Concatenate SessionID || RemMgmtInfo to form Session Data (=S)
4. Process Protecting Session ID using S, IV ENC, IV MAC, MKDK1, MKDK2, MAC Length, Padding Info, as
described in reference [83], [84], [85] of Mark II).
5. Compute RNMsg = D4 || ASD from step 6.
6. Protect SID by DPK using IV and Encryption Mode for Session ID and Padding Method. Padding will be done to
make the data left justified.
RSA-ENCIPHER-PIN (EE204E)
Request Length Type Description
PVK-Spec Var K-Spec Key Specifier for PVK and Dec. Table
(Formats: 0–3, 11, 12, 13, 14, 17, 18)
Validation Data 8 h Data (usually a part of the PAN) used in the calculation of
the reference PIN
ICC Unpredictable 8 h
Number
rc 1 h Return Code
This function calculates a card's random PIN, formats it in accordance with section 7.2 of [5] and encrypts it using the
card's ICC PIN Encipherment Public Key, PPE, or DDA key, PIC.
Function Modifier Reserved for possible future use; must be set to zero.
PVK-Spec Key specifier for PIN Verification Key (PVK) (Formats 0 - 3, 11, 12, 13, 14, 17, 18). HSM
stored and encrypted with KMv7
Validation Data 8 bytes of PAN data used to recreate the reference PIN.
Offset 6 byte offset that is used to recreate the reference PIN. The offset is in bcd format – big
endian. With the validation data and PIN length, the PIN can be recalculated.
PPE-Spec or PIC-Spec Key specifier for PIN encryption key (Formats 0 - 3, 81).
The function will fail with Error Code 78 if the ISO-2 PIN block format is disabled.
Function usage
• Encipherment of a cardholder-entered PIN is generally performed by the terminal. This function may be used by a
card issuer wishing to test a card prior to issue.
SELF-CERT-ISSUER-PUBLIC-KEY (EE2041)
Request Length Type Description
SI-Spec Var K-Spec Key Specifier for the issuer private key used in the signing
operation.
Key Type = Certificate, Data Signature
(Formats: 0-3, 82)
PI-Spec Var K-Spec Key Specifier for the issuer public key to be signed.
Key Type = Certificate, Data Signature
(Formats: 0-3, 81)
Certificate Expiry Date 2 h MMYY format for when the Certificate expires.
Hash Algorithm Indicator 1 h EMV currently specify the Hash Algorithm as SHA-1 value
01.
rc 1 h Return Code
Issuer Public Key Length 1 h Length of the issuer public key modulus (NI).
Issuer Public Key Var h The 'Self-certified Issuer Public Key', of length equal to the
Certificate length of the Issuer Public Key Modulus (NI)
This function creates the 'Self-certified Issuer Public Key', as described in reference [17] of Card Issuance. It confirms
that the provided public and private keys form a valid key pair, by verifying the self-certified public key.
The function returns the certificate and other public key data, in the format required for providing to the CA. It also
returns the calculated hash-code, for sending separately to the CA.
SI-Spec Key specifier for the Issuer Private Key SK (formats 0-3, 82). The Key specifier in
formats 0 - 3 describes the location of the key to be loaded from the ESM. The Key
specifier in format 82 describes the complete Issuer SK.
PI-Spec Key specifier for the Issuer Public Key (formats 0-3, 81). The Key specifier in formats 0
- 3 describes the location of the key to be loaded from the ESM. The Key specifier in
format 81 describes the complete Issuer PK.
Issuer Public Key Exponent 1 byte, valid length values are 1 and 3.
Length
Leftmost Digits of Issuer Variable length field to represent Issuer PK modulus length. As in Tables 3-1 and 3-2 of
Public Key Ref [17]
Issuer Public Key IPK remainder. As in Tables 3-1 and 3-2 of Ref [17]
Remainder
Issuer Public Key Exponent Variable length field. Valid values are value=3 (length=1) and value=216+1 (length=3).
Processing Steps
1. Build the data block to be included in the hash calculation, as specified in Tables 3-1 and 3-2 of [17], using the
appropriate fields provided in the request and the public key specified by PK-Spec.
The following fixed values fields will also be incorporated into the data block: Certificate Format = 11 (hex); Issuer
Public Key Algorithm Indicator = 01 (hex).
2. Calculate the hash result. [Currently, SHA-1 is the only approved hash algorithm, and is indicated in Hash
Algorithm Indicator by a value of hex '01'.]
3. Truncate the data block, append the hash result, and add the data header and trailer to form the block to be signed.
4. Calculate Issuer Public Key Certificate by signing the block to be signed, using the private key specified in SK-
Spec.
5. Confirm that SK and PK constitute a key pair, by using PK to recover the data block from Certificate and
comparing the recovered data block with the original. Return an error if they do not.
6. Calculate the Issuer Public Key Check Sum, using ID of Certificate Subject, Issuer Public Key Index and the
public key specified by PK-Spec, in accordance with Chapter 7 of [17]
Function usage
• The function is used to create the Self-certified Issuer Public Key and associated Issuer Public Key Check Sum
that is required to be sent to the Europay-MasterCard CA in order to obtain an Issuer Certificate.
SELF-SIGN-ISSUER-PK-VISA (EE2044)
Request Length Type Description
SI-Spec Var K-Spec Key Specifier for the issuer private key used in the
signing operation.
Key Type = Certificate, Data Signature
(Formats: 0-3, 82)
PI-Spec Var K-Spec Key Specifier for the issuer public key to be signed.
Key Type = Certificate, Data Signature
(Formats: 0-3, 81)
General Public Key Data 15 h Data included in the self-signed public key data.
The first six fields from Table 3.3 of [18] currently 18
bytes in total.
rc 1 h Return Code
This function creates the 'Self-Signed Issuer Public Key Data', as described in 3.2.3.2 of [18]. It confirms that the
provided public and private keys form a valid key pair, by verifying the self-signed public key.
SI-Spec Key specifier for the Issuer Private Key SK (formats 0 - 3, 82). The Key specifier in formats 0 - 3
describes the location of the key to be loaded from the ESM. The Key specifier in format 82
describes the complete Issuer SK.
PI-Spec Key specifier for the Issuer Public Key (Formats 0 - 3, 81). The Key specifier in formats 0 - 3
describes the location of the key to be loaded from the ESM. The Key specifier in format 81
describes the complete Issuer PK.
Processing Steps
1. Build the data block to be included in the hash calculation using: General Public Key Data, the algorithm
indicators and the public key specified by PK-Spec. Calculate the hash result.
2. Truncate the data block and append the hash result, to form the block to be signed.
3. Calculate Signature by signing the block to be signed, using the private key specified in SK-Spec.
4. Confirm that SK and PK constitute a key pair, by using PK to recover the data block from Signature and comparing
the recovered data block with the original. Return an error if they do not.
Function usage
• The function is used to obtain the 'Self-Signed Issuer Public Key Data' that is required to be sent to the Visa CA in
order to obtain an Issuer Certificate.
SET-CLOCK (0015)
This function sets the date and time in Luna EFT.
rc 1 x Return Code
SHA1-GENERATOR (0021)
This function returns the SHA1 hash value of the input data, to a maximum length as specified by the supplier.
Bit Count 8 bin Initially zeroes, then returned value from previous call
Hash Value Var x Hash chaining Value, initially 0s then returned value
rc 1 h Return Code
Note: The length of the Input Hash Chaining value determines the length of the hash value in
the response. The length must be one of the valid values defined for the SHA-1 algorithm. At
present only the 160-bit (20 byte) hash value has been defined in Australian Standard AS2805
Part 13:2000. Algorithms for SHA-256, SHA-384 and SHA-512 have been defined by NIST.
The initial implementation need only have the 160-bit algorithm implemented.
SIGN-DATA (EE9005)
Request Length Type Description
rc 1 h Return Code
This function signs the data using the private key and signature algorithm indicated, and returns the digital signature.
If 0 is given as hash function, data must be already hashed and formatted into a valid ASN.1 DER-Encoded DigestInfo
structure.
SIGN-FEP-PUB-KEY (EE4007)
Request Length Type Description
FM 1 h Function Modifier
SCA Var K-spec CA private key used to create the digital signature for the
public key certificate.
(Formats: 82)
Key Type = Certificate
rc 1 h Return Code
Issuer Public Key Certificate Var h Digital signature for the public key certificate. The field
length is equal to the length NCA of the modulus of SCA
This function creates the certificate for the FEP public key (PI) using the private key of the CA (SCA). The EMV format
02 certificate is formulated as specified in section 5.1 of [74], and will have the format (when recovered) described in
Appendix A of [73].
The function inserts the data fields supplied in the request message into the certificate, along with the following fields:
Public Key Length, Public Key Exponent Length, Leftmost Digits of the Public Key, Hash Result.
SIGN-ICC-STATIC-DATA (EE204B)
Request Length Type Description
rc 1 h Return Code
Signed Static Application Data Var h Digital signature for the Static Application Data. The
field length will be equal to the length NI of the modulus
of SI
This function calculates a digital signature for the ICC Static Application Data using an Issuer Private Key.
The function request fields provide all the variable data fields that form the Static Application Data to be signed, as
specified in Table 2 in [5].
Function Modifier Reserved for possible future use; must be set to zero.
SI-Spec Key specifier for the Issuer Private Key (Formats 0 - 3, 82).
Signed Data Format EMV currently specify the signed data format value 03.
Hash Algorithm EMV currently specify the Hash Algorithm as SHA-1 value 01.
Indicator
Signed Static The variable length return signed static application data.
Application Data
Processing Steps
1. Build the Static Application Data using the request fields and the appropriate Pad Pattern.
2. Calculate the hash result for the Static Application Data using the hash algorithm indicated by Hash Algorithm
Indicator. [Currently, SHA-1 is the only approved hash algorithm, and is indicated by a value of hex '01'.]
3. Build the signature block using the calculated hash result and the leftmost bytes of the Static Application Data, as
defined in A2.1.2 in [5].
4. Sign the signature block using SI and its associated asymmetric algorithm. [Currently, RSA is the only approved
asymmetric algorithm.]
5. Return the signature in Signed Static Application Data.
Function usage
• The function is for use during ICC initialization: the Static Application Data and corresponding digital signature
would be passed subsequently to the card personalization system.
rc 1 x Return Code
The modulus in RSAPublicKey is one-byte longer than the modulus supplied in PK-HSM, to which a byte with value of
binary zero is prepended. The exponent in RSAPublicKey is the exponent supplied in PK-HSM, with leading binary zero
bytes removed. The DER-encoded RSAPublicKey is returned in the response.
The public key is encoded with the EMSA-PKCS-v1_5 encoding operation, applying the SHA-1 hash function, before it
is signed with the RSASP1 signature primitive.
Note:
- Only a modulus length (PK-HSM field) of 256 bytes is accepted.
- Only a public key exponent value of 0x10001 (65537) is accepted.
Example:
The following example is the hexadecimal representation of a 2048-bit PK-HSM.
Table 1: As supplied in the request, with 256-byte modulus and exponent
modulus 960356F5B591C57183FA0DA622D84CC5C6D13A0680DB4575EE6A6F150359301
BB41F0AD9E21DEF216B888F3653D08C887BD4C93769CDE86734BBCB977235E
9C3778FE209467E404BBE563D805C29D67178D238F12A9B3BB31A48AEA5562D
8494DC88EAD0DA34E55C33A910F367DBB6D5D7450AC3187624478F6BC84D92
3F66A156EF7F79081E5B2B8B4BFA2C11D89978D383F2719215E7CA21D7FED2A
D85FC4B7C4E21234931171C8304F250219B4523A66D81FADADDC7C3CD3A3AE
4AE407C0B88B0EF97B00F5A2D90B78EF0E3148C5E9BF1D7C7E550E0C5CFB97
87308F8DA71C3717180972029BDE8290162529FF7C61BD46A89C1DFF853713A1C
466BED18F3
exponent 00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000
000000000010001
modulus 00960356F5B591C57183FA0DA622D84CC5C6D13A0680DB4575EE6A6F150359
301BB41F0AD9E21DEF216B888F3653D08C887BD4C93769CDE86734BBCB977
235E9C3778FE209467E404BBE563D805C29D67178D238F12A9B3BB31A48AEA
5562D8494DC88EAD0DA34E55C33A910F367DBB6D5D7450AC3187624478F6B
C84D923F66A156EF7F79081E5B2B8B4BFA2C11D89978D383F2719215E7CA21
D7FED2AD85FC4B7C4E21234931171C8304F250219B4523A66D81FADADDC7
C3CD3A3AE4AE407C0B88B0EF97B00F5A2D90B78EF0E3148C5E9BF1D7C7E
550E0C5CFB9787308F8DA71C3717180972029BDE8290162529FF7C61BD46A8
9C1DFF853713A1C466BED18F3
exponent 010001
padding 0001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFF00
Digestinfo 3021300906052B0E03021A05000414
tag
SIGN-PUBLIC-PKCS10 (C810)
This function self-signs a public key with the corresponding secret key, for use in a certification request to be sent to a
certification authority.
rc 1 x Return Code
{
modulusINTEGER, --n
publicExponentINTEGER --e
}
The modulus in RSAPublicKey is one byte longer than the modulus supplied in VHOST, to which a byte with value of
binary zero is prepended. The exponent in RSAPublicKey is the exponent supplied in VHOST, with leading binary zero
bytes removed.
The message to be signed by RSASSA-PKCS1-v1_5-SIGN is the DER-encoded CertificationRequestInfo. The
CertificationRequestInfo is encoded with the EMSA-PKCS-v1_5 encoding operation, applying the SHA-1 hash
function, before it is signed with the RSASP1 signature primitive. The signature is placed in the Certification Request
which is returned in the response.
SPONSOR-KEY-GEN (B510)
This function generates a random Cross Acquirer Key (KCA) and a housekeeping key (KMACH) and returns them
encrypted under the appropriate variant of KM.
rc 1 x Return Code
STORE-KEY (22)
Request Length Type Description
22 1 h Function Code
KXT Spec Var K-Spec Key specifier for Key Transfer Table, (Formats: 0-3)
Key Spec Var K-Spec Key specifier for stored key, (Formats: 10, 11, 12, 13, 14,
15, 17, 18) (See notes))
22 1 h Function Code
rc 1 h Return Code
This function is used to store a key in the key transfer table. The KVC/KCV of the key is also returned. 4-digit
KVC/KCVs needs to be entered with two trailing zeroes. KVC is returned for KIS or KIR or KI key types, and KCV is
returned for ZCMK key.
Notes
– Format 15 is only accepted when the key sub type sent is 1 or 2. When the Key Spec field is a Format 15, the
key stored in the transfer table will have its attributes set.
– Format 15 will not be supported for key KI.
– Formats 10, 11, 12, 13, 14 for the Key Spec use the specific KM variant for the key type. KM variant 4 is used
for ZCMK's and KIR. KM variant 3 is used for KIS and KM variant 10 is used for KI.
– For format 17 and 18 the following restrictions will be implemented for KI:
- Allowed mode of use for KI can only be “B”.
- Key Usage should be K0.
- Algorithm should be D or T.
TERM-AUTH-1 (EE4003)
Request Length Type Description
FM 1 h Function Modifier
Issuer Identifier 4 h
Terminal ID 8 h
Issuer ID 4 h
rc 1 h Return Code
eKMv47(KF) Var K-Spec FEP random key – 128-bit, parity-adjusted value encrypted
by suitable variant of KM.
(Formats: 11, 13)
This function performs the processing described in section 2.2 of [72], and as listed below.
• Verify terminal EMV certificate according to Appendix A of [72].
• Recover terminal public key.
• Generate authentication cryptogram according to Appendix B.1 of [72].
Note: In Appendix B.1, Hash Result will be - Hash of fields Random, Key, Terminal ID, Issuer
ID, Hash Algorithm Indicator and Pad Pattern.
Processing Steps
1. Verify CTM using PCA-TM and recover PTM. Check Issuer Identifier is the same as value in the certificate.
2. Verify CEFT using PTM and recover PEFT. Check Issuer ID is the same as value in the certificate.
3. Generate RNF – 16 byte random number.
4. Generate KF – a 128-bit, parity-adjusted 3DES key.
5. Encrypt KF with a variant of the current KM.
6. Create FEP Cryptogram 1, as specified in Appendix B1 of [73] with length equal to length of modulus of PEFT.
Insert RNF, KF, Terminal ID, Issuer ID and Hash Algorithm Indicator.
7. Calculate the Hash Result using algorithm specified in Hash Algorithm Indicator and insert into the appropriate
cryptogram field.
8. Encrypt the completed cryptogram data using PEFT.
TERM-AUTH-2 (EE4004)
Request Length Type Description
FM 1 h Function Modifier
Terminal ID 8 h
Issuer ID 4 h
rc 1 h Return Code
This function performs the processing described in section 2.2 of [72], and as listed below.
• Verify terminal cryptogram and FEP random number according to appendix B.2 of [72].
• Generate authentication cryptogram according to appendix B.3 of [72].
Processing Steps
1. Check that length of terminal cryptogram is equal to length of modulus of SFEP
2. Decrypt terminal cryptogram using SFEP.
3. Check the values of the Data Header and Data Trailer are correct.
4. Calculate the hash result using the Hash Algorithm Indicator field and check against the Hash Result field.
5. Check the values of the Terminal Id, Issuer Id and FEP Random fields against those in the request message.
6. Extract the random number, RNE, and the key, KE.
TERM-VER-2 (EE0406)
Request Length Type Description
rc 1 h Return Code
This function verifies the validity of an EFT terminal by checking that the LOGON-DATA is equal to the result of
encrypting its Security Number (SEC-NO) under its KTM.
The function returns no response data. An Error Code of 00 indicates successful verification, while 08 indicates a
verification failure.
KTM-Spec A key specifier which incorporates an index to an HSM-stored or host-stored single length or double
length KTM.
Logon-Data The logon data is equivalent to the security number encrypted under the terminal master key.
Notes
– For key specifier formats, refer to Function Construction.
– This function supercedes function 4C.
TLS-ENCRYPTION-AND-MAC-KEY-DERIVATION (EE6004)
Request Length Type Description
FM 1 h Function Modifier
R1 28 x Client random
R2 28 x Server random
rc 1 h Return Code
This function supports a call to PKCS #11 function C_DeriveKey with the mechanism CKM_TLS_KEY_AND_MAC_
DERIVE.
Notes
– The 160 bit MPK will be padded with 4 bytes of 0s to the right in order to expand it to triple length before
encryption with KM.
TLS-MASTER-KEY-DERIVATION (EE6003)
Request Length Type Description
FM 1 h Function Modifier
R1 28 x Client random
R2 28 x Server random
rc 1 h Return Code
This function supports a call to PKCS #11 function C_DeriveKey with the mechanism CKM_TLS_MASTER_KEY_
DERIVE. It derives the master secret from the premaster secret and the random numbers of the client and server.
For more explanation, refer section 8.1 of [49].
TLS-PRE-MASTER-KEY-GENERATION (EE6000)
Request Length Type Description
FM 1 h Function Modifier
Version 2 h Provides the TLS protocol version number, where MSB and
LSB is used for major and minor version respectively.
For example, for version 2.10, major =02 and minor =10.
rc 1 h Return Code
This function supports a call to PKCS #11 function C_GenerateKey with the mechanism CKM_TLS_PRE_MASTER_
KEY_GEN.
The function concatenates Version (specified as CK_VERSION in reference [54] of Mark II) and 46 bytes of randomly
generated data to form the premaster secret and encrypts the secret for local storage.
TLS-PRE-MASTER-KEY-RECEIVE (EE6002)
Request Length Type Description
FM 1 h Function Modifier
rc 1 h Return Code
This function supports a call to PKCS #11 function C_UnwrapKey to RSA-decrypt the previously generated premaster
secret.
The function re-encrypts the received encrypted premaster secret for local storage and also extracts the TLS protocol
version number from it while providing that in a clear form.
For more explanation on C_UnwrapKey function, refer to section 11.14 in reference [54] of Mark II.
TLS-PRE-MASTER-KEY-SEND (EE6001)
Request Length Type Description
FM 1 h Function Modifier
rc 1 h Return Code
This function supports a call to PKCS #11 function C_WrapKey to RSA-encrypt the previously generated premaster
secret for sending it to the server.
For more explanation on C_WrapKey function, refer to section 11.14 in reference [54] of Mark II.
TRANS-KM-ENC-PIN (EE0643)
Request Length Type Description
rc 1 h Return Code
This function translates a PIN from encryption using PPK to encryption using KM.
Notes
– The ANB field is used (if required) in recovering the input PIN. It is also used to build the KM-encrypted PIN.
– The function will fail with Error Code 78 if PIN block format ISO-3 or PIN block format indicated by PF is
disabled or conflicts with the reformatting restrictions.
TRANSLATE-DATA-P2PE (EE080C)
This function is used to translate data for P2PE.
FM 1 h Function Modifier = 00
Algorithm 1 h 01 = TDES
Following Field to be present only if Source Mode and Format = 01 and Alphabet table Index=09
Padding Method 1 h XY
X = 0 : pad with all zeroes to make last block multiple of
block size of cipher algorithm
X = 1: data to be encrypted not multiple of block size add
0x80 and then as many zeroes as required.
X = 2 Add with random number to make last block multiple
of block size of cipher algorithm
Y = 0 left padded
Y= 1 right padded
rc 1 h Return Code
Processing Steps
1. Extract the supplied DPK
2. For Data Element Type=00, convert each byte of Data as unsigned integer (as a byte).
3. Check for input alphabet numbers with base number (deduced from alphabet table). The alphabet number should be
in the range of 0 to 2^n-1.
4. In case of Source Mode and Format =01; for Data Field type other than {01,02}, decrypt processed data with VFPE
Algorithm (as described in reference [89]) using the calculated transaction specific data encryption key, counter,
counter block length, base number, alphabet table index and alphabet table.
5. In case of Source Mode and Format =01; for Data Field type =01; decrypt processed data with VFPE Algorithm (as
described in reference [89]) using the calculated transaction specific data encryption key, counter, counter block
length, base number, alphabet table index and alphabet table. Adjust 5th digit from right to maintain the Luhn check
integrity.
6. In case of Source Mode and Format =01; for Data Field type =02; decrypt processed data with VFPE Algorithm (as
described in reference [89]) using the calculated transaction specific data encryption key, counter, counter block
length, base number, alphabet table index and alphabet table.
7. Follow the translation rules as given in table below:
VDSP VFPE Input data is binary representation of CBC (No Formatting) Formatting requirement is given
number. by Target Format. Data after
VFPE Decryption
VDSP Standard Input data is hex representation of CBC (No Formatting) Remove the formatting as given
encrypted data. in VDSP standard method. Only
package the data and return the
number of nibbles used for
padding. Padding Method field
will be applicable here.
VDSP VFPE Input data is binary representation of VDSP Standard Convert the data as defined in
number. target format. Thereafter
package it as defined in section
6 of reference [90].
8. Encrypt the converted/target content in the specified cipher mode using IV and the DPK extract from Target DPK
Spec.
Note: For VDSP standard formatting of generic data, refer section 6.3 of reference [90].
PAN with Valid Check BASE-10 First 6 and last 4 not to be encrypted.
Digit The extracted data is VFPE enciphered. In the
resulting data the first digit from last 5 digits is
recomputed for check digit and replaced.
TRANSLATE-DATA-RSA-TO-RSA (EE9014)
This function is used to translate sensitive data encrypted under one RSA key to another RSA key.
RSA private key Var K-Spec RSA private key format 82.
Key Type must be “Data Protect”
rc 1 h Return Code
Clear data Var Var Clear text data after stripping sensitive information.
Header 2h h = X’5A5A
Format 1 h 1
Trailer 2h h = X’5A5A
If the Header and Trailer fields do not match then P is treated as an unstructured variable length string encoded using
SHA-1 and MGF1 SHA1. If they do match but any other fields are not as specified, then an appropriate error code is
returned.
When input encryption scheme is 0x00 (OAEP), parameter string is assumed to be empty string and Hash algorithm
and OAEP MGF are SHA-1 and MGF1 SHA-1 respectively.
Note: Only 1024 and 2048 bit RSA modulus size is supported.
Processing Steps
1. Extract RSA private key.
2. Decode base 64 encoded encrypted data.
3. Decrypt data using RSA private key. Decrypted data will be base 64 encoded.
4. Decode decrypted data to get cleartext.
5. Clear text data must be in below format for NPCI formatting.
<Transaction Id><delimiter><Common library version><delimiter><Captured credential><delimiter><Transaction
amount><delimiter><Random number>
If it is not in above format, return error. Delimiter character used is ‘|’.
Below data can be used as example,
172652@u712373|33.22|978678|4000|402384
6. Extract captured credential from clear data. For example, 978678.
7. Encrypt data using public key.
8. Base 64 encode encrypted data according to output data encoding scheme.
9. Return encoded string in response.
10. Return clear data after removing user credential. For example, 172652@u712373|33.22|4000|402384
TRANSLATE-SENSITIVE-DATA (EE0645)
Request Length Type Description
Key data Var x Sensitive data encrypted under decryption key as indicated
or PIN data by Key Type
(multiple of 8 bytes)
rc 1 h Return Code
eTK(key or PIN data) Var x Sensitive data encrypted under transport key
This function translates encrypted sensitive data (key or PIN data) for sending to an IC card. The function supports the
crypto processing defined in the Global Platform [Reference [75] of Mark II] and EMV [Reference [79] of Mark II] CPS
specifications.
KTK/PPK/DPK-spec For formats 0-3, 10, 11, 12, 13, 14, 17, 18 references an HSM- or host-stored key of the type
indicated by Key Type.
For formats 50 or 51, the decryption key is derived from a stored KMC.
Format 10 is supported for key type PPK/DPK.
Processing Steps
1. Check that the Header and Trailer fields have a combined length that is a multiple of 8 bytes. If not, abort with an
error.
2. Decrypt the sensitive data using the specified key of the type as indicated, decryption mode and (if applicable)
decryption IV.
3. Concatenate the Header, decrypted data from step 1, and the Trailer ( in that order). The result will necessarily be a
multiple of 8 bytes.
Encrypt the result of step 3 using the specified KEK, encryption mode and, if applicable, encryption IV.
TRANSLATE-VFPE-ALPHABET-TO-DATA (EE080E)
This function is used to translate data from a VFPE alphabet binary string to target formatted binary string.
FM 1 h Function Modifier = 00
rc 1 h Return Code
Processing Steps
1. Identify the alphabet table to be used and verify if the target format is applicable for that alphabet table. Refer
Alphabet Table as described in reference [89] of Mark II.
2. Read the input data byte by byte convert it into corresponding binary data set from the alphabet table.
3. Package the bit/byte stream as defined by data packaging after conversion in the same order as alphabet numbers
were sent.
TRANSLATE-VFPE-DATA-TO-ALPHABET (EE080D)
This function is used to translate data from a source formatted data to VFPE alphabet binary string.
FM 1 h Function Modifier = 00
rc 1 h Return Code
Processing Steps
1. Identify the alphabet table to be used and verify if the source format is applicable for that alphabet table. Refer
Alphabet Table as described in reference [89] of Mark II.
2. Read the input data with respect to data packaging as defined in source format and convert it into corresponding
alphabet number from the alphabet table.
3. In each byte of output convert this alphabet number into integer and represent it in binary form.
VALIDATE-CBP-CVC3 (EE3054)
This function is used to verify the CVC3 generated for magnetic stripe cards used in cloud based payments.
FM 1 h Function Modifier = 00
CMK Derivation Method Var h For derivation method = 00, PAN || PAN Sequence No. ||
Data Mod PAN Sequence No.
Session Derivation Data Var h For derivation method = 00, 8-byte value for SK derivation
UN 4 x Unpredictable Number
CVC generation method 1 h 00 = MCBP v1.0 (use CVC3 Generation method described
in reference [83], [84], [85] of Mark II.
rc 1 h Return Code
Processing Steps
1. Extract IMKCLor IMKRP depending upon the card key type
a. If Card Key Type = {00,01}, extract IMKCL
b. If Card Key Type = {02,03}, extract IMKRP
2. Derive Card Master Keys as specified in Card Key Type using
a. corresponding IMKxx extracted in step1
b. CMK derivation data
c. CMK derivation method as defined in reference [83], [84], [85] of Mark II.
3. Derive Session Key from CMKxx from step 2 using
a. Session Key Derivation Data
b. Session Key Method as defined in reference [83], [84], [85] of Mark II.
4. Generate CVC as required using IV Data, XOR String, ATC, UN.
Supply these values to CVC3 Generation for MCBP, as described in reference [83], [84], [85] of Mark II, if CVC
generation method = 00.
5. Compare the generated CVC3 in step 4 with CVC3 value for n rightmost digits as specified by nCVC3.
Note:
- xx in CMKxx refers to Card Key Type - CLMD, CLUMD, RPMD, RPUMD
- xx in IMKxx refers to CL, RP
VALIDATE-CLOUD-AC-GENERATE-ARPC (EE3053)
This function is used to verify the Application Cryptogram and generate ARPC for Cloud Based Payments and generate
ARPC if required using same key.
FM 1 h Function Modifier = 00
CMK Derivation Data Var h For CMK derivation method = 00 and 01, data contains PAN
data concatenated with PAN sequence number or mod
PAN sequence number
ARPC Data Var h Data on which the ARPC has to be calculated. This field
can be zero length if no ARPC calculation required.
rc 1 h Return Code
Processing Steps
1. Extract IMKCLor IMKRP depending upon the card key type
a. If Card Key Type = {00,01}, extract IMKCL, or,
b. If Card Key Type = {02, 03}, extract IMKRP
2. Derive Card Master Keys as specified in Card Key Type using
a. corresponding IMKxx extracted in step 1
b. CMK derivation data
c. CMK derivation method
If CMK derivation method = 00 (MCBP), the card master key is derived using the method specified in reference
[83], [84], [85] of Mark II.
If CMK derivation method = 01 (VCBP), the card master key is derived using the method specified in reference
[86]. [87], [88] of Mark II.
3. Derive Session Key from CMKxx from step 2, using
a. Derivation Data R
Note: xx in CMKxx refers to Card Key Type - CLMD, CLUMD, RPMD, RPUMD
VAR-KB-PIN-VER (69)
Request Length Type Description
69 1 h Function Code
69 1 h Function Code
rc 1 h Return Code
This function verifies an AS/ANSI formatted PIN. The PIN Block must be supplied encrypted under an HSM stored
Terminal Master Key (KTM).
Note that only the first 99 KTMs may be used with this function.
PK-Index identifies the PVKn, DTn, and MINPINn appropriate to the PIN verification procedure.
AS-PIN is the AS/ANSI formatted PIN Block containing the PIN to be verified. It must be supplied encrypted
by a PIN Protect session key (PPK).
PAN the Primary Account Number used in the verification procedure. It must be padded appropriately prior
to input to this function.
ANB is the 12-digit Account Number Block used in the formation of the clear AS/ANSI PIN Block.
CHKLEN The CHKLEN field contains the number of PIN digits to be checked and may be less than, or equal to,
the actual length of the PIN. The significant Offset digits must be supplied left aligned and right
padded in the Offset field.
Offset consists of up to 12 digits of offset data. The significant digits must be left- justified in the field.
Unused digits are ignored. If offsets are not used, the significant digits must be zeros.
The function will fail with Error Code 78 if an ISO-0 PIN block is disabled.
See IBM 3624 PIN Verification, for a more detailed overview of the PIN verification procedure.
VCEPS-GEN-HASH-CEP (EF0F01)
Request Length Type Description
KMx-Spec Var K-Spec Key specifier for Master Derivation Key (KML)
(Formats: 0-3)
rc 1 h Return Code
This function calculates RCEP , appends it to the hash data, then calculates and returns the hash result, HCEP .
Processing Steps
1. Derive the card's diversified key (KDL) using the Master Derivation Key and IDCEP , according to the method
specified in 3.5.1 of reference [12] of Mark II.
2. Calculate RCEP using KDL, according to the method specified in 3.6.1 of reference [12] of Mark II.
Note: The NETS document indicates that a OWF2(KDLcep. NTcep) is used to calculate RCEP. This differs from
the above.
3. Append RCEP to Hash Data, and use the resulting string to calculate HCEP according to the method specified in
3.6.1 of reference [12] of Mark II.
VCEPS-GEN-SN (EF0703)
Request Length Type Description
KMx-Spec Var K-Spec Key specifier for Master Derivation Key (KMx)
(Formats: 0-3)
Derivation Data Var h Data used in the calculation of the derived key. (0 or 2 - 6
bytes)
Session Key Data Var h Data used in the calculation of the session key. (0 or 2 - 6
bytes)
rc 1 h Return Code
Processing Steps
1. Derive the diversified key using the Master Derivation Key and Derivation Data, according to the method specified
above in Verify Sn, step 1.
2. Derive the card Session Key (SK) using the diversified key and Session Key Data according to the method
specified above in Verify Sn, step 2.
3. Calculate the Sn MA, reference [12] of Mark II. Return the result in Sn.
Function usage
• The function could be used generate any Sn MAC, e.g. for testing purposes.
VCEPS-MAC-VER-LSAM (EF0704)
Request Length Type Description
LSAMK-Spec Var K-Spec Key specifier for LSAM (Format: 11, 13, 17,18)
rc 1 h Return Code
Processing Steps
1. Recover the MAC key, R1.
2. Calculate a MAC for Data, according to the method specified in 5.1.3 of reference [12] of Mark II.
3. Compare the calculated MAC with MACLSAM and return the result.
Function usage
• The function can be used when function Generate LSAM Key is used to generate the LSAM key.
VCEPS-VER-S1-GEN-S2 (EF0701)
Request Length Type Description
KMx-Spec Var K-Spec Key specifier for Master Derivation Key (KML or KMX).
(Formats: 0-3)
rc 1 h Return Code
This function verifies the S1 MAC produced by the CEP card and generates the S2 MAC for sending to the CEP card.
Processing Steps
1. Derive the card's diversified key (KDL or KDX) using the Master Derivation Key and IDcep, according to the method
specified in 3.5.1 of reference [12] of Mark II.
2. Derive the card Session Key (SK) using the card's diversified key and NTcep, according to the method specified in
5.1.2 of reference [12] of Mark II.
3. Calculate the S1 MAC using SK and the data provided in S1 Data, according to the method specified in 5.1.3 of
reference [12] of Mark II.
4. Compare the values of the calculated S1 and that supplied in S1. If the values are not identical, fail with the
appropriate error code.
5. Calculate the S2 MAC using SK and the data provided in S2 Data, according to the method specified in 5.1.3 of
reference [12] of Mark II. Return the result in S2.
Function usage
• The function is used for Load / Unload and Currency Exchange authorization transactions.
VCEPS-VER-SN (EF0702)
Request Length Type Description
KMx-Spec Var K-Spec Key specifier for Master Derivation Key (KM3L, KM3X or
KMP). (Formats: 0-3)
Derivation Data Var h Data used in the calculation of the derived key. (0 or 2 - 6
bytes)
Session Key Data Var h Data used in the calculation of the session key. (0 or 2 - 6
bytes)
rc 1 h Return Code
Processing Steps
1. Derive the diversified key (KD3L, KD3X, KDP, etc) using the Master Derivation Key and Derivation Data.
– To derive the left half of the diversified key, Derivation Data is left-justified in an 8-byte data Block and padded
to the right with 'F0' and sufficient '00' bytes to fill the Block. The data Block is then encrypted with the Master
Derivation Key; the result is the left half of the diversified key.
– To derive the right half of the diversified key, Derivation Data is left-justified in an 8-byte data Block and padded
to the right with '0F' and sufficient '00' bytes to fill the Block. The data Block is then encrypted with the Master
Derivation Key; the result is the right half of the diversified key.
2. If Session Key Data has a length of zero, use the diversified key directly as the Session Key (SK) otherwise derive
the SK using the diversified key and Session Key Data.
– To derive the left half of the session key, Session key Data is left-justified in an 8-byte data Block and padded
to the right with 'F0' and sufficient '00' bytes to fill the Block. The data Block is then encrypted with the
diversified key; the result is the left half of the session key.
– To derive the right half of the session key, Session Key Data is left-justified in an 8-byte data Block and padded
to the right with '0F' and sufficient '00' bytes to fill the Block. The data Block is then encrypted with the
diversified key; the result is the right half of the session key.
3. Calculate the Sn MAC using SK and the data provided in Sn Data, according to the method specified in 5.1.3 of
reference [12] of Mark II.
4. Compare the values of the calculated Sn and that supplied in Sn.
Function usage
The function may be used to verify:
S3 S4 S5 S6 S6' S6''
VER-KM-ENC-PIN (EE0642)
Request Length Type Description
rc 1 h Return Code
This function verifies a transaction PIN by comparing it with a KM-encrypted reference PIN.
Notes
– The ANB field is used (if required) in recovering the transaction PIN. It is also used to recover the reference
PIN.
– The function will fail with Error Code 78 if either PIN block format ISO-3 or PIN block format indicated by PF is
disabled.
VERIFY-ATM-RESPONSE-DIEBOLD (EE9102)
Request Length Type Description
rc 1 h Return Code
This function processes the ATM’s response (KTA2) to the download of the initial key (KTB1). It verifies the signature on
the PKCS#7 messages and compares random nonce’s and identifier provided in the function request.
VERIFY-CA-PK-VISA (EE2045)
Request Length Type Description
rc 1 h Return Code
Certificate Data Var h The data recovered from Certificate, of length equal to the
length of the CA Public Key Modulus (NCA).
This function validates the 'Self-Signed Visa CA Public Key Certificate, as described in 3.4 of [18]. It provides the
public key for host storage, and the recovered certificate data for further processing by the host.
Function Modifier Reserved for possible future use; must be set to zero.
Visa CA Public Key Index As in Tables 3-1 and 3-2 of Ref [17].
Visa CA Public Key Modulus As in Tables 3-1 and 3-2 of Ref [17].
Visa CA Public Key Exponent As in Tables 3-1 and 3-2 of Ref [17].
User Data Variable length user data for input to the PK/SK generation process. User data is
inserted into the clear PK and clear component of the SK. When no User data is
being supplied, this field is 1 byte in length with value of zero to represent a zero
length variable field.
PCA-Spec Key specifier for the CA Public Key (format 81). The Key specifier describes the
complete CA PK.
Processing Steps
1. Validate the Visa CA Public Key, as specified in steps 1 – 4 of 3.4.4 of [18]
2. Build PCA-Spec, using Visa CA Public Key Modulus and Visa CA Public Key Exponent.
3. Provide the data block recovered from Certificate in Certificate data.
Function usage
• The function is used to validate and store a CA public key received from Visa.
VERIFY-CA-PUBLIC-KEY-MC (EE2042)
Request Length Type Description
rc 1 h Return Code
Certificate Data Var h The data recovered from CA Public Key Certificate, of
length equal to the length of the CA Public Key Modulus
(NCA).
This function verifies the Self-certified Europay-MasterCard Public Key, as described in chapter 4 of [17]. It provides
the public key for host storage, and the recovered certificate data for further processing by the host.
Function Modifier Reserved for possible future use; must be set to zero.
CA Public Key Algorithm As in Tables 3-1 and 3-2 of Ref [17]. Currently specified as RSA value 01.
Indicator
Leftmost Digits of CA Public Key Left-most digits of CA PK modulus. Variable length equal to (C_modLen - 32 -
CERT_ID_LEN) or modulus length.
CA Public Key Remainder Only present if CA PK (modulus length > (C_modLen - 32 - CERT_ID_LEN).
Variable length field, length is (C_modLen - 32 - CERT_ID_LEN) otherwise is
length 1 with value 0. As in Tables 3-1 and 3-2 of Ref [17].
Hash Algorithm Indicator EMV currently specify the Hash Algorithm as SHA-1 value 01.
User Data Variable length user data for input to the PK/SK generation process. User data is
inserted into the clear PK and clear component of the SK. When no User data is
being supplied, this field is 1 byte in length with value of zero to represent a zero
length variable field.
Processing Steps
1. Verify the 'Self-certified Europay-MasterCard Public Key', as described in chapter 4 of [17].
2. Build PCA-Spec, using CA Public Key Modulus and CA Public Key Exponent.
3. Provide the data block recovered from Certificate in Certificate Data.
Function usage
• The function is used to verify and store a CA public key received from Europay or MasterCard.
VERIFY-CERTIFICATE (C800)
This function can be used to verify the certificates received from an ATM (for example, Diebold) and extract the public
keys from them. This function is required to support Diebold ATMs.
rc 1 x Return Code
Each of the certificates CertEPPv , CertEPPe, and CERTICA is an X.509 certificate embedded in a PKCS #7 message.
The certificates are encoded using the Distinguished Encoding Rules (DER). CERTICA is not necessarily a root CA
certificate, and need not be self-signed. The calling application is assumed to have established a trust path from this
path to a trusted root CA certificate prior to calling function C800.
This host function is used for Australian Major Bank (AMB).
VERIFY-CSC (EE0502)
Request Length Type Description
CSC Value 3 d Relevant CSC value should be sent right justified padded
with zeros on left.
5 CSC value = 0XXXXX
4 CSC value = 00XXXX
3 CSC value = 000XXX
Where, X represents digits.
rc 1 h Return code
00 = CSC verification passed
08 = verification failure
This host function verifies the given CSC value. It derives the CSC values from Expiry date, PAN and Service Code
and verifies it with the given CSC Value. The CSC field identifies which CSC value of CSC string needs to be verified.
FM Function Modifier = 00
Expiry Any Random Number, as specified in Table 37 of Page 69, in American Express Hardware
Date/Unpredictable Security Module (HSM) Function Requirements.pdf , October 2010.
Number
Service Code Service code to derive CSC string. Left most nibble must be 0.
The possible range is 000-999 as given in section 4.6.4 of Reference [47] and Page 3-20 of
Reference [46].
Must be 0000 in case of CSC v1.0
CSC Value Relevant Packed CSC value (to be verified) should be sent right justified padded with zeros on
left.
Processing Steps
1. Form a 12-nibble CSC string as detailed in processing steps of function EE0501.
2. Using the CSC, find out which CSC value needs to be verified.
If CSC = 00, then verify 3 CSC of CSC string with given CSC value.
If CSC = 01, then verify 4 CSC of CSC string with given CSC value.
If CSC = 02, then verify 5 CSC of CSC string with given CSC value.
3. Return error 0x00 if verification succeeds, else return an appropriate error code.
Note: It is the application’s responsibility to provide correct Service code and there is no check
for correctness in host function.
VERIFY-CSC-1 (0010)
This host function verifies the given CSC value.
CSC Value 3 d Relevant CSC value should be sent right justified padded
with zeros on left.
5 CSC value = 0XXXXX
4 CSC value = 00XXXX
3 CSC value = 000XXX
Where, X represents digits.
rc 1 h Return code
00 = CSC verification passed
09 = verification failure
Expiry Date / Any Random Number, as specified in Table 37 of Page 69, in American Express Hardware
Unpredictable Security Module (HSM) Function Requirements.pdf , October 2010.
Number
CSC Value Relevant Packed CSC value (to be verified) should be sent right justified padded with zeros
on left.
Processing Steps
1. Form a 12-nibble CSC string as detailed in processing steps of function EE0501.
2. Using the CSC, find out which CSC value needs to be verified.
– If CSC = 00, then verify 3 CSC of CSC string with given CSC value
– If CSC = 01, then verify 4 CSC of CSC string with given CSC value
– If CSC = 02, then verify 5 CSC of CSC string with given CSC value
3. Return error 0x00 if verification succeeds; else return an appropriate error code.
Note: It is the application’s responsibility to provide correct Service code and there is no check
for correctness in host function.
VERIFY-DETACHED-CERT-VISA (EE2047)
Request Length Type Description
Detached Signature Var h Detached signature for Issuer Public Key, of length NCA.
Hash Data Var h Data that is hashed for inclusion in the detached signature –
concatenation of the Output Extension and the resolved IPK
Certificate.
rc 1 h Return Code
This function validates the Issuer Public Key Detached Signature, as described in 3.3.3.3 of [18].
Processing Steps
1. Validate the Detached Signature according to 3.3.3.3 of [18].
Function Modifier Reserved for possible future use; must be set to zero.
PCA-Spec Key specifier for the CA Public Key (Format 81). The Key specifier describes the complete
CA PK.
Hash Data Variable length hash data (SHA-1) used to verify the detached signature.
Return Code Returns the result of validation tests for the Visa Detached Signature. Contains value zero to
represent validation was successful.
rc 1 x Return Code
SN-EPP 3030303031303236
SN-EPP 3030303031303236
padding 0001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00
VERIFY-ICC-CERTIFICATE (EE2049)
Request Length Type Description
ICC Public Key Certificate Var h Digital signature for the public key certificate. The field
length is equal to the length NI of the modulus of PI
rc 1 h Return Code
This function verifies an ICC Certificate for PIC or PPE. It also returns the public key for subsequent use in verifying a
DDA signature or encrypting a PIN.
Function Modifier Reserved for possible future use; must be set to zero.
PI-Spec Key specifier for the Issuer Public Key (Formats 0-3, 81).
ICC Public Key Variable length right-most digits of the ICC PK. Only present when (ICC_modLen >
Remainder (ISS_modLen - 42)). Length equals (ICC_modLen - (ISS_ModLen + 42)) or 1 (value=0,
when no remainder present).
ICC Public Key Exponent Variable length ICC PK exponent Valid values are value = 3 (length = 1) and value =
216+1 (length = 3).
User Data Variable length user data for input to the PK/SK generation process. User data is inserted
into the clear PK and clear component of the SK. When no User data is being supplied,
this field is 1 byte in length with value of zero to represent a zero length variable field.
Pxx-Spec Key specifier for the return Public Key (Format 81). The Key specifier describes the
complete PK.
Processing Steps
1. Validate the ICC Public Key Certificate according to Table 7 in [5].
2. Build the Pxx -Spec
VERIFY-ICC-DYNAMIC-DATA (EE204D)
Request Length Type Description
Signed Dynamic Var h Digital signature for the Dynamic Application Data. The field
Application Data length must be equal to the length NIC of the modulus of
PIC.
rc 1 h Return Code
Signed Data Format 1 h Data fields recovered from Signed Dynamic Application
Data - as specified in Table 13 in [5].
Hash Algorithm Indicator 1 h
This function verifies an ICC's Dynamic Application Data and the associated digital signature, using an ICC Public
Key. Data recovered from the signature block is returned in the response.
Function Modifier Reserved for possible future use; must be set to zero.
PIC-Spec Key specifier for the ICC Public Key (Format 81). The Key specifier describes the
complete ICC PK.
Terminal Dynamic Data Variable length terminal dynamic data as described in Table 11 in [5].
Verify Flag 1 byte length to represent result of validation test on the recovered signed application
data.
Signed Data Format Recovered from the signed data and PK values. EMV currently specify the signed data
format value 05.
Hash Algorithm Indicator Recovered from the signed data and PK values. EMV currently specify the Hash
Algorithm as SHA-1 value 01.
ICC Dynamic Data Length of the built return ICC dynamic data.
Length
Processing Steps
1. Obtain the Recovered Data, using the Signed Dynamic Application Data with PIC and its associated
asymmetric algorithm. [Currently, RSA is the only approved asymmetric algorithm.]
2. Check the values of the Recovered Data Header, Recovered Data Trailer, Signed Data Format and Hash
Algorithm Indicator.
3. Build the Dynamic Application Data using the Terminal Dynamic Data request field and fields extracted from the
Recovered Data.
4. Calculate the hash result for the Dynamic Application Data using the hash algorithm indicated by Hash Algorithm
Indicator in the Recovered Data. [Currently, SHA-1 is the only approved hash algorithm, and is indicated by a
value of hex '01'.]
5. Compare the calculated hash result with the Hash Result field in the Recovered Data. If the two hash results are
identical, then the signature is verified.
Function usage
• Verification of the signature (i.e. data authentication) is generally performed by the terminal. This function may be
used by a card issuer wishing to test a card prior to issue.
VERIFY-ICC-STATIC-DATA (EE204C)
Request Length Type Description
Signed Static Application Var h Digital signature for the Static Application Data. The field
Data length must be equal to the length NI of the modulus of PI
rc 1 h Return Code
Signed Data Format 1 h Data fields recovered from Signed Static Application Data -
as specified in Table 5 in [5]. If there is a verification failure
Hash Algorithm Indicator 1 h these 3 fields are returned zero filled.
Data Authentication Code 2 h
This function verifies an ICC's Static Data and the associated digital signature, using an Issuer Public Key. Data
recovered from the signature block is returned in the response.
Function Modifier Reserved for possible future use; must be set to zero.
PI-Spec Key specifier for the Issuer Public Key (Formats 0-3, 81).
Static Data to be Variable length static data to be authenticated. Used to build the static application
Authenticated data.
Signed Static Application Variable length signed static application data. Used to validate the recovered
Data signature from the Issuer PK.
Verify Flag 1 byte length to represent result of validation test on the recovered signed application
data.
Signed Data Format Recovered from the signed data and PK values. EMV currently specify the signed
data format value 03.
Hash Algorithm Indicator Recovered from the signed data and PK values. EMV currently specify the Hash
Algorithm as SHA-1 value 01.
Data Authentication Code Recovered from the signed data and PK values.
Processing Steps
1. Obtain the Recovered Data, using the Signed Static Application Data with PI and its associated asymmetric
algorithm. [Currently, RSA is the only approved asymmetric algorithm.]
2. Check the values of the Recovered Data Header, Recovered Data Trailer, Signed Data Format and Hash
Algorithm Indicator.
3. Build the Static Application Data using the Static Data to be Authenticated request field and fields extracted from
the Recovered Data.
4. Calculate the hash result for the Static Application Data using the hash algorithm indicated by Hash Algorithm
Indicator in the Recovered Data. [Currently, SHA-1 is the only approved hash algorithm, and is indicated by a value
of hex '01'.]
5. Compare the calculated hash result with the Hash Result field in the Recovered Data. If the two hash results are
identical, then the signature is verified.
Function usage
• Verification of the signature (i.e. data authentication) is generally performed by the terminal. This function may be
used by a card issuer wishing to test a card prior to issue.
VERIFY-MAC-NDC-ATM (5630)
This function compares a reference MAC contained in the request message with the MAC calculated on the data
contained in the request message. The result of the comparison is reflected in the return code in the response message.
The MAC shall be computed in accordance with the NDC+ PRM (PRM 5.1-9).
rc 1 x Return Code
VERIFY-ISSUER-PK-CERT-MC (EE2043)
Request Length Type Description
PI-Spec Var K-Spec Key Specifier for the Issuer public key.
Key Type = Certificate, Data Signature
(Formats: 0-3, 81)
rc 1 h Return Code
Certificate Data Var h The data recovered from Certificate, of length equal to the
length of the CA Public Key Modulus (NCA).
This function verifies the signature, form, and content of an Issuer Public Key Certificate.
Function Modifier Reserved for possible future use; must be set to zero.
PCA-Spec Key specifier for the CA Public Key (Format 81). The Key specifier describes the complete CA
PK.
PI-Spec Key specifier for the Issuer Public Key (Formats 0-3, 81). The Key specifier in formats 0 - 3
describes the location of the key to be loaded from the ESM. The Key specifier in format 81
describes the complete Issuer PK.
Issuer Public Key Used to validate the recovered certificate data from the CA PK.
Remainder
Issuer Public Key Used to validate the recovered certificate data from the CA PK.
Exponent
Verify Flag 1 byte representing the result of validation tests on the certificate. Value 1 when validation
failed, otherwise value 0.
Certificate Data Variable length certificate data recovered from the CA PK.
Processing Steps
1. Validate the certificate and recover the Issuer Public Key.
2. Provide the recovered certificate data block.
Function usage
• The Issuer Public Key Certificate is stored for subsequent transfer to an ICC.
VERIFY-ISSUER-PK-CERT-VISA (EE2046)
Request Length Type Description
rc 1 h Return Code
This function verifies the signature, form, and content of an Issuer Public Key Certificate (CERI). It provides the
recovered certificate data for any further host checking.
Function Modifier Reserved for possible future use; must be set to zero.
PCA-Spec Key specifier for the CA Public Key (Format 81). The Key specifier describes the complete CA
PK.
PI-Spec Key specifier for the Issuer Public Key (Formats 0-3, 81). The Key specifier in formats 0 - 3
describes the location of the key to be loaded from the ESM. The Key specifier in format 81
describes the complete Issuer PK.
IPK Exponent Variable length field. Valid values are value = 3 (length = 1) and value
= 216+1 (length = 3).
Verify Flag 1 byte representing the result of validation tests on the certificate. Value 1 when validation
failed, otherwise value 0.
Certificate Data Variable length certificate data recovered from the CA PK.
Processing Steps
1. Validate the certificate and recover the Issuer Public Key, as specified in 5.3 of [5], and provide the result in Verify
Flag.
2. Provide the recovered certificate data block in Certificate Data.
Function usage
• The Issuer Public Key Certificate is stored for subsequent transfer to an ICC.
VERIFY-SIGNED-DATA (EE9006)
Request Length Type Description
rc 1 h Return Code
• The function may be used to verify that the received signed public key PK-HSM + (PK-HSM)*SK-NCR
corresponds with the public key sent to NCR.
• The function may be used to verify the signed serial number of an EPP: SN-EPP + (SN-EPP)*SK-NCR.
VERIFY-TOKEN-A2 (C860)
This function verifies the key token A2 by verifying the signature with the ATM’s public verification key and checking
the contents of the token. This function is required to support Remote Key transport on Diebold ATMs.
rc 1 x Return Code
DEA2 keys must have a 256 byte modulus length and a public key exponent value of 0x10001.
This host function is used for Australian Major Bank (AMB).
VFPE-DECRYPT (EE080B)
This function is used to decrypt data in a format preserving way. This is meant to support P2P program.
FM 1 h Function Modifier = 00
Algorithm 1 h 01 = TDES
rc 1 h Return Code
Data Var h Plain Text data in the format specified by Data Element
Type
Processing Steps
1. Extract the supplied DPK
2. For Data Element Type = 00, convert each byte of Data as unsigned integer (as a byte).
3. Check for input alphabet numbers with base number. The alphabet number should be in the range of 0 to 2^n-1.
4. Decrypt processed data with VFPE Algorithm, as described in reference [89] of Mark II, using the calculated
transaction specific data encryption key, counter, counter block length and base number.
VFPE-ENCRYPT (EE080A)
This function is used to encrypt data in a format preserving way. This is meant to support P2P program
FM 1 h Function Modifier = 00
Algorithm 1 h 01 = TDES
rc 1 h Return Code
Processing Steps
1. Extract the supplied DPK
2. For Data Element Type = 00, convert each byte of Data as unsigned integer (as a byte).
3. Check for input alphabet numbers with base number. The alphabet number should be in the range of 0 to 2^n-1.
4. Encrypt processed data with VFPE Algorithm, as described in reference [89] of Mark II, using the extracted data
encryption key, counter, counter block length and base number.
VISA-RECEIVE (4501)
This function deciphers a set of double length session keys received, from a Visa Interchange, enciphered under a
KEK, and re-enciphers them under the current Domain Master Key.
2 x Message Identifier
rc 1 x Return Code
Note:
- This function supports the Visa Dynamic Key Exchange protocol.
- Enciphered session keys input to the function are ECB enciphered by the KEKr.
- The translated keys are returned CBC enciphered under the Domain Master Key for
subsequent use with PINBLOCKTRANS-6.3 to 6.3 (AWK) and PINVERIFY-VISA (IWK).
VISA-RECEIVE-AWK (4504)
This function deciphers a double-length Acquirer Working Key received from a Visa Interchange, enciphered under an
Acquirer Dynamic Key Exchange Key, and re-enciphers it under the current Domain Master Key.
eKMv82(AKEK) Var K-Spec Acquirer Dynamic Key Exchange Key (Format: 21)
rc 1 x Return Code
Note:
- This function supports the Visa Dynamic Key Exchange protocol.
- The enciphered session key input to the function is ECB-enciphered by the AKEK, with no
variant.
- The translated key is returned CBC-enciphered under the KPEs variant of the Domain Master
Key, for subsequent use with PINBLOCKTRANS-6.3 TO 6.3.
- This function is provided as an alternative to VISA-REC (4501), for use when it is desired to
enforce key separation between the IWK and the AWK.
- The AKEK has previously been entered at the SCM console by combining the three
components of a Visa ZCMK (Zone Control Master Key) with the variant value
X’08000000000000000800000000000000’, and saving it encrypted under the KEKs variant of
the Domain Master Key.
- For key separation, the AKEK must have a different value from the IKEK used with VISA-
REC-IWK (4503). Institutions which are Visa acquirers and also Visa issuers will need to
establish separate ZCMKs with Visa.
VISA-RECEIVE-IWK (4503)
This function deciphers a double-length Issuer Working Key received from a Visa Interchange, enciphered under an
Issuer Dynamic Key Exchange Key, and re-enciphers it under the current Domain Master Key.
rc 1 x Return Code
Note:
- This function supports the Visa Dynamic Key Exchange protocol.
- The enciphered session key input to the function is ECB-enciphered by the IKEK, with no
variant.
- The translated key is returned CBC-enciphered under the KPEr variant of the Domain Master
Key, for subsequent use with PINBLOCKTRANS-6.3 to 6.3 or PINVERIFY-VISA.
- This function is provided as an alternative to VISA-REC (4501), for use when it is desired to
enforce key separation between the IWK and the AWK.
- The IKEK has previously been entered at the SCM console by combining the three
components of a Visa ZCMK (Zone Control Master Key) with the variant value
X’08000000000000000800000000000000’, and saving it encrypted under the KEKr variant of
the Domain Master Key.
- For key separation, the IKEK must have a different value from the AKEK used with VISA-
REC-AWK (4504). Institutions that are Visa acquirers and also Visa issuers will need to
establish separate ZCMKs with Visa.
WEB-SERVICE-MESSAGE (EE305B)
This function is used for both encryption and authentication for sending message as well as verification and decryption
of received message.
FM 1 h Function Modifier = 00
Method 1 h 0xXY
X = Encryption method
Y = Authentication method
X:
0 = Counter
Y:
0: MAC Algorithm 1 in ISO/IEC 9797-1 with padding method
2
00 = Refer Algorithm for MCBP v1.0
ClrMessage Var h First part of message in clear text. Can be zero length field.
EncMessage Var h Second part of the message, encrypted under the KTK or
DPK.
Can be zero length field.
Key Details Var h Key details to decrypt encrypted data. See Key Details.
rc 1 h Return Code
Encrypted message key details value for defined values of key type
IV/SV Decryption Var h In case of ECB, this must be zero length field.
In CBC, this is IV
In CTR, this is SV
IV/SV Decryption Var h In case of ECB, this must be zero length field.
In CBC this is IV
In CTR this is SV
IV/SV must be 16 bytes in length
Processing Steps
1. Read Key Category to identify if MKDK1/MKDK2 or MPK/DPK to be extracted.
2. Decrypt the identified key.
3. Check for Operation Type.
4. If Operation Type = 1, go to step 5, else step 7
5. Pass SV, Method, Keys and WSMessage for receiving data from the Mobile Payment Application, as described in
reference [83], [84], [85] of Mark II.
6. Publish the decrypted message and exit.
7. Decrypt encrypted message using Key type and Key details.
8. Concatenate clear message || decrypted message.
9. Process algorithm for protecting data sent to mobile payment, as defined in reference [83], [84], [85] of Mark II.
10. Return encrypted Message.
WRITE-USER-STORE-DATA (EE4102)
Request Length Type Description
FM 1 h Function Modifier
rc 1 h Return Code
This function stores the variable-length data at the specified location. Writing of a zero-length byte-string can be used to
delete an entry.
Note: The write operation is destructive and overwrites any previous contents of an entry
without any warning or notification.
See also
WRITE-USER-STORE-KEY (EE4100)
Request Length Type Description
FM 1 h Function Modifier
rc 1 h Return Code
This function stores a KM-encrypted key at the specified location. Although, the key specifier is stored as provided
initially, the encrypted key is decrypted and the KVC of the key is checked. If the check fails, then an error is displayed
and the key is not stored.
Note: The write operation is destructive and overwrites any previous contents of an entry
without any warning or notification.
See also
ZKA-CALC-PVN (EE0612)
Request Length Type Description
rc 1 h Return Code
This function calculates the two PVNs for a PIN and also provides the length of the PIN. The PIN is supplied in an
encrypted form, using any of the standard PIN Block formats.
ePPK(PIN Is the input formatted PIN Block containing the PIN to be verified. It must be supplied encrypted by
a PIN Protect session key (PPK).
PPK-spec Can be any valid key specifier for a PPK. Consequently, the function supports an encrypted PIN
Block encrypted using a single-length or double-length or triple-length, HSM Mark II-stored or host-
stored key.
PF Specifies the format of the supplied PIN Block, as defined for the standard PIN Translate function.
(includes formats: 1, 3, 8, 9, 10, 11 and 13).
ANB Account Number Block, which is the rightmost 12 digits of the Primary Account Number (PAN),
excluding the check digit.
*KKBLZ-spec Can be any valid key specifier for a *KKBLZ. Consequently, the function supports an encrypted
PIN Block encrypted using a single-length HSM Mark II-stored or double-length, HSM Mark II-
stored or double length host-stored key.
Expiration Year Is the last digit of the expiry year of the card.
PVN Is the returned PIN Verification Number, used to verify the user’s PIN.
The function will fail with Error Code 78 if PF indicates a PIN block format that is disabled.
ZKA-IMPORT-MK (EE0210)
Request Length Type Description
ICM 1 h 00 = No check
01 = Standard KVC
02 = MDC-2
rc 1 h Return Code
This function translates an ECB- or CBC-encrypted MK to encryption by variant 18 of the Domain Master Key for host
storage. It optionally performs an integrity check on the clear MK using the specified method. If the integrity check fails,
a return code of 08 results (and the key is not re-encrypted).
NOTES
– The key specifier 13 under the Response, are generated when using the Legacy option.
– The key specifiers 11, 13 under the Response, are generated based on the chosen operation on console and
FM. See, section Function Modifier Values.
FM = x0
The Host Key Protection using Function Modifier can be in the range of x0, where x= 0 , 1, or 2.
*KTK-spec Supports only double-length HSM Mark II-stored keys. (Formats: 0-3)
Encryption Mode Indicates the encryption setting used for the *KTK
00 = ECB Encryption Mode, and
01 = CBC Encryption Mode.
Key Type Indicates the Key Type and KM variant used to encrypt for Host storage.
ICM The Integrity Check Method - additional integrity check methods will be added later.
ICV The Integrity Check Value - This value is set to ‘00’ if the ICM is zero.
10 ‘B0’ ‘T’
11 ‘V0’
12 ‘K0’
Note: There is no appropriate key usage in TR-31 draft that matches KGK. KGK is used for key
derivation therefore key usage B0 will be used for KGK.
ZKA-MAC-GEN (EE0710)
Request Length Type Description
rc 1 h Return Code
This function generates a random encrypted MAC key, RND, and uses the clear MAC key to generate a MAC for the
provided data. The value of RND may be inserted in the data prior to calculating the MAC.
C Offset used to insert RND into Data. If zero, do not insert RND, else insert RND at specified offset,
(1 indicates insert at leftmost byte of Data).
ZKA-MAC-GEN-1 (EE0711)
Request Length Type Description
rc 1 h Return Code
This function generates a random encrypted MAC key, RND, and uses the clear MAC key to generate a MAC for the
provided data. The values of RND, Version Number and Generation Number may be inserted in the data prior to
calculating the MAC.
Offset1 If zero, do not insert RND in Data, else insert RND at specified Offset1 (01 indicates insert at
leftmost byte of Data.)
Offset2 If zero, do not insert Version Number in Data, else insert Version Number at specified Offset2 (01
indicates insert at leftmost byte of Data.)
Offset3 If zero, do not insert Generation Number in Data, else insert Generation Number at specified Offset3
(1 indicates insert at leftmost byte of Data.)
ZKA-PIN-TRANS (EE0610)
Request Length Type Description
rc 1 h Return Code
This function performs translation of both the PIN Block format and the PIN encryption key. The input PIN Block is
encrypted by a PPKi, which might be a host- or HSM Mark II-stored session key or might be a ZKA-encrypted PAC key
(RND). The output PIN Block is encrypted by a session key generated within the function. The session key is also
returned in encrypted form (RNDo).
ePPKi(PIN) Is the input formatted PIN Block containing the PIN to be verified. It must be supplied encrypted by
a PIN Protect session key (PPK).
PPKi-spec Can be any valid key specifier for a PPK. Consequently, the function supports an encrypted PIN
Block encrypted using a single-length or double-length or triple-length, HSM Mark II-stored or host-
stored key – or a ZKA terminal random number
PFi and PFo These respectively specify the format of the supplied PIN Block and of the required PIN Block, as
defined for the standard PIN Translate function (includes formats 1, 3, 8, 9, 10, 11 and 13).
NOTE: Restriction is placed on output format 8, PFi 8 – PFo8 only.
ANB Account Number Block, which is the rightmost 12 digits of the Primary Account Number (PAN),
excluding the check digit.
MK-spec A Host stored (format 13) CBC key specifier incorporating an encrypted ZKA Master Key.
ePPKo(PIN) Is the output formatted PIN Block containing the PIN to be verified. It must be supplied encrypted
by a PIN Protect session key (PPK).
RNDo Is the encrypted Session Key (Refer Session Key Derivation for details).
The function will fail with Error Code 78 if Pfi or PFo indicates a PIN block format that is disabled or conflicts with the
reformatting restrictions.
ZKA-PIN-TRANS-1 (EE0613)
Request Length Type Description
rc 1 h Return Code
This function performs translation of both the PIN Block format and the PIN encryption key. It is similar to function
ZKA-PIN-TRANS (EE0610), but derives the output PPK using an MK from the MK2 table.
The input PIN Block is encrypted by a PPKi, which might be a host- or HSM Mark II -stored session key or might be a
ZKA-encrypted PAC key (RND). The output PIN Block is encrypted by a session key generated within the function.
The session key is also returned in encrypted form (RNDo).
The function uses MK2-spec-1 to search the MK2 table for the record for Sub-type Number that has the latest Expiry
Date. The MK in this record is used to derive the PPKo. The MK2-spec-2 in the response has all fields completed from
the MK record used.
Pfi and Pfo respectively specify the format of the supplied PIN Block and of the required PIN Block, as defined for
the standard PIN Translate function (including ISO formats 0 and 1).
NOTE: Restriction is placed on output format 8, PFi 8 – PFo8 only.
ANB Account Number Block, which is the rightmost 12 digits of the Primary Account Number (PAN),
excluding the check digit.
The function will fail with Error Code 78 if Pfi or PFo indicates a PIN block format that is disabled or conflicts with the
reformatting restrictions.
ZKA-PIN-VER (EE0611)
Request Length Type Description
rc 1 h Return Code
This function performs the verification of a PIN using the ecPVN method. The PIN is supplied in encrypted form, using
any of the PIN Block formats supported by the standard product (including ISO formats 0 and 1).
ePPK(PIN) Is the input formatted PIN Block containing the PIN to be verified. It must be supplied encrypted by
a PIN Protect session key (PPK).
PPK-spec Can be any valid key specifier for a PPK. Consequently, the function supports an encrypted PIN
Block encrypted using a single-length or double-length or triple length, HSM Mark II-stored or host-
stored key.
PF Specifies the format of the supplied PIN Block, as defined for the standard PIN Translate function
(included formats: 1, 3, 8, 9, 10, 11, and 13).
ANB Account Number Block, which is the rightmost 12 digits of the Primary Account Number (PAN),
excluding the check digit.
*KKBLZ-spec Can be any valid key specifier for a *KKBLZ. Consequently, the function supports an encrypted
PIN Block encrypted using a single-length HSM Mark II-stored or double-length, HSM Mark II-
stored or double length host-stored key.
Expiration Year Is the last digit of the expiry year of the card.
PVN Is the PIN Verification Number, used to verify the user’s PIN.
The function will fail with Error Code 78 if PF indicates a PIN block format that is disabled.
This section contains a list of functions that have been superceded by another function that contains additional
functionality apart from original.
PIN 60 PIN-TRAN Allows translation of both the PIN block format and the
PIN encryption key.
72 MAC-VER Verifies that the MAC is a valid MAC for the supplied
DATA using the supplied MAC Processing Key
(MPK), in accordance with AS2805.4.
Data 80 ENCIPHER Encrypts the supplied DATA under the supplied Data
Management Protect Key (DPK), using the DES Cipher Block Chain
method and a fixed non-zero Initialisation Vector.
VISA 90 PVV-GEN-1 Calculates the PVV by using the IBM 3624 method to
produce the PIN.
AUTHENTICATION-PARAMETER-GEN (E100)
This function generates an Authentication Parameter according to Australian Standard AS2805.6.2 1988.
rc 1 h Return Code
CVV-GEN (9B)
Request Length Type Description
9B 1 h Function Code
9B 1 h Function Code
rc 1 h Return Code
This function generates a Card Verification Value (CVV) by the Visa method for card data (CVV-data).
CVK-Index A one byte BCD field that indicates which HSM stored CVK-A/B pair to use in the CVV generation
process.
CVV-Data The data from which the CVV is generated. It is up to the host to format the field correctly and to do
any required range checking on the data.
CVV The three digit Card Verification Value. The three digits are left aligned and right padded with the
hexadecimal digit "F".
CVV-VER (9C)
Request Length Type Description
9C 1 h Function Code
9C 1 h Function Code
rc 1 h Return Code
This function verifies card data (CVV-data) deriving a CVV for that data and validating it against the CVV in the request.
CVK-Index is a one byte BCD field which indicates which HSM stored CVK-A/B pair to use in the CVV generation
process.
CVV-Data is the data from which the CVV is generated. It is up to the host to format the field correctly and to do
any required range checking on the data.
CVV is the digit byte Card Verification Value. The three digits are left aligned and right padded with the
hexadecimal digit "F".
D51-PIN-TRAN (65)
Request Length Type Description
65 1 h Function Code
65 1 h Function Code
rc 1 h Return Code
This function performs translation of both the PIN Block format and the PIN Block encryption key of an encrypted PIN
Block received from a Docutel 5100 ATM.
51-PIN is the Docutel formatted PIN Block. It must contain from four to six numeric PIN digits, left
justified and terminated to the right with a single hex 'F' digit. All other digits in the PIN Block
(Julian Date and Serial Number) are ignored.
PPKi respectively specify the PIN Protect Key of the supplied PIN Block and of the required PIN
Block. If key translation is not required, PPKo must equal PPKi.
ANB is the 12-digit Account Number Block used in the formation of the clear AS/ANSI PIN Block.
The function will fail with Error Code 78 if the Docutel or ANSI/ISO 0 PIN block format is disabled.
D51-PIN-VER (66)
Request Length Type Description
66 1 h Function Code
66 1 h Function Code
rc 1 h Return Code
This function performs the verification of a PIN in a DOCUTEL 5100 formatted PIN Block, using the IBM 3624 method.
PVK- identifies the PVKn, DTn, and MINPINn appropriate to the PIN verification procedure.
Index
D51-PIN is the DOCUTEL 5100 formatted PIN Block containing the PIN to be verified. It must be
supplied encrypted by a PIN Protect Key (PPK).
PAN is the Primary Account Number (or other card data) used in the verification procedure. It
must be padded appropriately prior to input to this function.
Offset consists of up to 12 digits of Offset data. The significant digits must be left-justified in the
field. Unused digits are ignored. If Offsets are not used, the significant digits must be zeros.
The function will fail with Error Code 78 if the Docutel PIN block format is disabled.
DECIPHER (81)
Request Length Type Description
81 1 h Function Code
81 1 h Function Code
rc 1 h Return Code
This function DES decrypts the supplied encrypted DATA using the supplied Data Protect Key (DPK), the Cipher Block
Chaining mode of operation and a fixed Initialization Vector having a value of X’555555555555555555.
DECIPHER-ECB (83)
Request Length Type Description
83 1 h Function Code
83 1 h Function Code
rc 1 h Return Code
This function decrypts the supplied encrypted DATA using the supplied Data Protect Key (DPK) and the DES in
Electronic Code Book mode.
ENCIPHER (80)
Request Length Type Description
80 1 h Function Code
80 1 h Function Code
rc 1 h Return Code
This function DES encrypts the supplied DATA using the supplied Data Protect Key (DPK), the Cipher Block Chaining
mode of operation and a fixed Initialization Vector having a value of X’555555555555555555.
ENCIPHER-ECB (82)
Request Length Type Description
82 1 h Function Code
82 1 h Function Code
rc 1 h Return Code
This function encrypts the supplied DATA under the supplied Data Protect Key (DPK), using the DES in Electronic
Code Book mode.
GEN-SESS-KEYS (4A)
Request Length Type Description
4A 1 h Function Code
4A 1 h Function Code
rc 1 h Return Code
1eKTM(KS) 8 B64 Encrypted Session Key
1eKMx(KS) 8 B64 Session Key
1 This pair of fields will occur one or more times in the response
This function generates a set of random session keys for an EFT terminal. For distribution to the terminal the session
keys are encrypted by the Terminal Master Key (KTM), and for host storage and subsequent use with other functions
they are encrypted by variants of the Domain Master Key.
Key Flags Indicates the session keys to generate. The function response will contain one or more sets of
encrypted key fields as shown: one set for each bit set in the flags. The bit positions are allocated as
follows:
eKTM(KS) These fields form a key set. The response incorporates a key set for each bit (validly) set in the Key
eKMx(KS) flag field. The order of the returned key sets is the same order that the keys are specified in the Key
flag field.
II-DPK-GEN (53)
Request Length Type Description
53 1 h Function Code
n 1 d KIS Index
53 1 h Function Code
rc 1 h Return Code
This function generates a random initial interchange Data Protect Key (DPK).
For transmitting to the receiving institution, the key is returned encrypted under the Interchange Sending Key (KISn)
indicated by the specified index (KIS Index). It is also returned encrypted under the KM, for storage within the host.
eKM(DPK) is the host stored session key encrypted under the KM.
Notes
– This function will check the length of KISn and use the appropriate encryption method.
– When there is no variant scheme chosen for the KIS, this function will be automatically disabled. In such a
case the function can be manually enabled from the console by selecting “Enable function for data key
generation” under the KIS Options dialog.
– Please refer to the Console Guide for directions on how to set options for the KIS.
– This function is superceded by function EE0402.
II-DPK-RCV (56)
Request Length Type Description
56 1 h Function Code
n 1 d KIR Index
56 1 h Function Code
rc 1 h Return Code
This function takes an Interchange Data Protect Key (DPK) that has already been encrypted under the Interchange
Receive Key (KIRn) indicated by the supplied index (KIR Index), and re-encrypts it under the KM, for storage within the
host.
eKM(DPK) is the host stored session key encrypted under the KM.
Notes
– This function will check the length of KIRn and use the appropriate encryption method.
– When there is no variant scheme chosen for the KIR, this function will be automatically disabled. In such a
case, this function can be manually enabled from the console by selecting “Enable function for receiving of data
keys” under the KIR Options dialog.
– This function is superceded by function EE0403.
II-MPK-GEN (52)
Request Length Type Description
52 1 h Function Code
n 1 d KIS Index
52 1 h Function Code
rc 1 h Return Code
This function generates a random initial interchange MAC Protect Key (MPK).
For transmitting to the receiving institution, the key is returned encrypted under variant 2 of the Interchange Sending
Key (KISn) indicated by the specified index (KIS Index). It is also returned encrypted under KM variant 2, for storage
within the host.
eKISnv2(MPK) is the session key encrypted under variant 1 of KISn. The variant is determined by the variant
scheme associated with KISn.
eKMv2(MPK) is the host stored session key encrypted under variant 1 of the KM.
Notes
– This function will check the length of KISn and use the appropriate encryption method.
– This function is superceded by function EE0402.
II-MPK-RCV (55)
Request Length Type Description
55 1 h Function Code
n 1 d KIR Index
55 1 h Function Code
rc 1 h Return Code
This function takes an Interchange MAC Protect Key (MPK) that has already been encrypted under the Interchange
Receive Key (KIRn) indicated by the supplied index (KIR Index), and re-encrypts it under KM variant 2, for storage
within the host.
eKIRnv2 is the session key encrypted under variant 2 of KIRn. The variant is determined by the variant scheme
(MPK) associated with KIRn.
eKMv2 is the host stored session key encrypted under variant 2 of the KM.
(MPK)
Notes
– This function will check the length of KIRn and use the appropriate encryption method.
– This function is superceded by function EE0403.
II-PPK-GEN (51)
Request Length Type Description
51 1 h Function Code
n 1 d KIS Index
51 1 h Function Code
rc 1 h Return Code
This function generates a random initial interchange PIN Protect Key (PPK).
For transmitting to the receiving institution, the key is returned encrypted under variant 1 of the Interchange Sending
Key (KISn) indicated by the specified index (KIS Index). It is also returned encrypted under KM variant 1, for storage
within the host.
eKISnv1(PPK) is the session key encrypted under variant 1 of KISn. The variant is determined by the variant
scheme associated with KISn.
KIS range = 01 - 99.
eKMv1(PPK) is the host stored session key encrypted under variant 1 of the KM.
Notes
– This function will check the length of KISn and use the appropriate encryption method.
– This function is superceded by function EE0402.
II-PPK-RCV (54)
Request Length Type Description
54 1 h Function Code
n 1 d KIR Index
54 1 h Function Code
rc 1 h Return Code
This function takes an Interchange PIN Protect Key (PPK) that has already been encrypted under variant 1 of the
Interchange Receive Key (KIRn) indicated by the supplied index (KIR Index), and re-encrypts it under KM variant 1, for
storage within the host.
eKIRnv1 is the session key encrypted under variant 1 of KIRn. The variant is determined by the variant
(PPK) scheme associated with KIRn.
eKMv1(PPK) is the host stored session key encrypted under variant 1 of the KM.
Notes
– This function will check the length of KIRn and use the appropriate encryption method.
– This function is superceded by function EE0403.
IT-DPK-GEN (43)
Request Length Type Description
43 1 h Function Code
n 1 D KTM Index
43 1 h Function Code
rc 1 h Return Code
This function generates a random initial Data Protect Key (DPK) for an EFT terminal.
For transmitting to the EFT terminal, the key is returned encrypted under the Terminal Master Key (KTMn) indicated by
the specified index (KTM index). It is also returned encrypted under the KM, for storage within the host.
IT-MPK-GEN (42)
Request Length Type Description
42 1 h Function Code
n 1 D KTM Index
42 1 h Function Code
rc 1 h Return Code
This function generates a random initial MAC Protect Key (MPK) for an EFT terminal.
For transmitting to the EFT terminal, the key is returned encrypted under the Terminal Master Key (KTMn) indicated by
the specified index (KTM index). It is also returned encrypted under KM Variant 2, for storage within the host.
IT-PPK-GEN (41)
Request Length Type Description
41 1 h Function Code
n 1 D KTM Index
41 1 h Function Code
rc 1 h Return Code
This function generates a random initial PIN Protect Key (PPK) for an EFT terminal.
For transmitting to the EFT terminal, the key is returned encrypted under the Terminal Master Key (KTMn) indicated by
the specified index (KTM Index). It is also returned encrypted under the Master Key Variant 1(KMv1) for storage within
the host.
Notes
– This function is superceded by function EE0400.
– This function only supports use of the first 99 KTMs.
MAC-GEN (70)
Request Length Type Description
70 1 h Function Code
70 1 h Function Code
rc 1 h Return Code
This function generates a 32-bit Message Authentication Code (MAC) for the supplied DATA using the supplied MAC
Protect Key (MPK), in accordance with AS2805.4 1985.
MAC-TRAN (71)
Request Length Type Description
71 1 h Function Code
71 1 h Function Code
rc 1 h Return Code
This function verifies that MACi is a valid MAC for Data using MPKi, and generates a new MAC (MACo) using MPKo.
MAC-VER (72)
Request Length Type Description
72 1 h Function Code
72 1 h Function Code
rc 1 h Return Code
This function verifies that the MAC is a valid MAC for the supplied DATA using the supplied MAC Protect Key (MPK),
in accordance with AS2805.4 1985.
NI-DPK-GEN (59)
Request Length Type Description
59 1 h Function Code
59 1 h Function Code
rc 1 h Return Code
This function generates a new random Data Protect Key (DPKn+1) for an Interchange.
For transmitting to the receiving node, the key is returned encrypted under the supplied previous Data Protect Key
(DPKn). It is also returned encrypted under the KM, for storage within the host system.
NI-DPK-RCV (5C)
Request Length Type Description
5C 1 h Function Code
5C 1 h Function Code
rc 1 h Return Code
This function allows a Data Protect Key roll-over for the remote Interchange.
The remote Interchange receives a new Data Protect Key (DPKn+1) encrypted under the current one (DPKn) and sends
it together with the current Data Protect Key encrypted under the KM to the HSM.
NI-MPK-GEN (58)
Request Length Type Description
58 1 h Function Code
58 1 h Function Code
rc 1 h Return Code
This function generates a new random MAC Protect Key (MPKn+1) for an Interchange.
For transmitting to the receiving node, the key is returned encrypted under the supplied previous MAC Protect Key
(MPKn). It is also returned encrypted under KM Variant 2, for storage within the host system.
NI-MPK-RCV (5B)
Request Length Type Description
5B 1 h Function Code
5B 1 h Function Code
rc 1 h Return Code
This function allows a MAC Protect Key roll-over for the interchange.
The node receives a new MAC Protect Key (MPKn+1) encrypted under the current one (MPKn) and sends it together
with the current MAC Protect Key encrypted under KM Variant 2 to the HSM. The HSM returns the new MAC Protect
Key encrypted under KM Variant 2, for storage within the host.
NI-PPK-GEN (57)
Request Length Type Description
57 1 h Function Code
57 1 h Function Code
rc 1 h Return Code
This function generates a new random PIN Protect Key (PPKn+1) for an Interchange.
For transmitting to the receiving node, the key is returned encrypted under the supplied previous PIN Protect Key
(PPKn). It is also returned encrypted under KM Variant1, for storage within the host system.
NI-PPK-RCV (5A)
Request Length Type Description
5A 1 h Function Code
5A 1 h Function Code
rc 1 h Return Code
This function allows a PIN Protect Key roll-over for the interchange.
The node receives a new PIN Protect Key (PPKn+1) encrypted under the current one (PPKn) and sends it together with
the current PIN Protect Key encrypted under KM Variant 1 to the HSM. The HSM returns the new PIN Protect Key
encrypted under KM Variant 1, for storage within the host.
NT-DPK-GEN (46)
Request Length Type Description
46 1 h Function Code
46 1 h Function Code
rc 1 h Return Code
This function generates a new random Data Protect Key (DPKn+1) for an EFT Terminal.
For transmitting to the EFT Terminal, the key is returned encrypted under the supplied previous Data Protect Key
(DPKn). It is also returned encrypted under the KM, for storage within the host system.
NT-MPK-GEN (45)
Request Length Type Description
45 1 h Function Code
45 1 h Function Code
rc 1 h Return Code
This function generates a new random MAC Protect Key (PPKn+1) for an EFT Terminal.
For transmitting to the EFT Terminal, the key is returned encrypted under the supplied previous MAC Protect Key
(MPKn). It is also returned encrypted under KM Variant 2, for storage within the host system.
NT-PPK-GEN (44)
Request Length Type Description
44 1 h Function Code
44 1 h Function Code
rc 1 h Return Code
This function generates a new random PIN Protect Key (PPKn+1) for an EFT Terminal.
For transmitting to the EFT Terminal, the key is returned encrypted under the supplied previous PIN Protect Key
(PPKn). It is also returned encrypted under KM Variant 1, for storage within the host system.
PIN-OFF-AS (6A)
Request Length Type Description
6A 1 h Function Code
6A 1 h Function Code
rc 1 h Return Code
This function generates an Offset for an AS/ANSI formatted PIN. The PIN Block must be supplied encrypted under a
PIN Protect Key (PPK).
Offset digits for all PIN digits are returned. If CHKLEN is to be set to be less than the PINLEN in a PIN Verification
function, then the significant digits must be selected from the returned Offset. These digits must then be passed left
aligned and right padded in the Offset field of the appropriate PIN Verification function.
See IBM 3624 PIN Verification Method for a more detailed overview of the PIN verification procedure and for examples
on selecting significant Offset digits.
PVK-Index identifies the PVKn, DTn, and MINPINn appropriate to the PIN verification procedure.
AS-PIN is the AS/ANSI formatted PIN Block containing the PIN to be verified. It must be supplied encrypted
by a PIN Protect session key (PPK).
PAN the Primary Account Number used in the verification procedure. It must be padded appropriately prior
to input to this function.
ANB is the 12-digit Account Number Block used in the formation of the clear AS/ANSI PIN Block.
A Return Code of 07 indicates that the format of the PIN Block in the request is incorrect. A Return Code of 0B
indicates that PINLEN is less than MINPIN.
The customer's current PIN should be verified before this function is called. The function will fail with Error Code 78 if
the ANSI/ISO 0 PIN block format is disabled.
The function performs a check that the ANB field and the PAN field (Validation Data) contain a number of consecutive
digits in common. The number of digits to check is in the range 0 to 12, as may be specified using a console operation,
and defaults to 8. If the number of digits to check has been set to 0 the check is disabled, and the function accepts any
supported PIN block format that is enabled. If the number of digits to check is greater than 0, then only ISO-0 and ISO-3
PIN blocks are allowed, if enabled. If the check fails, the function will fail with Return Code 79.
PIN-OFF-PP (6B)
Request Length Type Description
6B 1 h Function Code
6B 1 h Function Code
rc 1 h Return Code
This function generates an Offset for a IBM 3624 formatted PIN. The PIN Block must be supplied encrypted under a
PIN Protect Key (PPK).
Offset digits for all PIN digits are returned. If CHKLEN is to be set to be less than the PINLEN in a PIN Verification
function, then the significant digits must be selected from the returned Offset. These digits must then be passed left
aligned and right padded in the Offset field of the appropriate PIN Verification function. See IBM 3624 PIN Verification
Method for a more detailed overview of the PIN verification procedure and for examples on selecting significant Offset
digits.
PVK-Index identifies the PVKn, DTn, and MINPINn appropriate to the PIN verification procedure.
PAN the Primary Account Number used in the verification procedure. It must be padded appropriately prior
to input to this function.
A Return Code of 07 indicates that the format of the PIN Block in the request is incorrect. A Return Code of 0B
indicates that PINLEN is less than MINPIN.
The current customer's PIN should be verified before this function is called.
The function will fail with Error Code 78 if the IBM 3624 PIN block format is disabled.
As the encrypted PIN block does not incorporate the account number (ANB) this function requires that the number of
consecutive digits in common between the ANB and PAN field (Validation Data) is set to 0, otherwise the function will
fail with Return Code 79. The number of digits to check is in the range 0 to 12, as may be specified using a console
operation, and defaults to 8.
PIN-TRAN (60)
Request Length Type Description
60 1 h Function Code
60 1 h Function Code
rc 1 h Return Code
This function allows translation of both the PIN Block format and the PIN encryption key.
PFi and PFo respectively specify the format of the supplied PIN Block and of the required PIN Block. If format
translation is not required, the PFi and PFo fields must be set to the same value. The valid field
values are:
1 = AS/ANSI format
3 = IBM 3624 format
PPKi and respectively specify the PIN Protect Key of the supplied PIN Block and of the required PIN Block.
PPKo If key translation is not required, PPKo must equal PPKi.
ANB is the 12-digit Account Number Block used in the formation of the clear AS/ANSI PIN Block.
The function will fail with Error Code 78 if Pfi or PFo indicates a PIN block format that is disabled or conflicts with the
reformatting restrictions.
PIN-TRAN-1 (94)
Request Length Type Description
94 1 h Function Code
94 1 h Function Code
rc 1 h Return Code
This function performs a PIN Translation from the local Key (PPK) to the Visa Acquirer Key (AWK).
The function will fail with Error Code 78 if the ANSI/ISO 0 PIN block format is disabled.
PIN-TRAN-2-VISA (95)
Request Length Type Description
95 1 h Function Code
95 1 h Function Code
rc 1 h Return Code
This function performs a PIN Translation from a Visa Issuer Key (IWK) to the local Key (PPK).
The function will fail with Error Code 78 if the ANSI/ISO 0 PIN block format is disabled.
PIN-VER-AS (61)
Request Length Type Description
61 1 h Function Code
61 1 h Function Code
rc 1 h Return Code
This function performs the verification of a PIN in an AS/ANSI formatted PIN Block, using the IBM 3624 method.
PVK-Index identifies the PVKn, DTn, and MINPINn appropriate to the PIN verification procedure.
AS-PIN is the AS/ANSI formatted PIN Block containing the PIN to be verified. It must be supplied encrypted
by a PIN Protect session key (PPK).
PAN is the Primary Account Number (or other card data) used in the verification procedure. It must be
padded appropriately prior to input to this function.
ANB is the 12-digit Account Number Block used in the formation of the clear AS/ANSI PIN Block.
Offset consists of up to 12 digits of Offset data. The significant digits must be left-justified in the field. Unused
digits are ignored. If Offsets are not used, the significant digits must be zeros.
The function will fail with Error Code 78 if the ANSI/ISO 0 PIN block format is disabled.
PIN-VER-PP (62)
Request Length Type Description
62 1 h Function Code
62 1 h Function Code
rc 1 h Return Code
This function verifies a PIN in a IBM 3624 formatted PIN Block using the IBM 3624 method.
PVK-Index identifies the PVKn, DTn, and MINPINn appropriate to the PIN verification procedure.
PP-PIN is the formatted PIN Block containing the PIN to be verified. It must be supplied encrypted by a PIN
Protect session key (PPK).
PAN is the Primary Account Number (or other card data) used in the verification procedure. It must be
padded appropriately prior to input to this function.
Offset consists of up to 12 digits of Offset data. The significant digits must be left-justified in the field.
Unused digits are ignored. If Offsets are not used, the significant digits must be zeros.
In general, the function may be used to verify a IBM 3624 formatted PIN Block supplied encrypted by a host stored
PPK, if the PIN Block has been received either from a terminal or from an interchange. However, in the interchange
situation it is recommended that the Acquirer institution translates the PIN Block to AS/ANSI format prior to routing the
transaction to the Issuer. The Issuer would then use the PIN-VER function to verify the PIN.
The function will fail with Error Code 78 if the IBM 3624 PIN block format is disabled.
PVV-CHANGE (9A)
Request Length Type Description
9A 1 h Function Code
9A 1 h Function Code
rc 1 h Return Code
This function generates a PVV for the encrypted PIN in the request. If the PIN is not in AS/ANSI format, a PIN format
error (Return Code 07) is returned in the response.
The request also includes an index to select the PVK-A/B pair that is to be used in the PVV generation process. The
PVKI that is contained in the TSP12 is no longer used as an index. This allows the host to dictate which key pairs are
associated with each card base.
The PVVK-index has a range of 1 to 36. The PVKI has a range of 1 to 6.
PVVK- identifies the PVK-A/B pair, which are to be used in the derivation of the PVV and must be in BCD
Index format.
AS-PIN is the AS 2805.3 1985 formatted PIN Block containing the PIN the PVV is to be generated for. It must
be supplied encrypted by a PIN Protect session Key (PPK).
ANB is the 12-digit Account Number Block (a PAN element of the clear PIN Block).
TSP12 is the leftmost 12 digits of the TSP and consists of 11 PAN digits followed by the appropriate one digit
PVKI.
The function will fail with Error Code 78 if the ANSI/ISO 0 PIN block format is disabled.
The function performs a check that the ANB field and the TSP12 field contain a number of consecutive digits in
common. The number of digits to check is in the range 0 to 12, as may be specified using a console operation, and
defaults to 8. If the number of digits to check has been set to 0 the check is disabled. If the check fails, the function will
fail with Return Code 79.
PVV-GEN-1 (90)
Request Length Type Description
90 1 h Function Code
90 1 h Function Code
rc 1 h Return Code
This function calculates the PVV by using the IBM 3624 method to produce the PIN. The four leftmost digits of the
derived or random PIN are appended to the TSP12 to form the TSP.
PVK-Index identifies the PVKn and DECTABn appropriate to the PIN Generation method.
Note: Whenever PVK keys are used a corresponding decimalization table is used. Additionally in some
functions, the PIN Length must exist. Therefore when entering PVKs the user should also enter the
corresponding decimalization table PIN Length for each PVK.
PAN is the 16-digit field which is encrypted using PVKn and decimalized using DECTABn to produce the
leftmost four digits of the derived PIN.
Offset4 is the leftmost 4 digits of Offset data which is modulo-10 added to the derived PIN to produce the
random PIN. If random PINs are not used this field should be set to zeros.
TSP12 is the leftmost 12 digits of the TSP and consists of 11 PAN digits followed by the appropriate one digit
PVKI.
The PVV is calculated using an HSM stored PVK-A/B pair. This function uses the PVKI as the PVK-A/B index, hence
only the first six of the thirty-six key pairs may be referenced.
PVV-GEN-2 (96)
Request Length Type Description
96 1 h Function Code
96 1 h Function Code
rc 1 h Return Code
This function is similar to the Visa function PVV-GEN-1 (Function Code 90), except that the request includes an index
to select the PVK-A/B pair, which is to be used in the verification process. The PVKI that is contained in the TSP12 is
no longer used as an index. This allows the host to dictate which key pairs are associated with each card base.
The PVVK-index has a range of 1 to 36. The PVKI has a range of 1 to 6.
PVVK-Index identifies the PVK-A/B pair that is to be used in the derivation of the PIN and must be in BCD format.
PVK-Index identifies the PVKn and DECTABn appropriate to the PIN Generation method.
Note: Whenever PVK keys are used a corresponding decimalization table is used. Additionally in
some functions, the PIN Length must exist. Therefore when entering PVKs the user should also enter
the corresponding decimalization table PIN Length for each PVK.
PAN is the 16-digit field which is encrypted using PVKn and decimalized using DECTABn to produce the
leftmost four digits of the derived PIN.
Offset4 is the leftmost 4 digits of Offset data which is modulo-10 added to the derived PIN to produce the
random PIN. If random PINs are not used this field should be set to zeros.
TSP12 is the leftmost 12 digits of the TSP and consists of 11 PAN digits followed by the appropriate one digit
PVKI.
PVV-VER-1 (91)
Request Length Type Description
91 1 h Function Code
91 1 h Function Code
rc 1 h Return Code
This function verifies an Issuer AS 2805.3 1985 formatted PIN by using the Visa PVV method.
AS-PIN is the AS 2805.3 1985 formatted PIN Block containing the PIN to be verified.
ANB is the 12-digit Account Number Block (a PAN element of the clear PIN Block).
TSP12 is the leftmost 12 digits of the TSP and consists of 11 PAN digits followed by the appropriate one digit
PVKI.
PVV is the PIN Verification Value used to verify the calculated PVV.
The PVKI is used as the PVK-A/B index, hence only the first six of the thirty-six key pairs may be referenced.
The function will fail with Error Code 78 if the ANSI/ISO 0 PIN block format is disabled.
PVV-VER-2 (92)
Request Length Type Description
92 1 h Function Code
92 1 h Function Code
rc 1 h Return Code
This function performs a local PIN verification of a PIN in an AS 2805.3 1985 formatted PIN Block using the Visa PVV
method.
AS-PIN is the AS 2805.3 1985 formatted PIN Block containing the PIN to be verified. It must be supplied
encrypted by a PIN Protect session key (PPK).
ANB is the 12-digit Account Number Block (a PAN element of the clear PIN Block).
TSP12 is the leftmost 12 digits of the TSP and consists of 11 PAN digits followed by the appropriate one digit
PVKI.
PVV is the PIN Verification Value used to verify the calculated PVV.
The PVKI is used as the PVK-A/B index, hence only the first six of the thirty-six key pairs may be referenced.
The function will fail with Error Code 78 if the ANSI/ISO 0 PIN block format is disabled.
PVV-VER-3 (93)
Request Length Type Description
93 1 h Function Code
93 1 h Function Code
rc 1 h Return Code
This function performs a local PIN verification of a IBM 3624 formatted PIN by using the Visa PVV method (PIN must
be left-justified).
PP-PIN is the IBM 3624 formatted PIN Block containing the PIN to be verified. It must be supplied encrypted by a
PIN Protect session key (PPK).
TSP12 is the leftmost 12 digits of the TSP and consists of 11 PAN digits followed by the appropriate one digit
PVKI.
PVKI is the PIN Verification Key Indicator used to identify the PVK pair (PVK-A and PVK-B) and to build the
Transformed Security Parameter (TSP) for the PIN verification procedure.
PVV is the PIN Verification Value used to verify the calculated PVV.
The PVKI is used as the PVK-A/B index, hence only the first six of the thirty-six key pairs may be referenced.
The function will fail with Error Code 78 if the IBM 3624 PIN block format is disabled.
PVV-VER-4 (97)
Request Length Type Description
97 1 h Function Code
97 1 h Function Code
rc 1 h Return Code
This function is similar to the Visa function PVV-VER-1 (Function Code 91), except that the request includes an index
to select the PVK-A/B pair which is to be used in the verification process. The PVKI which is contained in the TSP12 is
no longer used as an index. This allows the host to dictate which key pairs are associated with each card base.
The PVVK-index has a range of 1 to 36. The PVKI has a range of 1 to 6.
A Return Code of 00 indicates that the PIN is verified. A 07 indicates that the format of the PIN Block in the request is
incorrect, and a 08 indicates PIN verification failure.
PVVK-Index identifies the PVK-A/B pair, which are to be used in the derivation of the PVV and must be in BCD
format.
AS-PIN is the AS2805.3 1985 formatted PIN Block containing the PIN to be verified.
ANB is the 12-digit Account Number Block (a PAN element of the clear PIN Block).
TSP12 is the leftmost 12 digits of the TSP and consists of 11 PAN digits followed by the appropriate one digit
PVKI.
PVV is the PIN Verification Value used to verify the calculated PVV.
The function will fail with Error Code 78 if the ANSI/ISO 0 PIN block format is disabled.
PVV-VER-5 (98)
Request Length Type Description
98 1 h Function Code
98 1 h Function Code
rc 1 h Return Code
This function is similar to the Visa function PVV-VER-2 (Function Code 92), except that the request includes an index
to select the PVK-A/B pair that is to be used in the verification process. The PVKI that is contained in the TSP12 is no
longer used as an index. This allows the host to dictate which key pairs are associated with each card base.
The PVVK-index has a range of 1 to 36. The PVKI has a range of 1 to 6.
A Return Code of 00 indicates that the PIN is verified. A 07 indicates that the format of the PIN Block in the request is
incorrect, and a 08 indicates PIN verification failure.
PVVK-Index identifies the PVK-A/B pair, which are to be used in the derivation of the PVV and must be in BCD
format.
AS-PIN is the AS 2805.3 1985 formatted PIN Block containing the PIN to be verified. It must be supplied
encrypted by a PIN Protect session key (PPK).
ANB is the 12-digit Account Number Block (a PAN element of the clear PIN Block).
TSP12 is the leftmost 12 digits of the TSP and consists of 11 PAN digits followed by the appropriate one digit
PVKI.
PVV is the PIN Verification Value used to verify the calculated PVV.
The function will fail with Error Code 78 if the ANSI/ISO 0 PIN block format is disabled.
PVV-VER-6 (99)
Request Length Type Description
99 1 h Function Code
99 1 h Function Code
rc 1 h Return Code
This function is similar to the Visa function PVV-VER-3 (Function Code 93), except that the request includes an index
to select the PVK-A/B pair that is to be used in the verification process. The PVKI that is contained in the TSP12 is no
longer used as an index. This allows the host to dictate which key pairs are associated with each card base.
The PVVK-index has a range of 1 to 36. The PVKI has a range of 1 to 6.
A Return Code of 00 indicates that the PIN is verified. A 07 indicates that the format of the PIN Block in the request is
incorrect, and a 08 indicates PIN verification failure.
PVVK-Index identifies the PVK-A/B pair that is to be used in the derivation of the PVV and must be in BCD format.
PP-PIN is the IBM 3624 formatted PIN Block containing the PIN to be verified. It must be supplied encrypted
by a PIN Protect session key (PPK).
TSP12 is the leftmost 12 digits of the TSP and consists of 11 PAN digits followed by the appropriate one digit
PVKI.
PVV is the PIN Verification Value used to verify the calculated PVV.
The function will fail with Error Code 78 if the IBM 3624 0 PIN block format is disabled.
TermKeyInit-6.4 (3130)
This function randomly generates a set of initial keys and data for an Australian Standard AS2805.6.4 2001 terminal
(*KEK1, *KEK2, PPASN). These keys are encrypted under *KTK for transmission to the terminal and the appropriate
variants of KM for storage on the host.
n 1 h Index of *KTK
rc 1 h Return Code
TERM-VER (4C)
Request Length Type Description
4C 1 h Function Code
n 1 d KTM Index
4C 1 h Function Code
rc 1 h Return Code
This function verifies the validity of an EFT terminal by checking that the Logon-Data is equal to the result of encrypting
its Security Number (SEC-No) under its Base Key.
VAR-PIN-VER (67)
Request Length Type Description
67 1 h Function Code
67 1 h Function Code
rc 1 h Return Code
This function verifies an AS/ANSI formatted PIN. The PIN Block must be supplied encrypted under a PIN Protect Key
(PPK).
PVK-index identifies the PVKn, DTn, and MINPINn appropriate to the PIN verification procedure.
AS-PIN is the AS/ANSI formatted PIN Block containing the PIN to be verified. It must be supplied encrypted by
a PIN Protect session key (PPK).
PAN the Primary Account Number used in the verification procedure. It must be padded appropriately prior to
input to this function.
ANB is the 12-digit Account Number Block used in the formation of the clear AS/ANSI PIN Block.
CHKLEN the CHKLEN field contains the number of PIN digits to be checked and may be less than, or equal to,
the actual length of the PIN. The significant Offset digits must be supplied left aligned and right padded
in the Offset field.
Offset consists of up to 12 digits of Offset data. The significant digits must be left- justified in the field. Unused
digits are ignored. If Offsets are not used, the significant digits must be zeros.
The function will fail with Error Code 78 if the ANSI/ISO 0 PIN block format is disabled.
See IBM 3624 PIN Verification Method for a more detailed overview of the PIN verification procedure.
VAR-PIN-VER-PP (68)
Request Length Type Description
68 1 h Function Code
68 1 h Function Code
rc 1 h Return Code
This function verifies a IBM 3624 formatted PIN. The PIN Block must be supplied encrypted under a PIN Protect Key
(PPK).
PVK-Index identifies the PVKn, DTn, and MINPINn appropriate to the PIN verification procedure.
PAN the Primary Account Number used in the verification procedure. It must be padded appropriately prior to
input to this function.
CHKLEN The CHKLEN field contains the number of PIN digits to be checked and may be less than, or equal to,
the actual length of the PIN. The significant Offset digits must be supplied left aligned and right padded
in the Offset field.
Offset consists of up to 12 digits of Offset data. The significant digits must be left- justified in the field.
Unused digits are ignored. If Offsets are not used, the significant digits must be zeros.
The function will fail with Error Code 78 if the IBM 3624 PIN block format is disabled.
See IBM 3624 PIN Verification Method for a more detailed overview of the PIN verification procedure.
This section helps you understand various standards supported by Luna EFT.
• 3-D Secure Support
• AS2805.6.3 Support
• American Express Support
• CEPS Support
• Clear PIN Support
• Contactless Payment Card Support
• EMV Support
• Global Platform Support
• Italian Banking and Debit Card Support
• Japan PIN Support
• MasterCard Support
• MasteCard Cloud Based Payment Support
• Online Banking Support
• Remote ATM Initialization
• Smart Card Support
• Visa Support
• Visa Cloud-Based Payments Support
• Visa Data Secure Platform with Point to Point Encryption
• ZKA Support
1Transport Layer Security, a 3-D Secure protocol, and a successor to Secure Sockets Layer (SSL). The Mark II
functions include support for TLS as required for the transport of 3-D Secure messages.
KIS-SEND EE3031
KIR-REC EE3032
NODEPROOF EE3033
NODERESP EE3034
1The transaction Key Scheme, typically of use in EFTPOS systems, is a technique in which data-encrypting keys
change with each transaction in a manner that cannot be followed by a third party.
VCEPS-VER-SN EF0702
VCEPS-GEN-SN EF0703
VCEPS-MAC-VER-LSAM EF0704
VCEPS-GEN-HASH-CEP EF0F01
Luna EFT is a cornerstone component in card management, responsible for securely storing the secret keys and
processing cryptographic computations. It provides various functions related to card management, that are classified
as:
Card Issuance: Including Issuer key Pair Initialization, card personalization, and
Card Verification: Including card authentication (Static Data Authentication, Dynamic Data Authentication)
Luna EFT supports the standards of some of the best known payment cards, such as MasterCard® PayPass™, and
Visa payWave™.
MasterCard PayPass
Calculation of the PayPass CVC3 uses a unique-per-card derived key, KDCVC3, which is derived from a Master Key,
IMKCVC.The extension defined here supports:
• Console operations for user management of the IMKCVC.
• A host function that derives the KDCVC3 and calculates IVCVC3 (for personalization of the ICC).
• A host function that derives the KDCVC3 from IMKCVC and then generates the CVC3.
• A host function that derives the KDCVC3 from IMKCVC and then verifies the CVC3.
The calculation of a CVC3 differs from that of a static CVC (or CVV) in that it is a 3DES encryption of a single 8-byte
block, and the CVC3 is the rightmost 4 hex digits (2-bytes) rather than the left 3 digits after decimalization.
A card that supports both EMV debit/credit and PayPass requires 2 public key certificates in support of DDA. A
function is provided that creates an additional certificate, thereby supplementing the existing CI functions that generate
the ICC key pair and certificate.
Visa payWave
Visa payWave embraces three contactless card technologies: Magnetic Stripe Data (MSD), qVSDC and contactless
VSDC.
In MSD, the contactless card presents a virtual magnetic stripe to the reader. The significant difference from a real
magnetic stripe is that the virtual magnetic stripe contains a dynamic CVV (dCVV) rather than a static CVV. The dCVV
is calculated using a card-stored Unique Derived Key (UDK). As for the UDKs in VSDC, this key value is unique per
card and is derived from a Master Derivation Key (MDK). This is the significant difference from the calculation of a
static CVV; there is also a difference in the data involved in the calculation, but this is of no consequence to the HSM
processing. The algorithm is identical to that for a static CVV.
Note: The IMKCVC will be used for the Visa payWave as MDK.
EMV-AC-GEN EE2000
EMV-AC-VERIFY EE2001
EMV-DAC-GEN EE2002
EMV-DAC-VERIFY EE2003
EMV-ICC-DN-GEN EE2004
EMV-ICC-DN-VERIFY EE2005
EMV-ARPC-GEN EE2006
EMV-SCRIPT-CRYPTO EE2007
EMV-VERIFY-AC-EMV-2000 EF2010
EMV-VERIFY-AC-VISA EF2011
EMV-GENERATE-ARPC EF2012
EMV-SCRIPT-CRYPTO-EMV-2000 EF2013
EMV-SCRIPT-CRYPTO-VISA EF2014
EMV-PIN-CHANGE-UNBLOCK-VISA EF2015
EMV-PIN-CHANGE-UNBLOCK EE2016
EMV-PIN-CHANGE-UNBLOCK-EMV- EE2017
2000
EMV-VERIFY-AC-GEN-ARPC EE2018
EMV-AC-GEN-MULTI EE2019
EMV-SCRIPT-CRYPTO-MULTI EE2020
EMV-PIN-CHANGE-UNBLOCK-MULTI EE2021
SELF-CERT-ISSUER-PUBLIC-KEY EE2041
VERIFY-CA-PUBLIC-KEY-MC EE2042
VERIFY-ISSUER-PK-CERT-MC EE2043
SELF-SIGN-ISSUER-PK-VISA EE2044
VERIFY-CA-PK-VISA EE2045
VERIFY-ISSUER-PK-CERT-VISA EE2046
VERIFY-DETACHED-CERT-VISA EE2047
GENERATE-ICC-KEYPAIR EE2048
GENERATE-ICC-CRT-KEYPAIR EE2058
VERIFY-ICC-CERTIFICATE EE2049
DERIVE-ICC-MASTER-KEY EE204A
SIGN-ICC-STATIC-DATA EE204B
VERIFY-ICC-STATIC-DATA EE204C
VERIFY-ICC-DYNAMIC-DATA EE204D
RSA-ENCIPHER-PIN EE204E
GENERATE-RANDOM-PIN-EMV EE204F
EXPORT-PIN-EMV EE2050
KTK-KEY-EXPORT EE2051
DERIVE-NEW-ICC-KEY-SET EE2052
DERIVE-NEW-ICC-KEY EE2053
GENERATE-DCV EE2054
1Authentication Parameter (AP), a sort of Italian proprietary PIN block needs to travel from the POS to the issuer where
the issuer authorizes a transaction by checking the received AP. In this case the encrypted Authentication Parameter
(AP) needs to be translated under the same key type (DPK) so that the translated encrypted AP is identical to the value
stored in the Issuer's data base. However, this scenario may be different for different banks.
Equivalent keys
Key Type Visa Key HSM Key
EXPORT-KEY-2 EE3061
Type Description
Struct Represents a field that contains a ‘structure’ that is made up of any number and variety of
the other fields. EPB Processing Unit and CTPV Processing Unit, described below, are
examples of the struct operator.
SK-Spec Var K-Spec Key specifier for RSA Private Key (HSM-stored) Provides the index
into the key table in Secure Memory where the key is stored.
Pre-requisites: None
Process: Decrypt and decode the RSA-encrypted PIN Block.
Result: Error Code or Plaintext PIN Block (M).
Processing Steps
1. Retrieve the index from the key specifier: SK-Spec. Read the RSA private key (SK) from the entry in the RSA Key
Pair table indicated by the index.
2. Decrypt the RSA-encrypted PIN Block, C, using SK.
3. Decode the resulting PIN Block, in accordance with PKCS #1 and using parameter string P, and thereby recovering
the message M.
4. Check that the header byte is equal to 1 or 2.
5. Check that the PIN Blocks contained in M are valid Format 2 or Format 12 PIN Blocks. If not, return an appropriate
value in Error Code.
6. Compare the provided random number, RN, with the rightmost bytes of M. If the values do not agree, return an
appropriate value of Error Code.
DataA Var h Data used in the hashing of the PIN, or in the formatting of the PIN
Block for encryption.
May be zero-length field.
KTPV-Spec Var K-Spec KTPV used to encrypt the hashed PIN or formatted PIN Block. Or
zero-length field if no encryption.
Allowed key spec for KTPV are 0-3,10,11,12,13,14,17,18
(Algorithm Identifier = 0x).
NOTES
– The characters of DataA and DataB are XOR'd with the PIN Block. If more data is available in the field than is
required, the leftmost characters are used; if insufficient characters are supplied they will be right-justified and
padded to the left with zeroes. No demand has been made that the correct number of characters are supplied,
as the application may not know whether a Format 2 or 12 PIN Block has been recovered or the length of the
Format 12 Block.
– In case the encryption algorithm and hash algorithm are non-zero, the result of hashing will be padded with 0s
to the left to make it a multiple of block size.
Header 2 h = X’5A5A’
Format 1 h =1
Trailer 2 h = X’A5A5’
CS L P P P P P/ P/ 8xP/F 8xP/F
F F
1 1 || PB || RN
2 2 || PB1 || PB2 || RN
3 3 || Data
Control 1 h =1
PB incorporates a PIN block consisting of 8, 16, 24 or 32 bytes that contains an alpha-numeric PIN (password) using a
non-standard Format 12 PIN block (explained above). The random number (RN) consists of at least 8 bytes from a
random bit stream.
The maximum length of Random Number (RN) depends on the RSA key length and the length of the hash result
produced in the PKCS#1 encoding.
Format 2
Control 1 h =2
PB1 and PB2 incorporate a PIN block consisting of 8, 16, 24 or 32 bytes that contains an alpha-numeric PIN
(password) using a non-standard Format 12 PIN block (explained above). The random number (RN) consists of at least
8 bytes from a random bit stream.
The maximum length of Random Number (RN) depends on the RSA key length and the length of the hash result
produced in the PKCS#1 encoding.
Format 3
Control 1 h =3
The plaintext block contains the user data that is to be directly encrypted, and subsequently recovered using an HSM
host function. The maximum length of Data depends on the RSA key length and the length of the hash result produced
in the PKCS#1 encoding.
Control 1 h =4
Alg 1 h = 1: 3DES
Mode 1 h = 1: ECB
= 2: CBC
The plaintext block contains the encryption parameters used in the encryption of user data. (The enciphered data must
be transported separately.)
VERIFY-ATM-RESPONSE- EE9102
DIEBOLD
VERIFY-CA-PUBLIC-KEY-MC EE2042
VERIFY-ISSUER-PK-CERT-MC EE2043
SELF-SIGN-ISSUER-PK-VISA EE2044
VERIFY-CA-PK-VISA EE2045
VERIFY-ISSUER-PK-CERT-VISA EE2046
VERIFY-DETACHED-CERT-VISA EE2047
VERIFY-ICC-CERTIFICATE EE2049
DERIVE-ICC-MASTER-KEY EE204A
VERIFY-ICC-DYNAMIC-DATA EE204D
Equivalent keys
Key Type Visa Key HSM Key
Note: A Return Code of 0A (meaning, uninitialized key accessed), will be returned whenever
an attempt is made to access an AWK or IWK which has been stored in the HSM but is not
currently selected.
VFPE-DECRYPT EE080B
TRANSLATE-VFPE-DATA-TO- EE080D
ALPHABET
TRANSLATE-VFPE-ALPHABET-TO- EE080E
DATA
MK MKLEFT MKRIGHT
CV CVLEFT CVRIGHT
Note: There is only one MK. But there are separate values for the CV and RND data, depending on the type of Session
Key (MAC or PAC) - there is a CVMAC and CVPAC and RNDMES and RNDPAC
To derive the Session Key using above definitions, the following steps are required:
• TK1 = XOR (MKLEFT | CVLEFT)
• TK2 = XOR (MKRIGHT | CVLEFT )
• TK3 = XOR (MKLEFT | CVRIGHT)
• TK4 = XOR (MKRIGHT | CVRIGHT)
• SKLEFT =d*TK1 | TK2 ( RNDLEFT )
• SKRIGHT = d*TK3 | TK4 ( RNDRIGHT )
• SK = SKLEFT | SKRIGHT
PIN Verification
PIN verification is performed with the help of two national PIN verification values, PVN 1 and PVN 2, which can be
placed on the magnetic stripe of the ec-card instead of offset 1 and offset 2. It's also possible to verify the PIN without
using the PVNs on the magnetic stripe if these are stored in a "Positive-File" in the authorization system database. In
this case only one PVN is required.
Each PVN is generated with the help of a bank specific Master Key *KKBLZ, which is valid for a particular area and card
specific data. Within this BLZ area customer account numbers are unique and multiple cards per account are
identifiable via the card sequence number. The keys can be changed depending on the card's expiration year so that a
compromise of this key is restricted in time (1 year) and scope (this bank).
PVN is calculated as follows:
PVN = e* KKBLZ (X)
The value X is formed as follows:
• All values are encoded in binary form.
Account Number 34 bits 8589939303 10 0000 0000 0000 0000 0001 0010 0110 0111
X contains unique account number information and the PIN, so that the verification value within the validity scope of the
key *KKBLZ cannot be compromised.
00 No error
05 Invalid key index: Index not defined, key with this Index not stored or incorrect key
length
06 Invalid PIN format specifier: only AS/ANSI = 1 & IBM 3624 = 3 specified
07 PIN format error: PIN does not comply with the AS2805.3 1985 specification, is in an
invalid IBM 3624 format, or is in an invalid Docutel format
08 Verification failure
09 Contents of key memory destroyed: e.g. the Luna EFT was tampered or all Keys
deleted
0A Uninitiated key accessed. Key or decimalization table (DT) is not stored in the Luna
EFT.
0B Checklength Error. Customer PIN length is less than the minimum PVK length or less
than Checklen in function.
10 Internal Error
32 No administration session
34 Invalid signature
35 KKL disabled
36 No PIN pad
50 Invalid SDF
65 Unsupported file id
66 Unsupported control id
94 Invalid algorithms
00 SUCCESSFUL RESPONSE
This code is returned (by Luna EFT or host) when a request has been successfully completed and
any validation requirements have been successful. This is not an error condition.
03 TAMPER ERROR
Luna EFT has detected that it has been tampered or lost power to its long-term storage.
04 STORAGE FULL
A request has been made to store information in Luna EFT’s long term storage, but no space exists.
05 NO RESOURCES
Luna EFT is unable to complete the request owing to insufficient resources. This condition may be
transitory.
09 VALIDATION ERROR
26 INVALID MAC
For the MACVERIFY functions, the MAC field in the request did not match the MAC calculated on
the input data field.
28 INVALID PIN
The PIN data within the transaction does not verify according to the PIN Verification method.
30 TERMPROOF FAILURE
The TERMPROOF function found a mismatch during the verify/check procedure.
32 KVC ERROR
The KVC supplied was incorrect.
3E DEA DISABLED
All pre-APCA functions that support DEA and do not have replacement/superseded function are not
removed. Single DES operations in such functions return an error response DEA DISABLED
65 UNSUPPORTED FILE ID
A Software load function call has failed.
Reference (A)
1 Integrated Circuit Card Application Specification For Debit and Credit on Chip, Version 2.0, MasterCard
International.
2 EMV ’96 Version 3.1.1, May 31, 1998 Integrated Circuit Card Application Specification for Payment Systems
3 EMV ’96 Version 3.1.1, May 31, 1998 Integrated Circuit Card Specification for Payment Systems Part IV –
Security Aspects; Annexes E and F.
4 EMV Draft version 0.5 October 31, 2000 Issuer Security Guidelines
5 EMV2000 Version 4.0 December 2000 Integrated Circuit Card Specification for Payment Systems Book 2 –
Security and Key Management
6 Europay Int'l Version 2.1 October 1999 Integrated Circuit Card (ICC) Application Specification for Pay Now
(Debit) and Pay Later (Credit) cards
7 MasterCard Int'l Version 2.1 November 1999 MasterCard Chip— Recommended Specifications for Debit and
Credit
8 Visa Int'l Version 1.4.0 October 2001 Visa Integrated Circuit Card Application Overview
9 Visa Int'l Version 1.4.0 October 2001 Visa Integrated Circuit Card (ICC) Specification
10 Common Electronic Purse Specifications – Technical Specification Version 2.3 March 2001
11 Joint Specification for Common Electronic Purse Cards Version 2.1.3 February, 2001
12 Joint Card Interface Specification for Issuers of Common Electronic Purse Cards –Volume 1 – Load,
Currency Exchange and POS Transaction Processing Version 1.0 April 2000
13 Visa Cash Electronic Purse Specifications – Technical Specification – Volume 1, Version 4.1 September
2000
14 Visa Cash Electronic Purse Specifications – Technical Specification – Volume 2, Version 4.1 January 2001
19 Diebold, Triple DES Requirements, FIRST Key – 91x Message Formats, Rev. 1.5, 26 Jun 02
20 NCR, Modifications to NDC+ to support: EPP, RSA Initial Key loading, ISO PIN Block formats, 17 Jul 01
24 X9.24 Part II, Symmetric Key Management, using asymmetric techniques for the distribution of symmetric
keys, V1.0., ..03
25 ANSI X9, TR-31 2004: Interoperable Secure Key Exchange Key Block Specification for Symmetric
Algorithms, Draft, 7 Nov 03
26 Vendor Group (ACI WorldWide, HP Atalla, Diebold, Thales e-Security, Verifone Inc.), Global Interoperable
Secure Key Exchange key Block, V2.3, 6 Dec 02
27 Verfione, Global Interoperable Secure Key Exchange (GISKE) Key Block Specification, VPN 22986 Rev C,
data unknown
28 ISO 9564-1-2002 Banking - Personal Identification Number - PIN - management and security - Part 1- Basic
principles and requirements for online PIN handling in ATM and POS systems.
29 ISO 9564-3-2003 Banking - Personal Identification Number management and security - Part 3- Requirements
for offline PIN handling in ATM and POS systems.
30 ANS X9.24-1 Retail Financial Services Symmetric Key Management Part 1 :Using Symmetric Techniques:
2004
33 Global Platform Card Specification, Global Platform, Version 2.1, June 2001.
34 Schnittstellen Spezifikation für die ZKA-Chipkarte: Secure Chip Card Operating System (SECCOS), Version
5.0, June 2001.
35 EMV Integrated Circuit Card Specification for Payment Systems: Book 2 – Security and Key Management,
Version 4.1, May 2004.
36 Specification Update Bulletin No. 46 Replacement of EMV Session Key Derivation Method First Edition
October 2005
37 American Express Global Network Services AEIPS Chip Card Specification 4.0 March 2003
39 Visa Int'l Version 1.3.2 Visa Integrated Circuit Card Card (ICC) Specification July 1999
40 ZKA Interface Specifications for the SECCOS ICC Version 6.2 18.09.2007 with revisions.
43 ANSI_X9_TR-31_Final_2005
44 Support for Derived Unique Key per Transaction (DUKPT), Version 0.3, Apr 2004
46 AEIPS Hardware Security Module (HSM) Specification by American Express, Version 4.1, May 2010
48 China Union Pay Financial Integrated Circuit (IC) Card Specification Part VII: Security Specification for
Debit/Credit Application, December 2009.
49 RFC 2246: The TLS Protocol Version 1.0 by IETF, January 1999
50 RFC 2104: HMAC: Keyed-Hashing for Message Authentication by IETF, February 1997
51 SPA Algorithm for the MasterCard Implementation of 3-D Secure v1.04 by MasterCard Int’l, 27th May 2004
53 FIPS PUB 198: The Keyed-Hash Message Authentication Code (HMAC) by NIST, 06th March 2002.
54 PKCS #11: Cryptographic Token Interface Standard v2.20 by RSA Laboratories, 28th June 2004
55 PKCS #1: RSA Cryptography Standard v2.0 by RSA Laboratories, 01st October, 1998
57 3-D Secure: Protocol Specification – Core Functions v1.0.2 with errata by Via International, 20th Jan 2004
58 3-D Secure: Functional Requirements – Access Control Server v1.0.2 with errata by Via International, 20th
Jan 2004
59 3-D Secure: Functional Requirements – Merchant Server Plug-in v1.0.2/1.0.1 with errata by Visa
International, 20th Jan 2004
60 3-D Secure: Functional Specification – Chip Card Authentication v1.0 by Visa International, 06th August 2001
61 3-D Secure: Protocol Specification – Extension for Mobile Internet Devices v1.0.2/1.0.1 with errata by Visa
International, 06th January 2003
62 3-D Secure: Protocol Specification – Extension for Voice and Messaging Channels by Visa International
63 3-D Secure: Security Requirements – Enrollment and Access Control Servers v1.1 by Visa International,
01st January 2004
64 XML Signature Syntax and Processing second edition by W3C, 10th June 2008
65 FIPS Publication 180-3 Secure Hash Standard (SHS) by NIST, October 2008
66 FIPS Publication 198 The Keyed-Hash Message Authentication Code (HMAC) by NIST, March 2002
67 TR-31 200x Interoperable Secure Key Exchange Key Block Specification for Symmetric Algorithms, 2010.
69 PKCS #7: Cryptography Message Syntax Standard by RSA Laboratories, Version 1.5, 1st November 93.
70 BPS; a Format-Preserving Encryption Proposal, by Eric Brier, Thomas Peyrin and Jacques Stern, France.
71 DKV - 7.5 PIN Code Algorithm DKV SELECTION CARD ISO code 704310, extracted from file DKV-spec-
Englisch_v2.12.pdf, Version 2.12.
73 Erdöl-Vereinigung (EV) IFSF Implementation Guidelines (EV) Guidelines Security by Franz Sidler/Reldis
Engineering AG, Version 1.0, 08 July 2010
74 EMV Integrated Circuit Card Specifications for Payment Systems, by EMVCo, LLC, Version 4.2, June 2008
75 GlobalPlatform Card Technology Secure Channel Protocol 03 Card Specification v 2.2 – Amendment D by
Global Platform version 1.1, September 2009
76 Special Publication 800-38B Recommendation for Block Cipher Modes of Operation: The CMAC Mode for
Authentication by NIST, May 2005
77 Special Publication 800-108 Recommendation for Key Derivation Using Pseudorandom Functions (Revised)
by NIST, October 2009
79 Specification Update Bulletin No. 74 AES option in EMV second edition by EMVCo, Jul 2010
80 National Standard Indonesian Chip Card Specification (NSICCS) – ATM/Debit Application Specification for
the HSM by NSICCS, June 2008
81 Retail Financial Services Symmetric Key Management Part 1: Using Symmetric Techniques by ANS X9.24-
1, October 2009
82 PKCS #1 v2.1: RSA Cryptography Standard by RSA Laboratories, 14th June 2002
86 Visa Cloud-Based Payments Contactless Specification by Visa Int’l, Version 1.3, July 2014
87 Visa Cloud Based Payments Program- Minimum requirements and Guidelines by Visa Int’l, Version 1.1, May
2014
88 Visa Cloud Based Payments Program Description by Visa Int’l, Version 1.1, May 2014
89 Visa Data Secure Platform with Point to Point Encryption (VDSP with P2PE) Hardware Security Module
Guide, Version 3.3, June, 2014
90 Payment Card Industry (PCI) Point-to-Point Encryption Solution Requirements and Testing Procedures:
Encryption, Decryption, and Key Management within Secure Cryptographic Devices, Version 1.1.1, July
2013
91 3-D Secure Functional Requirements: Access Control Server, Version 1.0.2, July 16, 2002
94 EMV, Book 1 Application Independent ICC to Terminal Interface Requirements, Version 4.3, Nov 2011
95 EMV, Book 2 Security and Key Management, Version 4.3, Nov 2011
97 EMV, Book 4 Cardholder, Attendant, and Acquirer Interface Requirements, Version 4.3, Nov 2011
98 SECCOS, Interface Specifications for the SECCOS ICC, Version 7.1, July 2014
Reference (B)
1 Integrated Circuit Card Application Specification For Debit and Credit on Chip, Version 2.0, MasterCard
International.
2 EMV ’96 Version 3.1.1, May 31, 1998, Integrated Circuit Card Application Specification for Payment
Systems.
3 EMV ’96 Version 3.1.1, May 31, 1998, Integrated Circuit Card Specification for Payment Systems Part IV –
Security Aspects; Annexes E and F.
4 EMV Draft version 0.5, October 31, 2000, Issuer Security Guidelines.
5 EMV2000 Version 4.0, December 2000, Integrated Circuit Card Specification for Payment Systems Book 2 –
Security and Key Management.
6 Europay Int'l Version 2.1, October 1999, Integrated Circuit Card (ICC) Application Specification for Pay Now
(Debit) and Pay Later (Credit) cards.
7 MasterCard Int'l Version 2.1, November 1999, MasterCard Chip— Recommended Specifications for Debit
and Credit.
8 Visa Int'l Version 1.4.0, October 2001, Visa Integrated Circuit Card Application Overview.
9 Visa Int'l Version 1.4.0, October 2001, Visa Integrated Circuit Card (ICC) Specification.
10 Common Electronic Purse Specifications – Technical Specification, Version 2.3, March 2001.
11 Joint Specification for Common Electronic Purse Cards, Version 2.1.3, February 2001.
12 Joint Card Interface Specification for Issuers of Common Electronic Purse Cards –Volume 1 – Load,
Currency Exchange and POS Transaction Processing, Version 1.0, April 2000.
13 Visa Cash Electronic Purse Specifications – Technical Specification – Volume 1, Version 4.1, September
2000.
14 Visa Cash Electronic Purse Specifications – Technical Specification – Volume 2, Version 4.1, January 2001.
17 Registration Authority (RA) Interface Specification, Europay International, Version 2.1, November 2000.
18 Visa Certificate Authority User's Guide Visa International, Version 1.2, 31 March 2001.
20 Global Platform Card Specification, Global Platform, Version 2.1, June 2001.
28 X9.24 Part II, Symmetric Key Management, using asymmetric techniques for the distribution of symmetric
keys, V1.0., ..03
29 Visa Int'l Visa Smart Debit Card (VSDC) Technical Guide to Visa’s Applet for GlobalPlatform Cards.
November 2003.
30 ISO 9564-1-2002 Banking - Personal Identification Number - PIN - management and security - Part 1- Basic
principles and requirements for online PIN handling in ATM and POS systems.
31 ISO 9564-3-2003 Banking - Personal Identification Number management and security - Part 3- Requirements
for offline PIN handling in ATM and POS systems.
35 Global Platform: Card Configuration and Script Builder Specification, Version 2.0.2, November 2000
38 Global Platform: Card Technology Secure Channel Protocol 03 Card Specification v 2.2 – Amendment D,
Version 1.1, September 2009
40 RSA Laboratories: PKCS#11, RSA Cryptography Standard, Version 2.1, June 2002
42 Visa International: Common Personalization Technical Requirements for Visa Smart Debit and Credit
(VSDC), Version 1.2, December 2001
Reference (C)
1 MasterCard Int'l: MChip/4 Security and Key Management, June 2006
2 EMVCo: EMV2000 Integrated Circuit Card Specification for Payment Systems Book 2 – Security and
Key management, Version 4.1, May 2004
4 Visa Int'l: Visa Integrated Circuit Card Specification, Version 1.4.0, September 2005
5 ZKA: Schnittstellen Spezifikation für die ZKA-Chipkarte Secure Chip Card Operating System
(SECCOS), Version 5.0, June 2001
6 American Express, Global Network Services: AEIPS Chip Card Specification, Version 4.0, March 2003
9 MasterCard Int'l: MasterCard Chip - Recommended Specifications for Debit and Credit, Version 2.1,
November 1999
10 EMVCo: EMV2000 Integrated Circuit Card Specification for Payment Systems; Book 2 - Security and
Key management, Version 4.0, December 2000
11 Visa Int'l: Visa Integrated Circuit Card Specification, Version 1.3.2, July 1999
12 ZKA: Interface specifications for the SECCOS ICC, Version 6.2, September 2007
13 EMVCo: Specification Update Bulletin No. 46 Replacement of EMV session key derivation method,
Version 1, October 2005
16 American Express: AEIPS Hardware Security Module (HSM) Specification by American Express,
Version 4.1, May 2010
This section details the steps to create, load and then print a postscript file. These steps are further divided as the
following:
1. Creating a postscript file
2. Configuring settings for printing the postscript file
3. Loading the postscript file
4. Printing the postscript file
References
• Console Guide for details on Printer Settings and the Postscript PIN Mailer option.
Introduction
This section provides a detailed understanding of SafeNet’s Luna EFT implementation with MasterCard and Visa cloud
based payment specification. The information provided in this section are meant for issuers who are using MasterCard
and Visa cloud based payment for account enablement, credential management, and transaction management.
Account Enablement
Responsible for managing cardholder identification and verification process, and card digitization process.
Manage and secure the mobile PROTECT-CLEAR- EE3056 Encrypts the clear mobile PIN.
PIN for Mobile Payment MOBILE-PIN
Application (MPA)
PROTECT- EE3057 Translates the encrypted
ENCRYPTED-MOBILE- mobile PIN from one set of
PIN protection key to another.
Share keys securely with CCM-ENCRYPT EE305D Used for enciphering in CBC-
Transaction Management Counter mode.
System (TMS)
CCM-DECRYPT EE305E Used for deciphering using
CBC-Counter mode.
Credential Management
Provisions the remote management of mobile payment application (MPA). It encompasses the delivery of payment
credentials to the MPA, necessary to support transactions.
Generate single use key unique ADVANCED-RANDOM- EE0619 Generates a random key of any
to each mobile device KEY-GENERATION key type and encrypts under
the respective KM variant.
Transfer data from CMS to MPA RNS-MESSAGE EE305F Prepares Remote Notification
Service Message and provide
DPK encrypted Session Id to
be used in CBP as derivation
and verification data.
Transaction Management
Responsible for validating transaction performed using a digitized card.