[go: up one dir, main page]

WO2011060662A1 - 一种对双电子钱包进行圈存的方法 - Google Patents

一种对双电子钱包进行圈存的方法 Download PDF

Info

Publication number
WO2011060662A1
WO2011060662A1 PCT/CN2010/076701 CN2010076701W WO2011060662A1 WO 2011060662 A1 WO2011060662 A1 WO 2011060662A1 CN 2010076701 W CN2010076701 W CN 2010076701W WO 2011060662 A1 WO2011060662 A1 WO 2011060662A1
Authority
WO
WIPO (PCT)
Prior art keywords
electronic wallet
balance
cpu
electronic
command
Prior art date
Application number
PCT/CN2010/076701
Other languages
English (en)
French (fr)
Inventor
陆舟
于华章
Original Assignee
北京飞天诚信科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from CN2009102378752A external-priority patent/CN101799954B/zh
Priority claimed from CN2009102378767A external-priority patent/CN101799955B/zh
Application filed by 北京飞天诚信科技有限公司 filed Critical 北京飞天诚信科技有限公司
Priority to US12/989,764 priority Critical patent/US9378498B2/en
Publication of WO2011060662A1 publication Critical patent/WO2011060662A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/08Payment architectures
    • G06Q20/10Payment architectures specially adapted for electronic funds transfer [EFT] systems; specially adapted for home banking systems
    • G06Q20/105Payment architectures specially adapted for electronic funds transfer [EFT] systems; specially adapted for home banking systems involving programming of a portable memory device, e.g. IC cards, "electronic purses"
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/30Payment architectures, schemes or protocols characterised by the use of specific devices or networks
    • G06Q20/36Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/30Payment architectures, schemes or protocols characterised by the use of specific devices or networks
    • G06Q20/34Payment architectures, schemes or protocols characterised by the use of specific devices or networks using cards, e.g. integrated circuit [IC] cards or magnetic cards
    • G06Q20/341Active cards, i.e. cards including their own processing means, e.g. including an IC or chip
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/30Payment architectures, schemes or protocols characterised by the use of specific devices or networks
    • G06Q20/34Payment architectures, schemes or protocols characterised by the use of specific devices or networks using cards, e.g. integrated circuit [IC] cards or magnetic cards
    • G06Q20/343Cards including a counter
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/30Payment architectures, schemes or protocols characterised by the use of specific devices or networks
    • G06Q20/34Payment architectures, schemes or protocols characterised by the use of specific devices or networks using cards, e.g. integrated circuit [IC] cards or magnetic cards
    • G06Q20/343Cards including a counter
    • G06Q20/3433Cards including a counter the counter having monetary units
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/30Payment architectures, schemes or protocols characterised by the use of specific devices or networks
    • G06Q20/34Payment architectures, schemes or protocols characterised by the use of specific devices or networks using cards, e.g. integrated circuit [IC] cards or magnetic cards
    • G06Q20/352Contactless payments by cards
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/30Payment architectures, schemes or protocols characterised by the use of specific devices or networks
    • G06Q20/36Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes
    • G06Q20/363Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes with the personal data of a user
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/30Payment architectures, schemes or protocols characterised by the use of specific devices or networks
    • G06Q20/36Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes
    • G06Q20/367Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes involving electronic purses or money safes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/30Payment architectures, schemes or protocols characterised by the use of specific devices or networks
    • G06Q20/36Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes
    • G06Q20/367Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes involving electronic purses or money safes
    • G06Q20/3672Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes involving electronic purses or money safes initialising or reloading thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/30Payment architectures, schemes or protocols characterised by the use of specific devices or networks
    • G06Q20/36Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes
    • G06Q20/367Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes involving electronic purses or money safes
    • G06Q20/3676Balancing accounts
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07FCOIN-FREED OR LIKE APPARATUS
    • G07F7/00Mechanisms actuated by objects other than coins to free or to actuate vending, hiring, coin or paper currency dispensing or refunding apparatus
    • G07F7/08Mechanisms actuated by objects other than coins to free or to actuate vending, hiring, coin or paper currency dispensing or refunding apparatus by coded identity card or credit card or other personal identification means

