Part V IC Card Internet Multipurpose Terminal Specification
Part V IC Card Internet Multipurpose Terminal Specification
— Product Specifications
Version 2014
THIS PAGE IS INTENTIONALLY LEFT BLANK.
Part V IC Card Internet Multipurpose Terminal Specification
Table of Contents
Summary of Revisions.................................................................................................................1
3.9 Cryptogram....................................................................................................................5
UPI Confidential i
Part V IC Card Internet Multipurpose Terminal Specification
3.27 Load...............................................................................................................................6
3.29 Response........................................................................................................................7
UPI Confidential ii
Part V IC Card Internet Multipurpose Terminal Specification
7 Terminal Personalization....................................................................................................16
9 Security System....................................................................................................................21
UPI Confidential iv
Part V IC Card Internet Multipurpose Terminal Specification
UPI Confidential v
Part V IC Card Internet Multipurpose Terminal Specification
UPI Confidential vi
Part V IC Card Internet Multipurpose Terminal Specification
Summary of Revisions
UPI Confidential 1
Part V IC Card Internet Multipurpose Terminal Specification
1 Application Scope
UPI Confidential 2
Part V IC Card Internet Multipurpose Terminal Specification
2 Normative Reference
The clauses in the following documents become the clauses of these Specifications
after being quoted by UICS. For the dated references, all their subsequent
modifications (excluding contents of the corrigendum) or the revisions are not
applicable to these Specifications. However, all the Parties reaching an agreement
according to these Specifications are encouraged to study whether the latest version
of these documents can be used. For the undated references, their latest versions are
applicable to these Specifications.
UPI Confidential 3
Part V IC Card Internet Multipurpose Terminal Specification
3.1 Application
The application protocol and relevant datasets shared by card and terminal.
3.3 Authentication
The process by which an entity is confirmed to have the identity that it claims to
have.
3.4 Card
3.5 Certificate
A signature process applied to entity's public key, identifying information and other
relevant information by the authentication centre which generates certificate using
private keys, thus producing unforgeable data.
A trustworthy third party institution that authenticates the public keys and other
relevant information of a given entity; this term is simplified in these specifications
are “CA Authentication Center” or “CA Center”; unless otherwise stated, the term
“CA Center” in these specifications refer to UnionPay while “CA Center Server"
refers to the financial IC card internet terminal certificate management system,
simplified as "RA System”.
The starting point of a chain of trust whereby the CA authentication center gives
itself an unsigned public key certificate or self-signing certificate.
3.8 Command
UPI Confidential 4
Part V IC Card Internet Multipurpose Terminal Specification
3.9 Cryptogram
3.11 Decryption
3.14 Encryption
The processes used before an actual transmission of data whereby the identity of all
parties are authenticated, encryption algorithms are determined, encryption keys are
exchanged, etc.
A card that is packed internally with one or more ICs used for processing and
storage.
A small card reading device that utilized an internet channel to complete an IC card
transaction together with an IC card; the device includes interface devices and all
relevant components and interfaces (such as computer interfaces, etc.). |Based on
UPI Confidential 5
Part V IC Card Internet Multipurpose Terminal Specification
this specification, all internet terminal products developed by UnionPay are named
as ‘MiniPay’.
Operational commands used by terminals for receiving terminal parameter data and
controlling terminal prompts.
A digital certificate issued by Root CA Center used to encrypt online PIN digital
certificates in X.509 format.
One of the key of an entity's asymmetrical key pair which could be disclosed. Used
for authentication of digital signatures.
3.27 Load
The process of increasing an electronic cash balance. There are multiple load
methods; transferring from a primary account, cash deposit, or fund transfers from
other accounts. However the final post-loading balance could not exceed the
electronic cash limit.
UPI Confidential 6
Part V IC Card Internet Multipurpose Terminal Specification
3.29 Response
3.32 Script
A command or command sequence sent from an issuer, used for inputting that
command into an IC card.
An encryption technique whereby the sender and receiver both use the same
encryption key for data transformation; without this key it is impossible to derive
the data transformation conducted either by the sender or receiver.
Trusted platform module is a device that can perform key generation, encryption
and decryption independently with independent internal processor and memory cell,
UPI Confidential 7
Part V IC Card Internet Multipurpose Terminal Specification
and can store keys and the featured data, providing encryption and security
certification service for the equipment. It uses security chip for encryption and the
key is stored in the hardware so that the stolen data cannot decrypted, thus
protecting commercial privacy and data security.
3.39 UUID
UPI Confidential 8
Part V IC Card Internet Multipurpose Terminal Specification
an Alphanumeric
CA Certificate Authority
DN Distinguished Name
n Numeric
P1 Parameter 1
UPI Confidential 9
Part V IC Card Internet Multipurpose Terminal Specification
P2 Parameter 2
RA Register Authority
UPI Confidential 10
Part V IC Card Internet Multipurpose Terminal Specification
Terminal shall store and transmit sensitive information, such as bankcard number,
card verification code, PIN and card validity period, in ciphertext.
Only asterisks should be displayed and not plaintext whenever a cardholder inputs a
password into a terminal.
When a cardholder is asked to input the PIN, the terminal should not allow the
cardholder to skip this process; in the other words, PIN bypass is not allowed;
only after the cardholder has inputted the six digits PIN, should the terminal allow
for the continuation of the transaction process.
At the very least, the secure memory space of a terminal should satisfy the
requirement for storing transaction certificates and keys that are discussed in other
sections of these specifications.
Terminals should only response to the instruction requests that are contained within
the scope and definitions defined by the command instruction set of these
specifications; all instructions outside of this instruction set should be ignored.
Terminals should use secure modules that are capable of performing both key
generation and digital signature calculations, guarantee that sensitive operations are
only performed within these secure modules, and guard against both the leakage of
sensitive information and detrimental influences to security functions.
Secure modules should contain unreadable areas that are used to store unique
terminal information such as terminal private keys. The following mechanisms are
not allowed: the capability to output private key or PIN plaintext or the ability to
use leaked keys to encrypt PINs or other keys.
The random number used during key calculations should be generated within the
secure module; the randomness of this number should be in accordance with the
UPI Confidential 11
Part V IC Card Internet Multipurpose Terminal Specification
Terminals should be equipped with an IC card reader module; this module should
be capable of communicating command data with IC cards and support both
contact and contactless IC cards. This module should include mechanical, electrical,
and logical protocol components; for specific requirements please see UICS.
Terminals should be equipped with markings that illustrate how to insert contact IC
cards or read contactless IC cards.
Terminals should be reequipped with display screens that allow for the monitoring
of transaction process, input of data, and the setup, selection, and confirmation of
transaction data. Terminals should support ISO8859 basic character sets. The
display screen should be capable of displaying Chinese, English, and numbers.
5.3.3 Keyboard
Terminals should be equipped with button keyboards that allow for the input of
transaction amounts, PIN numbers, command selections, and execution
functionality. For digital keyboard, letter button, command button, function button,
and button layout requirements, see UICS. If colored command buttons are used,
the following colors are recommended.
Terminal shall at least support power supply in the form of USB. According to the
exisitng requirements for USB power supply, power supply voltage should be DC
5V±5%, and current should be less than 500mA; if having built-in battery, terminal
shall meet the relevant certification requirements imposed by China’s compulsory
product certification system.
UPI Confidential 12
Part V IC Card Internet Multipurpose Terminal Specification
Radio interference limit shall comply with A level ITE stipulations in CISPR
22-2006.
5.6 Reliability
Unless otherwise specified for special parts, the consecutive operation time
between failures shall be no less than 50,000 hours.
‘CUP_R’+ terminal type + ‘_’ + vendor code + ‘_’ + vendor type number
2. Merchant code and merchant type number must be a string consisting of English
letters and numbers; the total length of the merchant type number must be smaller
than 20 bytes.
For hardware requirements for various types of terminal, please refer to Table 2.
UPI Confidential 13
Part V IC Card Internet Multipurpose Terminal Specification
Hardware
Contact financial IC Contactless financial Dual interface IC
Types
S/N card internet IC card internet card internet
Hardware
terminal terminal terminal
module
Contactless IC card
4 None Mandatory Mandatory
reader module
Host Communication
5 Mandatory Mandatory Mandatory
module
UPI Confidential 14
Part V IC Card Internet Multipurpose Terminal Specification
6 General requirements
Financial IC card internet terminal shall at least support transactions such as E-cash
load, electronic cash balance inquiry and debit/credit primary account balance
inquiry.
Terminals should support the reading and writing of financial IC cards and industry
IC cards but not support magstrip cards.
Terminal shall be able to provide the secure download, update and deletion of
certificate, terminal program and parameters.
Download method shall be online remote download. Terminal shall ensure the
security of download control. Only the authorized or approved party could
download data to terminal, and it is not allowed to modify contents in the terminal
without authorization. Terminal shall also be able to confirm the security of
downloaded data, verify the integrity and correctness of terminal download
program and ensure that the sensitive and crucial key data will not be disclosed in
the download process.
For terminal firmware that has been released to users, the manufacturers could
determine at its sole discretion whether to update the terminal firmware through the
method of automatic download by terminals. The format of the firmware could be
determined by the manufacturers themselves as well.
UPI Confidential 15
Part V IC Card Internet Multipurpose Terminal Specification
7 Terminal Personalization
Affiliated Institution Code: this code consists of 8 digits and consists of bank code
+ area code. If the 4-digit area code is not defined then it can be replaced with 0000;
for instance, 01022900 represents the Shanghai branch of ICBC, 01045800
represents the Guangdong branch of BOC, 00010000 represents UnionPay, etc.
Affiliated Institution
8 n
Code
Terminal Manufacture
4 n
Date
UPI Confidential 16
Part V IC Card Internet Multipurpose Terminal Specification
Root CA certificates are issued and managed by UnionPay using the RA system,
where they must also be downloaded. They are primarily used to verify terminal
certificates, trusted server certificates, and the legality of PIN encryption
certificates throughout the transaction process.
Terminal public keys are generated by the terminal before the terminal download of
the terminal certificate. Terminal generated public keys are submitted to CA for
creation of certificates; terminal private keys should be stored within the terminal
secure module and not be exported at any time.
UPI Confidential 17
Part V IC Card Internet Multipurpose Terminal Specification
Root CA certificates are used to verify the authenticity and legality of trusted server
certificates, terminal certificates and PIN encryption certificates and they must be
written into the secure communication devices of financial IC card internet devices
and processing centers during the personalization process. Root CA certificate
downloads are negotiated and set by UnionPay and terminal affiliated institutions
together.
Before applying for a certificate, terminals must conduct a security appraisal of the
certificate applicatoon channel; only if this appraisal is successful should the
terminal initiate certificate application and issuance processes. Once CA Center
appraisal is successful, application and issuance procedures proceed as shown in
the image below.
Terminal CA Center
2. Application for
audit
4. Generation
of key pair
UPI Confidential 18
Part V IC Card Internet Multipurpose Terminal Specification
The terminal vendors shall develop the download tools according to the interfacee
defined by CA center; terminal certificates can only be downloaded from the RA
system directly into internal storage of a terminal using these download tools; no
other download method is permitted and only terminals may conduct such
downloads.
UPI Confidential 19
Part V IC Card Internet Multipurpose Terminal Specification
8 Ceritificate Update
In the daily usage of terminal, it has to support the update of certificates: CA root
certificate, Channel certificate and PIN encryption certificate.
The update of CA root certificate and Terminal certificate happen at the same time.
During the update of terminal certificate, backend system decides if CA ceritifcate
file needs to be updated based on the CA certificate serial number returned by
terminal, and distributes new CA root certificate before distributing new terminal
certificate. The detailed update flow refers to Appendix I.1.
UPI Confidential 20
Part V IC Card Internet Multipurpose Terminal Specification
9 Security System
CA Center
Terminal certificate
registration system
(RA)
As shown in the image above, the terminal certificate registration system (RA) is
primarily used to audit applications from terminal merchants and processing centers
and then issue certificates to terminals and processing centers once auditing is
completed.
UPI Confidential 21
Part V IC Card Internet Multipurpose Terminal Specification
The basic data unit in protocol interaction process is called message. Message
includes three parts of message type, message length and message body. In these
Specifications, the definition of message code shall be described in C language
format. Basic message unit is defined as follows:
struct {
MessageType msg_type;
WORD length;
BYTE body[ ];
} Message;
enum{
client_hello = 0x80,
server_hello = 0x81,
server_certificate = 0x82,
client_certificate = 0x83,
certificate_verify = 0x84,
client_key_exchange = 0x85,
server_finished = 0x86,
client_finished = 0x87,
UPI Confidential 22
Part V IC Card Internet Multipurpose Terminal Specification
error_message= 0x88,
application_data = 0x89
} MessageType;
Message can be divided into three types according to different functions of message
in protocol interaction process, i.e., handshake protocol message, error information
message and record protocol message.
struct {
MessageType msg_type;
WORD length;
switch ( MessageType ) {
} body;
} Message;
ClientHello Message
struct {
BYTE random[32];
BYTE cipherSuite[2];
} ClientHello;
UPI Confidential 23
Part V IC Card Internet Multipurpose Terminal Specification
The first byte is used in the Specifications. The second byte shall be reserved. For
the definition of the first byte of cipherSuite, please refer to Table 4.
Table 4 CipherSuite
B7 B6 B5 B4 B3 B2 B1 B0 Algorithm
X X X X * * X 1 RSA
X X X X * * 1 X ECC
X X X 1 * * X X 3DES
X X 1 X * * X X AES-128
X 1 X X * * X X 3DES
1 X X X * * X X AES-128
ServerHello Message
struct {
BYTE random[32];
BYTE cipherSuite;
} ServerHello;
ClientCertificate Message
struct {
BYTE certificate[ ];
} ClientCertificate;
ServerCertificate Message
UPI Confidential 24
Part V IC Card Internet Multipurpose Terminal Specification
struct {
BYTE certificate[ ];
} ServerCertificate;
CertificateVerify Message
The Client adopts RSA private key to sign the results of linking ClientHello and
ServerHello messages. For signature algorithm, please refer to Appendix B.2.
Signature result: signature = Sign (Master_secret||ClientHello||ServerHello) as
message main body.
struct {
BYTE signature[ ];
} CertificateVerify;
ClientKeyExchange Message
It is 48-byte master_secret that uses server terminal certificate public key for
encryption. For cryptographic algorithm, please refer to Appendix B.1.
struct {
BYTE encryptedSharedSecret[ ];
} ClientKeyExchange;
ServerFinished Message
For HAMC algorithm, please refer to Appendix C.2, among which, master_secret
is the master secret, Finish_label is the 6-byte ASCII code value “SERVER”, and
Hash algorithm adopts the SHA-1. Handshake_messages is the link of handshake
message:
handshake_messages =
(ClientHello||ServerHello||
Hash(ServerCertificate)||
Hash(ClientCertificate)||
UPI Confidential 25
Part V IC Card Internet Multipurpose Terminal Specification
CertificateVerify||ClientKeyExchange);
struct {
BYTE message_MAC[32];
} ServerFinished;
ClientFinished Message
For HAMC algorithm, please refer to Appendix C.2, among which, master_secret
is the master secret, Finish_label is the 6-byte ASCII code value “CLIENT”, and
Hash algorithm adopts the SHA-1. Handshake_messages is the link of handshake
message:
handshake_messages =
(ClientHello||ServerHello||
Hash(ServerCertificate)||
Hash(ClientCertificate)||
CertificateVerify||ClientKeyExchange);
struct {
} ClientFinished;
Error information message is used for the error processing in protocol interactive
process. It is defined as follows:
struct {
WORD length;
BYTE body;
} Message;
Wherein, for the definition of message type and message body, please refer to
Table 5:
UPI Confidential 26
Part V IC Card Internet Multipurpose Terminal Specification
Message body
Name of message body Definitions of message body
code
Handshake protocol will enter record layer protocol after completing the key
agreement. Record layer message is used for application data transmission, defined
as follows:
struct{
WORD length;
BYTE encryptedData [ ];
BYTE dataMac[8];
} Record;
UPI Confidential 27
Part V IC Card Internet Multipurpose Terminal Specification
9. Generation of processing
10. Sending of processing center handshake
center handshake completion
10.发送处理中心握手完成消息
completion information information
11. Verification of
processing center
handshake information 12. Sending of terminal handshake
and generation of 12.发送终端握手完成消息
completion information
terminal handshake
13. Verification of terminal
completion information
handshake completion information
14. Generation of and calculation of session key
session key
15. Completion of handshake and exchange of data
15.完成握手,交换数据信息
UPI Confidential 28
Part V IC Card Internet Multipurpose Terminal Specification
5) The terminal uses a preset Root CA certificate to verify the authenticity of the
received processing center trusted server certificate; if the verification is not
successful then an error message will be generated and the connection will be
stopped; otherwise, the terminal will generate a 48-byte random number to act
as a shared main key M1, the card will then use the assymetrical algorithm
established before using the public key provided by processing center trusted
server certificate to encrypt M1 and generate E1;
6) M1 connects with R1 and R2, then create R3; the terminal will use digest
algorithm on R3 to create H1, then use it’s own private key to sign H1, and
creating S1;
7) The terminal sends S1, E1, and terminal certificate to the processing center;
8) The processing center uses rhe Root CA certificate to verify the legality of the
terminal certificate; If the verification fails then an error message will be
produced and the connection will be stopped; if verification succeeds then the
terminal certificate will be used to verify S1. If S1 verification fails then then
an error message will produced and the connection will be stopped; otherwise,
E1 will be decrypted to yield shared main key M1;
9) The processing center will conduct a summary operation on the trusted server
certificate to obtain H2 and on the terminal certificate to obtain H3. R1, R2,
H2, H3, S1, and E1 are connected to obtain T1 (T1=R1||R2||H2||H3||S1||E1); a
digest operation will then be conducted on T1 to obtain H4; ASCII code
“SERVER” and H4 are connected to yield D1; the first 16 bytes of M1 are
used to conduct HMAC on D1 to obtain F1 (See Appendix C.2 foe HMAC
calculation algorithms);
11) The terminal will verify F1 sent from the processing center; if verification is
not successful then then an error message will be produced and the connection
will be stopped; if verification succeeds then the terminal will produce
handshake verification message F2; F2 calculation is performed differently
than that used for F1 and only requires that the ASCII code “SERVER”
obtained during F1 to be changed to ASCII code “CLIENT”;
UPI Confidential 29
Part V IC Card Internet Multipurpose Terminal Specification
13) The processing center will use the same calculation process to verify F2. if
verification is not successful then then an error message will be produced and
the connection will be stopped;
14) Once the handshake procedure above is successful then both sites will use the
following method to calculate a session key:
Key_label is the 3-byte ASCII code “key” ;see Appendix B.2 for HMAC
algorithm. X1X2…X20 are the first twenty bytes of X and encryption key
SKey is: SKey = X1X2…X16; MAC key MKey is: MKey = X5X6…X20;
After successful handshake, both parties could conduct the data transmission in the
established secure channel
Add data block length (2-byte) before the transmitted data (Data) to form data
block D= (Length||Data). Use encryption key Skey to encrypt D according to
cryptogrphic algorithm specified by the processing center and the terminal.
Namely:
The first 8 bytes of multi-interface card random number Random1 are acquired as
well as the first 8 bytes of processing center random number Random2, thus
Seq0=Random1 || Random2.
For each record of a sent or received message, the record serial number will add a 1,
namely Seqi = Seqi-1 + 1. Note that all parties must maintain serial number
syncronization.
The integrity of application data from both parties should be protected using
information authentication code MAC; MAC is generated using the following
method:
DataMAC = MAC( MKey, Seqi || EData) (MKey uses its front 16 bytes)
EData is the transmitted encrypted application data; Seqi is the current record serial
number. See Appendix C.1 for MAC calculation method. Once the terminal or
UPI Confidential 30
Part V IC Card Internet Multipurpose Terminal Specification
processing center has received data it will then verify MAC authenticity; if verified
successfully then processing will continue; if not, an error message will be
generated and the connection will be terminated..
UPI Confidential 31
Part V IC Card Internet Multipurpose Terminal Specification
This section describes online transaction procedures for financial IC card internet
terminals; these transaction processing procedures occur after the terminal and
processing center have authenticated each other and created a secure channel.
Once the terminal and processing center have established a secure channel, the
terminal will begin to analyze the transaction based on the commands received
from the processing center (see Appendic A.4 for command details); if there are no
processing errors then the debit/credit transaction processing procedures will be
initiated.
For load transactions, the terminal should automatically check electronic cash
upper balance limits and inform the cardholder of the maximum allotted load
balance.
MiniPay only supports online transactions; terminals do not support offline data
authentication.
UPI Confidential 32
Part V IC Card Internet Multipurpose Terminal Specification
Refer to UICS for a detailed description. Terminals should use light and sound to
notify cardholders that a transaction is completed.
For load transactions, should a terminal receive an explicit script failure or issuer
authentication failure then it should initiate a reversal; otherwise terminals should
not initiate reversal procedures, including for IC card issuer script response
time-out situations.
UPI Confidential 33
Part V IC Card Internet Multipurpose Terminal Specification
Terminal uses the USB interface and adopts CCID protocol. For the the command
format sent to terminal by the Host, please refer to the following Table:
↓ ↓ ↓ ↓ ↓ ↓ ↓
UPI Confidential 34
Part V IC Card Internet Multipurpose Terminal Specification
Under RSA-1024 certificate system, the interaction time between bluetooth 4.0 and
SecurePay gateway should be within 5 seconds
Android USB OTG interface, Apple Lightning, Apple 30-pin dock interface, refer
to 11.1 USB interface protocol to implement.
UPI Confidential 35
Part V IC Card Internet Multipurpose Terminal Specification
Appendix A
(Normative Appendix)
Terminal Command Set
Refer to UICS for the APDU format of terminal command and response..
The terminal command set is divided into two parts; special commands and normal
commands.
Special Command Set: refers to all APDU commands with message-type (CLA)
7E or 7F mentioned within these specifications. 7E refers to plaintext
transmission data; 7F refers to encrypted transmission data, keys (including
session keys (for data encryption) and MAC keys; keys are generated by
mutual consensus using secure channels. Terminal special commands are
divided into five categories based on their function: secure channel commands,
transaction commands, issuer retention commands, and specification retention
commands. For special command defitions, see the table below.
Normal command set: refers to all other APDU commands aside from the
special commands described in these specifications.
Notes:
UPI Confidential 36
Part V IC Card Internet Multipurpose Terminal Specification
For all special command sets mentioned in these specifications that are not
specifically defined, datatype is defined by UICS. For terminal commands defined
by these specifications, see the following table:
UPI Confidential 37
Part V IC Card Internet Multipurpose Terminal Specification
Mandato
Command CL IN
No. Description of Function ry(M)/Op
Name A S
tional(O)
MANAGE
7E 11 Used to control buzzer status O
BUZZER
CONFIG
Used to control display indiciator
Management DISPLAY 7E 13 O
information and format
Commands FORMAT
GET CARD
TERMINAL 7E 15 Retrieval of terminal response data. M
RECODE
MULTIPLE
7E 16 Multiple instruction processing command. M
INSTRUCTION
ADD
7E 20 Used to install certificate into terminals. M
CERTIFICATE
UPI Confidential 38
Part V IC Card Internet Multipurpose Terminal Specification
Mandato
Command CL IN
No. Description of Function ry(M)/Op
Name A S
tional(O)
VERIFY
Used to verify legality of trusted server
SERVER 7E 27 M
certificate.
CERTIFICATE
EXPORT
7E 29 Exports shared main key in ciphertext form. M
MASTERKEY
TRANSMIT
Used to transmit post-encryption APDU
ENCRYPTED 7F 2B M
commands.
COMMAND
CLOSE
SECURE 7E 2C Used to close secure channel. M
CHANNEL
UPI Confidential 39
Part V IC Card Internet Multipurpose Terminal Specification
Mandato
Command CL IN
No. Description of Function ry(M)/Op
Name A S
tional(O)
READ
Used to retrieve cardholder information and
CARDHOLDER 7E 47 M
other transaction process information.
INFO
GET CARD
Used to retrieve financial IC card card
TRADE 7E 48 M
transaction logs.
RECODE
See Table A.3 for the encoding of READ TERMINAL INFO command message:
UPI Confidential 40
Part V IC Card Internet Multipurpose Terminal Specification
Code Value
CLA 7E
INS 10
P1 00
P2 00: Read status of terminal device /01: Read information of terminal device
Lc Not Available
P2=0x00:
B7 B6 B5 B4 B3 B2 B1 B0 Remarks
X Reserved
UPI Confidential 41
Part V IC Card Internet Multipurpose Terminal Specification
B7 B6 B5 B4 B3 B2 B1 B0 Remarks
X Reserved
P2=0x01:
It indicates to acquire the terminal data, firmware version number and the number
of financial IC card.
Output data is in TLV form. Response data is defined in the table below:
Terminal Data 23
UPI Confidential 42
Part V IC Card Internet Multipurpose Terminal Specification
UPI Confidential 43
Part V IC Card Internet Multipurpose Terminal Specification
Tag value: 08
Note: To guarantee certificate security,
PIN certificate serial number
1 response messages will only contain this data
code label
field after a secure channel has been
established.
Tag value: 09
CA certificate serial number
1 CA certificates are the father certificates of
label
terminal and trusted server certificates
UPI Confidential 44
Part V IC Card Internet Multipurpose Terminal Specification
See Appendix A.5 List of Terminal Command Response Status Code for the error
information which may be returned by the terminal
See Table A.6 for the MANAGE BUZZER command message encoding:
Code Value
CLA 7E
INS 11
P1 00
P2 00
UPI Confidential 45
Part V IC Card Internet Multipurpose Terminal Specification
Code Value
Lc 01
Le Not Available
See Table A.7 for the data field encoding of command message:
Value Meanings
00 Close
02 Continuously buzz
03 Intermittently buzz
Other Reserved
See Appendix A.5 List of Terminal Command Response Status Code for the error
information which may be returned by the terminal
The MANAGE LED command is used to set the status of LED. It reports the
cardholder’s transaction state in a simple and explicit way by setting the status of
LED.
See Table A.8 for the MANAGE LED command message encoding:
UPI Confidential 46
Part V IC Card Internet Multipurpose Terminal Specification
Code Value
CLA 7E
INS 12
P1 00
P2 00
Lc 01
Le Not Available
See Table A.9 for the data field encoding of command message:
Value Meanings
03 Blink LED
Other Reserved
See Appendix A.5 List of Terminal Command Response Status Code for the error
information which may be returned by the terminal
UPI Confidential 47
Part V IC Card Internet Multipurpose Terminal Specification
See Table A.10 for the CONFIG DISPLAY FORMAT command message
encoding:
Code Value
CLA 7E
INS 13
Le Not Available
The data field of command message represents the character contents shown in the
display.
Refer to Appendix A.5 Terminal Command Response Status Code for the error
information which may be returned by the terminal
UPI Confidential 48
Part V IC Card Internet Multipurpose Terminal Specification
EXCHANGE STATUS command message codes are described in the table below:
Code Value
CLA 7E
INS 14
P2 Reserved
Lc Not Available
Le 00
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
Note: For 0x90XX, XX is the transmission value of P1. For example: 0x7E 47 01
00 00; return: 0x9001
UPI Confidential 49
Part V IC Card Internet Multipurpose Terminal Specification
When a transaction instruction returns 61XX, the server will use this instruction to
retrieve terminal response data.
See the table below for information on GET CARD TERMINAL RESPONSE
command message codes:
Code Value
CLA 7E
INS 15
P1 00
P2 00
Lc Not Available
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
UPI Confidential 50
Part V IC Card Internet Multipurpose Terminal Specification
Code Value
CLA 7E
INS 16
P1 00
P2 00
Le ‘00’
UPI Confidential 51
Part V IC Card Internet Multipurpose Terminal Specification
The response message data field is the response data of the last instruction of a
multiple instruction command; should command execution fail, then the instruction
serial code and card error response code will be returned.
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
ADD CERTIFICATE is used to add the public key certificate for the terminal.
See Table A.14 for the ADD CERTIFICATE command message encoding:
Code Value
CLA 7E
INS 20
P1 High 4bit represents certificate type and low 4bit represents offset value
Le Not Available
The high 4-bit information of P1 defines the certificate type, is defined as follows:
B7 B6 B5 B4 Explanation
UPI Confidential 52
Part V IC Card Internet Multipurpose Terminal Specification
B7 B6 B5 B4 Explanation
1 0 0 0 Reserved
The low 4-bit of P1 and the P2 byte form the 12-bit shift byte and the shift range is
0-4095 bytes.
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
Code Value
CLA 7E
UPI Confidential 53
Part V IC Card Internet Multipurpose Terminal Specification
Code Value
INS 21
P1 High 4bit represents certificate type and low 4bit represents offset value
Le Not Available
B7 B6 B5 B4 Explanation
1 0 0 0 Terminal Certificate
The low 4-bit of P1 and the P2 byte form the 12-bit shift byte and the shift range is
0-4095 bytes.
The content of command message data field includes the data of new certificate.
UPI Confidential 54
Part V IC Card Internet Multipurpose Terminal Specification
Refer to Appendix A.5 List of Terminal Command Response Status Code for the
error information which may be returned by the terminal
Refer to Table A.18 for the DELETE CERTIFICATE command message encoding:
Code Value
CLA 7E
INS 22
P2 00
Le Not Available
B7 B6 B5 B4 Explanation
UPI Confidential 55
Part V IC Card Internet Multipurpose Terminal Specification
B7 B6 B5 B4 Explanation
1 0 0 0 Reserved
Terminal number 23
Refer to Appendix A.5 List of Terminal Command Response Status Code for the
error information which may be returned by the terminal
READ CERTIFICATE is used to read the existing public key certificate in the
terminal.
Refer to Table A.21 for the READ CERTIFICATE command message encoding:
Code Value
CLA 7E
UPI Confidential 56
Part V IC Card Internet Multipurpose Terminal Specification
Code Value
INS 23
Lc Not Available
Le See Description
Level 1 Root CA
0x01
Certificate
Level 2 Root CA
0x02
Certificate
A "61FF" code means that this command has been executed successful and
indicates that GET CERT RESPONSE should be used to read response data.
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
UPI Confidential 57
Part V IC Card Internet Multipurpose Terminal Specification
The GET CERT RESPONSE Command is used to read the response data as
returned by READ CERTIFICATE
Refer to Table A.23 for the GET CERT RESPONSE command message encoding:
Code Value
CLA 7E
INS 24
P1 00
P2 00
Lc Not Available
“9000” indicates that this command has been executed successfully; a "61XX”
code indicates that XX amount of data remains to be read.
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
GET CLIENT HELLO is used to acquire algorithm identifier and random number
supported by the terminal
UPI Confidential 58
Part V IC Card Internet Multipurpose Terminal Specification
Refer to Table A.24 for the GET CLIENT HELLO command message encoding:
Code Value
CLA 7E
INS 25
P1 00
P2 00
Lc Not exist
Le 0x21
B7 B6 B5 B4 B3 B2 B1 B0 Algorithm
* * * * * * * 1 RSA
* * * * * * 1 * ECC
* * * 1 * * * * 3DES
* * 1 * * * * * Reserved
1 * * * * * * * 1-Reserved, 0-RSA
UPI Confidential 59
Part V IC Card Internet Multipurpose Terminal Specification
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
See Table A.26 for the HASH SERVER CERTIFICATE command message
encoding:
Code Value
CLA 7E
INS 26
P1 00
Le Not Available
The structure of input data is as follow: 1-byte flag bit + 1-byte extracting
information offset value + server certificate message data
UPI Confidential 60
Part V IC Card Internet Multipurpose Terminal Specification
B4 Flag bit for public key field to be extracted in the current data
B3 Reserved
B2 Reserved
B1 Reserved
B0 Reserved
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
Refer to Table A.28 for the VERIFY SERVER CERTIFICATE command message
encoding:
UPI Confidential 61
Part V IC Card Internet Multipurpose Terminal Specification
Code Value
CLA 7E
INS 27
P1 00
Le Not Available
The structure of input data is as follow: 1-byte flag bits + 1-byte offset value +
signature value message data
B5 Reserved
B4 Reserved
B3 Reserved
B2 Reserved
B1 Reserved
B0 Reserved
As the transferred certificate signature value is in the TLV encoding format, the
offset value represents the offset length of Value from the starting address of
message
UPI Confidential 62
Part V IC Card Internet Multipurpose Terminal Specification
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command
The CLIENT SIGN Command uses a terminal private key to sign designated data
and return a signature value.
Refer to Table A.30 for the CLIENT SIGN command message encoding:
Code Value
CLA 7E
INS 28
P1 00
P2 00
Le 00
Signed data
UPI Confidential 63
Part V IC Card Internet Multipurpose Terminal Specification
Refer to Appendix A.5 List of Terminal Command Response Status Code for the
error information which may be returned by the terminal
Code Value
CLA 7E
INS 29
P1 00
P2 00
Lc Not Available
Le 00
Master key information encrypted by the public key of trusted server certificate.
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
UPI Confidential 64
Part V IC Card Internet Multipurpose Terminal Specification
1) Extract the HMAC value generated after the handshake process with terminal,
which is then sent to the processing center for verification.
2) Input the HMAC value generated in the process of handshake with the
processing center, which is then sent to the terminal for verification.
Refer to the detailed definition of protocol process in Section 8.2.1 and 8.2.2 in the
specification for the details of above contents.
Code Value
CLA 7E
INS 2A
P1 00
P2 Lc Data Le Remarks
UPI Confidential 65
Part V IC Card Internet Multipurpose Terminal Specification
When P2=00, the response message data field will be the HMAC value calculated
by the terminal. Refer to Section 8.2.1 for details regarding HMAC data elements
generated by terminals.
When P2=01 and P2=02, there are no response message data fields.
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
Code Value
CLA 7F
INS 2B
P1 00
UPI Confidential 66
Part V IC Card Internet Multipurpose Terminal Specification
Code Value
Le 00
SKey encrypted command and MAC Key calculated with MKey from processing
center.
Refer to Appendix A.5 List of Terminal Command Response Status Code for the
error information which may be returned by the terminal.
Notes:
(2) Terminal commands are transmitted using this command, and will be
executed after decryption; execution results and response codes must be
encrypted before they are sent to the processing center, and return codes must
be sent directly after return ciphertexts in plaintext format.
Example: the ‘【】’ (brackets) below indicate APDU command data fields; this field
includes two parts; the encrypted plaintext data within the brackets as well as MAC
ciphertext. Refer to Section 8.2.2 for a specific explanation of how the content of
thie data field is calculated.
UPI Confidential 67
Part V IC Card Internet Multipurpose Terminal Specification
CLOSE SECURE CHANNEL commands are used to close secure channels and
destroy all keys used within that channel.
See the table below for information on CLOSE SECURE CHANNEL command
message codes:
Code Value
CLA 7E
INS 2C
P1 00
P2 00
Lc Not Available
Le 00
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
UPI Confidential 68
Part V IC Card Internet Multipurpose Terminal Specification
READ NON-PBOC PIN is used to read the PIN of non-UICS financial IC card,
such as industry card PIN. The PIN of financial IC card or financial account is not
allowed to be read. This command is an optional command.
Code Value
CLA 7E/7F
INS 2D
P1 00
P2 00
Lc Not Available
The data field of response message contains six-digit of non-financial IC card PIN.
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
UPI Confidential 69
Part V IC Card Internet Multipurpose Terminal Specification
The CREDIT FOR LOAD command is used to support financial IC card online
load transactions; permits financial IC card primary account funds to be transferred
to an electronic cash account and completes IC card electronic cash balance update
operations. Load amounts are inputted at the terminal. During the transaction the
terminal will automatically check load limits and inform the cardholder of the
maximum allotted load amount.
For CREDIT FOR LOAD command message encoding please refer to Table A.37:
Code Value
CLA 7E
INS 40
P1 00/01
When P1=00 and P2=00: Start transaction, read data as defined in Table A.36;
P2 When P1=00 and P2=01: read data as defined in Table A.37;
When P1=01 and P2=00: Online response data
Le 00
Start load transaction; see the command message data field table below:
UPI Confidential 70
Part V IC Card Internet Multipurpose Terminal Specification
Notes: Other transaction date refers to processing center data; during abnormal
transactions (such as reversals, script notifications, etc.) this data must be sent back
to the processing center in abnormal (such as reversals and script notifications)
transaction messages. Terminals do not need to analyze this data. Other transaction
processing methods are the same.
When P1=01:
Online returned data; see the table below for command message data fields:
UPI Confidential 71
Part V IC Card Internet Multipurpose Terminal Specification
Start load transaction; see the response message data field table below:
Terminal Verification
7 TLV format
Result (TVR) (Tag 95)
UPI Confidential 72
Part V IC Card Internet Multipurpose Terminal Specification
Read PAN, PAN serial number, and related information: see the command
response data field table below:
Online PIN Ciphertext (Tag 99) 130 Ciphertext data encrypted by PIN
When P1=01:
Returned online data sent from terminal to processing center; see the response
message data field table below:
UPI Confidential 73
Part V IC Card Internet Multipurpose Terminal Specification
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
For DEBIT FOR PURCHASE command message encoding please refer to Table
A.43:
UPI Confidential 74
Part V IC Card Internet Multipurpose Terminal Specification
Code Value
CLA 7E
INS 41
P1 00/01
When P1=00 and P2=00: Start transaction, read data as defined in Table A.42;
P2 When P1=00 and P2=01: read data as defined in Table A.43;
When P1=01 and P2=00: Online data return
Le 00
Start online purchase transaction; see the command message data field table below:
Notes: Other transaction date refers to processing center data; during abnormal
transactions (such as reversals, script notifications, etc.) this data must be sent back
to the processing center in abnormal (such as reversals and script notifications)
transaction messages. Terminals do not need to analyze this data.
UPI Confidential 75
Part V IC Card Internet Multipurpose Terminal Specification
When P1=01:
Online returned data; see the table below for command message data fields:
Authorization Response
4 TLV format
Code (Tag 8A)
Start online purchase transaction; see the command message data field table below:
Terminal Verification
7 TLV format
Result (TVR) (Tag 95)
UPI Confidential 76
Part V IC Card Internet Multipurpose Terminal Specification
Read PAN, PAN serial number, and related information: see the command
response data field table below:
UPI Confidential 77
Part V IC Card Internet Multipurpose Terminal Specification
When P1=01:
Returned online data sent from terminal to processing center; see the response
message data field table below:
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
UPI Confidential 78
Part V IC Card Internet Multipurpose Terminal Specification
Code Value
CLA 7E
INS 42
P2 00
Lc Not Exist
Le 00
See table below for financial IC card electronic cash balance/response message data
fields:
Table A.50 GET ELECTRONIC CASH BALANCE Response Message Data Fields
UPI Confidential 79
Part V IC Card Internet Multipurpose Terminal Specification
Refer to Appendix A.5 List of Terminal Command Response Status Code for the
error information which may be returned by the terminal
Code Value
CLA 7E
INS 43
P1 00/01
When P1=00 and P2=00: Start transaction, read data as defined in Table A.50;
P2 When P1=00 and P2=01: read data as defined in Table A.51;
When P1=01 and P2=00: Online data return
Le 00
UPI Confidential 80
Part V IC Card Internet Multipurpose Terminal Specification
When P1=01:
Online returned data; see the table below for command message data fields:
BCD
Authorization Response
4 TLV format
Code (Tag 8A)
UPI Confidential 81
Part V IC Card Internet Multipurpose Terminal Specification
TLV format
Available balance (Tag Debit card: Does not have this data
9
FF02) field
Credit card: Available limit
Note: For debit cards, micropayment will only display "Primary Account Balance";
if the card is a debit card then the micropayment will only display "Available
Balance", “Used Amount”.
Terminal Verification
7 TLV format
Result (TVR) (Tag 95)
UPI Confidential 82
Part V IC Card Internet Multipurpose Terminal Specification
Read PAN, PAN serial number, and related information: see the command
response data field table below:
When P1=01:
Returned online data sent from terminal to processing center; see the response
message data field table below:
UPI Confidential 83
Part V IC Card Internet Multipurpose Terminal Specification
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
The GET DOL TAGE VALUE is used to retrieve data object content in accordance
with inputted data object list.
See the table below for information on GET DOL VALUE command message
codes:
UPI Confidential 84
Part V IC Card Internet Multipurpose Terminal Specification
Code Value
CLA 7E
INS 45
P1 00
P2 00
Le 00
Table A.58 GET DOL VALUE Command Message Data Field Format
Note: Length indicates required length of read label value; see explanation of DOL
format.
Response message data field are the data objects of BER-TLV code. These data
objects must be in accordance with the following format codes:
Table A.59 GET DOL VALUE Response Message Data Field Format
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
UPI Confidential 85
Part V IC Card Internet Multipurpose Terminal Specification
Code Value
CLA 7E
INS 46
Lc Not Available
Le 00
Read transaction reversal information; see table below for command response data
fields:
Table A.61 Read Reversal Information Command Response Data Field Formats
UPI Confidential 86
Part V IC Card Internet Multipurpose Terminal Specification
Read script execution result notification information; see table below command
response data fields:
UPI Confidential 87
Part V IC Card Internet Multipurpose Terminal Specification
Table A.62 Read Script Execution Notification Command Response Data Field Formats
UPI Confidential 88
Part V IC Card Internet Multipurpose Terminal Specification
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
The READ CARDHOLDER INFO command is used to read from the device other
information about the cardholder participating in the current transaction. The
cardholder will input appropriate cardholder information in accordance with the
instructions displayed by on the device display screen. Cardholder information
includes cardholder phone number, cardholder ID number, cellphone dynamic
password, etc; the cardholder must input and confirm this information during the
transaction process.
See the table below for REVERSAL INFO command message codes:
Code Value
CLA 7E
INS 47
P2 00 (Reserved)
Le 00
UPI Confidential 89
Part V IC Card Internet Multipurpose Terminal Specification
UPI Confidential 90
Part V IC Card Internet Multipurpose Terminal Specification
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
The GET CARD TRADE RECODE command is used on IC card transaction detail
record files.
See the table below for information on GET CARD TRADE RECODE command
message codes:
Code Value
CLA 7E/7F
INS 48
P1 00
Lc Not Exist
Le 00
UPI Confidential 91
Part V IC Card Internet Multipurpose Terminal Specification
When P2=01, response data is the card log record format data element.
Total record length 2 bytes (length does not include number of records)
Record 1
See UnionPay IC Card Specifications Part 5 – UICS
……
for record file content format
Record N
Note: When response data is greater than 255 bytes then it must be transmitted in
bundles and the response message status code will be 61XX (successive data
length). When a server receives a status response of 61XX it must use the GET
TERMINAL RESPONSE instruction to retrieve the record data and combine it into
a complete message.
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
See the table below for CREDIT CARD PAYMENT command message codes:
Code Value
CLA 7E/7F
INS 49
P1 00/01
UPI Confidential 92
Part V IC Card Internet Multipurpose Terminal Specification
Code Value
When P1=00 and P2=00: Start transaction, read data as defined in Table A.69;
P2 When P1=00 and P2=01: read data as defined in Table A.70;
When P1=01 and P2=00: Online data return
Le ‘00
Start credit payment transaction; see the command message data field table below:
Credit Card Account Number 28 Pad from right with spaces if not 28
Notes: Other transaction date refers to processing center data; during abnormal
transactions (such as reversals, script notifications, etc.) this data must be sent back
to the processing center in abnormal transaction messages (such as reversals and
script notifications). Terminals do not need to analyze this data.
When P1=01:
Online returned data; see the table below for command message data fields:
UPI Confidential 93
Part V IC Card Internet Multipurpose Terminal Specification
Start credit card repayment transaction; see the command message data field table
below:
UPI Confidential 94
Part V IC Card Internet Multipurpose Terminal Specification
Read PAN, PAN serial number, and related information: see the command
response data field table below:
When P1=01:
Returned online data sent from terminal to processing center; see the response
message data field table below:
UPI Confidential 95
Part V IC Card Internet Multipurpose Terminal Specification
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
The VERITY OFFLINE PIN command is used by the terminal to verify an offline
PIN. The verification command causes the IC card to compare the transaction PIN
data contained within the command message data field and the corresponding
parameter PIN data. The verification method is determined by the IC card
application.
See the table below for information on VERITY OFFLINE PIN command message
codes:
UPI Confidential 96
Part V IC Card Internet Multipurpose Terminal Specification
Code Value
CLA 7E
INS 4A
P1 00
P2 00
Lc Not Exist
Le 00
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
UPI Confidential 97
Part V IC Card Internet Multipurpose Terminal Specification
Code Value
CLA 7E
INS 4B
P1 00/01/02/03
Le 00
Notes:
1) In IC card transfer mode, execute the “IC card transfer procedures” defined in
Table A.61.
Start “IC card transfer procedures” ; see the command message data field table
below:
UPI Confidential 98
Part V IC Card Internet Multipurpose Terminal Specification
Transfer amount
When this field is all 0 then utilize the terminal
Transaction Amount 6
to input transfer amount; when not all 0, the
terminal will confirm the transfer amount.
When P1=01:
Online returned data; see the table below for command message data fields:
UPI Confidential 99
Part V IC Card Internet Multipurpose Terminal Specification
Transfer amount
When this field is all 0 then utilize the terminal
Transaction Amount 6
to input transfer amount; when not all 0, the
terminal will confirm the transfer amount.
Notes:
Online returned data; see the table below for command message data fields:
Authorization Response
4 TLV format
Code (Tag 8A)
Notes:
Online return of transfer results; see the table below for command message data
fields:
TLV format
Authorization Response
4 Card-not-present channel transfer
Code (Tag 8A)
transaction authorization response code
Start “IC card transfer procedures”; see the command message data field table
below:
Terminal Verification
7 TLV format
Result (TVR) (Tag 95)
Application Interchange
4 TLV format
Profile (AIP) (Tag 82)
Application Transaction
5 TLV format
Code (ATC) Tag 9F36)
Ciphertext Information
4 TLV format
Type (CID) (Tag 9F27)
Application Ciphertext
11 TLV format
(AC) (Tag 9F26)
Cardholder Verification
Method (CVM) Result 6 TLV format
(Tag 9F34)
Transaction Sequence
5-7 TLV format
Counter (Tag 9F41)
Application Version
5 TLV format
Number (Tag 9F09)
Notes:
Read PAN, PAN serial number, and related information: see the command
response data field table below:
When P1=01:
Returned online data sent from terminal to processing center; see the response
message data field table below:
Terminal Verification
7 TLV format
Result (TVR) (Tag 95)
Read PAN, PAN serial number, and related information: see the command
response data field table below:
Returned online data sent from terminal to processing center; see the response
message data field table below:
No response data.
Refer to Appendix A.5 – Terminal Command Response Status Code Table for
possible error codes for this command.
Appendix B
(Informative Appendix)
Basic Encryption Algorithms
RSA public key is used to encrypt the plaintext message. Encryption standard uses
RSAES-PKCS1-V1_5 in the encryption mode of PKCS # 1 specification.
Algorithm parameter
M Plaintext
mLen Length of M
C Cryptogram message
Steps of algorithm
1. Message encoding:
Use RSA private key to sign the message abstract. Signature standard uses
RSASSA-PKCS1-V1_5 signature mode in the PKCS # 1 spcifications. Message
abstract uses SHA-1 algorithm.
Algorithm parameter
M Plaintext
C Cryptogram message
M Plaintext
Steps of algorithm
H = SHA-1(M)
2. Message encoding:
T = (0x) 30 21 30 09 06 05 2b 0e 03 02 1a 05 00 04 14 || H
EM = 0x00‖0x01‖PS‖0x00‖T
3. Signature:
In this specification, cipher block chaining (CBC) mode using the block cipher
algorithm is used for data encryption and protection. Among which, the encryption
algorithm can use AES algorithm with 128-bit key length or 3DES algorithm.
Block length using AES encryption is 128 bits, and block length using 3DES
encryption is 64 bits.
Algorithm parameter
M Plaintext
C Cryptogram message
K Encrypted key
IV Initial vector
Steps of algorithm
Add 0x80 to the plaintext M, then pad a minimum 0x00 on the right, so after
padding, length of message M ( M= (M||80||00||00||…||00) ) will be an integer
multiple of 16. Divide M into 16-byte blocks, which are M1, M2, ..., Mn.
2. Encryption calculation
Use key K under CBC mode to encrypte the plaintext block M1, M2, ..., Mn to
encryption block C1, C2,…,Cn using AES-128 algorithm. Where, the initial vector
IV = (00 || 00 || 00 || 00 || 00 || 00 || 00 || 00).
C0 = IV
Ci = EK(Mi⊕Ci-1) , i = 1, 2, . . . , n
C = (C1 || C2 || . . . || Cn)
3. Decryption calculation
Use key K under CBC mode to decrypte the cryptogram into block C1, C2,…,Cn to
plaintext block M1, M2,…,Mn. using AES-128 algorithm,Where, the initial vector
IV = (00 || 00 || 00 || 00 || 00 || 00 || 00 || 00).
C0 = IV
Mi = DK(Ci)⊕Ci-1, i = 1, 2, . . . , n
M = (M1 || M2 || . . . || Mn)
Add 0x80 to the plaintext M, then pad a minimum 0x00 on the right, so after
padding, length of message M (M = (M||80||00||00||…||00) ) will be an integer
multiple of 8. M is divided into 8-byte blocks, which are M1, M2, ..., Mn
2. Encryption calculation
Use the key under CBC mode to encrypt the plaintext block M1, M2, ..., Mn to
encryption block C1, C2,…,Cn.using 3DES algorithm. Where, the initial vector IV
= (00 || 00 || 00 || 00 || 00 || 00 || 00 || 00).
C0 = IV
Ci =EK(Mi⊕Ci-1) , i = 1, 2, . . . , n
C = (C1 || C2 || . . . || Cn)
3. Decryption calculation
Use the key under CBC mode to decrypt the cryptogram block C1, C2,…,Cn to
plaintext block M1, M2,…,Mn using 3DES algorithm. Where, the initial vector IV
= (00 || 00 || 00 || 00 || 00 || 00 || 00 || 00).
C0 = IV
Mi =DK(Ci)⊕Ci-1, i = 1, 2, . . . , n
M =(M1 || M2 || . . . || Mn)
Appendix C
(Normative Appendix)
MAC Algorithm
Algorithm parameter
M Plaintext
C Cryptogram message
K MAC key
IV Initial vector
Steps of algorithm
Padding
Add 0x80 to the plaintext M, then pad a minimum 0x00 on the right, so after
padding, length of message M (M = (M||80||00||00||…||00)) will be an integer
multiple of 8. Divide M into 16-byte blocks, which are M1, M2, ..., Mn.
MAC calculation
Use the left 8-byte KL of key K under CBC mode through 3DES algorithm to
encrypt block M1, M2, ..., Mn. Where, the initial vector IV = (00 || 00 || 00 || 00 ||
00 || 00 || 00 || 00).
C0 = IV
Ci = E KL (Mi⊕Ci-1) , i = 1, 2, . . . , n
The method to use the last block of to calculate the message authentification code is
as follows:
MAC =EKL(DKR(Cn))
Algorithm parameter
ipad Pad the byte string, the content is: repeat padding 64 times of the 8-bit byte 0x36
opad Pad the byte string, the content is: repeat padding 64 times of the 8-bit byte 0x5c
text Input data whose MAC needs to be calculated, excluding the padded byte string
K MAC key
Hash
secure
Use key K to encrypt M
HASH
algorithm
Algorithm parameter
3. If K <64, pad 0x00 byte at the end of K, and generate 64-byte K0;
5. Add text to the end of string K0⊕ipad generated from Step 4: (K0⊕ipad)||text;
6. Apply Hash algorithm to string generated from step 5 and get: Hash((K0⊕
ipad)||text);
8. Add the result generated from step 6 to the end of the result from step 7:
Appendix D
(Informative Appendix)
Certificate Format Table
Certificate Field
Meaning Explanation Segment Content (Example)
Name
C Country CN
Issuer Issuer
O Unit Issuer institution
Validity
Validity X months
expiration
Start date of
notBefore Date of issuance YYMMDD + HHMMSS
validity
End date of
notAfter Start date + x months YYMMDD + HHMMSS
validity
C Country CN
Institution
OU XX bank or XX institution
name
Subject Subject
Certificate
OU Includes all 4 integer types
Type
Certificate Field
Meaning Explanation Segment Content (Example)
Name
Includes encryption
Subject Public Uses RSA algorithm; key length greater or
Public Key algorithm and public
Key Information equal to 1024
key value
Extension
Extensions
field
Digital Signature,
Key usage
KeyUsage Key extension keyEncipherment;
method
Authority
AuthorityKeyIdent
Key Key extension Authority certificate public key hash value
ifier
Identifier
Certificate Field
Meaning Explanation Segment Content (Example)
Name
Algorithm used to
SignatureAlgorith Signature electronically sign
m Algorithm certificate basic
information
Issuer electronic
Issuer
Issuer’s Signature signature of certificate Electronic signature value
Signature
basic information
Appendix E
(Informative Appendix)
Secure Channel Establishment Procedure Example
The host sends a GET CLIENT HELLO command to the terminal; terminal
responds with a 1-byte algorithm identifier and 32-byte random number;
The host uses the 1-byte algorithm identifier sent by the terminal to acquire the list
of supported symmetrical and assymetrical algorithms; this identifer is transmitted
to the processing center which uses the list to determine if the signature algorithm
and symmetrical algorithm used by the processing center trusted server certificate
is supported;
The random number is used after this point for verification purposes and generation
of authentication information.
The server then sends the trusted server certificate, algorithm identifier, and
32-byte random number to the terminal.
At this point, the terminal should first inspect the legality of the trusted server
certificate using HASH SERVER CERTIFICATE and VERIFY SERVER
CERTIFICATE commands;
Once the legality of the trusted server certificate has been determined terminal will
generate a 48-byte random number as a shared main key and then encrypt this key
using the trusted server certificate; the EXPORT MASTERKEY command will
then complete the encryption of the shared main key by the trusted server
certificate and return a 128-byte ciphertext;
The terminal certificate will then be read using the READ CERTIFICATE and
GET CERT RESPONSE commands; because certificates are larger than the
maximum transmission bytes admissible by CCID, making it impossible to read a
terminal certificate using a single command. The GET CERT RESPONSE
command can be used multiple times until the entire terminal certificate has been
read; for command details, refer to A.3;
To authenticate the terminal the processing center must verify the terminal private
key signature. The terminal will use the CLIENT SIGN command to conduct a
hash operation and signature of the connection value of the random number inputed
from the terminal and the terminal’s own random number, then return the 128-byte
signature data;
The terminal then sends the 128-byte shared main key ciphertext, terminal
certificate, and 128-byte signature value to the processing center.
Ths server uses the root certificate to verify the legality of the terminal certificate;
if successful then it will verify the signature value with the terminal public key and
thus verify the legality of the terminal itself; once the terminal has been
authenticated the trusted server certificate private key will be used to decrypt the
shared main key ciphertext and acquire the 48-byte shared main key; here, a server
authentication completion message must be sent; so as to guard against this
message being fraudulent it must be completed using an HMAC calculation; the
first 16 values of the 48-byte shared main key serves as the key with the data
consisting of ASCII“SERVER”, the terminal random number, the processing center
random number, the trusted server certificate hash value, the terminal certificate
hash value, the signature value sent from terminal to the server, and the shared
main key ciphertext;
Once the terminal has received the HMAC it will use the HMAC (P2=0x01)
command to verify the HMAC value produced by the server during handshake
completition. Then the HMAC (P2=0x00) command will be used to return the
HMAC value to the terminal; this process is the same as used by the processing
center to generate an HMAC value, but changes ASCII“SERVER” to “CLIENT”;
The terminal will then use the HMAC (P2=0x02) command to generate a dialogue
key; this dialogue key will only be stored within the terminal and will not be
exported; in the case of a power failure this key must be regenerated.
The processing center then verifies the terminal handshake completion information
and generates a session key.
Finally, both the processing center and the termnal will have a 48-byte shared main
key and a 20-byte session key; the first 16 bytes of the 20-byte session key acts as
the encryption key while the last 16-bytes act as the key used to calculate MAC.
Appendix F
(Normative Referrence)
Requirements for Terminal Support of Dual Processing Centers
Transaction
Initialization
Establishment of
secure channel
Assessment of
Channel Certificate A channel certificate Channel Certificate B
CN
Transaction Complete
3) The terminal uses the trusted server certificate general name content of the
DN field retrieved during the establishment of the secure channel to verify
the identity of the processing center. If the trusted server certificate is for
processing center A, then the terminal will enter into processing center A
terminal application procedures; if the trusted server certificate is for
processing center B, then the terminal will enter into processing center B
terminal application procedures;
F.2 DN Rules
DN
Meaning Remarks
Characteristics
The terminal data and certificate system of a terminal that supports dual processing
centers are the same as those used for terminals that only support a single
processing center, but the number of certificates used for terminal personalization is
very different. See Table D.1 for personalization certificate amounts.
Terminal
Capabilities Single Processing Center
Dual Processing Center Terminal
Terminal
Certificate Type
Terminal Certificate 1 1
Root CA Certificate 1 1
Personalization not
Trusted server certificates Personalization not required
required
Appendix G
(Normative Appendix)
List of Command Status Code
DELETE CERTIFICATE
MANAGE LED
SW1
SW2
Normal
61 XX
processing
No information
62 00
provided
Returned data
62 81
may be wrong
Selected file
62 83 √ √ √ √ √ √ √ √ √
invalid
Authentication
63 00 √ √ √ √ √ √ √ √ √
failure
Verification fails,
63 CX X attempts
remaining
65 81 Memory error √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ √
DELETE CERTIFICATE
MANAGE LED
SW1
SW2
67 00 Length error √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ √
Do not support
68 82
secure message
69 00 Unable to process √ √ √ √ √ √ √ √ √ √ √ √ √ √ √
Command
69 01 unaccepted
(invalid)
Command
69 81 incompatible
with file structure
Security status is
69 82 √ √ √ √ √ √ √ √ √ √ √
not met
Verification
69 83 √ √ √ √ √ √ √ √ √ √ √
method lockup
Reference data
69 84
invalid
The application
69 85 conditions are not √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ √
met
Security message
69 87 √ √ √ √ √ √ √ √ √ √ √
data missing
DELETE CERTIFICATE
MANAGE LED
SW1
SW2
Data objects of
security
69 88
information is
incorrect
Data field
6A 80 parameter is
incorrect
Functions not
6A 81 √ √ √ √ √ √ √ √ √ √ √
support
6A 83 No records found
No enough
6A 84 storage space in
file
P1, P2 parameter
6A 86 √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ √
is incorrect
Reference data
6A 88
not found
Parameter error
6B 00 (offset address
outside the EF)
6F 00 Invalid data √ √ √ √ √ √ √ √ √ √ √ √ √ √ √
DELETE CERTIFICATE
MANAGE LED
SW1
SW2
Successful
90 00 execution, no √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ √
error
Insufficient
93 01
amount
Insufficient
93 02
amount
Application
93 03 permanently √ √ √ √ √ √ √ √ √ √ √
locked
Insufficient
94 01 √
amount
Transaction
counter reaches
94 02
the maximum
value
Required MAC is
94 06
not usable
Types not
6E 00 supported: CLA √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ √ √
error
66
66
66
66
66
6D
SW2
04
03
02
01
00
00
UPI Confidential
received
incorrect
character
Default Meaning of Status Code
Receiving
Checksum
has no FCI
not supported
under current DF
response time out
is
Current DF file
No SF or KF
Parity error of
Instruction code
√
READ TERMINAL INFO
√
MANAGE BUZZER
√
MANAGE LED
√
ADD CERTIFICATE
√
UPDATE CERTIFICATE
√
DELETE CERTIFICATE
√
127
Part V IC Card Internet Multipurpose Terminal Specification
Appendix H
(Normative Appendix)
Terminal Version Number Defination And Upgrade Rules
A.B.C.D
And, A\B\C\D are all decimal based, range 0-99, and code is ASCII character, e.g.:
‘1.1.1.1’.
If terminal firmware version is Ac, Bc, Dc, Dc, and firmware version on firmware
upgrade platform is As.Bs.Cs.Ds, then upgrade rules should be:
Notes: 1) all comparision above are based on number, but not string; e.g.: if based
on string comparison ‘9’ is greater than ‘10’, but if based on number comparison,
10 is greater than 9, and this specification is based on number comparison.
Appendix I
(Normative Appendix)
Certificate Update Flow
After secure channel established, MiniPay transaction processing system will use
terminal CA certificate serial number to decide whether update or not, detailed
update flow are defined as follow:
MiniPay Transaction
System MiniPay
3. Return CA certificate SN
Steps:
After secure channel established, MiniPay system will use terminal PIN public key
certificate serial number to decide if need update, detailed flow as below:
MiniPay Transaction
System MiniPay
Steps:
2) MiniPay system gets PIN certificate serial number and CA certificate serial
number from terminal information;
3) MiniPay system uses PIN certificate serial number and CA certificate serial
number to evaluate if terminal needs to update PIN public key and will choose
update PIN certificate file, CA certificate and PIN certificate which match each
other. MiniPay system uses CA certificate serial number to choose
corresponding PIN public key certificate file;
4) MiniPay system compares selected PIN public key certificate file serial number
and PIN certificate serial number returned by terminal, it will distribute new
PIN public key certificate if they are different, or continue if they are the same;
5) After data is received, terminal uses CA certificate to validate new PIN public
key certificate. Terminal will remove old certificate file if the validation
succeeds, and new PIN certificate encryption will be used in the following
transactions.
After secure channel established, MiniPay system uses terminal returned terminal
certificate validation date to decide if terminal certificate needs update. When
update terminal certificate, MiniPay system will check if CA root certificate needs
update. If yes, the system will update CA root certificate, then update terminal
certificate. CA root certificate update and terminal certificate update need happen at
the same time.
3.Transfer command
9.Return P10
10.Transfer P10
13.Request certificate
Steps:
6) MiniPay processing system uses two code, downloads public key certificate
8) Server retruns new publich key certificate file, and use scontrol to transfer to
terminal
9) Terminal validates new public key certificate signature, if success then deletes
old terminal certificate file and private key file, complete update. During
terminal update certificate process, if update failed, then terminal will save old
terminal certificate and private key, until update success, then delete old
terminal certifidate and private key file.
SecurePay
MiniPay
Gateway
1.Get device information
Steps:
1) SecurePay gateway uses 7E25 command to get the CA certificate type supported
by terminal
Appendix J
(Informative Appendix)
Transaction Type
Appendix K
(Informative Appendix)
Platform Access And Communicate Interface Code