US-12619987-B2 - Transaction verification method and apparatus using a secure element at a terminal device to verify validity of the transaction
Abstract
A transaction verification method is applied to an electronic device that includes a secure element (SE), a trusted execution environment (TEE), and a rich execution environment (REE), and includes, in a transaction verification process, execution of service logic and data storage are performed on a TEE side instead of on an SE side, and transaction validity verification is reserved on the SE side.
Inventors
- Shuo Cheng
- Heng Zhang
- Guangyao NIE
Assignees
- DIGITAL CURRENCY INSTITUTE, THE PEOPLE'S BANK OF CHINA
- HUAWEI TECHNOLOGIES CO., LTD.
Dates
- Publication Date
- 20260505
- Application Date
- 20230119
- Priority Date
- 20200720
Claims (11)
- 1 . A method, implemented by a first electronic device, for verifying a transaction, wherein the method comprises: sending, by a rich execution environment (REE) of the first electronic device, a first transaction request message to a trusted execution environment (TEE) of the first electronic device, wherein the first transaction request message comprises a transaction type of a transaction; executing, by the TEE, a service logic based on the transaction type to obtain a first verification instruction, wherein the first verification instruction comprises a to-be-verified digital signature; sending, by the TEE, the first verification instruction to a secure element (SE) of the first electronic device; verifying, by the SE in accordance with receiving the first verification instruction comprising the to-be-verified digital signature, validity of the transaction based on the to-be-verified digital signature to obtain a verification result; sending, by the SE in accordance with the verifying validity of the transaction, the verification result to the TEE; sending, by the TEE, a transaction response message to the REE, wherein the transaction response message comprises the verification result; sending, by the REE, a second transaction request message to a second electronic device based on a receiver identifier of the transaction in accordance with the verification result indicating that the validity of the transaction has been verified, wherein the receiver identifier indicates the second electronic device; and storing, by the TEE, at least one candidate data certificate, wherein the executing the service logic comprises executing, by the TEE, the service logic based on the at least one candidate data certificate, wherein the at least one candidate data certificate comprises a currency certificate, wherein the currency certificate comprises an original currency string and at least one transaction subchain, wherein the original currency string comprises an amount of the original currency string, an issuer certificate, and an institution signature, wherein the at least one transaction subchain comprises a first subchain digital signature corresponding to the at least one transaction subchain, and wherein the currency certificate is used by a cloud server to construct a currency certificate transaction tree structure comprising: a root node corresponding to the original currency string, and leaf nodes, wherein each leaf node comprises a digital signature of a transaction subchain corresponding to a verified transaction on the original currency string.
- 2 . The method of claim 1 , wherein the first transaction request message further comprises a transaction amount of the transaction, and wherein executing the service logic comprises: selecting, by the TEE, a to-be-verified currency certificate from at least one candidate currency certificate based on the transaction type and the transaction amount; performing, by the TEE, basic verification on the to-be-verified currency certificate, wherein the basic verification comprises a transaction quantity or a transaction quota verification; and extracting, by the TEE, a second subchain digital signature of a last transaction subchain of the currency certificate that succeeded in the basic verification to generate the first verification instruction, wherein the second subchain digital signature is the to-be-verified digital signature, and wherein the first verification instruction comprises the second subchain digital signature and the transaction amount.
- 3 . The method of claim 2 , wherein the currency certificate comprises a serial number that is a unique identifier of the currency certificate, and wherein verifying the validity of the transaction comprises: generating, by the SE, transaction information based on the transaction amount; comparing, by the SE, a locally stored reference digital signature with the second subchain digital signature based on the serial number; generating, by the SE based on the transaction information, the second subchain digital signature, and a private key that is locally stored in the SE, a first digital signature corresponding to the transaction when the locally stored reference digital signature is consistent with the second subchain digital signature; generating, by the SE based on the first digital signature and the transaction information, a first transaction subchain corresponding to the transaction, wherein a third subchain digital signature in the first transaction subchain is the first digital signature; and generating, by the SE, the verification result comprising the first transaction subchain.
- 4 . The method of claim 3 , further comprising: storing, by the TEE, the verification result; and updating, by the TEE based on the serial number, the first transaction subchain to the currency certificate that succeeded in the basic verification.
- 5 . The method of claim 4 , further comprising synchronizing, by the first electronic device to a server, the currency certificate that is updated and that has succeeded in the basic verification.
- 6 . A method, implemented by a second electronic device, for verifying a transaction, wherein the method comprises: receiving, by a rich execution environment (REE) of the second electronic device, a transaction request message from a first electronic device, wherein the transaction request message comprises at least one data certificate; sending, by the REE, the transaction request message to a trusted execution environment (TEE) of the second electronic device; executing, by the TEE, a service logic based on the at least one data certificate to obtain a verification instruction, wherein the verification instruction comprises a to-be-verified digital signature; sending, by the TEE, the verification instruction to a secure element (SE) of the second electronic device; verifying, by the SE in accordance with receiving the verification instruction comprising the to-be-verified digital signature, validity of the at least one data certificate based on the to-be-verified digital signature to obtain a verification result that indicates whether validity verification of the at least one data certificate has succeeded; sending, by the SE in accordance with the verifying validity of the transaction, the verification result to the TEE; receiving, by the TEE, the verification result from the SE; storing, by the TEE, at least one candidate data certificate; sending, by the TEE, a transaction response message to the REE, wherein the transaction response message indicates whether the transaction has succeeded; and sending, by the REE in response to the transaction request message, the transaction response message to the first electronic device, wherein the executing the service logic comprises executing, by the TEE, the service logic based on the at least one candidate data certificate, wherein the at least one candidate data certificate comprises a currency certificate, wherein the currency certificate comprises an original currency string and at least one transaction subchain, wherein the original currency string comprises an amount of the original currency string, an issuer certificate, and an institution signature, and wherein the at least one transaction subchain comprises a first subchain digital signature corresponding to the at least one transaction subchain, and wherein the currency certificate is used by a cloud server to construct a currency certificate transaction tree structure comprising: a root node corresponding to the original currency string, and leaf nodes, wherein each leaf node comprises a digital signature of a transaction subchain corresponding to a verified transaction on the original currency string.
- 7 . The method of claim 6 , wherein the at least one data certificate comprises a currency certificate, wherein the currency certificate comprises an original currency string or comprises the original currency string and at least one transaction subchain, wherein the original currency string comprises an amount of the original currency string, an issuer certificate, and an institution signature, and wherein the at least one transaction subchain comprises a first subchain digital signature corresponding to the at least one transaction subchain.
- 8 . The method of claim 7 , wherein the service logic comprises verification of the institution signature.
- 9 . The method of claim 7 , wherein verifying the validity of the at least one data certificate comprises verifying validity of a last transaction subchain of the currency certificate.
- 10 . The method of claim 9 , further comprising storing, by the SE, a second subchain digital signature of the last transaction subchain after verifying validity of the last transaction subchain has succeeded, wherein the second subchain digital signature is configured to be used as a reference value for comparison and verification in a subsequent transaction.
- 11 . The method of claim 7 , wherein the service logic comprises verification of a preorder transaction of a last transaction subchain of the currency certificate.
Description
CROSS-REFERENCE TO RELATED APPLICATIONS This is a continuation of International Patent Application No. PCT/CN2021/080336 filed on Mar. 12, 2021, which claims priority to Chinese Patent Application No. 202010698620.2 filed on Jul. 20, 2020. The disclosures of the aforementioned applications are hereby incorporated by reference in their entireties. TECHNICAL FIELD Embodiments of this disclosure relate to the field of computer technologies, and in particular, to a transaction verification method. BACKGROUND With rapid development of e-commerce and mobile payment, a conventional financial system and a conventional financial technology are constantly challenged. A digital currency concept is brought into the public eye by blockchain technology-based Bitcoins, and all major economies in the world start to research and promote digital currency-related technologies. A digital currency can be issued by a central bank of a country. A blockchain technology and a distributed ledger technology or an existing banking system-based centralized financial account system are/is widely used in the industry to implement a high-performance and highly available digital currency. Although the blockchain technology and the distributed ledger technology have a plurality of advantages, for example, natural tamper resistance of data and distributed consensus, the blockchain technology and the distributed ledger technology still have a plurality of disadvantages: The blockchain technology is still in a development stage, and current performance may not support a transaction pressure caused by a large-scale application of the digital currency. Therefore, a solution based on an existing centralized banking system architecture is a preferential implementation solution. However, this solution still has a performance bottleneck in transaction verification. To resolve this problem, the industry already has a digital currency technology in which controllable anonymity is implemented. To be specific, a model similar to a cash transaction is simulated in an existing centralized banking system to implement offline and online transactions of a digital currency. A currency certificate of the digital currency includes an original currency string and several transaction subchains. In the conventional technology, based on an original currency string, new transaction subchains are continuously added to an end of a currency certificate as a digital currency circulates, a digital signature is generated for overall data of the currency certificate after each transaction, and validity of the digital signature is verified. In the conventional technology, online and offline transaction functions of the digital currency can be effectively implemented, and validity and security problems of the currency certificate are resolved. However, there are still deficiencies such as specific redundant computation in a verification process and poor user experience due to limited performance. Therefore, how to improve verification performance of a digital currency and improve user experience becomes a problem to be resolved urgently. SUMMARY Embodiments of this disclosure provide a transaction verification method and apparatus, which are applied to the field of computer technologies, to resolve the following problem: How to improve verification performance of a digital currency in a transaction process, to improve user experience. For ease of understanding of embodiments of this disclosure, the following first describes some technical concepts that appear in this disclosure. It should be understood that these technical concepts are applied to the following embodiments described in this disclosure. However, these embodiments are merely some embodiments of solutions provided in the present application. Therefore, these technical concepts are not necessarily applied to all embodiments of this disclosure. Soft wallet: a client wallet application implemented on an electronic device and executed in a rich execution environment (REE). Hard wallet: a wallet service logic and security module implemented on a trusted execution environment (TEE) and a secure element (SE) in combination with a security hardware feature on an electronic device. Applet: an application developed and used in an SE by using a JAVA Card framework. Issuer: The issuer refers to a background service of a digital currency issuer, and is responsible for verification, synchronization, auditing, and the like of a digital currency. Original currency string: an immutable data structure used to represent a value of a digital currency, which uses a serial number as a unique identifier, and carries information such as a currency issuer and an amount. Institution signature: The institution signature is used to prove validity of an original currency string, and is generated by performing digital signature on an original currency string by using a private key of a digital currency issuer. Transaction subchain: The trans