Definitions

  • the present invention relates to the field of information security, and in particular, to a method for buffering a dual electronic wallet.
  • Mifare 1 Mifare 1
  • a logical encryption card Mifare 1 (Ml) has mature technology and low price, and occupies most of the traditional urban traffic smart card applications, but there is no independent CPU and operating system inside the Ml card, and completely relies on built-in hardware logic to achieve security. Certification and protection, so Ml card is easy to be cracked. According to the development trend of traffic smart card "one", “multi-use, multi-card intercommunication", the capital stock of Ml card e-wallet will be higher and higher, so Ml's security risks Has caused a high degree of attention.
  • CPU card with central processing unit (CPU), random access memory (RAM), program memory
  • the present invention provides a method for buffering a dual-electron 4 packet at a CPU terminal, the method comprising:
  • the CPU card enters the non-contact sensing area of the terminal, and the terminal establishes a connection with the CPU card according to the ISO 14443 interface protocol;
  • the CPU card is powered on and initialized to perform the same on the first electronic wallet and the second electronic wallet. Step, and waiting to receive the terminal to send a command; the terminal sends a cache initialization command to the CPU card; the CPU card receives the cache initialization command, performs a cache initialization operation, and returns the cache initialization
  • the response of the command is sent to the terminal; the terminal receives the response of the cache initialization command, and sends the data in the response message of the cache initialization command to the host; And saving the data, sending a cache transaction acceptance message to the terminal; the terminal receiving the cache transaction acceptance message, and sending a buffer command to the CPU card; the CPU card receiving the buffer Saving a command, buffering the second electronic wallet, updating a balance of the first electronic 4 packet, and returning a response of the buffering command to the terminal; the terminal receiving the cache The response of the command is 4, and the end of the transaction.
  • the invention has the beneficial effects that the present invention provides a method for buffering a dual electronic 4 packet in a CPU terminal, wherein the CPU terminal is used for buffering, thereby improving the original through the M1 terminal.
  • the security of the refilling is performed, and the CPU card provided by the present invention can still use the dual electronic 4 packet in the CPU card in the original M1 terminal without changing the M1 consumer terminal, thus providing the user with a great Convenience
  • the present invention also provides a method for synchronizing the dual electronic wallets in the CPU card, ensuring the consistency of the balance of the dual electronic wallets in the CPU card.
  • FIG. 1 is a schematic diagram of a method for performing a personal operation on a M1 and a CPU portion of a dual CPU card according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of a CPU electronic 4 in a CPU card according to an embodiment of the present invention
  • FIG. 3 is a flowchart of a method for simultaneously storing a CPU e-wallet and an M1 e-wallet in a CPU card by a CPU terminal according to an embodiment of the present invention
  • FIG. 4 is a flowchart of a method for using a CPU e-wallet and an M1 e-wallet in a CPU card to be consumed by a CPU terminal according to an embodiment of the present invention
  • FIG. 5 is a dual-electron in a CPU card according to an embodiment of the present invention
  • the present invention uses a dual interface CPU card, specifically a contactless CPU card with an ISO 14443 interface and Mifare 1, such as SLE66CL80PEM, P5CD012, etc., and through the contactless CPU card, the present invention A dual-electronic 4-pack application is implemented.
  • the ISO 14443 interface in the contactless CPU card is implemented by an electronic 4 package that conforms to a banking standard (such as the PBOC 2.0 standard), that is, a CPU electronic 4 package.
  • the Mifare 1 in the contactless CPU card implements the financial application based on the logical encryption chip standard (Mifare standard), that is, the M1 electronic 4 package.
  • the two 4 packages are independent of each other in hardware, but the CPU electronic 4 package application can access Ml. electronic wallet.
  • the CPU card with the dual electronic wallet is a contactless CPU card
  • the CPU terminal is a contactless terminal.
  • Embodiment 1 This embodiment provides a method for personalizing a M1 and a CPU part in a CPU card, wherein the M1 part in the CPU card can be personalized first, and then the CPU part is personalized. The CPU part of the CPU card can be personalized first, and then the M 1 part is personalized.
  • the M1 part is personalized first, and then the CPU part is personalized, for example, the specific implementation step 4 is as follows: Step 101: Set a new password A and a password B of each sector in M1 under the control of the initial password A and the initial password B, and set the access conditions of each data block in each sector; In the M1, there are 16 sectors, that is, a new password A and a password B need to be set in the 16 sectors, and each sector has 4 blocks, of which the first 3 are data blocks, and the last one.
  • each block is 16 bytes
  • the data block is used to store data
  • the control block contains the password A and password B of the sector in which it is located
  • the access conditions of each data block where password A and password B are respectively 6 bytes, access condition is 4 Bytes.
  • Step 102 Write an initial value to the data block under the control of the password A or the password B of the sector in which the data block to be initialized is located.
  • the balance of the M1 electronic wallet is reserved in advance in the fan.
  • block 0 of block 1 when sector 1 block 0 is initialized, the initial value of M1 e4 packet is written to block 0 under the control of password A or password B of sector 1, that is, block 0 is written.
  • steps 101 and 102 specifically describe the process of initializing the M1 portion.
  • Step 103 Obtain a transport key from the CPU card, and transmit the key Create the file system's home directory MF under the control;
  • Step 104 Create a key (KEY) file under MF;
  • Step 4 105: Add the master key under MF under the control of the transport key;
  • Step 106 The maintenance key under the MF, the global PIN, the unlocking key of the global PIN, and the rekey of the global PIN are added under the control of the master key of the MF;
  • Step 107 Create an application directory file (DIR), PBOC application file (ADF) and key (KEY) file under ADF;
  • Step 108 Add the ADF master key under the control of the MF master key;
  • Step 109 Control the ADF master key Add the ADF maintenance key, application PIN, application PIN unlock key, application PIN reload key, purchase cash withdrawal key, cache key, pickup key, transaction verification (TAC) key, modification Overdraft limit key, external authentication key, and internal recognition
  • the 8-byte sector access key specifically, the input password A and password B of the sector 1 of the sector in which the M1 electronic 4 packet is located are: A0A1A2A3A4A5 and B0B1B2B3B4B5, respectively, and the password A and the password B are hashed.
  • Step 111 Add the sector access key MF_password of the sector where the M1 electronic wallet is located under the control of the master key of the ADF; in this embodiment, the sector access key of the sector where the M1 electronic 4 packet is located may also be MF_password is written to a specific location in the CPU portion of the CPU card.
  • the initial value of the balance into the CPU wallet is 00000000.
  • Step 116 Set a personalized flag in the attribute area of the MF, and then set the personalized flag to ⁇ , indicating that the CPU card has been personalized.
  • a file may also be created, a personalized flag bit is set in the file, and the personalized flag bit is set to OxAA, indicating that the CPU card has been personalized; or It is also possible to use a specific location in the CPU portion of the CPU card as a personalization flag, and set the personalized flag bit to OxAA, indicating that the CPU card has been personalized; wherein OxAA is customized, 0x01 can also be used as a sign that the CPU card has been personalized. That is, the step 4 can also be: the personal ⁇ flag is set to 0x01; or, in the embodiment, step 116 can also be replaced by: Create an identity file,
  • the embodiment of the present invention provides a method for personalizing the M1 and the CPU part in the CPU card respectively.
  • the sector access key of the sector where the M1 electronic wallet is located is written into the CPU part, so that the CPU
  • the electronic 4 package application can access the Ml Electronics 4 package, which can read the ear and 4 tamper with the balance of the Ml Electronics 4 package.
  • Embodiment 2 This embodiment provides a method for synchronizing a CPU electronic wallet and an M1 electronic wallet in a CPU card. When the CPU card is powered on, the CPU electronic wallet and the M1 electronic wallet are synchronously processed to prevent utilization. The Ml terminal performs illegal recharging.
  • the CPU electronic 4 packet and the M1 electronic wallet are synchronized when the CPU card is powered on next time, that is, the CPU is compared.
  • the size of the balance of the wallet and the Ml e-wallet with a small balance to cover the large balance, so that the balance of the Ml e-wallet is covered by the balance of the CPU e-wallet, equivalent to the Ml e-wallet is not illegally recharged, or, when the user uses the CPU card
  • the CPU e-wallet and The Ml e-wallet performs synchronization processing to set the balance of the CPU e-wallet to be the same as the balance of the Ml e-wallet,
  • Step 201 The CPU card enters the non-contact sensing area of the terminal, and establishes a connection with the terminal according to the ISO 14443 interface protocol;
  • the card issuing system and the CPU card pre-arrange, if the card issuing system has personalized the CPU card, the card issuing system creates an identification file under the main directory MF of the file system in the CPU card, when the CPU card When it is judged that the identification file exists internally, it indicates that the CPU card has been personalized. When the CPU card judges that the identification file does not exist internally, it indicates that the CPU card is not personalized.
  • the sector number and the block number of the balance of the M1 electronic 4 packet are pre-agreed, and the M1 is obtained according to the pre-agreed sector number.
  • the sector key, wherein the CPU card obtains the sector key of M1 is specifically: Calling the API interface function extern WORD GetMifareS ectorPassword (BYTE *secPwdBuf, BYTE blockNo) to obtain the sector key of M1.
  • the CPU card uses the sector key of M1 obtained in step 103, and the block number of the balance of the pre-agreed M1 electronic wallet.
  • the method for obtaining the balance of the Ml e-package 4 is as follows: Call the API interface function extern BYTE GetMifarePurseBalance(BYTE *balanceBuf) to obtain the balance of the Ml e-package 4.
  • Step 205 Obtain the balance of the CPU e-wallet.
  • the method for obtaining the balance of the CPU e-wallet is specifically: searching for the address of the application file ADF; and searching for the CPU electronic 4 package file under the ADF according to the application file ADF.
  • Step 206 Synchronize the M1 electronic wallet and the CPU electronic wallet, that is, compare the balance of the M1 electronic wallet with the balance of the CPU electronic wallet.
  • step 207 If the balance of the M1 electronic wallet is less than the balance of the CPU electronic wallet, perform step 207, if the CPU If the balance of the e-wallet is less than the balance of the Ml e-wallet, step 208 is performed. If the balance of the Ml e-wallet is equal to the balance of the CPU e-wallet, step 209 is performed; Step 207: setting the balance of the CPU e-wallet to be related to the Ml e-wallet The balance is consistent, and then step 4 is performed.
  • the balance of the CPU electronic 4 packet is set to be consistent with the balance of the M1 electronic 4 packet, specifically: finding the address of the application file ADF; Finding the address of the CPU electronic 4 packet file under the ADF according to the application file ADF; calculating the CPU for storing the CPU based on the address of the CPU electronic 4 packet file obtained by the search and the preset balance of the CPU electronic 4 packet.
  • the address of the wallet's balance clear the data in the storage area pointed to by the above address, and then write the balance of the Ml e-wallet to the storage area pointed to by the above address In the new balance of the CPU e-package; or, the address of the balance of the CPU e-wallet is read from the pre-agreed storage space; the data in the storage area pointed to by the address is emptied, and then the Ml e-wallet is The balance is written in the storage area pointed to by the above address as a new balance of the CPU electronic 4 package; further, the balance of the CPU electronic wallet is set to
  • the method further includes: The number of transaction details of the M 1 e-wallet in the transaction details of the CPU e-wallet, correspondingly adding the corresponding value of the offline transaction number of the CPU e-wallet, wherein the corresponding value is the same as the above-mentioned number, such as appending to The transaction details of the Ml Electronics 4 package in the transaction details of the CPU Electronics 4 package are 5, and the offline transaction number of the CPU e-wallet is correspondingly increased by 5.
  • Step 208 Set the balance of the M1 electronic wallet to be consistent with the balance of the CPU electronic wallet, and then perform step 4 209; in step 4 of the embodiment 208, the balance of the ⁇ 1 M1 electronic 4 package is set to be electronic with the CPU.
  • the method of consistent balance of the package is as follows: According to the pre-agreed sector number, call the API interface function extern WORD GetMifareS ectorPassword (BYTE *secPwdBuf, BYTE blockNo ) to obtain the sector key of Ml; call the API interface function extern BYTE SetMifarePurseBalance ( BYTE *balanceBuf ), and use the obtained sector key of M 1 to set the balance of the M 1 e-wallet, that is, the balance of the M1 electronic 4 package is set to be consistent with the balance of the CPU electronic 4 package; wherein, the Ml electronic wallet The balance is set to match the balance of the CPU e-wallet.
  • Update the transaction details of the Ml Electronics 4 package by: The specific time of reading the transaction details of the Ml e-wallet; The time of each transaction of the CPU e-wallet Compare with the time obtained by reading above; The transaction details of the CPU e-wallet are in the transaction details of the Ml e- 4 package after the time of the above-mentioned read time; wherein, the transaction details are: transaction amount, transaction type identifier, terminal Machine number, transaction date, transaction time, etc.; further, after updating the transaction details of the Ml e-wallet, the method further includes: according to the number of transaction details of the CPU e-wallet in the transaction details appended to the M1 electronic wallet, correspondingly The offline transaction serial number of the M1 electronic 4 packet plus the corresponding value, wherein the corresponding value is the same as the above-mentioned number, for example, the transaction details of the CPU electronic 4 packet added to the transaction details of the M1 electronic 4 package are 2 , then the offline transaction number of the Ml Electronic
  • Step 209 Determine whether a command to search for a card is received. If not, continue to wait for receiving the command and make a determination. If yes, execute step 210; Step 210: Receive a wake-up command WUPA and a request command REQA; Step 211: Return a response command ATQA Then, the anti-collision processing ANTICOL is performed, and then the selection command SELECT is received; Step 212: Send the selection confirmation SAK to the terminal (MIFARE enabled); Step 213: Receive the contact data frame CL (contactless) Frame; Step 214: Determine whether there is Select the response request command RATS Ccommand, if no, go to step 215, and if yes, go to step 216; Step 215: Perform the Ml wallet application operation until the power is off or the CPU card leaves the non-contact sensing area of the terminal; Step 216: Waiting to receive application commands.
  • the embodiment provides a method for synchronizing the CPU electronic wallet and the M1 electronic wallet in the CPU card.
  • the CPU card When the CPU card is powered on, it is necessary to compare the balance of the CPU electronic 4 packet and the M1 electronic 4 packet to the balance. Smaller to cover the balance, this solves the problem that the size of the balance of the CPU e-wallet and the Ml e-wallet is inconsistent when the user uses the CPU card to illegally store and/or illegally consume the M1 terminal.
  • Embodiment 3 This embodiment provides a method for simultaneously storing a CPU electronic 4 packet and an M1 electronic wallet in a CPU card at a CPU terminal. The CPU card enters a non-sensing area of the CPU terminal, and the CPU terminal establishes a connection with the host.
  • Step 301 Displaying the terminal
  • the application of the bank is selected by the user.
  • the user selects the bank application displayed on the terminal according to the needs of the user.
  • the user selects the cache application.
  • Step 302 The CPU card sets the current application identifier according to the cache application selected by the user, and returns the application serial number corresponding to the application identifier to the terminal.
  • Step 304 The host saves the application serial number corresponding to the CPU card sent by the terminal;
  • Step 306 The terminal sends a cache initialization command INITIALIZE FOR LOAD to the CPU card.
  • the cache initialization command INITIALIZE FOR LOAD is used for the initial 4 cache transaction;
  • the INITIALIZE FOR LOAD command is divided into four parts: Command Head + Command Body: (CLA + INS + P 1 + P2) + (Lc + Data + Le); where CLA + INS + P1 + P2 is the command header, Lc + Data + Le is the command body, the command header is the code of the command, CLA in the command header is the instruction type, INS is the instruction code, P1 and P2 are the instruction parameters; Lc in the command body is the length of the data in the command body, Le Is the maximum number of bytes of the expected APDU data field; And the data contained in the INITIALIZE FOR LOAD command 4 or the data is specifically the key index number, the transaction amount and the terminal number.
  • Step 307 The CPU card receives the INITIALIZE FOR LOAD command sent by the terminal, reads and saves the data in the above command, and then checks whether it supports the key index number included in the above INITIALIZE FOR LOAD command. If not, step 308 is performed.
  • Step 309 Generate a pseudo random number and a process key, and use the process key to calculate the first 4 ⁇ In the present embodiment, the process key is obtained by decentralizing the key DLK; the method for calculating the first message authentication code MAC1 by using the process key is specifically as follows: The balance, transaction amount, transaction type identifier and terminal number sequence link, and then use the process key to encrypt the linked data, and the first four bytes of the obtained encrypted data are the first text authentication code MAC1. .
  • the status codes swl and sw2 in the text are '9000, and the INITIALIZE FOR LOAD response data contained in the data field Data is the balance of the CPU wallet before the transaction, CPU wallet Online transaction serial number, key version number, algorithm identification, pseudo-random number and MAC 1 . If the command execution is unsuccessful, the CPU card returns the INITIALIZE FOR LOAD response to the terminal.
  • Step 311 The terminal receives the INITIALIZE FOR LOAD response returned by the CPU card, and determines whether the status code is '9000. If not, the transaction is terminated. If yes, step 312 is performed; Step 312: The terminal responds with INITIALIZE FOR LOAD All the response data in the text is sent to the host; Step 313: The host receives and saves all the response data sent by the terminal, generates a same process key according to the same method that the CPU card generates the process key in step l 309, and uses the process key to verify the received response.
  • Step 314 The host notifies the terminal that the transaction is not accepted, and the transaction is terminated.
  • Step 315 The host deducts the transaction amount from the user in the corresponding account of the bank, and calculates the second message authentication code by using the process key generated in step 213.
  • MAC2 the method for calculating the second message authentication code MAC2 by using the process key generated in step 313 is specifically: the transaction amount, the transaction type identifier, the terminal number, the transaction date of the host, and the host.
  • the transaction time sequence is linked, and the data obtained by the link is encrypted by using the generated process key, and the first four bytes of the obtained encrypted data are the second message authentication code MAC2.
  • Step 316 The host adds 1 to the online transaction serial number of the CPU e-wallet, and sends a buffer transaction acceptance message to the terminal.
  • the data contained in the data field of the cache transaction acceptance message is specifically MAC2. , the transaction date of the host and the trading time of the host.
  • Step 317 The terminal receives the buffer transaction acceptance message sent by the host, reads and saves the data in the cache transaction acceptance message, and then sends a buffer command CREDIT FOR LOAD to the CPU card.
  • the buffer is stored.
  • the command CREDIT FOR LOAD is used for inventory transactions;
  • the CREDIT FOR LOAD command 4 is divided into: Command Head + Command Body That is: (CLA + INS + P 1 + P2) + (Lc + Data + Le); where, the data in the data field of the CREDIT FOR LOAD command message is specifically the transaction date of the host, the transaction time of the host, and M AC2.
  • Step 318 The CPU card receives the CREDIT FOR LOAD command sent by the terminal, reads and saves the data in the above command, and then verifies whether the MAC2 in the data field of the CREDIT FOR LOAD command is valid. If yes, step 319 is performed.
  • step S1 the method for correcting whether the school-risk MAC2 is correct is specifically: linking the transaction amount, the transaction type identifier, the terminal number, the transaction date, and the transaction time, and then using the generated step 309.
  • the process key encrypts the data obtained by the link, and compares the first four bytes of the data obtained by the secret key with the MAC2 in the data field of the CREDIT FOR LOAD command. If not, the MAC2 is incorrect, if the same , then MAC2 is correct.
  • Step 319 The CPU card returns the status code 0x9302 to the terminal, prompting the MAC2 to be invalid, and terminating the buffering operation;
  • Step 320 The CPU card increases the online transaction serial number of the CPU electronic wallet by 1, and the transaction amount is increased to the CPU electronic 4 packet.
  • the method of adding the transaction amount to the balance of the CPU electronic wallet is specifically: searching the address of the application file ADF; searching for the CPU electronic 4 package file under the ADF according to the application file ADF.
  • the method may further include: updating the transaction details of the CPU e-wallet;
  • the transaction details of the CPU e-wallet that need to be updated are specifically: transaction amount, transaction type identifier, terminal number, transaction date of the host, and transaction time of the host, specifically, the CPU card will be the transaction amount, the transaction type identifier, the terminal number,
  • the transaction date of the host and the transaction time sequence of the host are linked to form a record for updating.
  • Step 321 The CPU card obtains the sector key of M1.
  • the sector number and the block number of the balance of the M1 electronic wallet are pre-agreed, and the sector key of the M1 is obtained according to the pre-agreed sector number.
  • the method for obtaining the sector key of the M1 by the CPU card is specifically: calling the API interface function extern WORD GetMifareS ectorPassword (BYTE *secPwdBuf, BYTE blockNo) to obtain the sector key of M1.
  • Step 322 The CPU card adds 1 to the online transaction serial number of the M1 e-wallet, and sets the balance of the M1 e-wallet, that is, the balance of the M1 e-wallet is overwritten by the balance of the CPU e-wallet updated in step 320.
  • the CPU card sets the balance of the Ml e-wallet by: calling the API interface function extern BYTE SetMifarePurseBalance (BYTE *balanceBuf ), and using the sector key obtained in step 321 to set the balance of the M1 e-wallet, that is, in step 320
  • the balance of the updated CPU e-wallet covers the balance of the Ml e-wallet; after setting the balance of the M1 e-packet, it may further include: updating the transaction details of the M1 electronic 4 package; specifically, the post-CPU electronically updated in step 320
  • the transaction details of the wallet are added to the transaction details of the Ml e-wallet; the transaction details are: transaction amount, transaction type identifier, terminal number, transaction date and transaction time, etc.
  • Step 323 The CPU card is different from 8 bytes of DTK. Or operation, and then using the result obtained by the exclusive OR operation to calculate the transaction-risk code TAC code; in step 323 of the embodiment, The result obtained by the exclusive OR operation calculates the TAC code, which is specifically: the balance of the CPU wallet after the transaction or the balance of the Ml electronic wallet, the online transaction serial number of the CPU card before adding 1, the transaction amount, the transaction type identifier, the terminal number , the trading day of the host The transaction time sequence is linked with the host, and the result obtained by the exclusive OR operation is used to encrypt the data obtained by the link, and the first four bytes of the obtained encrypted data are the TAC code.
  • TAC code which is specifically: the balance of the CPU wallet after the transaction or the balance of the Ml electronic wallet, the online transaction serial number of the CPU card before adding 1, the transaction amount, the transaction type identifier, the terminal number , the trading day of the host
  • the transaction time sequence is linked with the host, and the result obtained by the exclusive OR operation is
  • Step 324 The CPU card returns the TAC code as the response data field of the CREDIT FOR LOAD command to the terminal.
  • Step 325 The terminal receives the response of the CREDIT FOR LOAD command, and saves the TAC code, and the transaction ends.
  • the TAC code may be verified, or the TAC code may not be immediately verified.
  • the embodiment provides a method for simultaneously storing the CPU electronic 4 packet and the M1 electronic 4 packet in the CPU card at the CPU terminal, thereby avoiding the unsafe time when the original storage through the M1 terminal is performed. Problems, and improve the security of inventory.
  • Embodiment 4 provides a method for using a CPU electronic packet and a M1 electronic wallet in a CPU card for consumption in a CPU terminal.
  • the CPU card enters a non-contact sensing area of the CPU terminal, and the CPU card After power-on, the steps of synchronizing the CPU electronic 4 packet and the M1 electronic wallet described in Embodiment 2 are performed, and then different operations are performed according to the application selected by the user. Specifically, the user selects in this embodiment.
  • the embodiment provides a method for using the CPU electronic wallet and the M1 electronic wallet in the CPU card for consumption. When the CPU terminal uses the CPU electronic wallet for consumption, the CPU wallet is deducted from the balance of the CPU electronic wallet.
  • Step 401 The terminal sends a consumption initialization command INITIALIZE FOR to the CPU card.
  • the consumption initialization command INITIALIZE FOR PURCHASE is used to initialize the consumer transaction
  • the INITIALIZE FOR PURCHASE command 4 is divided into: Command Head + Command Body That is: (CLA + INS + P 1 + P2) + (Lc + Data + Le); where CLA + INS + P1 + P2 is the command header, Lc + Data + Le is the command body, and the command header is the command code.
  • the CLA in the command header is the instruction category, INS is the instruction code, P1 and P2 are the instruction parameters; Lc in the command body is the length of the data in the command body data, and Le is the maximum number of bytes of the expected response APDU data field;
  • the data contained in the INITIALIZE FOR PURCHASE command 4 data or data is specifically the key index number, transaction amount, and terminal number.
  • Step 402 The CPU card receives the INITIALIZE FOR PURCHASE command sent by the terminal, reads and saves the data in the above instruction, and then checks whether it supports the key index number included in the above INITIALIZE FOR PURCHASE command. If not, step 403 is performed. If yes, go to step 404; Step 403: Return the status code 0x9403 to the terminal, and terminate the execution command; Step 404: Read the balance of the CPU electronic 4 packet, and compare whether the transaction amount included in the above INITIALIZE FOR PURCHASE command is If the value is greater than the balance of the CPU e-wallet, if yes, go to step 405. If no, go to step 406.
  • step 404 of this embodiment the method for reading the balance of the CPU e-wallet is as follows: According to the application file ADF, the address of the CPU electronic 4 packet file under the ADF is searched; the data is calculated based on the offset of the CPU electronic 4 packet file obtained by the search and the preset balance of the CPU electronic 4 packet. The address of the balance of the CPU wallet; the calculated address for storing the balance of the CPU wallet Take the balance of CPU e-wallet. Step 405: Return the status code 0x9401 to the terminal, and terminate the execution command.
  • Step 406 The CPU card generates a pseudo random number and a process key. In this embodiment, the process key is used for the CPU electronic wallet or the Ml electronic wallet.
  • Step 407 The CPU card sends a response of the INITIALIZE FOR PURCHASE command to the terminal; wherein, the INITIALIZE FOR PURCHASE response is composed of Data + swl + sw2; only when the INITIALIZE FOR PURCHASE command is successfully executed, the CPU card returns to the terminal
  • the status code swl and sw2 in the INITIALIZE FOR PURCHASE response of the terminal are '9000, and the data contained in the INITIALIZE FOR PURCHASE response data or the data is specifically the pseudo random number generated by the CPU card in step 406.
  • the offline transaction serial number of the CPU e-wallet The offline transaction serial number of the CPU e-wallet.
  • Step 408 The terminal receives the INITIALIZE FOR PURCHAS response returned by the CPU card, and determines whether the status code is '9000. If not, the transaction is terminated.
  • step 409 The terminal responds with INITIALIZE FOR PURCHAS 4 The pseudo-random number in the data field Data and the offline transaction serial number of the CPU e-wallet, and generate the same process key in the same way as the CPU card generation process key, and calculate the third 4 ⁇ text identification The code MAC3;
  • the method for calculating the third 4 ⁇ authentication code MAC3 is specifically: linking the transaction amount, the transaction type identifier, the terminal number, the transaction date of the terminal, and the transaction time of the terminal, and then using The generated process key encrypts the data obtained by the link, and the first four bytes of the obtained encrypted data are the third message authentication code MAC3.
  • Step 410 The terminal sends a consumer transaction command DEBIT FOR PURCHASE WITHDRAW to the CPU card;
  • DEBIT FOR PURCHASE WITHDRAW command 4 ⁇ text is divided into: command header + command body is: (CLA + INS + P1 + P2) + (Lc + Data + Le); where, DEBIT FOR PURCHASE WITHDRAW command message data field Data
  • the data is specifically the terminal transaction serial number, the transaction date of the terminal, the transaction time of the terminal, and MAC3.
  • the CPU card links the transaction amount, the transaction type identifier, the terminal number, the transaction date of the terminal, and the transaction time of the terminal, and uses the process key generated in step 406 to force the data obtained by the link, and then compares the obtained force. .
  • the first four bytes of the encrypted data are the same as the MAC3 in the DEBIT FOR PURCHASE WITHDRAW command data field Data. If they are not the same, MAC3 is invalid. If it is the same, MAC3 is valid.
  • Step 412 Return the status code 0x9302 to the terminal, and terminate the transaction.
  • Step 413 The CPU card increments the offline transaction serial number of the CPU 4 packet by 1 and deducts the transaction amount from the balance of the CPU electronic 4 packet. In step 413 of this embodiment.
  • the method for deducting the transaction amount from the balance of the CPU e-wallet is specifically: finding the address of the application file ADF; searching for the address of the CPU electronic 4 packet file under the ADF according to the application file ADF; The address of the CPU electronic 4 packet file and the preset balance of the CPU electronic 4 packet are used to calculate the address for storing the balance of the CPU e-wallet; reading the data in the storage area pointed to by the above address, will read The obtained data is subtracted from the transaction amount, and the data obtained by the subtraction is used to cover the data in the storage area pointed to by the above address, and the subtracted data is used as the new balance of the CPU electronic 4 package; from the balance of the CPU electronic wallet
  • Update the transaction details of the CPU electronic 4 package wherein, the transaction details of the CPU e-wallet that need to be updated are specifically: transaction amount, transaction class Type identification, terminal number, transaction date of the terminal, and transaction time of the terminal, specifically, CPU The card links the transaction amount, the transaction
  • Step 414 The CPU card obtains the sector key of M1.
  • the sector number and the block number of the balance of the M1 electronic wallet are pre-agreed, and the sector of M1 is obtained according to the pre-agreed sector number.
  • the key, wherein the CPU card obtains the sector key of M1 is specifically: Calling the API interface function extern WORD GetMifareS ectorPassword (BYTE *secPwdBuf, BYTE blockNo) to obtain the sector key of M1.
  • Step 415 The CPU card adds 1 to the offline transaction serial number of the M1 electronic wallet, and sets the balance of the M1 electronic wallet, that is, overwrites the balance of the M1 electronic wallet with the balance of the updated CPU electronic wallet in step 413;
  • the method for setting the balance of the Ml e-wallet by the CPU card is specifically as follows: Calling the API interface function extern BYTE SetMifarePurseBalance (BYTE *balanceBuf ), and setting the balance of the M1 e-wallet by using the sector key obtained in step 414, that is, using the steps
  • the balance of the updated CPU e-wallet in 413 is used to cover the balance of the Ml e-wallet; after setting the balance of the M1 e-package 4, the method may further include: updating the transaction details of the M1 electronic 4 package; specifically, the CPU updated in step 413
  • the transaction details of the e-wallet are added to the transaction details of the Ml e-wallet; the transaction details are:
  • Step 416 The CPU card generates a fourth authentication code MAC4.
  • the method for generating the fourth authentication code MAC4 is specifically: encrypting the transaction amount by using the process key generated in step 406, The first four bytes of the encrypted data are the fourth 4-character authentication code MAC4.
  • Step 417 performing an exclusive OR operation on the left and right 8 bytes of the DTK, and calculating the transaction-risk code TAC code by using the result obtained by the exclusive OR operation;
  • the method for calculating the TAC code by using the result obtained by the exclusive OR operation is specifically: linking the transaction amount, the transaction type identifier, the terminal number, the terminal transaction serial number, the transaction date of the terminal, and the transaction time of the terminal, And the result obtained by the exclusive OR operation is used to encrypt the data obtained by the link, and the first four bytes of the obtained encrypted data are the TAC code.
  • the INITIALIZE FOR PURCHASE response data contains the MAC2 and TAC codes in the data i or Data.
  • This embodiment provides an embodiment in which consumption is performed by a CPU terminal.
  • Embodiment 5 This embodiment provides a method for operating a CPU electronic 4 packet and an M1 electronic wallet in a CPU card in a CPU terminal.
  • a CPU card with a CPU electronic wallet and an M1 electronic wallet is The non-contact CPU card and the CPU terminal are non-contact terminals.
  • Step 501 The CPU card enters the non-contact sensing area of the terminal, and the CPU card is powered on and initialized.
  • Step 502 Determine whether it has been performed.
  • Personalization that is, whether the internal personalized flag is OxAA, if yes, step 503 is performed, and if not, step 509 is performed;
  • the personalization flag is pre-agreed by the card issuing system and the CPU card.
  • the card issuing system sets a personalized flag in the CPU card, and the person is set.
  • the flag bit is set to a pre-agreed value.
  • the pre-agreed value of the CPU card is specifically OxAA, which is customized.
  • the personalized flag is OxAA, it indicates that the CPU card has been personalized. Otherwise, the CPU card is not personalized, and the card issuance system and CPU card. Any other value may be pre-agreed as an identifier, such as 0x01, that is, when the personalized flag is 0x01, it indicates that the CPU card has been personalized, otherwise it indicates that the CPU card is not personalized; or, in this embodiment
  • the card issuing system and the CPU card pre-agreed. If the card issuing system has personalized the CPU card, the card issuing system creates a file system home directory MF in the CPU card, when the CPU card judges that the file system home directory MF exists internally.
  • Step 503 Acquire a sector key of M1.
  • a sector number and a block number for storing a balance of the M1 electronic wallet are pre-agreed, and the sector key of the M1 is obtained by the pre-agreed sector number, where
  • the method for obtaining the sector key of M1 is specifically as follows: Calling the API interface function extern WORD GetMifareSectorPassword (BYTE *secPwdBuf, BYTE blockNo ) to obtain the sector key of M1.
  • Step 504 Acquire the balance of the M1 electronic wallet; in this embodiment, the CPU card acquires the M1 according to the sector key of M1 obtained in step 503 and the block number of the balance of the pre-agreed Ml e-wallet.
  • the balance of the e-wallet in which the balance of the Ml e-4 package is obtained, is specifically as follows: Call the API interface function extern BYTE GetMifarePurseBalance(BYTE *balanceBuf) to obtain the balance of the Ml e-4 package. Step 505: Obtain a balance of the CPU e-wallet.
  • the method for obtaining the balance of the CPU e-wallet is specifically: Find the address of the application file ADF; find the address of the CPU electronic 4 packet file under the ADF according to the application file ADF; the address of the CPU electronic 4 packet file obtained by the search and the balance of the preset CPU electronic 4 package Deviating to calculate an address for storing the balance of the CPU e-wallet; reading the balance of the CPU e-wallet according to the calculated address for storing the balance of the CPU e-wallet; or, pre-arranging a storage space in the CPU card
  • the address for storing the balance of the CPU wallet is read from the above storage space, and the balance of the CPU electronic 4 packet is directly read according to the address.
  • Step 506 Synchronize the M1 electronic wallet and the CPU electronic wallet, that is, compare the balance of the M1 electronic wallet with the balance of the CPU electronic wallet. If the balance of the M1 electronic wallet is less than the balance of the CPU electronic wallet, execute step 507, if the CPU If the balance of the electronic wallet is less than the balance of the M1 electronic wallet, step 508 is performed. If the balance of the M1 electronic wallet is equal to the balance of the CPU electronic wallet, step 4 is performed 509; Step 507: setting the balance of the CPU electronic wallet to be M 1 The balance of the electronic wallet is the same, and then step 4 is performed.
  • the balance of the CPU electronic 4 packet is set to be consistent with the balance of the M1 electronic 4 package, specifically: searching for the application file ADF. Address; find the address of the CPU electronic 4 packet file under the ADF according to the application file ADF; calculate the offset of the CPU electronic 4 packet file obtained by the search and the preset balance of the CPU electronic 4 packet
  • Step 508 Set the balance of the M1 electronic wallet to be consistent with the balance of the CPU electronic wallet, and then perform step 4: 509; in step 508 of this embodiment, set the balance of the M1 electronic wallet to the balance with the CPU electronic wallet.
  • the consistent method is specifically as follows: According to the pre-agreed sector number, the API interface function extern WORD GetMifareS ectorPassword (BYTE *secPwdBuf, BYTE blockNo ) is called to obtain the sector key of M1; the API interface function extern BYTE SetMifarePurseBalance (BYTE is called)
  • the balance of the Ml e-wallet is set to be consistent with the balance of the CPU e-wallet, and further includes: updating the transaction details of the M1 e-packet by: reading the specific time of the last transaction detail of the M1 e-wallet; The time of each transaction detail of the CPU e-wallet is compared with the time obtained by the above reading; the transaction details of the CPU e-wallet are traced to all the transaction details of the time after the above-mentioned read time to the M1 electronic 4 package.
  • the method further includes: The number of transaction details of the CPU e-wallet in the transaction details of the e-wallet, correspondingly the offline transaction serial number of the M1 electronic 4 package plus the corresponding value, wherein the corresponding value is the same as the above-mentioned number, such as appending to Ml
  • the number of transaction details of the CPU electronic 4 package in the transaction details of the electronic 4 package is 1, and the offline delivery of the M1 electronic 4 package is correspondingly performed.
  • Serial number plus 1 Determine whether a command to search for a card is received.
  • step 510 Receive a wakeup command WUPA and a request command REQA
  • Step 511 Return a response command ATQA
  • step 4 is 512: the transmission selection confirmation SAK (MIFARE enabled)
  • step 513 receiving the contact data frame CL (contactless) frame
  • step 514 determining whether there is Selecting the response request command RATS Ccommand, if not, executing step 515, and if yes, executing step 516
  • Step 515 performing the Ml wallet application operation until the power is off or the CPU card leaves the non-contact sensing area of the terminal
  • Step 516 Waiting to receive the application command, when the buffer initialization command INITIALIZE FOR LOAD is received, step 517 is performed, and when the consumption initialization command INITIALIZE FOR PURCHASE is received, step 4 is performed 532;
  • Step 517 Read the data contained in the INITIALIZE FOR LOAD command and save it.
  • the data included in the INITIALIZE FOR LOAD command is specifically the key index number, the transaction amount, and the terminal number.
  • Step 518 Check whether the key index number included in the INITIALIZE FOR LOAD command is supported. If not, execute step 519. If yes, go to step 520.
  • Step 519 Return the status code 0x9403 to the terminal and terminate the execution.
  • Step 520 Generating a pseudo random number and a process key, and using the process key to calculate the first 4th text authentication code MAC 1;
  • the process key is obtained by decentralizing the key DLK;
  • the method for calculating the first message authentication code MAC1 by using the process key is specifically: the balance of the CPU electronic 4 package before the transaction, the transaction amount, the transaction type identifier, and the terminal
  • the numbered sequence is linked, and the linked data is encrypted by the process key, and the first four bytes of the obtained encrypted data are MAC1.
  • Step 522 Receive the buffer command CREDIT FOR LOAD sent by the terminal, read the data in the CREDIT FOR LOAD command and save it; in this embodiment, the cache command CREDIT FOR LOAD is used for the cache transaction; wherein, the CREDIT FOR LOAD command
  • the data in the data is specifically the transaction date, the transaction time and the second message authentication code MAC2.
  • Step 523: The process key generated in step 520 is used to verify whether the MAC2 is valid.
  • step 524 is performed. If yes, step 525 is performed.
  • - is the method for validating the risk MAC2, Specifically, the transaction amount, the transaction type identifier, the terminal number, the transaction date, and the transaction time are sequentially linked, and then the data obtained by the link is encrypted by using the process key generated in step 520, and the data obtained by the secret is compared. The first four bytes are the same as the MAC2 in the data field of the CREDIT FOR LOAD command. If they are not the same, MAC2 is invalid. If they are the same, MAC2 is valid.
  • Step 524 Return the status code 0x9302 to the terminal, prompt MAC2 to be invalid, terminate the execution of the cache operation, and then return to step 4 to gather 516;
  • Step 525 Add the online transaction serial number of the CPU electronic wallet to 1, and add the transaction amount to the CPU electronic wallet.
  • the method of adding the transaction amount to the balance of the CPU electronic wallet is specifically: searching for the address of the application file ADF; and searching for the CPU electronic 4 package under the ADF according to the application file ADF.
  • the address of the file; the address for storing the balance of the CPU e-wallet is calculated based on the offset of the address of the CPU electronic 4 packet file obtained by the search and the balance of the preset CPU electronic 4 packet;
  • the data in the storage area pointed to by the address for storing the balance of the CPU electronic 4 packet, the transaction amount is added to the read data, and the calculated data is used to overwrite the above calculated CPU for storing the electronic wallet.
  • the data in the storage area pointed to by the address of the balance, the data obtained by adding this is the new balance of the CPU e-wallet.
  • Step 526 Update the transaction details of the CPU e-wallet; in this embodiment, the transaction details of the CPU e-wallet that need to be updated are specifically: transaction amount, transaction type identifier, terminal number, transaction date, and transaction time, specifically, the CPU card.
  • the transaction amount, transaction type identifier, terminal number, transaction date, and transaction time sequence are linked to form a record for updating.
  • Step 527 Obtain a sector key of M1.
  • a sector number and a block number for storing a balance of the M1 electronic wallet are pre-agreed, and a sector key of M1 is obtained according to the pre-agreed sector number, where
  • the method for obtaining the sector key of the M1 is specifically: calling the API interface function extern WORD GetMifareSectorPassword (BYTE *secPwdBuf, BYTE blockNo ) to obtain the sector key of M1; Step 528: adding 1 to the online transaction serial number of the M1 electronic wallet.
  • the method of updating the balance of the M1 e-packet is specifically: calling the API interface function Extern BYTE SetMifarePurseBalance ( BYTE *balanceBuf ), and use the obtained sector key to set the balance of the Ml e-wallet, that is, overwrite the balance of the Ml e-wallet with the balance of the updated CPU e-wallet in step 525;
  • Step 530 Perform an exclusive OR operation on the 8 bytes of the DTK, and then calculate the transaction risk code TAC code by using the result of the exclusive OR operation.
  • the TAC code is calculated by using the result obtained by the exclusive OR operation. Specifically: the balance of the CPU wallet after the transaction or the balance of the Ml e-wallet, the online transaction serial number of the CPU card before adding 1, the transaction amount, the transaction type identifier, the terminal number, the transaction date, and the delivery The easy time sequence is linked, and the result obtained by the exclusive OR operation is used to encrypt the data obtained by the link, and the first four bytes of the obtained encrypted data are the TAC code.
  • Step 531 Return the response of the CREDIT FOR LOAD command to the terminal, the transaction ends, and then return to step 516, where the response of the CREDIT FOR LOAD command contains the TAC code;
  • Step 532 Read the consumption initialization command INITIALIZE FOR The data in the PURCHASE is saved; in this embodiment, the consumption initialization command INITIALIZE FOR PURCHASE is used to initialize the consumer transaction; and the data in the INITIALIZE FOR PURCHASE command is specifically the key index number, the transaction amount, and the terminal number.
  • Step 533 Check whether the key index number included in the above INITIALIZE FOR PURCHASE command is supported. If not, execute step 534. If yes, go to step 535.
  • Step 534 Return status code 0x9403 to the terminal, and terminate execution. Consumption initialization operation, then return to step 4 516;
  • Step 535 Read the balance of the CPU electronic 4 packet, determine whether the size of the transaction amount included in the above INITIALIZE FOR PURCHASE command is greater than the size of the balance of the CPU electronic wallet, and if so, Step 536 is performed. If no, step 537 is performed.
  • the method for reading the balance of the CPU wallet is specifically: searching for the address of the application file ADF; and applying the file ADF to find the CPU under the ADF.
  • Step 536 Return the status code 0x9401 to the terminal, and terminate the execution of the consumption initialization operation, and then return to step 4 to gather 516;
  • Step 537 Generate a pseudo random number and a process key;
  • the process key is used for For the consumer transaction of the CPU e-wallet or the M 1 e-wallet, the process key is distributed by the key DPK.
  • Step 538 Send a response of the INITIALIZE FOR PURCHASE command to the terminal; wherein, the INITIALIZE FOR PURCHASE response is composed of Data + swl + sw2; only when the INITIALIZE FOR PURCHASE command is successfully executed, the CPU card is returned to the terminal.
  • the INITIALIZE FOR PURCHASE response status code swl and sw2 are '9000, and the data contained in the INITIALIZE FOR PURCHASE response data is the pseudo-random number and the offline transaction number of the CPU e-wallet. If the command execution is unsuccessful, the CPU card returns the INITIALIZE FOR PURCHAS response to the terminal.
  • Step 539 Receive the consumption command DEBIT FOR PURCHASE WITHDRAW sent by the terminal, and read and save the data in the DEBIT FOR PURCHASE WITHDRAW command; wherein, the data in the DEBIT FOR PURCHASE WITHDRAW command is specifically: terminal transaction serial number, terminal transaction date, terminal Transaction time and third authentication code MAC3.
  • Step 540 Use the process key generated in step 537 to verify whether the MAC3 included in the DEBIT FOR PURCHASE WITHDRAW command is valid. If not, execute step 541. If yes, perform step 4 542.
  • the method of validating whether the MAC3 included in the DEBIT FOR PURCHASE WITHDRAW command is valid is: linking the transaction amount, the transaction type identifier, the terminal number, the transaction date of the terminal, and the transaction time of the terminal, using the process generated in step 537.
  • the key is used to encrypt the data obtained by the link, and the first four bytes of the data obtained by comparing the obtained force p are the same as the MAC3 included in the DEBIT FOR PURCHASE WITHDRAW command. If not, the MAC3 is invalid, if the same , then MAC3 is valid.
  • Step 541 Return status code 0x9302 to the terminal, terminate the transaction, and then return to step 516;
  • the method for deducting the transaction amount from the balance of the CPU electronic wallet is specifically: searching for the address of the application file ADF; searching for the address of the CPU electronic 4 package file under the ADF according to the application file ADF; Finding the offset of the obtained CPU electronic 4 packet file address and the preset CPU electronic 4 packet balance to calculate the address for storing the balance of the CPU e-wallet; reading the above calculated CPU for storing CPU 4
  • the data in the storage area pointed to by the address of the balance of the package, the data obtained by subtracting the transaction amount, and the data obtained by the subtraction are overwritten by the storage pointed to by the address calculated for storing the balance of the CPU electronic wallet.
  • Step 4 543: Update the transaction details of the CPU electronic 4 package;
  • the related transaction details of the CPU electronic wallet that need to be updated are specifically: transaction amount, transaction type identification, terminal number, transaction date, and transaction time, specifically The CPU card combines the transaction amount, the transaction type identifier, the terminal number, the transaction date, and the transaction time sequence to form a record for updating.
  • Step 544 Obtain a sector key of M1.
  • a sector number and a block number for storing a balance of the M1 electronic 4 packet are pre-agreed, and a sector key of the M1 is obtained according to the pre-agreed sector number.
  • the method for obtaining the sector key of M1 is specifically as follows: Calling the API interface function extern WORD GetMifareSectorPassword (BYTE *secPwdBuf, BYTE blockNo) to obtain the sector key of M1.
  • Step 545 Add 1 to the offline transaction serial number of the M1 electronic wallet, and update the balance of the M1 electronic wallet, that is, overwrite the balance of the M1 electronic wallet with the balance of the updated CPU electronic wallet in step 542;
  • the method for updating the balance of the M1 electronic 4 package is specifically: calling the API interface function extern BYTE SetMifarePurseBalance (BYTE *balanceBuf ), and using the steps
  • the sector key obtained in 514 sets the balance of the M1 electronic 4 packet, that is, the balance of the M1 electronic 4 packet is covered by the balance of the CPU 4 packet updated in step 542;
  • Step 547 Generate a fourth 4th text authentication code MAC4.
  • the method for generating the fourth 4th text authentication code MAC4 is specifically: encrypting the transaction amount by using the process key generated in step 537, and obtaining the encrypted
  • the first four bytes of the subsequent data are the fourth text authentication code MAC4.
  • Step 548 Perform an exclusive OR operation on the left and right 8 bytes of the DTK, and calculate the transaction-risk code TAC code by using the result obtained by the exclusive OR operation.
  • the TAC code is calculated by using the result obtained by the exclusive OR operation.
  • the method is specifically: linking the transaction amount, the transaction type identifier, the terminal number, the terminal transaction serial number, the transaction date of the terminal, and the transaction time of the terminal, and encrypting the data obtained by the link by using the result of the exclusive OR operation.
  • the first four bytes of the encrypted data are the TAC codes.
  • the INITIALIZE FOR PURCHASE response data contains MAC2 and TAC codes.
  • the embodiment provides a method for operating a CPU electronic 4 packet and an M1 electronic wallet in a CPU card in a CPU terminal, in which the CPU electronic wallet and the M 1 electronic wallet are synchronized, thereby ensuring the CPU electronic wallet. Consistent with the balance of the Ml e-wallet, it solves the CPU e-wallet and the CPU caused by the user using the CPU card illegally stored and/or illegally consumed by the Ml terminal.
  • the size of the balance of the M1 e-wallet is inconsistent; and in the method, when receiving the cache command, the CPU card caches the CPU electronic 4 packet and the M1 electronic 4 packet in the CPU card at the CPU terminal, so that The security of the cache is improved; and when the consumption command is received in the method, the CPU terminal uses the CPU electronic wallet and the Ml electronic wallet in the CPU card for consumption, that is, deducted from the balance of the CPU electronic 4 package. The corresponding transaction amount is also deducted from the balance of the M 1 electronic 4 package.

Landscapes

  • Business, Economics & Management (AREA)
  • Engineering & Computer Science (AREA)
  • Accounting & Taxation (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Finance (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Microelectronics & Electronic Packaging (AREA)
  • Economics (AREA)
  • Development Economics (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Description

一种对双电子钱包进行圏存的方法 技术领域 本发明涉及信息安全领域,特别涉及一种对双电子钱包进行圏存的方法。 背景技术 逻辑加密卡 Mifare 1 ( Ml )技术成熟、 价格低廉, 在传统的城市交通智 能卡应用中占据了绝大部分, 但 Ml卡内部没有独立的 CPU和操作系统, 完 全依靠内置硬件逻辑电路实现安全认证和保护,因此导致 Ml卡容易被破解, 按交通智能卡"一"" ^多用、 多卡互通"的发展趋势, Ml 卡内电子钱包的资金 存量必将越来越高, 因此 Ml的安全隐患已引起高度的关注。 CPU 卡内具有中央处理器 (CPU )、 随机存储器 (RAM )、 程序存储器
( ROM )、 数据存储器 (EEPROM ) 以及片内操作系统, 其安全性大幅优于 Ml卡, 但高昂的价格严重制约了其推广应用, 近来随着非接触 CPU卡的推 出, 其价格接近 Ml 卡, 技术也日趋成熟, 这使全面推广应用 CPU卡取代 Ml卡成为可能。 现在技术中存在一种包含 Ml和 CPU两部分的 CPU卡, 但是使用这种
CPU卡在 Ml终端进行充值时存在着较大的风险, 同时使用这种 CPU卡也 无法在现有的 Ml终端进行消费, 这样给用户造成了极大的不便, 并且这种 CPU卡在内部处理流程上两部分是完全独立的, 没有同步机制来对这两部分 进行同步。 发明内容 为了解决现有技术中的不足,本发明提供了一种在 CPU终端对双电子 4 包进行圏存的方法, 所述方法包括:
CPU卡进入终端的非接触式感应区, 所述终端与所述 CPU卡按照 ISO 14443接口协议建立连接;
所述 CPU卡上电并初始化,对所述第一电子钱包和第二电子钱包进行同 步, 并等待接收所述终端发送命令; 所述终端向所述 CPU卡发送圏存初始化命令; 所述 CPU卡接收所述圏存初始化命令, 进行圏存初始化操作, 并返回所 述圏存初始化命令的响应 4艮文给所述终端; 所述终端接收所述圏存初始化命令的响应 4艮文, 并将所述圏存初始化命 令的响应报文中的数据发送给主机; 所述主机接收并保存所述数据, 向所述终端发送圏存交易接受报文; 所述终端接收所述圏存交易接受报文, 并向所述 CPU卡发送圏存命令; 所述 CPU卡接收所述圏存命令, 对所述第二电子钱包进行圏存, 更新所 述第一电子 4 包的余额, 并返回所述圏存命令的响应 4艮文给所述终端; 所述终端接收所述圏存命令的响应 4艮文, 圏存交易结束。 本发明的有益效果在于:本发明提供的一种在 CPU终端对双电子 4 包进 行圏存的方法, 该方法中釆用了 CPU终端来进行圏存, 这样就提高了原有的 通过 Ml终端进行充值的安全性, 并且本发明提供的 CPU卡在不改变 Ml消 费终端的前提下,仍然可以在原有的 Ml终端使用该 CPU卡中的双电子 4 包 进行消费,这样给用户提供了极大的方便, 本发明还提供了对 CPU卡内的双 电子钱包进行同步的方法, 保证了 CPU卡内的双电子钱包的余额的一致。 附图说明 图 1为本实施例提供的一种双 CPU卡的 Ml和 CPU部分分别进行个人 4匕的方法¾¾程图; 图 2为本实施例提供的一种对 CPU卡内的 CPU电子 4 包和 Ml电子 4 包进行同步的方法流程图; 图 3为本实施例提供的一种在 CPU终端对 CPU卡内的 CPU电子钱包和 Ml电子钱包同时进行圏存的方法流程图; 图 4为本实施例提供的一种在 CPU终端使用 CPU卡内的 CPU电子钱包 和 M 1电子钱包进行消费的方法流程图; 图 5为本实施例提供的一种在 CPU卡内对双电子钱包进行操作的方法的 流程图。 具体实施方式 为使本发明的目的、 技术方案和优点更加清楚, 下面将结合附图对本发 明实施方式故进一步地详细描述。 本发明使用了一种双界面 CPU 卡, 该双界面 CPU 卡具体为带有 ISO 14443接口和 Mifare 1的非接触式 CPU卡, 如 SLE66CL80PEM、 P5CD012 等,并且通过该非接触式 CPU卡, 本发明实现了双电子 4 包应用, 具体地, 使用该非接触式 CPU 卡中的 ISO 14443 接口实现的是符合银行标准 (如 PBOC2.0标准) 的电子 4 包, 即 CPU电子 4 包, 而使用该非接触式 CPU卡 中的 Mifare 1实现的是基于逻辑加密芯片标准 (Mifare标准) 的金融应用, 即 Ml 电子 4 包,两种 4 包在硬件上相互独立, 但 CPU电子 4 包应用可以访 问 Ml 电子钱包。 在本发明中, 带有双电子钱包的 CPU卡为非接触式 CPU 卡, CPU终端为非接触式终端。 实施例 1 本实施例提供了一种对 CPU卡内的 Ml和 CPU部分分别进行个人化的 方法, 其中可以先对 CPU卡内的 M 1部分进行个人化, 再对 CPU部分进行 个人化, 也可以先对 CPU卡内的 CPU部分进行个人化, 再对 M 1部分进行 个人化, 本实施例以先对 Ml部分进行个人化, 再对 CPU部分进行个人化为 例来进行说明, 具体实现步 4聚如下: 步骤 101: 在初始密码 A和初始密码 B的控制下设置 Ml中各扇区的新 的密码 A和密码 B, 同时设置各扇区中各数据块的访问条件; 在本实施例中, Ml 中共有 16个扇区, 即需要在这 16个扇区中分别设 置新的密码 A和密码 B , 并且, 各个扇区分别有 4个块, 其中前 3个为数据 块, 最后一个为控制块, 每个块均为 16 字节, 数据块用于存储数据, 控制 块包含了所在扇区的密码 A和密码 B , 以及各数据块的访问条件, 其中密码 A和密码 B分别为 6个字节, 访问条件为 4个字节。 步骤 102: 在需要进行初始化的数据块所在的扇区的密码 A或密码 B的 控制下对该数据块写入初始值; 在本实施例步骤 102中, 预先约定 Ml电子钱包的余额存储在扇区 1块 0中, 则对扇区 1块 0进行初始化时, 则在扇区 1的密码 A或密码 B的控制 下 对块 0 写 入 Ml 电 子 4 包 的 初 始 值 , 即 对块 0 写 入 00000000FFFFFFFF0000000004FB04FB, 其中, 前 4个字节的 00000000为 写入的 Ml电子 4 包的初始值, 接下来的 4个字节的 FFFFFFFF为 Ml电子 4 包的初始值的反,再接下来的 4个字节 00000000为 Ml电子 4 包的初始值, 最后的 4个字节 04FB04FB为 Ml电子钱包的余额所在的数据块的块号、 块 号的反、 块号和块号的反。 在本实施例中, 步骤 101和步骤 102具体说明了对 Ml部分进行初始化 的过程, 下面具体描述对 CPU部分进行初始化的过程: 步骤 103: 从 CPU卡内获取传输密钥, 并在传输密钥的控制下创建文件 系统的主目录 MF; 步骤 104: 创建 MF下的密钥 (KEY ) 文件; 步 4聚 105 : 在传输密钥的控制下添加 MF下的主控密钥; 步骤 106:在 MF的主控密钥的控制下添加 MF下的维护密钥、全局 PIN、 全局 PIN的解锁密钥、 全局 PIN的重装密钥等其它密钥; 步骤 107: 创建应用目录文件 (DIR)、 PBOC应用文件 (ADF)以及 ADF下 的密钥 ( KEY ) 文件; 步骤 108: 在 MF的主控密钥的控制下添加 ADF的主控密钥; 步骤 109:在 ADF的主控密钥的控制下添加 ADF下维护密钥、应用 PIN、 应用 PIN的解锁密钥、 应用 PIN的重装密钥、 消费取现密钥、 圏存密钥、 圏 提密钥、 交易验证 ( TAC ) 密钥、 修改透支限额密钥、 外部认证密钥和内部 认证密钥等其它密钥; 步骤 110: 利用 Ml电子 4 包所在扇区的密码 A和密码 B来计算 Ml电 子 4 包所在扇区的 8字节的扇区访问密钥 MF_password; 在本实施例步 4聚 110中, 计算 Ml电子 4 包所在扇区的 8字节的扇区访 问密钥 MF_password的方法, 具体为: 对 Ml电子 4 包所在扇区的密钥 A和 密码 B进行哈希运算, 得到 16字节, 再将得到的 16字节作为 3DES算法的 密钥, 然后用 3DES算法对 8字节的初始值 0000000000000000进行力口密, 结 果即是 Ml电子钱包所在扇区的 8字节的扇区访问密钥; 具体地, Ml电子 4 包所在扇区的扇区 1的输入的密码 A和密码 B分别 为: A0A1A2A3A4A5和 B0B1B2B3B4B5 ,对密码 A和密码 B进行哈希运算, 得 i l的结果为: 40424446484A7E00 007E60626466686A, J>J的结果作为 3DES算法的密钥, 用 3DES算法对初始值 0000000000000000进行力口密, 得 到的结果为 : 8C7F46D76CE01266 , 即得到 的扇 区访问 密钥为 : 8C7F46D76CE01266。 步骤 111 : 在 ADF的主控密钥的控制下添加 Ml电子钱包所在扇区的扇 区访问密钥 MF_password; 在本实施例中, 还可以将 Ml 电子 4 包所在扇区的扇区访问密钥 MF_password写入 CPU卡内的 CPU部分存储区中的特定位置。 步骤 112: 创建 ADF下的公共应用基本文件 ( SFI = 0x15 ), 写入初始信 息; 步骤 113 : 创建 ADF下的持卡人基本文件 ( SFI = 0x16 ),写入初始信息; 步骤 114: 创建 ADF下的交易明细文件 ( SFI = 0x18 ); 步 4聚 115 : 创建 ADF下的自定义的交易工作文件, 写入初始值; 在本实施例步骤 115中,具体在自定义的交易工作文件中写入 CPU电子 钱包的余额的初始值 00000000。 步骤 116: 在 MF的属性区内设置一个个人化标志位, 再将该个人化标 志位设置为 ΟχΑΑ , 表示 CPU卡已进行了个人化操作。 在本实施例中, 还可以创建一个文件, 在该文件内设置一个个人化标志 位, 再将该个人化标志位设置为 OxAA, 表示 CPU卡已进行了个人化操作; 或者, 还可以将 CPU卡内的 CPU部分存储区中的特定位置作为个人化标志位, 并将该个人化标志位设置为 OxAA, 表示 CPU卡已进行了个人化操作; 其中, OxAA是自定义的, 也可以将 0x01作为 CPU卡已进行了个人化 操作的标志, 即步 4聚 116还可以为: 夺个人^ ^标志位设置为 0x01 ; 或者, 在本实施例步骤 116还可以替换为: 在 MF下创建一个标识文件,
本发明实施例提供了一种对 CPU卡内的 Ml和 CPU部分分别进行个人 化的方法, 在本实施例中将 Ml电子钱包所在扇区的扇区访问密钥写入 CPU 部分中, 这样 CPU 电子 4 包应用可以访问 Ml 电子 4 包, 可以读耳又并 4爹改 Ml电子 4 包的余额。 实施例 2 本实施例提供了一种对 CPU卡内的 CPU电子钱包和 Ml电子钱包进行 同步的方法, CPU卡每次上电时, 都会对 CPU电子钱包和 Ml 电子钱包进行 同步处理,防止利用 Ml终端进行非法充值,例如当用户利用 Ml终端对 CPU 卡内的 Ml电子 4 包进行充值后, 则下次 CPU卡上电时会对 CPU电子 4 包 和 Ml电子钱包进行同步, 即比较 CPU电子钱包和 Ml电子钱包的余额的大 小, 以小余额来覆盖大余额, 这样 Ml电子钱包的余额被 CPU电子钱包的余 额覆盖了, 相当于 Ml电子钱包没有被非法充值, 或者, 当用户使用 CPU卡 在 Ml终端消费时, 当时只从 Ml 电子钱包的余额中扣减交易金额, 而不能 从 CPU电子钱包的余额中扣减相应的交易金额,只有在下次 CPU卡上电时, 对 CPU电子钱包和 Ml电子钱包进行同步处理, 从而将 CPU电子钱包的余 额设置为与 Ml电子钱包的余额一致,相当于也从 CPU电子钱包的余额中扣 减了相应的交易金额, 具体实现步骤如下: 步骤 201 : CPU卡进入终端的非接触式感应区, 与终端按照 ISO 14443 接口协议建立连接; 步 4聚 202: CPU卡上电, 初始^^ 判断个人^ ^标志位是否为 OxAA, 若 是, 则执行步骤 203 , 若否, 则执行步骤 209; 在本实施例中, OxAA是 CPU卡与发卡系统预先约定的, 是自定义的, 即预先约定当个人化标志位是 OxAA时, 则表示 CPU卡已进行了个人化, 否 则表示 CPU卡未进行个人化, 并且 CPU卡和发卡系统也可以预先约定任意 其他字符作为标识, 如 0x01 , 即当个人化标志位是 0x01时, 则表示 CPU卡
或者,在本实施例中发卡系统与 CPU卡预先约定,若发卡系统已对 CPU 卡进行个人化时,则发卡系统在 CPU卡中的文件系统的主目录 MF下创建一 个标识文件, 当 CPU卡判断内部已存在标识文件时, 则表示 CPU卡已进行 了个人化, 当 CPU卡判断内部不存在标识文件时, 则表示 CPU卡未进行个 人化。 步骤 203: CPU卡获取 M 1的扇区密钥; 在本实施例中, 预先约定存储 Ml 电子 4 包的余额的扇区号和块号, 并 才艮据该预先约定的扇区号来获取 Ml的扇区密钥, 其中 CPU卡获取 Ml的扇 区 密 钥 的 方 法 具体 为 : 调 用 API 接 口 函 数 extern WORD GetMifareS ectorPassword ( BYTE *secPwdBuf, BYTE blockNo )来获取 Ml的 扇区密钥。 步骤 204: CPU卡获取 M 1电子钱包的余额; 在本实施例中, CPU卡才艮据步骤 103中获得的 Ml的扇区密钥, 以及预 先约定的存储 Ml 电子钱包的余额的块号来获取 Ml 电子钱包的余额, 其中 获取 Ml 电子 4 包的余额的方法具体为: 调用 API接口函数 extern BYTE GetMifarePurseBalance(BYTE *balanceBuf) 来获取 Ml电子 4 包的余额。 步骤 205: 获取 CPU电子钱包的余额; 在本实施例中, 获取 CPU电子钱包的余额的方法具体为: 查找应用文件 ADF的地址; 才艮据应用文件 ADF查找 ADF下的 CPU电子 4 包文件的地址; 才艮据查找得到的 CPU电子 4 包文件的地址和预先设定的 CPU电子 4 包 的余额偏移来计算用于存储 CPU电子钱包的余额的地址; 根据计算得到的用于存储 CPU电子钱包的余额的地址来读取 CPU电子 钱包的余额; 或者, 预先约定 CPU卡内有一块存储空间用于存储 CPU电子钱包的余额的地 址, 则从上述存储空间中读取上述地址, 再才艮据上述地址直接读取 CPU电子 钱包的余额。 步骤 206: 对 Ml电子钱包和 CPU电子钱包进行同步, 即比较 Ml电子 钱包的余额与 CPU电子钱包的余额的大小,若 Ml电子钱包的余额小于 CPU 电子钱包的余额, 则执行步骤 207, 若 CPU电子钱包的余额小于 Ml电子钱 包的余额, 则执行步骤 208, 若 Ml电子钱包的余额与 CPU电子钱包的余额 相等, 则执行步骤 209; 步骤 207: 将 CPU电子钱包的余额设置为与 Ml电子钱包的余额一致, 然后执行步 4聚 209; 在本实施例步骤 207中,将 CPU电子 4 包的余额设置为与 Ml电子 4 包 的余额一致的方法, 具体为: 查找应用文件 ADF的地址; 才艮据应用文件 ADF查找 ADF下的 CPU电子 4 包文件的地址; 才艮据查找得到的 CPU电子 4 包文件的地址和预先设定的 CPU电子 4 包 的余额偏移来计算用于存储 CPU电子钱包的余额的地址; 将上述地址所指向的存储区中的数据清空, 然后将 Ml 电子钱包的余额 写入上述地址所指向的存储区中, 作为 CPU电子 4 包的新的余额; 或者, 从预先约定的存储空间中读取 CPU电子钱包的余额的地址; 将上述地址所指向的存储区中的数据清空, 然后将 Ml 电子钱包的余额 写入上述地址所指向的存储区中, 作为 CPU电子 4 包的新的余额; 进一步地, 将 CPU电子钱包的余额设置为与 Ml电子钱包的余额一致, 还包括: 更新 CPU电子 4 包的交易明细, 具体方法为: 读取 CPU电子钱包的最后一条交易明细的具体时间; 将 Ml 电子 4 包的每条交易明细的时间与上述读取得到的时间进行比 较; 将 Ml 电子钱包的交易明细的时间在上述读取得到的时间之后的所有交 易明细追^?口到 CPU电子 4 包的交易明细中; 其中, 交易明细具体为: 交易金额、 交易类型标识、 终端机编号、 交易 日期和交易时间等; 进一步地, 更新 CPU电子钱包的交易明细之后, 还包括: 根据追加到 CPU电子钱包的交易明细中的 M 1电子钱包的交易明细的条 数, 相应地将 CPU电子钱包的脱机交易序号加上相应的值, 其中该相应的值 与上述条数相同,如追加到 CPU电子 4 包的交易明细中的 Ml电子 4 包的交 易明细的条数为 5 , 则相应地将 CPU电子钱包的脱机交易序号加 5。 步骤 208: 将 M 1电子钱包的余额设置为与 CPU电子钱包的余额一致, 然后执行步 4聚 209; 在本实施例步 4聚 208中, ^ 1 Ml电子 4 包的余额设置为与 CPU电子 4 包 的余额一致的方法具体为: 根据预先约定的扇 区号, 调用 API 接口 函数 extern WORD GetMifareS ectorPassword ( BYTE *secPwdBuf, BYTE blockNo )来获取 Ml的 扇区密钥; 调用 API 接口 函数 extern BYTE SetMifarePurseBalance ( BYTE *balanceBuf ), 并利用获得的 M 1的扇区密钥来设置 M 1电子钱包的余额, 即 将 Ml电子 4 包的余额设置为与 CPU电子 4 包的余额一致; 其中, 将 Ml电子钱包的余额设置为与 CPU电子钱包的余额一致, 还包 括: 更新 Ml电子 4 包的交易明细, 具体方法为: 读取 Ml电子钱包的交易明细的具体时间; 将 CPU 电子钱包的每条交易明细的时间与上述读取得到的时间进行比 较; 将 CPU 电子钱包的交易明细的时间在上述读取得到的时间之后的所有 交易明细追^?口到 Ml电子 4 包的交易明细中; 其中, 交易明细具体为: 交易金额、 交易类型标识、 终端机编号、 交易 日期和交易时间等; 进一步地, 更新 Ml电子钱包的交易明细之后, 还包括: 根据追加到 M 1电子钱包的交易明细中的 CPU电子钱包的交易明细的条 数, 相应地将 Ml 电子 4 包的脱机交易序号加上相应的值, 其中该相应的值 与上述条数相同,如追加到 Ml电子 4 包的交易明细中的 CPU电子 4 包的交 易明细的条数为 2, 则相应地将 Ml电子 4 包的脱机交易序号加 2。 步骤 209: 判断是否接收到寻卡的命令, 若否, 则继续等待接收命令并 进行判断, 若是, 则执行步骤 210; 步骤 210: 接收唤醒命令 WUPA和请求命令 REQA; 步骤 211 : 返回应答命令 ATQA, 再进行防冲撞处理 ANTICOL, 然后接 收选择命令 SELECT; 步骤 212: 发送选择确认 SAK给终端 ( MIFARE enabled ); 步骤 213: 接收到 接触式的数据帧 CL ( contactless ) Frame; 步骤 214: 判断是否有选择应答请求命令 RATS Ccommand, 若否, 则执 行步骤 215 , 若是, 则执行步骤 216; 步骤 215 : 执行 Ml钱包应用操作, 直到掉电或是 CPU卡离开终端的非 接触式感应区; 步骤 216: 等待接收应用命令。 本实施例提供了一种对 CPU卡内的 CPU电子钱包和 Ml电子钱包进行 同步的方法, CPU卡每次上电时, 需要比较 CPU电子 4 包和 Ml 电子 4 包的 余额的大小, 以余额小的来覆盖余额大的, 这样就解决了用户使用该 CPU卡 在 Ml终端非法圏存和 /或非法消费时而造成的 CPU电子钱包和 Ml 电子钱 包的余额的大小不一致的问题。 实施例 3 本实施例提供了一种在 CPU终端对 CPU卡内的 CPU电子 4 包和 Ml电 子钱包同时进行圏存的方法, CPU卡进入 CPU终端的非感应区,且 CPU终端 与主机建立连接后, CPU卡上电, 则 匕时会执行实施例 2 中所说的对 CPU 卡内的 CPU电子钱包和 Ml电子钱包进行同步的步骤,然后再根据用户选择 的应用进行不同的操作, 具体地, 本实施例中用户选择的是圏存应用, 则本 实施例提供了一种对 CPU卡内的 CPU电子钱包和 Ml电子钱包同时进行圏 存的方法, 具体实现步骤如下: 步骤 301 : 终端显示 4艮行的各种应用供用户选择; 其中, 用户根据自己的需要对终端上显示的银行应用进行选择, 在本实 施例中, 用户具体选择的圏存应用。 步骤 302: CPU卡根据用户选择的圏存应用设置当前应用标识, 并将该 应用标识对应的应用序列号返回给终端; 步骤 303 : 终端将 CPU卡发过来的应用序列号转发给主机; 步骤 304: 主机保存终端发送的上述 CPU卡对应的应用序列号; 步骤 305: 主机按照与终端预先约定的密钥标识, 使用相应的圏存主密 钥对上述应用序列号分散得到圏存子密钥; 步骤 306:终端向 CPU卡发送圏存初始化命令 INITIALIZE FOR LOAD; 在本实施例中, 圏存初始化命令 INITIALIZE FOR LOAD用于初始 4匕圏 存交易;
INITIALIZE FOR LOAD命令 4艮文分成: 命令头 + 命令体 即为: (CLA + INS + P 1 + P2) + (Lc + Data + Le); 其中, CLA + INS + P1 + P2为命令头, Lc + Data + Le为命令体, 命令 头为命令的编码, 命令头中的 CLA为指令类别, INS为指令代码, P1和 P2 为指令参数; 命令体中的 Lc为命令体内数据 Data的长度, Le是期望的应答 APDU数据字段的最大字节数; 并且 INITIALIZE FOR LOAD命令 4艮文数据 i或 Data中包含的数据具体为 密钥索引号、 交易金额和终端机编号。 步骤 307: CPU卡接收终端发送的 INITIALIZE FOR LOAD命令, 读取 并保存上述命令中的数据, 然后检查自身是否支持上述 INITIALIZE FOR LOAD命令中包含的密钥索引号, 若不支持, 则执行步骤 308, 若支持, 则 执行步骤 309; 步骤 308: 向终端返回状态码 0x9403 , 并终止执行命令; 步骤 309: 生成一个伪随机数和一个过程密钥, 并利用该过程密钥计算 得到第一 4艮文鉴别码 MAC 1; 在本实施例中, 过程密钥是由密钥 DLK分散得到的; 利用过程密钥计算得到第一报文鉴别码 MAC1的方法具体为: 将交易前的 CPU电子 4 包的余额、 交易金额、 交易类型标识和终端机编 号顺序链接, 再利用过程密钥对链接后的数据进行加密, 得到的加密后的数 据的前四个字节即为第一艮文鉴别码 MAC1。 步 4聚 310: CPU卡将 INITIALIZE FOR LOAD响应 4艮文返回给终端; 其中, INITIALIZE FOR LOAD响应 4艮文由 Data + swl + sw2组成; 只有当 INITIALIZE FOR LOAD命令执行成功时,则 CPU卡返回给终端 的 INITIALIZE FOR LOAD响应 4艮文中的状态码 swl和 sw2为' 9000,, 且 INITIALIZE FOR LOAD响应 4艮文数据域 Data中包含的数据为交易前的 CPU 电子钱包的余额、 CPU电子钱包的联机交易序号、 密钥版本号、 算法标识、 伪随机数和 MAC 1 ,若命令执行不成功,则 CPU卡返回给终端的 INITIALIZE FOR LOAD响应 4艮文中只含有状态码 swl和 sw2, 且状态码 swl和 sw2不 为' 9000,。 步骤 311 : 终端接收 CPU卡返回的 INITIALIZE FOR LOAD响应 4艮文, 并判断状态码是否为 '9000,, 若不是, 则终止交易, 若是, 则执行步骤 312; 步骤 312: 终端将 INITIALIZE FOR LOAD响应 4艮文中的所有响应数据 发送给主机; 步骤 313 : 主机接收并保存终端发送的所有响应数据, 按照 CPU卡在步 l 309中生成过程密钥相同的方法来生成一个相同的过程密钥, 并用该过程 密钥来校验接收到的响应数据中的 MAC1 是否有效, 若无效, 则执行步骤 314, 若有效, 则执行步 4聚 315; 在本实施例步骤 313中,利用生成的过程密钥来校验接收到的 MAC1是 否正确的方法具体为: 将交易前的 CPU电子 4 包的余额、 交易金额、 交易类型标识和终端机编 号顺序链接, 然后利用生成的过程密钥对链接得到的数据进行加密, 再比较 得到的加密后的数据的前四个字节与 MAC1 是否相同, 若不相同, 则校验 MAC1不正确, 若相同, 则校-险 MAC1正确。 步骤 314: 主机通知终端不接受圏存交易, 交易终止; 步骤 315: 主机从用户在银行相应的帐户中扣减交易金额, 并利用步骤 213中生成的过程密钥计算得到第二报文鉴别码 MAC2; 在本实施例中, 利用步骤 313中生成的过程密钥计算得到第二报文鉴别 码 MAC2的方法具体为: 将交易金额、 交易类型标识、 终端机编号、 主机的交易日期和主机的交 易时间顺序链接, 再利用生成的过程密钥对链接得到的数据进行加密, 得到 的加密后的数据的前四个字节即为第二报文鉴别码 MAC2。 步骤 316: 主机将 CPU电子钱包的联机交易序号加 1 , 并向终端发送一 个圏存交易接受报文; 在本实施例步骤 316中, 圏存交易接受报文数据域中包含的数据具体为 MAC2、 主机的交易日期和主机的交易时间。 步骤 317: 终端接收主机发送的圏存交易接受报文, 读取并保存上述圏 存交易接受报文中的数据, 然后向 CPU 卡发送圏存命令 CREDIT FOR LOAD; 在本实施例中, 圏存命令 CREDIT FOR LOAD用于圏存交易;
CREDIT FOR LOAD命令 4艮文分成: 命令头 + 命令体 即为: (CLA + INS + P 1 + P2) + (Lc + Data + Le); 其中, CREDIT FOR LOAD命令报文数据域中的数据具体为主机的交易 日期、 主机的交易时间和 M AC2。 步骤 318: CPU卡接收终端发送的 CREDIT FOR LOAD命令, 读取并保 存上述命令中的数据, 然后校验上述 CREDIT FOR LOAD命令数据域中的 MAC2是否有效, 若, 则执行步骤 319, 若正确, 则执行步骤 320; 在本实施例中, 校-险 MAC2是否正确的方法, 具体为: 将交易金额、 交易类型标识、 终端机编号、 交易日期和交易时间顺序链 接, 然后使用步骤 309中生成的过程密钥对链接得到的数据进行加密, 再比 较力口密后得到的数据的前四个字节与 CREDIT FOR LOAD命令数据域中的 MAC2是否相同, 若不相同, 则 MAC2不正确, 若相同, 则 MAC2正确。 步骤 319: CPU卡向终端返回状态码 0x9302, 提示 MAC2无效, 终止 进行圏存操作; 步骤 320: CPU卡将 CPU电子钱包的联机交易序号加 1 , 将交易金额大 小力口到 CPU电子 4 包的余额上; 在本实施例步骤 320中,将交易金额加到 CPU电子钱包的余额上的方法, 具体为: 查找应用文件 ADF的地址; 才艮据应用文件 ADF查找 ADF下的 CPU电子 4 包文件的地址; 居查找得到的 CPU电子 4 包文件的地址和预先设定的 CPU电子 4 包 的余额的偏移来计算用于存储 CPU电子钱包的余额的地址; 读取上述地址所指向的存储区中的数据, 将交易金额与读取得到的数据 相加, 并用相加得到的数据来覆盖上述地址所指向的存储区中的数据, 将此 相加得到的数据作为 CPU电子钱包新的余额; 将交易金额加到 CPU电子钱包的余额上之后还可以包括: 更新 CPU电 子钱包的交易明细; 其中, 需要更新的 CPU电子钱包的交易明细具体为: 交易金额、 交易类 型标识、 终端编号、 主机的交易日期和主机的交易时间, 具体地, CPU卡将 交易金额、 交易类型标识、 终端编号、 主机的交易日期和主机的交易时间顺 序链接组成一个记录以便更新。 步骤 321: CPU卡获得 Ml的扇区密钥; 在本实施例中, 预先约定存储 Ml 电子钱包的余额的扇区号和块号, 并 根据该预先约定的扇区号来获取 Ml的扇区密钥, 其中, CPU卡获得 Ml的 扇 区 密钥 的 方法具体为 : 调 用 API 接 口 函数 extern WORD GetMifareS ectorPassword ( BYTE *secPwdBuf, BYTE blockNo )来获得 Ml的 扇区密钥。 步骤 322: CPU卡将 Ml 电子钱包的联机交易序号加 1 , 设置 Ml 电子 钱包的余额,即用步骤 320中更新后的 CPU电子钱包的余额来覆盖 Ml电子 钱包的余额; 在本实施例中, CPU 卡设置 Ml 电子钱包的余额的方法具体为: 调用 API接口函数 extern BYTE SetMifarePurseBalance ( BYTE *balanceBuf ), 并 利用步骤 321 中获得的扇区密钥来设置 Ml 电子钱包的余额, 即用步骤 320 中更新后的 CPU电子钱包的余额来覆盖 Ml电子钱包的余额; 设置 Ml 电子 4 包的余额之后, 还可以包括: 更新 Ml 电子 4 包的交易 明细; 具体地,将步骤 320中更新的后 CPU电子钱包的交易明细追加到 Ml电 子钱包的交易明细中; 交易明细具体为: 交易金额、 交易类型标识、 终端机编号、 交易日期和 交易时间等 步骤 323: CPU卡用 DTK左右 8个字节进行异或运算, 再利用异或运 算得到的结果计算交易 -险证码 TAC码; 在本实施例步骤 323中 ,利用异或运算得到的结果计算 TAC码,具体为: 将交易后的 CPU电子钱包的余额或 Ml电子钱包的余额、加 1前的 CPU 卡的联机交易序号、 交易金额、 交易类型标识、 终端机编号、 主机的交易日 期和主机的交易时间顺序链接, 再利用异或运算得到的结果对链接得到的数 据进行加密, 得到的加密后的数据的前四个字节即为 TAC码。 步骤 324: CPU卡将 TAC码作为 CREDIT FOR LOAD命令的响应 4艮文 的数据域返回给终端; 步骤 325 : 终端接收 CREDIT FOR LOAD命令的响应 4艮文, 并保存 TAC 码, 交易结束。 在本实施例步骤 325中, 终端保存 TAC码后可以对 TAC码进行验证, 也可以不立即对 TAC码进行-险证。 本实施例提供了一种在 CPU终端对 CPU卡内的 CPU电子 4 包和 Ml电 子 4 包同时进行圏存的方法, 这样就避免了通过原有的通过 Ml终端进行圏 存时的不安全的问题, 并提高了圏存的安全性。 实施例 4 本实施例提供了一种在 CPU终端使用 CPU卡内的 CPU电子 4 包和 Ml 电子钱包进行消费的方法, 在本实施例中, CPU卡进入 CPU终端的非接触 感应区, CPU卡上电, 则此时会执行实施例 2中所说的对 CPU电子 4 包和 Ml电子钱包进行同步的步骤, 然后再根据用户选择的应用进行不同的操作, 具体地, 本实施例中用户选择的是消费应用, 则本实施例提供了一种使用 CPU卡内的 CPU电子钱包和 Ml电子钱包进行消费的方法, 在 CPU终端使 用 CPU电子钱包进行消费时, 从 CPU电子钱包的余额中扣减交易金额的同 时, 可以不从 Ml 电子 4 包的余额中扣减相应的金额, 然后通过下次上电时 的同步来从 Ml 电子 4 包的余额中扣减相应的金额, 相应地, 也可以直接从 Ml电子 4 包的余额中扣减相应的金额, 本实施例以从 CPU电子 4 包的余额 中扣减交易金额的同时, 也直接从 Ml 电子钱包的余额中扣减相应的金额为 例来进行说明, 具体实现步 4聚如下: 步骤 401 : 终端向 CPU 卡发送消费初始化命令 INITIALIZE FOR
PURCHASE; 在本实施例中,消费初始化命令 INITIALIZE FOR PURCHASE用于初始 化消费交易;
INITIALIZE FOR PURCHASE命令 4艮文分成: 命令头 + 命令体 即为: (CLA + INS + P 1 + P2) + (Lc + Data + Le); 其中, CLA + INS + P1 + P2为命令头, Lc + Data + Le为命令体, 命令 头为命令的编码, 命令头中的 CLA为指令类别, INS为指令代码, P1和 P2 为指令参数; 命令体中的 Lc为命令体内数据 Data的长度, Le是期望的应答 APDU数据字段的最大字节数; 并且 INITIALIZE FOR PURCHASE命令 4艮文数据 i或 Data中包含的数据 具体为密钥索引号、 交易金额和终端机编号。 步骤 402: CPU卡接收终端发送的 INITIALIZE FOR PURCHASE命令, 读取并保存上述指令中的数据, 然后检查自身是否支持上述 INITIALIZE FOR PURCHASE命令中包含的密钥索引号, 若不支持, 则执行步骤 403 , 若 支持, 则执行步骤 404; 步骤 403 : 向终端返回状态码 0x9403 , 并终止执行命令; 步骤 404 : 读取 CPU 电子 4 包的余额, 比较上述 INITIALIZE FOR PURCHASE命令中包含的交易金额的大小是否大于 CPU电子钱包的余额的 大小, 若是, 则执行步骤 405 , 若否, 则执行步骤 406; 在本实施例步骤 404中, 读取 CPU电子钱包的余额的方法具体为: 查找应用文件 ADF的地址; 才艮据应用文件 ADF查找 ADF下的 CPU电子 4 包文件的地址; 才艮据查找得到的 CPU电子 4 包文件的地址和预先设定的 CPU电子 4 包 的余额的偏移来计算用于存储 CPU电子钱包的余额的地址; 根据计算得到的用于存储 CPU电子钱包的余额的地址来读取 CPU电子 钱包的余额。 步骤 405 : 向终端返回状态码 0x9401 , 并终止执行命令; 步骤 406: CPU卡生成一个伪随机数和一个过程密钥; 在本实施例中,过程密钥用于 CPU电子钱包或 Ml电子钱包的消费交易, 过程密钥是用密钥 DPK分散得到的。 步骤 407: CPU卡发送 INITIALIZE FOR PURCHASE命令的响应 4艮文给 终端; 其中, INITIALIZE FOR PURCHASE响应 4艮文由 Data + swl + sw2组成; 只有当 INITIALIZE FOR PURCHASE命令执行成功时, 则 CPU卡返回 给终端的 INITIALIZE FOR PURCHASE响应 4艮文中的状态码 swl和 sw2为 '9000,, 且 INITIALIZE FOR PURCHASE响应 4艮文数据 i或 Data中包含的数 据具体为 CPU卡在步骤 406中生成的伪随机数和 CPU电子钱包的脱机交易 序号, 若命令执行不成功, 则 CPU 卡返回给终端的 INITIALIZE FOR PURCHAS响应 4艮文中只含有状态码 swl和 sw2, 且状态码 swl和 sw2不 为' 9000,。 步骤 408: 终端接收 CPU卡返回的 INITIALIZE FOR PURCHAS响应 4艮 文, 并判断状态码是否为 '9000,, 若不是, 则终止交易, 若是, 则执行步骤 409; 步骤 409: 终端利用 INITIALIZE FOR PURCHAS响应 4艮文数据域 Data 中的伪随机数和 CPU电子钱包的脱机交易序号, 并按照与 CPU卡生成过程 密钥相同的方法生成一个相同的过程密钥, 并计算得到第三 4艮文鉴别码 MAC3; 在本实施例中, 计算得到第三 4艮文鉴别码 MAC3的方法具体为: 将交易金额、 交易类型标识、 终端机编号、 终端的交易日期和终端的交 易时间顺序链接, 再用生成的过程密钥对链接得到的数据进行加密, 得到的 加密后的数据的前四个字节即为第三报文鉴别码 MAC3。 步骤 410: 终端向 CPU卡发送消费交易命令 DEBIT FOR PURCHASE WITHDRAW;
DEBIT FOR PURCHASE WITHDRAW命令 4艮文分成:命令头 + 命令体 即为: (CLA + INS + P1 + P2) + (Lc + Data + Le); 其中, DEBIT FOR PURCHASE WITHDRAW命令报文数据域 Data中的 数据具体为终端交易序号、 终端的交易日期、 终端的交易时间和 MAC3。 步骤 411 : CPU卡接收 DEBIT FOR PURCHASE WITHDRAW命令, 读 取并保存上述命令中的数据, 然后验证 DEBIT FOR PURCHASE WITHDRAW命令数据域 Data中的 MAC3是否有效, 若无效, 则执行步骤 412, 若有效, 则执行步 4聚 413; 在本实施例中, CPU卡验证 DEBIT FOR PURCHASE WITHDRAW命令 数据域 Data中的 MAC1是否有效的方法, 具体为:
CPU卡将交易金额、 交易类型标识、 终端机编号、 终端的交易日期和终 端的交易时间顺序链接, 并用步骤 406中生成的过程密钥对链接得到的数据 进行力 p密, 再比较得到的力。密后的数据的前四个字节与 DEBIT FOR PURCHASE WITHDRAW命令数据域 Data中的 MAC3是否相同,若不相同, 则 MAC3无效, 若 目同, 则 MAC3有效。 步骤 412: 向终端返回状态码 0x9302, 终止交易; 步骤 413 : CPU卡将 CPU 4 包的脱机交易序号加 1 , 并从 CPU电子 4 包的余额中扣减交易金额; 在本实施例步骤 413中,从 CPU电子钱包的余额中扣减交易金额的方法, 具体为: 查找应用文件 ADF的地址; 才艮据应用文件 ADF查找 ADF下的 CPU电子 4 包文件的地址; 才艮据查找得到的 CPU电子 4 包文件的地址和预先设定的 CPU电子 4 包 的余额的偏移来计算用于存储 CPU电子钱包的余额的地址; 读取上述地址所指向的存储区中的数据, 将读取得到的数据减去交易金 额, 并用相减得到的数据来覆盖上述地址所指向的存储区中的数据, 将此相 减得到的数据作为 CPU电子 4 包新的余额; 从 CPU电子钱包的余额中扣减交易金额之后, 还包括: 更新 CPU电子 4 包的交易明细; 其中, 需要更新的 CPU电子钱包的相关交易明细具体为: 交易金额、 交 易类型标识、 终端编号、 终端的交易日期和终端的交易时间, 具体地, CPU 卡将交易金额、 交易类型标识、 终端编号、 终端的交易日期和终端的交易时 间顺序链接组成一个记录以便更新。 步骤 414: CPU卡获得 Ml的扇区密钥; 在本实施例中, 预先约定存储 Ml 电子钱包的余额的扇区号和块号, 并 才艮据该预先约定的扇区号来获取 Ml的扇区密钥, 其中 CPU卡获得 Ml的扇 区 密 钥 的 方 法 具体 为 : 调 用 API 接 口 函 数 extern WORD GetMifareS ectorPassword ( BYTE *secPwdBuf, BYTE blockNo )来获得 Ml的 扇区密钥。 步骤 415 : CPU卡将 Ml 电子钱包的脱机交易序号加 1 , 并设置 Ml 电 子钱包的余额,即用步骤 413中更新后的 CPU电子钱包的余额来覆盖 Ml电 子钱包的余额; 在本实施例中, CPU 卡设置 Ml 电子钱包的余额的方法具体为: 调用 API接口函数 extern BYTE SetMifarePurseBalance ( BYTE *balanceBuf ), 并 利用步骤 414中获得的扇区密钥来设置 Ml 电子钱包的余额, 即用步骤 413 中更新后的 CPU电子钱包的余额来覆盖 Ml电子钱包的余额; 设置 Ml 电子 4 包的余额之后, 还可以包括: 更新 Ml 电子 4 包的交易 明细; 具体地,将步骤 413中更新的 CPU电子钱包的交易明细追加到 Ml电子 钱包的交易明细中; 交易明细具体为: 交易金额、 交易类型标识、 终端机编号、 交易日期和 交易时间等。 步骤 416: CPU卡生成第四 4艮文鉴别码 MAC4; 在本实施例中, 生成第四 4艮文鉴别码 MAC4方法具体为: 用步骤 406中生成的过程密钥对交易金额进行加密, 得到的加密后的数 据的前四个字节即为第四 4艮文鉴别码 MAC4。 步骤 417: 用 DTK左右 8个字节进行异或运算, 并利用异或运算得到的 结果来计算交易 -险证码 TAC码; 在本实施例中, 利用异或运算得到的结果来计算 TAC码的方法具体为: 将交易金额、 交易类型标识、 终端机编号、 终端交易序号、 终端的交易 日期和终端的交易时间顺序链接, 并用异或运算得到的结果对链接得到的数 据进行加密, 得到的加密后的数据的前四个字节即为 TAC码。 步 4聚 418: CPU卡发送 DEBIT FOR PURCHASE WITHDRAW命令的响 应 4艮文给终端; 其中, INITIALIZE FOR PURCHASE响应 4艮文由 Data + swl + sw2组成;
INITIALIZE FOR PURCHASE响应 4艮文的数据 i或 Data中包含有 MAC2 和 TAC码。 步 4聚 419:终端接收 CPU卡发送的 DEBIT FOR PURCHASE WITHDRAW 命令的响应 4艮文,并判断 INITIALIZE FOR PURCHASE响应 4艮文数据 i或 Data 中包含的 MAC4是否有效, 若无效, 则执行步骤 420, 若有效, 则执行步骤 421 ; 步骤 420: 终端进入自定义的错误处理流程; 步 4聚 421 : 交易正常结束。 本实施例提供的是在 CPU终端进行消费的实施例, 在 CPU终端进行消 费时, CPU卡不仅从 CPU电子钱包的余额中扣减相应的交易金额, 并且同 时从 Ml电子钱包的余额中也扣减相应的交易金额,将 CPU电子钱包的余额 设置为与 Ml电子 4 包的余额一致, 这样就保证了消费的一致性。 实施例 5 本实施例提供了一种在 CPU终端对 CPU卡内的 CPU电子 4 包和 Ml电 子钱包进行操作的方法,在本实施例中, 带有 CPU电子钱包和 Ml 电子钱包 的 CPU卡为非接触式 CPU卡, CPU终端为非接触式终端, 具体实现步骤如 下: 步骤 501 : CPU卡进入终端的非接触式感应区内, CPU卡上电并初始化; 步骤 502: 判断自身是否已进行了个人化, 即判断内部的个人化标志位 是否为 OxAA, 若是, 则执行步骤 503 , 若否, 则执行步骤 509; 在本实施例中, 个人化标志位是发卡系统与 CPU卡预先约定的, 当发卡 系统已对 CPU卡进行个人化时, 则发卡系统在 CPU卡中设置一个个人化标 志位, 并将该个人化标志位设置为预先约定的值, 在本实施例中发卡系统与
CPU卡预先约定的值具体为 OxAA,是自定义的, 即当个人化标志位是 OxAA 时, 则表示 CPU卡已进行了个人化, 否则表示 CPU卡未进行个人化, 并且 发卡系统和 CPU卡也可以预先约定任意其他的值作为标识, 如 0x01 , 即当 个人化标志位是 0x01时, 则表示 CPU卡已进行了个人化, 否则表示 CPU卡 未进行个人化; 或者,在本实施例中发卡系统与 CPU卡预先约定,若发卡系统已对 CPU 卡进行个人化时, 则发卡系统在 CPU卡中创建一个文件系统的主目录 MF, 当 CPU卡判断内部已存在文件系统的主目录 MF时, 则表示 CPU卡已进行 了个人化, 当 CPU卡判断内部不存在文件系统的主目录 MF时,则表示 CPU 卡未进行个人化; 或者, 发卡系统与 CPU卡预先约定, 若发卡系统已对 CPU卡进行个人 化时,则发卡系统在 CPU卡中的文件系统的主目录 MF下创建一个标识文件, 当 CPU卡判断内部已存在标识文件时, 则表示 CPU卡已进行了个人化, 当 CPU卡判断内部不存在标识文件时, 则表示 CPU卡未进行个人化。 步骤 503: 获取 Ml的扇区密钥; 在本实施例中, 预先约定存储 Ml 电子钱包的余额的扇区号和块号, 并 居该预先约定的扇区号来获取 Ml的扇区密钥, 其中获取 Ml的扇区密钥 的方法具体为: 调用 API接口函数 extern WORD GetMifareSectorPassword ( BYTE *secPwdBuf, BYTE blockNo ) 来获取 Ml的扇区密钥。 步骤 504: 获取 M 1电子钱包的余额; 在本实施例中, CPU卡才艮据步骤 503中获得的 Ml的扇区密钥, 以及预 先约定的存储 Ml 电子钱包的余额的块号来获取 Ml 电子钱包的余额, 其中 获取 Ml 电子 4 包的余额的方法具体为: 调用 API接口函数 extern BYTE GetMifarePurseBalance(BYTE *balanceBuf) 来获取 Ml电子 4 包的余额。 步骤 505: 获取 CPU电子钱包的余额; 在本实施例中, 获取 CPU电子钱包的余额的方法具体为: 查找应用文件 ADF的地址; 才艮据应用文件 ADF查找 ADF下的 CPU电子 4 包文件的地址; 才艮据查找得到的 CPU电子 4 包文件的地址和预先设定的 CPU电子 4 包 的余额的偏移量来计算用于存储 CPU电子钱包的余额的地址; 根据计算得到的用于存储 CPU电子钱包的余额的地址来读取 CPU电子 钱包的余额; 或者, 预先约定 CPU卡内有一块存储空间用于存储 CPU电子钱包的余额的地 址, 则从上述存储空间中读取上述地址, 再才艮据上述地址直接读取 CPU电子 4 包的余额。 步骤 506: 对 Ml电子钱包和 CPU电子钱包进行同步, 即比较 Ml电子 钱包的余额与 CPU电子钱包的余额的大小,若 Ml电子钱包的余额小于 CPU 电子钱包的余额, 则执行步骤 507, 若 CPU电子钱包的余额小于 Ml电子钱 包的余额, 则执行步骤 508, 若 Ml电子钱包的余额与 CPU电子钱包的余额 相等, 则执行步 4聚 509; 步骤 507: 将 CPU电子钱包的余额设置为与 M 1电子钱包的余额一致, 然后执行步 4聚 509; 在本实施例步骤 507中,将 CPU电子 4 包的余额设置为与 Ml电子 4 包 的余额一致的方法, 具体为: 查找应用文件 ADF的地址; 才艮据应用文件 ADF查找 ADF下的 CPU电子 4 包文件的地址; 才艮据查找得到的 CPU电子 4 包文件的地址和预先设定的 CPU电子 4 包 的余额的偏移量来计算用于存储 CPU电子钱包的余额的地址; 将上述地址所指向的存储区中的数据清空, 然后将 Ml 电子钱包的余额 写入上述地址所指向的存储区中, 作为 CPU电子钱包的新的余额; 或者, 从预先约定的存储空间中读取 CPU电子钱包的余额的地址; 将上述地址所指向的存储区中的数据清空, 然后将 Ml 电子钱包的余额 写入上述地址所指向的存储区中, 作为 CPU电子 4 包的新的余额; 进一步地, 将 CPU电子钱包的余额设置为与 Ml电子钱包的余额一致, 还包括: 更新 CPU电子 4 包的交易明细, 具体方法为: 读取 CPU电子钱包的最后一条交易明细的具体时间; 将 Ml 电子 4 包的每条交易明细的时间与上述读取得到的时间进行比 较; 将 Ml 电子钱包的交易明细的时间在上述读取得到的时间之后的所有交 易明细追力口到 CPU电子 4 包的交易明细中; 其中, 交易明细具体为: 交易金额、 交易类型标识、 终端机编号、 交易 日期和交易时间等; 进一步地, 更新 CPU电子钱包的交易明细之后, 还包括: 根据追加到 CPU电子钱包的交易明细中的 M 1电子钱包的交易明细的条 数, 相应地将 CPU电子 4 包的脱机交易序号加上相应的值, 其中该相应的值 与上述条数相同,如追加到 CPU电子 4 包的交易明细中的 Ml电子 4 包的交 易明细的条数为 3 , 则相应地将 CPU电子钱包的脱机交易序号加 3。 步骤 508: 将 M 1电子钱包的余额设置为与 CPU电子钱包的余额一致, 然后执行步 4聚 509; 在本实施例步骤 508中,将 M 1电子钱包的余额设置为与 CPU电子钱包 的余额一致的方法具体为: 根据预先约定的扇 区号, 调用 API 接口 函数 extern WORD GetMifareS ectorPassword ( BYTE *secPwdBuf, BYTE blockNo )来获取 Ml的 扇区密钥; 调用 API 接口 函数 extern BYTE SetMifarePurseBalance ( BYTE
*balanceBuf), 并利用获得的 Ml的扇区密钥来设置 Ml电子钱包的余额, 即 将 Ml电子 4 包的余额设置为与 CPU电子 4 包的余额一致; 其中, 将 Ml电子钱包的余额设置为与 CPU电子钱包的余额一致, 还包 括: 更新 Ml电子 4 包的交易明细, 具体方法为: 读取 M 1电子钱包的最后一条交易明细的具体时间; 将 CPU 电子钱包的每条交易明细的时间与上述读取得到的时间进行比 较; 将 CPU 电子钱包的交易明细的时间在上述读取得到的时间之后的所有 交易明细追^?口到 Ml电子 4 包的交易明细中; 其中, 交易明细具体为: 交易金额、 交易类型标识、 终端机编号、 交易 日期和交易时间等; 进一步地, 更新 Ml电子钱包的交易明细之后, 还包括: 根据追加到 M 1电子钱包的交易明细中的 CPU电子钱包的交易明细的条 数, 相应地将 Ml 电子 4 包的脱机交易序号加上相应的值, 其中该相应的值 与上述条数相同,如追加到 Ml电子 4 包的交易明细中的 CPU电子 4 包的交 易明细的条数为 1 , 则相应地将 Ml电子 4 包的脱机交易序号加 1。 步骤 509: 判断是否接收到寻卡的命令, 若否, 则继续等待接收命令并 进行判断, 若是, 则执行步骤 510; 步骤 510: 接收唤醒命令 WUPA和请求命令 REQA; 步骤 511 : 返回应答命令 ATQA, 再进行防冲撞处理 ANTICOL, 然后接 收选择命令 SELECT; 步 4聚 512: 发送选择确认 SAK ( MIFARE enabled ); 步骤 513: 接收到 接触式的数据帧 CL ( contactless ) Frame; 步骤 514: 判断是否有选择应答请求命令 RATS Ccommand, 若否, 则执 行步骤 515 , 若是, 则执行步骤 516; 步骤 515 : 执行 Ml钱包应用操作, 直到掉电或是 CPU卡离开终端的非 接触式感应区; 步骤 516 : 等待接收应用命令, 当接收到的是圏存初始化命令 INITIALIZE FOR LOAD时, 则执行步骤 517, 当接收到的是消费初始化命 令 INITIALIZE FOR PURCHASE时, 则执行步 4聚 532; 在本实施例中, 圏存初始化命令 INITIALIZE FOR LOAD用于初始 4匕圏 存交易。 步骤 517: 读取 INITIALIZE FOR LOAD命令中包含的数据并保存; 在本实施例中, INITIALIZE FOR LOAD命令中包含的数据具体为密钥 索引号、 交易金额和终端机编号。 步骤 518: 检查自身是否支持 INITIALIZE FOR LOAD命令中包含的密 钥索引号, 若不支持, 则执行步骤 519, 若支持, 则执行步骤 520; 步骤 519: 返回状态码 0x9403给终端, 并终止执行圏存初始化操作, 然 后返回到步 4聚 516; 步骤 520: 生成一个伪随机数和一个过程密钥, 并利用该过程密钥计算 得到第一 4艮文鉴别码 MAC 1; 在本实施例中, 过程密钥是由密钥 DLK分散得到的; 利用过程密钥计算得到第一报文鉴别码 MAC1的方法具体为: 将交易前的 CPU电子 4 包的余额、 交易金额、 交易类型标识和终端机编 号顺序链接, 再利用过程密钥对链接后的数据进行加密, 得到的加密后的数 据的前四个字节即为 MAC1。 步 4聚 521 : 将 INITIALIZE FOR LOAD响应 4艮文返回给终端; 其中, INITIALIZE FOR LOAD响应 4艮文由 Data + swl + sw2组成; 只有当 INITIALIZE FOR LOAD 响应 4艮文中的状态码 swl 和 sw2 为 '9000,时,则 INITIALIZE FOR LOAD命令执行成功, INITIALIZE FOR LOAD 响应报文数据域 Data中包含的数据有交易前的 CPU电子钱包的余额、 CPU 钱包的联机交易序号、 密钥版本号、 算法标识、 伪随机数和 MAC1 , 若命令 执行不成功, 则返回给终端的 INITIALIZE FOR LOAD响应 4艮文中只含有状 态码 swl和 sw2, 且状态码 swl和 sw2不为' 9000'。 步骤 522:接收终端发送的圏存命令 CREDIT FOR LOAD,读取 CREDIT FOR LOAD命令中的数据并保存; 在本实施例中, 圏存命令 CREDIT FOR LOAD用于圏存交易; 其中, CREDIT FOR LOAD命令中的数据具体为交易日期、 交易时间和 第二报文鉴别码 MAC2。 步骤 523:使用步骤 520中生成的过程密钥来验证上述 MAC2是否有效, 若无效, 则执行步骤 524, 若有效, 则执行步骤 525; 在本实施例中, -险证 MAC2是否有效的方法, 具体为: 将交易金额、 交易类型标识、 终端机编号、 交易日期和交易时间顺序链 接, 然后使用步骤 520中生成的过程密钥对链接得到的数据进行加密, 再比 较力口密后得到的数据的前四个字节与 CREDIT FOR LOAD命令数据域中的 MAC2是否相同, 若不相同, 则 MAC2无效, 若相同, 则 MAC2有效。 步骤 524: 返回状态码 0x9302给终端, 提示 MAC2无效, 终止执行圏 存操作, 然后返回到步 4聚 516; 步骤 525 : 将 CPU电子钱包的联机交易序号加 1 , 将交易金额加到 CPU 电子钱包的余额上; 在本实施例步骤 525中,将交易金额加到 CPU电子钱包的余额上的方法, 具体为: 查找应用文件 ADF的地址; 才艮据应用文件 ADF查找 ADF下的 CPU电子 4 包文件的地址; 才艮据查找得到的 CPU电子 4 包文件的地址和预先设定的 CPU电子 4 包 的余额的偏移量来计算用于存储 CPU电子钱包的余额的地址; 读取上述计算得到的用于存储 CPU 电子 4 包的余额的地址所指向的存 储区中的数据, 将交易金额与读取得到的数据相加, 并用相加得到的数据覆 盖上述计算得到的用于存储 CPU 电子钱包的余额的地址所指向的存储区中 的数据, 将此相加得到的数据作为 CPU电子钱包新的余额。 步骤 526: 更新 CPU电子钱包的交易明细; 在本实施例中,需要更新的 CPU电子钱包的交易明细具体为:交易金额、 交易类型标识、 终端编号、 交易日期和交易时间, 具体地, CPU卡将交易金 额、 交易类型标识、 终端编号、 交易日期和交易时间顺序链接组成一个记录 以便更新。 步骤 527: 获得 Ml的扇区密钥; 在本实施例中, 预先约定存储 Ml 电子钱包的余额的扇区号和块号, 并 根据该预先约定的扇区号来获取 Ml的扇区密钥, 其中获得 Ml的扇区密钥 的方法具体为: 调用 API接口函数 extern WORD GetMifareSectorPassword ( BYTE *secPwdBuf, BYTE blockNo ) 来获得 Ml的扇区密钥; 步骤 528: 将 Ml电子钱包的联机交易序号加 1 , 并更新 Ml电子钱包的 余额,即用步骤 525中更新后的 CPU电子钱包的余额覆盖 Ml电子钱包的余 额; 在本实施例中, 更新 Ml电子 4 包的余额的方法具体为: 调用 API接口 函数 extern BYTE SetMifarePurseBalance ( BYTE *balanceBuf ), 并利用获得 的扇区密钥设置 Ml电子钱包的余额,即用步骤 525中更新后的 CPU电子钱 包的余额覆盖 Ml电子钱包的余额; 步 4聚 529: 更新 Ml电子 4 包的交易明细; 具体地,将步骤 526中更新的后 CPU电子钱包的交易明细追加到 Ml电 子 4 包的交易明细中; 交易明细具体为: 交易金额、 交易类型标识、 终端机编号、 交易日期和 交易时间等。 步骤 530: 用 DTK左右 8个字节进行异或运算, 再利用异或运算得到的 结果计算交易险证码 TAC码; 在本实施例步骤 530中,利用异或运算得到的结果计算 TAC码,具体为: 将交易后的 CPU电子钱包的余额或 Ml电子钱包的余额、加 1前的 CPU 卡的联机交易序号、 交易金额、 交易类型标识、 终端机编号、 交易日期和交 易时间顺序链接, 再利用异或运算得到的结果对链接得到的数据进行加密, 得到的加密后的数据的前四个字节即为 TAC码。 步骤 531 :返回 CREDIT FOR LOAD命令的响应 4艮文给终端, 交易结束, 然后返回到步骤 516,其中 CREDIT FOR LOAD命令的响应 4艮文包含有 TAC 码; 步骤 532: 读取消费初始化命令 INITIALIZE FOR PURCHASE中的数据 并保存; 在本实施例中,消费初始化命令 INITIALIZE FOR PURCHASE用于初始 化消费交易; 并且 INITIALIZE FOR PURCHASE命令中的数据具体为密钥索引号、交 易金额和终端机编号。 步骤 533 : 检查自身是否支持上述 INITIALIZE FOR PURCHASE命令中 包含的密钥索引号, 若不支持, 则执行步骤 534, 若支持, 则执行步骤 535; 步骤 534: 返回状态码 0x9403给终端, 并终止执行消费初始化操作, 然 后返回到步 4聚 516; 步骤 535 : 读取 CPU 电子 4 包的余额, 判断上述 INITIALIZE FOR PURCHASE命令中包含的交易金额的大小是否大于 CPU电子钱包的余额的 大小, 若是, 则执行步骤 536, 若否, 则执行步骤 537; 在本实施例步骤 535中, 读取 CPU电子钱包的余额的方法具体为: 查找应用文件 ADF的地址; 应用文件 ADF才艮据查找 ADF下的 CPU电子 4 包文件的地址; 才艮据查找得到的 CPU电子 4 包文件的地址和预先设定的 CPU电子 4 包 的余额的偏移量来计算用于存储 CPU电子钱包的余额的地址; 根据计算得到的用于存储 CPU电子钱包的余额的地址来读取 CPU电子 4 包的余额。 步骤 536: 返回状态码 0x9401给终端, 并终止执行消费初始化操作, 然 后返回到步 4聚 516; 步骤 537: 生成一个伪随机数和一个过程密钥; 在本实施例中,过程密钥用于 CPU电子钱包或 M 1电子钱包的消费交易, 过程密钥是用密钥 DPK分散得到的。 步骤 538: 发送 INITIALIZE FOR PURCHASE命令的响应 4艮文给终端; 其中, INITIALIZE FOR PURCHASE响应 4艮文由 Data + swl + sw2组成; 只有当 INITIALIZE FOR PURCHASE命令执行成功时, 则 CPU卡返回 给终端的 INITIALIZE FOR PURCHASE响应 4艮文中的状态码 swl和 sw2为 '9000,, 且 INITIALIZE FOR PURCHASE响应 4艮文数据 i或 Data中包含的数 据具体为伪随机数和 CPU电子钱包的脱机交易序号, 若命令执行不成功, 则 CPU卡返回给终端的 INITIALIZE FOR PURCHAS响应 4艮文中只含有状态码 swl和 sw2, 且状态码 swl和 sw2不为' 9000,。 步骤 539: 接收终端发送的消费命令 DEBIT FOR PURCHASE WITHDRAW, 读取并保存 DEBIT FOR PURCHASE WITHDRAW命令中的 数据; 其中, DEBIT FOR PURCHASE WITHDRAW命令中的数据具体为: 终 端交易序号、 终端的交易日期、 终端的交易时间和第三鉴别码 MAC3。 步骤 540: 使用步骤 537 中生成的过程密钥来 证 DEBIT FOR PURCHASE WITHDRAW命令中包含的 MAC3是否有效, 若无效, 则执行 步骤 541 , 若有效, 则执行步 4聚 542; 在本实施例中 , 脸证 DEBIT FOR PURCHASE WITHDRAW命令中包含 的 MAC3是否有效的方法, 具体为: 将交易金额、 交易类型标识、 终端机编号、 终端的交易日期和终端的交 易时间顺序链接,用步骤 537中生成的过程密钥对链接得到的数据进行加密, 再比较得到的力 p密后的数据的前四个字节与 DEBIT FOR PURCHASE WITHDRAW命令中包含的 MAC3是否相同, 若不相同, 则 MAC3无效, 若 目同, 则 MAC3有效。 步骤 541 : 返回状态码 0x9302给终端, 终止交易, 然后返回到步骤 516; 步骤 542: 将 CPU电子钱包的脱机交易序号加 1 , 并从 CPU电子钱包的 余额中扣减交易金额; 在本实施例步骤 542中,从 CPU电子钱包的余额中扣减交易金额的方法, 具体为: 查找应用文件 ADF的地址; 才艮据应用文件 ADF查找 ADF下的 CPU电子 4 包文件的地址; 才艮据查找得到的 CPU电子 4 包文件的地址和预先设定的 CPU电子 4 包 的余额的偏移量来计算用于存储 CPU电子钱包的余额的地址; 读取上述计算得到的用于存储 CPU 电子 4 包的余额的地址所指向的存 储区中的数据, 将读取得到的数据减去交易金额, 并用相减得到的数据覆盖 上述计算得到的用于存储 CPU 电子钱包的余额的地址所指向的存储区中的 数据, 将此相减得到的数据作为 CPU电子钱包新的余额。 步 4聚 543: 更新 CPU电子 4 包的交易明细; 在本实施例中, 需要更新的 CPU电子钱包的相关交易明细具体为: 交易 金额、 交易类型标识、 终端编号、 交易日期和交易时间, 具体地, CPU卡将 交易金额、 交易类型标识、 终端编号、 交易日期和交易时间顺序链接组成一 个 ΐ己录以便更新。 步骤 544: 获得 Ml的扇区密钥; 在本实施例中, 预先约定存储 Ml 电子 4 包的余额的扇区号和块号, 并 根据该预先约定的扇区号来获取 Ml的扇区密钥, 其中获得 Ml的扇区密钥 的方法具体为: 调用 API接口函数 extern WORD GetMifareSectorPassword ( BYTE *secPwdBuf, BYTE blockNo ) 获得 Ml的扇区密钥。 步骤 545 : 将 Ml电子钱包的脱机交易序号加 1 , 并更新 Ml电子钱包的 余额,即用步骤 542中更新后的 CPU电子钱包的余额覆盖 Ml电子钱包的余 额; 在本实施例中, 更新 Ml电子 4 包的余额的方法具体为: 调用 API接口 函数 extern BYTE SetMifarePurseBalance ( BYTE *balanceBuf ), 并利用步骤
514 中获得的扇区密钥设置 Ml 电子 4 包的余额, 即用步骤 542中更新后的 CPU电子 4 包的余额覆盖 Ml电子 4 包的余额; 步 4聚 546: 更新 Ml电子 4 包的交易明细; 具体地,将步骤 543中更新的 CPU电子钱包的交易明细追加到 Ml电子 钱包的交易明细中; 交易明细具体为: 交易金额、 交易类型标识、 终端机编号、 交易日期和 交易时间等。 步骤 547: 生成第四 4艮文鉴别码 MAC4; 在本实施例中, 生成第四 4艮文鉴别码 MAC4方法具体为: 用步骤 537中生成的过程密钥对交易金额进行加密, 得到的加密后的数 据的前四个字节即为第四 艮文鉴别码 MAC4。 步骤 548: 用 DTK左右 8个字节进行异或运算, 并利用异或运算得到的 结果来计算交易 -险证码 TAC码; 在本实施例中, 利用异或运算得到的结果来计算 TAC码的方法具体为: 将交易金额、 交易类型标识、 终端机编号、 终端交易序号、 终端的交易 日期和终端的交易时间顺序链接, 并用异或运算得到的结果对链接得到的数 据进行加密, 得到的加密后的数据的前四个字节即为 TAC码。 步 4聚 549: 返回 DEBIT FOR PURCHASE WITHDRAW命令的响应 4艮文 给终端, 交易结束, 然后返回到步 4聚 516。 其中, INITIALIZE FOR PURCHASE响应 4艮文中包含的数据有 MAC2 和 TAC码。 本实施例提供了一种在 CPU终端对 CPU卡内的 CPU电子 4 包和 Ml电 子钱包进行操作的方法,该方法中对 CPU电子钱包和 M 1电子钱包进行同步, 这样就保证了 CPU电子钱包和 Ml电子钱包的余额的一致,就解决了用户使 用该 CPU卡在 Ml终端非法圏存和 /或非法消费时而造成的 CPU电子钱包和 Ml 电子钱包的余额的大小不一致的问题; 并且在该方法中当接收到圏存命 令时, 则 CPU卡在 CPU终端对 CPU卡内的 CPU电子 4 包和 Ml电子 4 包 进行圏存, 这样就提高了圏存的安全性; 并且在该方法中当接收到消费命令 时,则在 CPU终端使用 CPU卡内的 CPU电子钱包和 Ml电子钱包进行消费, 即从 CPU电子 4 包的余额中扣减相应的交易金额的同时也从 M 1电子 4 包的 余额中也扣减相应的交易金额。 以上仅为本发明的较佳实施例, 并不用以限制本发明, 凡在本发明的精 神和原则之内, 所作的任何修改、 等同替换、 改进等, 均应包含在本发明的 保护范围之内。

Claims

权 利 要 求 书
1. 一种对双电子 4 包进行圏存的方法, 其特征在于, 所述方法包括:
CPU卡进入终端的非接触式感应区, 所述终端与所述 CPU卡按照 ISO 14443接口协议建立连接;
所述 CPU卡上电并初始化,对第一电子钱包和第二电子钱包进行 同步, 并等待接收所述终端发送命令;
所述终端向所述 CPU卡发送圏存初始化命令;
所述 CPU卡接收所述圏存初始化命令, 执行圏存初始化操作, 并 返回所述圏存初始化命令的响应 4艮文给所述终端;
所述终端接收所述圏存初始化命令的响应报文, 并将所述圏存初 始化命令的响应报文中的数据发送给主机;
所述主机接收并保存所述数据, 向所述终端发送圏存交易接受 4艮 文;
所述终端接收所述圏存交易接受报文, 并向所述 CPU卡发送圏存 命令; 所述 CPU卡接收所述圏存命令,对所述第二电子钱包进行圏存操 作, 同时更新所述第一电子钱包的余额, 并返回所述圏存命令的响应 艮文给所述终端;
所述终端接收所述圏存命令的响应 4艮文, 圏存交易结束。
2. 如权利要求 1 所述的对双电子钱包进行圏存的方法, 其特征在于, 所 述 CPU卡进入终端的非接触式感应区内之前, 所述方法还包括: 所述 CPU 卡的发卡系统对所述 CPU 卡中的逻辑加密卡部分和 CPU部分分别进行个人化, 设置个人化标志位;
将所述第一电子钱包在逻辑加密卡部分中所在的扇区的扇区访问 密钥写入所述 CPU卡中的 CPU部分中;
将所述 CPU卡中的个人化标志位设置为第一标识; 或者, 所述 CPU 卡的发卡系统对所述 CPU 卡中的逻辑加密卡部分和 CPU部分分别进行个人^^ 创建一个标识文件;
将所述第一电子钱包在逻辑加密卡部分中所在的扇区的扇区访问 密钥写入所述 CPU卡中的 CPU部分中。 如权利要求 1 所述的对双电子钱包进行圏存的方法, 其特征在于, 所 述第一电子 4 包为基于逻辑加密芯片标准的金融应用, 预先约定存储 区在 CPU卡的逻辑加密卡部分中的扇区号和块号, 其中, 所述存储区 用于存储所述第一电子钱包的余额; 所述第二电子钱包为使用 ISO 14443接口协议实现的符合银行标准的电子钱包。 如权利要求 1 所述的对双电子钱包进行圏存的方法, 其特征在于, 所 述 CPU卡对第一电子钱包和第二电子钱包进行同步之前, 所述方法还 包括:
所述 CPU卡判断个人化标志位是否为预先约定的标识,或者判断 内部是否存在标识文件;
若否, 则所述 CPU 卡不对第一电子 4 包和第二电子 4 包进行同 步, 直接等待接收所述终端发送命令;
若是, 则所述 CPU卡对第一电子钱包和第二电子钱包进行同步, 然后等待接收所述终端发送命令。 如权利要求 1 所述的对双电子钱包进行圏存的方法, 其特征在于, 所 述 CPU卡对所述第一电子钱包和第二电子钱包进行同步的方法,具体 为:
所述 CPU卡获取所述第一电子 4 包的余额;
所述 CPU卡获取所述第二电子 4 包的余额;
所述 CPU 卡比较所述第一电子钱包和所述第二电子钱包的余额 的大小;
若所述第一电子钱包的余额小于所述第二电子钱包的余额, 则所 述 CPU 卡将所述第二电子钱包的余额设置为与所述第一电子钱包的 余额一致, 然后继续进行寻卡操作;
若所述第二电子钱包的余额小于所述第一电子钱包的余额, 则所 述 CPU 卡将所述第一电子钱包的余额设置为与所述第二电子钱包的 余额一致, 然后继续进行寻卡操作;
若所述第一电子钱包的余额与所述第二电子钱包的余额相等, 则 所述 CPU卡继续进行寻卡操作。
6. 如权利要求 5所述的对双电子钱包进行圏存的方法, 其特征在于, 所 述将第二电子钱包的余额设置为与所述第一电子钱包的余额一致的方 法, 具体为: 查找应用文件的地址;
才艮据所述应用文件查找所述应用文件下的第二电子 4 包文件的地 址; 根据所述查找得到的第二电子钱包文件的地址和预先设定的第二 电子钱包的余额的偏移量计算用于存储所述第二电子钱包的余额的地 址;
将所述计算得到的用于存储所述第二电子钱包的余额的地址所指 向的存储区中的数据清空, 并将所述第一电子钱包的余额写入所述计 算得到的用于存储所述第二电子钱包的余额的地址所指向的存储区 中, 作为所述第二电子钱包的新的余额;
或者,
从预先约定的存储空间中读取用于存储所述第二电子钱包的余额 的地址; 将所述用于存储第二电子钱包的余额的地址所指向的存储区中的 数据清空, 并将第一电子钱包的余额写入所述用于存储第二电子钱包 的余额的地址所指向的存储区中,作为所述第二电子钱包的新的余额。
7. 如权利要求 5所述的对双电子钱包进行圏存的方法, 其特征在于, 所 述将第二电子钱包的余额设置为与所述第一电子钱包的余额一致后, 还包括:
更新所述第二电子钱包的交易明细;
根据所述更新的第二电子钱包的交易明细的条数将所述第二电子 钱包的联机交易序号加上相应的值, 其中所述相应的值与所述条数相 同。
8. 如权利要求 5所述的对双电子钱包进行圏存的方法, 其特征在于, 所 述将第一电子钱包的余额设置为与所述第二电子钱包的余额一致的方 法, 具体为:
才艮据存储所述第一电子 4 包的余额的存储区在 CPU 卡的逻辑加 密卡区域中的扇区号, 调用函数获取所述第一电子钱包的扇区密钥; 根据所述获取的扇区密钥和存储所述第一电子钱包的余额的存储 区在 CPU卡的逻辑加密卡区域中的块号,调用函数设置所述第一电子 钱包的余额。
9. 如权利要求 5所述的对双电子钱包进行圏存的方法, 其特征在于, 所 述进行寻卡操作具体为:
判断是否接收到寻卡的命令, 若否, 则继续等待接收寻卡的命令, 若是, 则接收唤醒命令和请求命令;
返回应答命令, 进行防冲撞处理, 并接收终端发来的选择命令; 执行选择命令, 并发送确认信息给终端;
接收非接触式的数据帧。
10. 如权利要求 5所述的对双电子钱包进行圏存的方法, 其特征在于, 所 述进行寻卡操作之后, 还包括:
判断是否有选择应答请求命令, 若是, 则等待接收应用命令; 若 否, 则执行第一电子钱包应用操作。
11. 如权利要求 10所述的对双电子钱包进行圏存的方法, 其特征在于, 当 接收到的所述应用命令是圏存初始化命令时, 所述方法还包括:
执行圏存初始化操作, 返回所述圏存初始化命令的响应报文给终 端;
接收所述终端发送的圏存命令, 对所述第二电子钱包进行圏存, 并更新所述的一电子 4 包的余额, 返回所述圏存命令的相应 4艮文给终 端, 圏存交易结束。
12. 如权利要求 1 所述的对双电子钱包进行圏存的方法, 其特征在于, 所 述 CPU卡进行圏存初始化操作的步 4聚, 具体为:
所述 CPU卡读取并保存所述圏存初始化命令中的数据,其中所述 数据包括密钥索引号和交易金额; 所述 CPU卡检查自身是否支持所述密钥索引号; 若不支持, 则返回错误信息给终端, 终止执行圏存初始化操作; 若支持, 则生成一个伪随机数和一个过程密钥, 并用所述过程密 钥计算得到第一报文鉴别码。
13. 如权利要求 1 所述的对双电子钱包进行圏存的方法, 其特征在于, 所 述 CPU卡接收所述圏存命令,对所述第二电子钱包进行圏存操作的步 骤, 具体为: 读取并保存所述圏存命令中的数据, 其中, 所述数据包含有第二 艮文鉴别码;
使用所述过程密钥 -险证所述第二 4艮文鉴别码是否有效; 若无效, 则返回所述第二 4艮文鉴别码无效的信息给终端, 终止进 行圏存操作;
若有效, 则将所述交易金额加到所述第二电子钱包的余额上。
14. 如权利要求 13所述的对双电子钱包进行圏存的方法, 其特征在于, 所 述将交易金额加到所述第二电子钱包的余额上的方法, 具体为:
查找应用文件的地址;
才艮据所述应用文件查找所述应用文件下的第二电子 4 包文件的地 址; 根据所述查找得到的第二电子钱包文件的地址和预先设定的第二 电子钱包的余额偏移计算用于存储所述第二电子钱包的余额的地址; 读取所述计算得到的用于存储所述第二电子钱包的余额的地址所 指向的存储区中的数据,将所述交易金额与所述读取得到的数据相加, 并用所述相加得到的数据来覆盖所述计算得到的用于存储所述第二电 子钱包的余额的地址所指向的存储区中的数据, 并将所述相加得到的 数据作为所述第二电子钱包新的余额。
15. 如权利要求 1 所述的对双电子钱包进行圏存的方法, 其特征在于, 所 述更新所述第一电子钱包的余额, 具体为将第一电子钱包的余额设置 为与所述第二电子钱包的余额相同, 包括:
才艮据所述存储所述第一电子 4 包的余额的存储区在 CPU 卡的逻 辑加密卡部分中的扇区号, 并调用函数获取所述第一电子钱包的扇区 密钥;
才艮据所述存储所述第一电子 4 包的余额的存储区在 CPU 卡的逻 辑加密卡部分中的块号, 以及所述扇区密钥, 调用函数设置所述第一 电子钱包的余额, 即用所述更新后的第二电子钱包的余额覆盖所述第 一电子 4 包的余额。
16. 如权利要求 1 所述的对双电子钱包进行圏存的方法, 其特征在于, 所 述 CPU卡等待接收所述终端发送命令时, 若所述终端向所述 CPU卡 发送消费初始化命令, 则所述方法还包括:
所述 CPU卡接收所述消费初始化命令, 进行消费初始化操作, 并 返回所述消费初始化命令的响应报文给终端;
所述终端接收所述消费初始化命令的响应 4艮文, 并向所述 CPU卡 发送消费命令;
所述 CPU 卡接收所述消费命令, 使用所述第二电子钱包进行消 费, 并更新所述第一电子钱包的余额, 返回所述消费命令的响应报文 给所述终端;
所述终端接收所述消费命令的响应报文, 消费交易结束。
17. 如权利要求 16所述的对双电子钱包进行圏存的方法, 其特征在于, 所 述 CPU卡进行消费初始化操作的步骤, 具体为:
所述 CPU卡读取并保存所述消费初始化命令中的数据, 其中, 所 述数据包括密钥索引号和交易金额;
所述 CPU卡检查自身是否支持所述密钥索引号;
若不支持, 则返回错误信息给终端, 终止执行消费初始化操作; 若支持, 则读取所述第二电子钱包的余额, 判断所述交易金额是 否大于所述第二电子钱包的余额;
若是, 则返回错误信息给终端, 终止执行消费初始化操作; 若否, 则生成一个伪随机数和一个过程密钥。
18. 如权利要求 16所述的对双电子钱包进行圏存的方法, 其特征在于, 所 述 CPU卡接收所述消费命令,使用所述第二电子钱包进行消费的步骤, 具体为:
读取并保存所述消费命令中的数据, 其中, 所述数据包含第三报 文鉴别码;
使用所述过程密钥 -险证所述第三 4艮文鉴别码是否有效; 若无效, 则返回所述第三 4艮文鉴别码无效的信息给终端, 终止进 行消费操作;
若有效, 则从所述第二电子钱包的余额中扣减所述交易金额。
19. 如权利要求 18所述的对双电子钱包进行圏存的方法, 其特征在于, 所 述从第二电子钱包的余额中扣减所述交易金额的方法, 具体为:
查找应用文件的地址;
才艮据所述应用文件查找所述应用文件下的第二电子 4 包文件的地 址; 根据所述查找得到的第二电子钱包文件的地址和预先设定的第二 电子钱包的余额偏移计算用于存储所述第二电子钱包的余额的地址; 读取所述计算得到的用于存储所述第二电子钱包的余额的地址所 指向的存储区中的数据, 将所述读取得到的数据减去所述交易金额, 并用相减得到的数据覆盖所述计算得到的用于存储所述第二电子钱包 的余额的地址所指向的存储区中的数据, 并将所述相减得到的数据作 为所述第二电子钱包新的余额。
20. 如权利要求 16所述的对双电子钱包进行圏存的方法, 其特征在于, 所 述更新所述第一电子钱包的余额, 具体为将所述第一电子钱包的余额 设置为与所述第二电子钱包的余额相同, 包括:
才艮据所述存储第一电子 4 包的余额的存储区在 CPU 卡的逻辑加 密卡部分中的扇区号, 并调用函数来获取所述第一电子钱包的扇区密 钥;
才艮据所述存储所述第一电子 4 包的余额的存储区在 CPU 卡的逻 辑加密卡部分中的块号, 以及所述扇区密钥, 调用函数来设置所述第 一电子钱包的余额, 即用所述更新后的第二电子钱包的余额覆盖所述 第一电子钱包的余额。
PCT/CN2010/076701 2009-11-20 2010-09-07 一种对双电子钱包进行圈存的方法 WO2011060662A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US12/989,764 US9378498B2 (en) 2009-11-20 2010-09-07 Method for loading double e-wallets

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN200910237876.7 2009-11-20
CN2009102378752A CN101799954B (zh) 2009-11-20 2009-11-20 一种对双电子钱包进行圈存的方法
CN2009102378767A CN101799955B (zh) 2009-11-20 2009-11-20 一种对双电子钱包进行操作的方法
CN200910237875.2 2009-11-20

Publications (1)

Publication Number Publication Date
WO2011060662A1 true WO2011060662A1 (zh) 2011-05-26

Family

ID=44059203

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2010/076701 WO2011060662A1 (zh) 2009-11-20 2010-09-07 一种对双电子钱包进行圈存的方法

Country Status (2)

Country Link
US (1) US9378498B2 (zh)
WO (1) WO2011060662A1 (zh)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012000438A1 (zh) * 2010-06-29 2012-01-05 飞天诚信科技股份有限公司 一种对电子钱包进行操作的方法
US8538845B2 (en) 2011-06-03 2013-09-17 Mozido, Llc Monetary transaction system
US10438196B2 (en) 2011-11-21 2019-10-08 Mozido, Inc. Using a mobile wallet infrastructure to support multiple mobile wallet providers
US9208488B2 (en) * 2011-11-21 2015-12-08 Mozido, Inc. Using a mobile wallet infrastructure to support multiple mobile wallet providers
CN103544037B (zh) * 2013-10-29 2016-08-17 飞天诚信科技股份有限公司 一种支持OpenSC的软硬件驱动的实现方法
US10664833B2 (en) * 2014-03-05 2020-05-26 Mastercard International Incorporated Transactions utilizing multiple digital wallets
US10009324B2 (en) * 2015-06-29 2018-06-26 American Express Travel Related Services Company, Inc. Host card emulation systems and methods
US10567156B2 (en) 2017-11-30 2020-02-18 Bank Of America Corporation Blockchain-based unexpected data detection
FR3089042B1 (fr) * 2018-11-23 2021-05-21 Idemia France Procédé de personnalisation d’un dispositif électronique avec suivi de l’interruption d’une étape de personnalisation
US11829996B1 (en) * 2019-04-25 2023-11-28 Phunware, Inc. Hybrid organizational system for data management and tracking

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1287338A (zh) * 1999-09-06 2001-03-14 李东声 一种实现ic卡安全交易的方法
CN1904923A (zh) * 2006-08-08 2007-01-31 北京握奇数据系统有限公司 用于实现空中圈存的方法及其设备
CN1908995A (zh) * 2005-08-03 2007-02-07 李东声 实现交易ic卡联机交易的方法及其网络系统
CN1941008A (zh) * 2005-09-27 2007-04-04 中国科学院声学研究所 一种电子钱包及其电子货币转移方法
CN1949282A (zh) * 2005-10-11 2007-04-18 上海华虹集成电路有限责任公司 非接触式智能卡钱包操作方法
CN101236673A (zh) * 2008-03-07 2008-08-06 北京握奇数据系统有限公司 实现电子钱包离线充值的方法、复合功能卡和授权载体
WO2008104704A1 (fr) * 2007-02-14 2008-09-04 France Telecom Systeme de paiement electronique comportant un terminal mobile incorporant un porte-monnaie electronique et un serveur
CN101364321A (zh) * 2007-08-06 2009-02-11 北京中电华大电子设计有限责任公司 非接触智能卡中逻辑加密卡和cpu卡的钱包共享方法
CN101799955A (zh) * 2009-11-20 2010-08-11 北京飞天诚信科技有限公司 一种对双电子钱包进行操作的方法
CN101799954A (zh) * 2009-11-20 2010-08-11 北京飞天诚信科技有限公司 一种对双电子钱包进行圈存的方法

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3717031B2 (ja) * 1998-06-05 2005-11-16 富士通株式会社 電子マネー装置、方法、カード並びに電子マネー処理プログラムを記録したコンピュータ読取り可能な記録媒体
JPWO2002039342A1 (ja) * 2000-11-08 2004-03-18 松下電器産業株式会社 プライベート電子バリューバンクシステム
GB2374192B (en) * 2001-04-06 2005-05-18 Freedom Card Ltd Payment system
EP1804220A1 (de) * 2005-12-29 2007-07-04 AXSionics AG Verfahren zur berechtigten Gewährung eines Dienstes und portables Gerät zu dessen Durchführung
CN101536008B (zh) * 2006-09-20 2012-11-21 诺基亚公司 近场连接建立
US8296235B2 (en) 2007-09-07 2012-10-23 Ebay Inc. System and method for cashback funding
EP2279502B1 (en) * 2008-05-19 2016-01-27 Nxp B.V. Nfc mobile communication device and nfc reader

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1287338A (zh) * 1999-09-06 2001-03-14 李东声 一种实现ic卡安全交易的方法
CN1908995A (zh) * 2005-08-03 2007-02-07 李东声 实现交易ic卡联机交易的方法及其网络系统
CN1941008A (zh) * 2005-09-27 2007-04-04 中国科学院声学研究所 一种电子钱包及其电子货币转移方法
CN1949282A (zh) * 2005-10-11 2007-04-18 上海华虹集成电路有限责任公司 非接触式智能卡钱包操作方法
CN1904923A (zh) * 2006-08-08 2007-01-31 北京握奇数据系统有限公司 用于实现空中圈存的方法及其设备
WO2008104704A1 (fr) * 2007-02-14 2008-09-04 France Telecom Systeme de paiement electronique comportant un terminal mobile incorporant un porte-monnaie electronique et un serveur
CN101364321A (zh) * 2007-08-06 2009-02-11 北京中电华大电子设计有限责任公司 非接触智能卡中逻辑加密卡和cpu卡的钱包共享方法
CN101236673A (zh) * 2008-03-07 2008-08-06 北京握奇数据系统有限公司 实现电子钱包离线充值的方法、复合功能卡和授权载体
CN101799955A (zh) * 2009-11-20 2010-08-11 北京飞天诚信科技有限公司 一种对双电子钱包进行操作的方法
CN101799954A (zh) * 2009-11-20 2010-08-11 北京飞天诚信科技有限公司 一种对双电子钱包进行圈存的方法

Also Published As

Publication number Publication date
US20110196788A1 (en) 2011-08-11
US9378498B2 (en) 2016-06-28

Similar Documents

Publication Publication Date Title
CN101799954B (zh) 一种对双电子钱包进行圈存的方法
WO2011060662A1 (zh) 一种对双电子钱包进行圈存的方法
CN113812128B (zh) Nfc移动货币转账的方法、系统和存储介质
US8359630B2 (en) Method and system for implementing a dynamic verification value
US7357309B2 (en) EMV transactions in mobile terminals
CN100438409C (zh) 具有金融交易报文处理能力的智能卡及其工作方法
US20130179351A1 (en) System and method for an authenticating and encrypting card reader
CN110111087A (zh) 用于授权利用不可预期密码的交易的系统和方法
US9213968B2 (en) Systems and methods for conducting financial transactions using non-standard magstripe payment cards
CN103152174B (zh) 应用于停车场的数据处理方法、装置及停车场管理系统
TW201248409A (en) Security architecture for using host memory in the design of a secure element
US20150161591A1 (en) Mobile payment method and mobile payment apparatus
WO2012000438A1 (zh) 一种对电子钱包进行操作的方法
CN102044114A (zh) 一种对电子钱包进行消费的方法
CN102063767B (zh) 更新智能卡密钥的方法、系统及psam卡
CN101162535A (zh) 利用ic卡实现磁条卡交易的方法及系统
JP2024503358A (ja) 公開鍵/秘密鍵認証のための装置、システム、および方法
CN101799955B (zh) 一种对双电子钱包进行操作的方法
CN102118394A (zh) 基于双界面安全智能卡的网上银行远程支付的安全认证方法
CN201946038U (zh) 基于双界面安全智能卡的网上银行远程支付的安全认证装置
TW200917140A (en) A wireless communication transaction system and method using a wireless card reader
CN2929835Y (zh) 具有金融交易报文处理能力的智能卡
TWM640763U (zh) 基於交易風險控管的晶片卡交易系統
US20240086896A1 (en) Mobile wallets and companion smart cards
CN101110134A (zh) 生物特征码存取控制器及其架构与应用方法

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 12989764

Country of ref document: US

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 10831078

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 10831078

Country of ref document: EP

Kind code of ref document: A1