[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN115330383A - Offline bill generation method and device - Google Patents

Offline bill generation method and device Download PDF

Info

Publication number
CN115330383A
CN115330383A CN202210953387.7A CN202210953387A CN115330383A CN 115330383 A CN115330383 A CN 115330383A CN 202210953387 A CN202210953387 A CN 202210953387A CN 115330383 A CN115330383 A CN 115330383A
Authority
CN
China
Prior art keywords
transaction
information
tee
offline
bill
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202210953387.7A
Other languages
Chinese (zh)
Inventor
徐登伟
辛知
万小飞
崔显军
吴超
朱丙营
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alipay Hangzhou Information Technology Co Ltd
Original Assignee
Alipay Hangzhou Information Technology Co Ltd
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
Application filed by Alipay Hangzhou Information Technology Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN202210953387.7A priority Critical patent/CN115330383A/en
Publication of CN115330383A publication Critical patent/CN115330383A/en
Pending legal-status Critical Current

Links

Images

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/38Payment protocols; Details thereof
    • G06Q20/389Keeping log of transactions for guaranteeing non-repudiation of a transaction
    • 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

Landscapes

  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Engineering & Computer Science (AREA)
  • Strategic Management (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

An embodiment of the present specification provides an offline bill generation method and an offline bill generation device, where the method includes: the terminal equipment comprises a Trusted Execution Environment (TEE) and a security element based on encryption hardware, and under the condition that the terminal equipment detects that a target account generates a transaction in an offline scene, basic transaction information corresponding to the transaction and identity identification information of the target account are obtained in the TEE; sending the basic transaction information and the identity information to a secure element; in the secure element, signing basic transaction information and identity identification information by using a stored first private key to obtain a first signature; and in the TEE, combining the basic transaction information, the identity identification information and the first signature to generate an offline bill corresponding to the transaction, and storing the offline bill.

Description

Offline bill generation method and device
The application is a divisional application of an invention patent application with the application number of 2021108317560, entitled "an off-line bill generating method and device" filed on 2021, 7, month and 22.
Technical Field
The present disclosure relates to the field of electronic payment security technologies, and in particular, to an offline bill generation method and apparatus.
Background
Offline payments, i.e., payments without a network, including single offline payments and dual offline payments, are increasingly gaining interest and interest from various institutions. The single off-line indicates that the payee is off-line or the payer is off-line, and the double off-lines indicate that both the payee and the payer are off-line. Different from the online electronic payment, all bills are generated in real time at a server side and then directly stored at the server side, and the bills for offline payment are firstly generated locally at the equipment where the offline party is located, and the stored bills are synchronized to the corresponding server when the equipment where the offline party is located is in a networking state. That is, the bill generated by offline payment needs to be stored locally on the device where the offline party is located before the device where the offline party is located is in a networked state. Accordingly, security management of the bill at the device of the offline party is particularly noticeable before the device of the offline party is in a networked state.
Currently, for offline payment, a pure SE (Secure Element) scheme is generally used to complete generation and management of an offline bill, that is, a bill is generated and stored in an SE of a device where an offline party is located, and subsequent bill management is performed based on the SE of the device.
In the above scheme, the storage space of the SE is limited, so that excessive offline bills cannot be stored, and the storage, management and synchronization of the offline bills are limited under the condition that the offline device transactions are more.
Disclosure of Invention
The embodiment of the specification provides an offline bill generation method and device, and the method and device can be used for realizing more optimal storage, management and synchronization of the offline bill according to the technical scheme of the embodiment of the specification.
In a first aspect of the present specification, there is provided an offline bill generation method, applied to a terminal device, where the terminal device includes a trusted execution environment TEE and a secure element based on cryptographic hardware, the method including:
under the condition that a target account generates a transaction under an offline scene is detected, obtaining basic transaction information corresponding to the transaction and identity information of the target account in the TEE;
sending the basic transaction information and the identity information to the secure element;
in the secure element, signing the basic transaction information and the identity identification information by using the stored first private key to obtain a first signature;
and in the TEE, combining the basic transaction information, the identity identification information and the first signature to generate an offline bill corresponding to the transaction, and storing the offline bill.
In one implementation, the terminal device further comprises a common execution environment REE,
obtaining basic transaction information corresponding to the transaction and the identification information of the target account in the TEE, including:
obtaining the base transaction information from a payment-related application running in the REE;
obtaining the identity information from a secure storage area of the TEE.
In one implementation, the base transaction information includes at least one of:
a transaction amount, a transaction ID, a transaction type, a transaction currency, a transaction time, a target account nickname, and a nickname of another account with which a transaction is to be made.
In one implementation, the identification information includes at least one of the following information:
the ID of the target account, the ID of an operator to which the target account belongs, and the ID of a primary account to which the target account belongs.
In one implementation, after obtaining the first signature, the method further comprises:
in the secure element, updating, based on the base transaction information, an account balance of the target account after the transaction has occurred.
In one implementation, the base transaction information includes a transaction amount and a transaction type for the transaction;
in the secure element, signing the base transaction information and the identification information with the stored first private key, resulting in a first signature, comprising:
in the case where the transaction type is a payment type, determining, in the secure element, whether the stored account balance is not less than the transaction amount;
if the judgment result is yes, the stored first private key is used for signing the basic transaction information and the identity identification information to obtain a first signature.
In one implementation, the method further comprises:
and if the account balance is judged to be smaller than the transaction amount, outputting prompting insufficient balance information.
In one implementation, the method further comprises:
and under the condition that the terminal equipment is detected to be in a networking state, synchronizing the offline bill to a server through the TEE.
In one implementation, the synchronizing, by the TEE, the offline bill to a server in a case where it is detected that the terminal device is in a networking state includes:
under the condition that the terminal is detected to be in the networking state, bill synchronous prompt information is displayed;
and when the selection operation aiming at the bill synchronization prompt message is detected, synchronizing the offline bill to a server through the TEE.
In one implementation, the method further comprises:
in the TEE, encrypting the offline bill by using a randomly generated symmetric key to obtain an encrypted offline bill;
in the TEE, encrypting the symmetric key by using a preset server public key;
generating an offline bill synchronous message based on the encrypted symmetric key and the encrypted offline bill;
the synchronizing the offline bill to a server via the TEE includes:
and sending the offline bill synchronization message to a server through the TEE, so that the server determines the latest balance corresponding to the target account by using a server private key, a first public key corresponding to the first private key and the offline bill synchronization message.
In a second aspect of the present specification, there is provided an offline bill generation apparatus applied to a terminal device, where the terminal device includes a trusted execution environment TEE and a secure element based on cryptographic hardware, the apparatus including:
the information obtaining module is configured to obtain basic transaction information corresponding to the transaction and identity information of a target account in the TEE under the condition that the target account under an offline scene is detected to generate the transaction;
an information sending module configured to send the basic transaction information and the identification information to the secure element;
a signature module configured to sign the basic transaction information and the identification information with the stored first private key in the secure element to obtain a first signature;
a generation and storage module configured to combine the basic transaction information, the identity information, and the first signature in the TEE, generate an offline bill corresponding to the transaction, and store the offline bill.
In one implementation, the terminal device further comprises a common execution environment REE,
the information obtaining module is specifically configured to obtain the basic transaction information from a payment-related application running in the REE;
obtaining the identity information from a secure storage area of the TEE.
In one implementation, the base transaction information includes at least one of:
a transaction amount, a transaction ID, a transaction type, a transaction currency, a transaction time, a target account nickname, and a nickname of another account with which a transaction is to be made.
In one implementation, the identification information includes at least one of the following information:
the ID of the target account, the ID of an operator to which the target account belongs, and the ID of a primary account to which the target account belongs.
In one implementation, the apparatus further comprises:
an update module configured to update, in the secure element, an account balance of the target account after the transaction occurs based on the base transaction information after obtaining the first signature.
In one implementation, the base transaction information includes a transaction amount and a transaction type for the transaction;
the signature module comprises:
a determination unit configured to determine, in the secure element, whether the stored account balance is not less than the transaction amount, in a case where the transaction type is a payment type;
and the signature unit is configured to sign the basic transaction information and the identity identification information by using the stored first private key to obtain a first signature if the judgment result is yes.
In one implementation manner, the signature module further includes:
and the prompt information output unit is configured to output prompt balance insufficiency information if the account balance is judged to be smaller than the transaction amount.
In one implementation, the method further comprises:
and the synchronization module is configured to synchronize the offline bill to a server through the TEE under the condition that the terminal equipment is detected to be in a networking state.
In one implementation, the synchronization module is specifically configured to display a bill synchronization prompt message when detecting that the terminal is in a networking state;
and when the selected operation aiming at the bill synchronization prompt information is detected, synchronizing the offline bill to a server through the TEE.
In one implementation, the method further comprises:
the first encryption module is configured to encrypt the offline bill by using a randomly generated symmetric key in the TEE to obtain an encrypted offline bill;
the second encryption module is configured to encrypt the symmetric key by using a preset server public key in the TEE;
the message generation module is configured to generate an offline bill synchronous message based on the encrypted symmetric key and the encrypted offline bill;
the synchronization module is specifically configured to send the offline bill synchronization message to a server through the TEE, so that the server determines a latest balance corresponding to the target account by using a server private key, a first public key corresponding to the first private key, and the offline bill synchronization message.
In a third aspect of the present specification, there is provided a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the offline bill generation method provided in one or more embodiments of the present specification.
In a fourth aspect of the present specification, a computing device is provided, which includes a memory and a processor, where the memory stores executable code, and the processor executes the executable code to implement the offline bill generation method provided in one or more embodiments of the present specification.
According to the method and the device for generating the offline bill, provided by the embodiment of the specification, the terminal device presets data environments with different security levels, including a Trusted Execution Environment (TEE) and a secure element based on encryption hardware, stores a first private key with an extremely high security level in the secure element, and completes signature in the secure element. The method has the advantages that the offline bill is assembled, generated and stored in the TEE with higher security level, high data processing speed and relatively large storage space (compared with a security element), so that the offline bill is assembled, signed, generated and stored by using data environments with different security levels, and the security, efficiency and popularity of the offline bill generation management process are moderately unified by fully using the capabilities and characteristics of the data environments with different security levels. And the better storage, management and synchronization of the offline bills are realized.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present specification, the drawings used in the description of the embodiments will be briefly described below, and it is obvious that the drawings in the description below are only some embodiments of the present specification, and it is obvious for those skilled in the art that other drawings may be obtained according to these drawings without creative efforts.
Fig. 1A is a schematic diagram of a framework of a terminal device disclosed in the present specification;
FIG. 1B is an exemplary diagram of data flow during an offline bill generation process as provided herein;
fig. 2 is a schematic flow chart of an offline bill generation method provided in an embodiment of the present disclosure;
fig. 3 is another schematic flow chart of an offline bill generation method provided in an embodiment of the present specification;
fig. 4 is another schematic flow chart of an offline bill generation method provided in an embodiment of the present disclosure;
fig. 5 is a schematic block diagram of an offline bill generation apparatus provided in an embodiment of the present specification.
Detailed Description
Technical solutions of embodiments of the present specification will be described in detail below with reference to the accompanying drawings.
The embodiment of the specification discloses an offline bill generation method and an offline bill generation device, and the application scenario and the inventive concept of the offline bill generation are introduced as follows:
in the case where an account generates a transaction when the device on which the account is located is offline, it is necessary to first generate an offline bill locally at the device and store the offline bill locally at the device. And subsequently, synchronizing the offline bill generated when the equipment is in the offline state to a corresponding server when the equipment is in the networking state, so that the server transfers assets to the target account based on the offline bill and updates the balance. The account can be an account of a payee or an account of a payer.
Since the offline bill is stored locally on the device during the period of time when the device on which the account is located is offline, it is necessary that sufficient storage space exists locally for storing the offline bill. And considering the situation of avoiding double flowers on the account, the safe storage of the offline bill at the local of the device is particularly important.
In view of this, the embodiments of the present specification provide an offline bill generation method, which is applied to a terminal device. In view of the difference in security level of information used for offline bill generation, as shown in fig. 1A, the terminal device may include a Trusted Execution Environment TEE (Trusted Execution Environment), a secure element based on cryptographic hardware, and a normal Execution Environment REE (Rich Execution Environment) to support storage of data of different security levels and Execution of offline bill generation process steps of different security levels.
Here, the Trusted Execution Environment TEE (Trusted Execution Environment) is an area on a digital processor of the terminal device, for example, a CPU. The function of this block area is to provide a more secure space for the execution of data and code and to ensure their confidentiality and integrity. The method realizes data processing related to safety and privacy, such as safe storage, safe calculation and the like by creating a small operating system which runs independently.
The Secure Element based on the encryption hardware may include, but is not limited to, an SE (Secure Element) Secure Element, which is generally provided in the form of a chip having an encryption/decryption logic therein, so as to protect data security from external malicious parsing attacks. It should be noted that the secure element is an environment for performing encryption protection on data based on hardware, and thus has a higher security level than the TEE.
The security level of the normal execution environment REE is relatively low and the payment related applications run on the REE. Wherein the payment-related application generates an application on which the transaction depends for the target account.
The method comprises the steps that when terminal equipment is in an offline state and a target account is detected to generate a transaction, basic transaction information corresponding to the transaction and identity identification information of the target account are obtained in a TEE; the basic transaction information and the identity information are internally sent to a security element with the highest security level; in the secure element, signing basic transaction information and identity identification information by using a stored first private key to obtain a first signature, and sending the first signature to the TEE; and combining the basic transaction information, the identity identification information and the first signature in the TEE with stronger calculation power and larger storage space to generate an offline bill corresponding to the transaction, and storing the offline bill. Fig. 1B is a diagram illustrating an example of data flow in an offline bill generation process.
In one implementation, the basic transaction information includes basic information of the transaction, which may include, for example, at least one of the following: transaction amount, transaction ID, transaction type, transaction currency, transaction time, information of both parties to the transaction such as a nickname for the target account and a nickname for another account with which the target account has made a transaction. The transaction amount is the changed amount of the transaction. The transaction ID is the identification of the transaction and has uniqueness. The transaction types include, but are not limited to, payment, collection, refund, and the like. The transaction currencies may include, but are not limited to, RMB, USD, euro, and the like. The nickname of the target account has uniqueness, so that the target account can be uniquely determined, and the identities of two parties in transaction can be clarified through the nickname of the target account and the nickname of another account which generates transaction with the target account.
In one implementation, the identification information may include at least one of: the ID of the target account, the ID of the operator to which the target account belongs and the ID of the main account to which the target account belongs. In one case, the target account may be referred to as an offline account for conducting transactions while the terminal device is offline. The target account may be an offline account number that is open under the primary account. Wherein, one main account can comprise a plurality of offline accounts, and different offline accounts can belong to different operation organizations. The operation mechanism is a mechanism for opening an offline account.
In one embodiment, considering that different information has different security levels, such as basic transaction information, which is basic information of a transaction, the security level may be generally stored in a storage area corresponding to a payment-related application running in the REE. For the identification information, the identification information represents the identification information of the target account, relates to the privacy information of the target account, and has relatively higher importance relative to the account assets, and correspondingly, the security level of the identification information is higher. To ensure that the identification information is not easily tampered with, the identification information may be stored in a TEE with a higher security level. The balance of the target account, the key for signature and other information related to account assets and encryption are information with higher security level, and correspondingly, the information can be stored in a secure element with higher security level to prevent the information from being tampered and stolen.
Accordingly, as shown in fig. 1B, the terminal device obtains basic transaction information from the payment-related application running in the REE in the TEE, and obtains identification information in the secure storage area of the TEE.
In this embodiment, a first private key with a higher security level is stored in a secure element, and a step of signing basic transaction information and identity information with a higher security level is completed in the secure element; and the offline bill is assembled, generated and stored in the TEE with higher security level, high data processing speed and relatively larger storage space (compared with a security element), so that the offline bill is assembled, signed, generated and stored by using data environments with different security levels, the capacity and the characteristics of the data environments with different security levels are fully utilized, the safety, the efficiency and the moderate unification of the offline bill generation management process are realized, and further the better storage, the management and the synchronization of the offline bill are realized.
As can be understood, the TEE security is high, the storage space is relatively large, a large number of off-line bills can be stored safely, the off-line bills are guaranteed not to be tampered easily, and the situation that the storage space is insufficient when the off-line transaction of the target account is more and the generated off-line bills are more is avoided. And the TEE has larger data transmission quantity and stronger calculation power, and the synchronization efficiency is higher when synchronizing the offline bills in the subsequent terminal equipment networking state.
The off-line bill generation method provided in this specification is described in detail below with reference to specific embodiments.
Fig. 2 is a schematic flow chart of the offline bill generation method provided in the present specification. The method is applied to a terminal device, and the terminal device can be any device with data calculation, processing and storage functions, such as a mobile phone, a tablet computer, a smart watch, a payment card and the like. In one embodiment of the present specification, the terminal device includes a trusted execution environment TEE and a secure element based on cryptographic hardware, and the method includes:
s210: under the condition that the target account generates the transaction under the offline scene is detected, basic transaction information corresponding to the transaction and the identity information of the target account are obtained in the TEE.
When the terminal equipment is in an off-line state, namely in an unconnected state, and under the condition that the target account is detected to generate a transaction, basic transaction information corresponding to the transaction and the identity information of the target account are obtained in the TEE. The target account may be a payer account or a payee account.
The basic transaction information includes basic information of the transaction, and may include, for example, at least one of the following information: transaction amount, transaction ID, transaction type, transaction currency, transaction time, information of both parties to the transaction such as a nickname of the target account and a nickname of another account with which the target account has made a transaction. The transaction amount is the changed amount of the transaction. The transaction ID is the identification of the transaction and has uniqueness. The transaction types include, but are not limited to, payment, collection, deposit, refund, and the like. The transaction currencies may include, but are not limited to, RMB, USD, euro, and the like. The nickname of the target account has uniqueness, so that the target account can be uniquely determined.
The identification information is information characterizing the identity of the target account, and may include at least one of the following information: the ID of the target account, the ID of the operator to which the target account belongs and the ID of the main account to which the target account belongs. In one case, the target account may be an account number of any off-line wallet opened under the primary account, and may be called an off-line account, which may be used for performing a transaction when the terminal device is in an off-line state. Wherein, one main account can comprise a plurality of offline accounts, and different offline accounts can belong to different operation organizations. The operation mechanism is a mechanism for opening an off-line account. In one embodiment, the primary account may refer to a payment wallet account and the target account may refer to an account of any hardware wallet opened under the payment wallet.
In one implementation, the different information may be stored in different security level environments based on the security levels of the different information, taking into account the different security levels of the different information. Correspondingly, the terminal device also comprises a common execution environment REE. The basic transaction information, which is the basic information of the transaction, generally has a security level, and may be stored in a storage area corresponding to the payment-related application running in the REE. The identity information represents the identity information of the target account, relates to the privacy information of the target account, is relatively high in importance relative to account assets, and correspondingly is high in security level. Correspondingly, in step S210, in the case that a target account under an offline scenario is detected to generate a transaction, in the TEE, basic transaction information is obtained from a payment-related application running in the REE, and in a secure storage area of the TEE, identification information is obtained.
Where a payment-related application may refer to an application on which the transaction generation depends. If the primary account refers to a payment wallet account, the payment-related application may be a payment wallet application, accordingly.
S220: and sending the basic transaction information and the identification information to the secure element.
After the terminal device obtains basic transaction information and identity information corresponding to the transaction, the basic transaction information and the identity information are sent to the secure element from the TEE, wherein the sending is internal sending of the terminal device. In one implementation, the secure element may be a SE. In one case, the secure element may be a built-in secure element of the terminal device, or may be an external secure element of the terminal device, for example: in the case that the terminal device is a mobile phone, the external secure element may be a secure element supported by a Sim card.
S230: in the secure element, the basic transaction information and the identification information are signed by using the stored first private key, and a first signature is obtained.
The secure element may store the balance of the target account and keys for signing, etc. information relating to account assets and higher security levels of encryption. The information is stored in the security element with higher security level, so that the information can be prevented from being tampered and stolen. In this step, in the secure element, a preset hash algorithm is used to perform hash value calculation on the basic transaction information and the identity information to obtain hash values corresponding to the basic transaction information and the identity information, and then a first private key stored in the secure element is used to encrypt the hash values to obtain a first signature.
In one embodiment, the first private key and the corresponding first public key may be generated when the target account is opened. The generation process may be: when a target account is opened, a first public and private key pair is generated based on a preset device public and private key pair and the ID of a main account to which the target account belongs according to a preset public and private key pair generation algorithm, wherein the first public and private key pair comprises a first private key and a first public key corresponding to the first private key. The preset public and private key pair generation algorithm may be a national secret algorithm. The preset device public-private key pair may be generated when the payment-related application is first launched and stored in the TEE or secure element.
Subsequently, after generating the first public-private key pair, the first private key may be stored in a secure element of the terminal device, and the first public key may be stored in a secure element of the terminal device or a TEE. In one embodiment, the first public key may also be published to the network.
S240: and in the TEE, combining the basic transaction information, the identity identification information and the first signature to generate an offline bill corresponding to the transaction, and storing the offline bill.
And after the first signature is obtained by signing in the secure element, the first signature is sent to the TEE from the secure element, and in the TEE, the basic transaction information, the identity information and the first signature are combined to generate an offline bill corresponding to the transaction. In an embodiment, the basic transaction information, the identification information and the first signature may be combined according to a preset combination format, where the preset combination format includes a front-back combination sequence of each type of information, and the basic transaction information, the identification information and the first signature are combined in sequence based on the front-back combination sequence of each type of information, so as to obtain an offline bill corresponding to the transaction.
For example, the sequence of the front and back combinations of the types of information included in the preset combination format may be: the method comprises the steps of sequentially ordering and combining basic transaction information, identity identification information and a first signature in a TEE according to the sequence. The above process is an example of combining the basic transaction information, the identification information, and the first signature, and is not meant to be limiting.
After the offline bill is obtained, the offline bill is stored in the TEE. Specifically, the offline bill may be stored in a secure storage area of the TEE.
In this embodiment, a first private key with a higher security level is stored in a secure element, and a step of signing basic transaction information and identity information with a higher security level is completed in the secure element; in the TEE with the second highest security level, the high data processing speed and the relatively large storage space (compared with a security element), the offline bill is assembled, generated and stored, the offline bill is assembled, signed, generated and stored by using the data environments with different security levels, the capacity and the characteristics of the data environments with different security levels are fully utilized, the safety, the efficiency and the universality of the offline bill generation management process are moderately unified, and the offline bill is stored, managed and synchronized more optimally. It can be understood that the TEE security is high, and storage space is much larger than that of the secure element, and a large number of off-line bills can be stored safely, so that the off-line bills are guaranteed to be safe and credible and are not tampered, and the situation that the storage space is insufficient when a large number of off-line transactions of a target account are performed and a large number of generated off-line bills are generated is avoided.
In another embodiment of the present description, as shown in fig. 3, the method may include the steps of:
s310: under the condition that the target account generates the transaction under the offline scene is detected, basic transaction information corresponding to the transaction and the identity information of the target account are obtained in the TEE.
S320: and sending the basic transaction information and the identification information to the safety element.
S330: in the secure element, the basic transaction information and the identification information are signed by using the stored first private key, and a first signature is obtained.
S340: in the secure element, the account balance of the target account after the transaction occurs is updated based on the underlying transaction information.
S350: and in the TEE, combining the basic transaction information, the identity identification information and the first signature to generate an offline bill corresponding to the transaction, and storing the offline bill.
S310 is the same as S210 shown in fig. 2, S320 is the same as S220 shown in fig. 2, S330 is the same as S230 shown in fig. 2, and S350 is the same as S240 shown in fig. 2, and thus, the description thereof is omitted.
In this embodiment, to avoid tampering with the balance of the target account, the balance of the target account is stored in the secure element. After the first signature is obtained, the transaction may be considered to be conducted, and accordingly, in the secure element, the account balance of the target account after the transaction occurs is updated based on the transaction amount and the transaction type in the basic transaction information. If the transaction type is characterized as a payment type, subtracting the transaction amount from the balance currently stored by the secure element to obtain an amount difference; and taking the amount difference as the account balance of the target account after the transaction occurs, namely updating the balance stored in the secure element to the amount difference. If the transaction type is characterized as a collection type, the sum and the value can be obtained by adding the transaction sum to the balance currently stored by the secure element; the amount and value are used as the account balance of the target account after the transaction has occurred, i.e. the balance stored in the secure element is updated to the amount and value.
The account balance of the target account is stored in the secure element, so that the target account can be effectively prevented from being tampered, and the situation that the target account is double-colored can be avoided to a certain extent. In one case, where the transaction type of the transaction is a payment type, it may happen that the transaction amount paid for by the transaction exceeds the current account balance of the target account. In such cases, to avoid the situation of the target account being owed, in another embodiment of the present specification, the basic transaction information includes the transaction amount and the transaction type of the transaction; at S230, the following steps 11-12 may be included:
11: in the case where the transaction type is a payment type, in the secure element, it is determined whether the stored account balance is not less than the transaction amount.
12: if the judgment result is yes, the stored first private key is used for signing the basic transaction information and the identity identification information to obtain a first signature.
In this embodiment, it may be first determined whether the transaction type of the transaction is a payment type. In the case that the transaction type is determined to be the payment type, before the signature is performed in the secure element, it may be determined in the secure element whether an account balance currently stored in the secure element is not less than the transaction amount. And if the account balance stored in the safety element at present is judged to be not less than the transaction amount, the stored first private key is used for signing the basic transaction information and the identity identification information to obtain a first signature.
It is also possible that the above-described step of determining whether the transaction type of the transaction is a payment type is performed in the TEE or in the secure element.
In another embodiment of the present specification, S230 may further include the following step 13:
13: and if the account balance is judged to be less than the transaction amount, outputting information prompting that the balance is insufficient. In this embodiment, when the account balance is determined to be less than the transaction amount, the secure element may directly output the prompt insufficient balance information without continuing to perform the step of signing the basic transaction information and the identification information, so as to prompt the user that the balance of the target account is insufficient, and to change another payment method or another account for offline payment.
In one implementation, the terminal device may provide an offline bill query function based on storing the offline bill in the TEE. Specifically, in one embodiment, the terminal device may display information for querying the offline bill on a management interface of the payment-related application. When the terminal device detects the selection operation of the information for inquiring the offline bill, inquiring the offline bill from the TEE through the payment related application based on the TEE interface, and displaying the inquired offline bill on the related interface of the payment related application.
When the terminal device is in an offline state, the offline bill generated by each offline transaction of the target account is stored in the TEE of the terminal device, so that the offline bill is prevented from being tampered. When the target account is transacted, the corresponding account balance changes correspondingly. For asset security, verification and validation of the transacted account balance of the target account is required, and verification and validation of the account balance is required at the corresponding server for managing account-related information. In another embodiment of the present specification, on the basis of the flow shown in fig. 2, as shown in fig. 4, the following step S250 may also be included: and under the condition that the terminal equipment is detected to be in a networking state, synchronizing the offline bill to the server through the TEE.
When the terminal device is in the networking state, the type of the network to which the terminal device is connected may be a wireless local area network or a cellular mobile network. The embodiment of the present specification does not limit the type of the connected network when the terminal device is in the networking state.
In one implementation manner, when it is detected that the terminal device is in the networking state, the terminal device may automatically send all offline bills generated by the terminal device during the last offline state to the server through the TEE directly, so as to implement synchronization of the offline bills.
In another implementation, the target account owner may manually synchronize the offline bill with the terminal device in a networked state. Correspondingly, under the condition that the terminal equipment is detected to be in the networking state, the terminal equipment displays bill synchronous prompt information; and when the selection operation aiming at the bill synchronous prompt information is detected, synchronizing the offline bill to the server through the TEE. In this embodiment, when the selection operation for the bill synchronization prompt information is detected, the terminal device may retrieve all the offline bills that are not synchronized in the TEE, and then send all the offline bills that are not synchronized to the server through the TEE.
In one implementation, the terminal device displays the bill synchronization prompt message on a management interface of the payment-related application in the case that the terminal device is detected to be in a networking state. In one case, the account synchronization prompt may be a text message, and a selection button for the target account holder to select whether to synchronize is displayed. And when the trigger operation of the target account holder on the synchronous selection key is detected, considering that the selection operation on the bill synchronous prompt information is detected. And then, the terminal equipment determines all the offline bills which are not synchronized in the TEE, and then all the offline bills which are not synchronized are sent to the server through the TEE. In one case, the terminal device is in a networked state, the selection key may be highlighted, and the terminal device is in an offline state, the selection key may be grayed out.
After the TEE synchronizes the offline bills to the server, the server may determine the latest balance after the transaction corresponding to each offline bill is performed on the target account based on the transaction type and the transaction amount in each received offline bill and the current account balance of the target account number stored locally by the server.
Wherein the server is a server for managing relevant information of the target account, such as account balance. In one implementation, the server may be a server of an operator that opens the target account.
In the off-line bill synchronization process, in order to avoid the problem that the assets of the target account are lost due to the fact that the off-line bill is intercepted and then tampered, the off-line bill to be synchronized can be encrypted, and the encrypted off-line bill is sent to the server; the server can decrypt the encrypted offline bill to obtain the offline bill, and then updates the account balance corresponding to the target account based on the offline bill, so that the asset safety is ensured. Accordingly, in another embodiment of the present specification, before synchronizing offline bills through TEE, the method may further include the following steps 21-23:
21: in the TEE, the off-line bill m is encrypted by using a randomly generated symmetric key to obtain an encrypted off-line bill E1 key (m) of the reaction mixture. In one implementation, a symmetric key may be randomly generated by using a key random generation algorithm in the TEE, and then the offline bill m is encrypted by using the symmetric key and an encryption algorithm E1 to obtain an encrypted offline bill E1 key (m) of the reaction mixture. The random key generation algorithm may be any current algorithm capable of randomly generating a symmetric key. The offline bills include one or more offline bills currently to be synchronized in the TEE. The encryption algorithm E1 is a symmetric encryption algorithm.
22: in the TEE, a symmetric key is encrypted by using a preset public server key S-Pkkey to obtain the encrypted symmetric key E2 S-pk (key). The preset server public key S-Pk may be agreed by the terminal device and the server in advance and stored in the TEE. It is to be understood that the encryption algorithm E2 herein is an asymmetric encryption algorithm.
23: based on the encrypted symmetric key E2 S-pk (key) and encrypted offline bill E1 key And (m) generating an offline bill synchronous message. In this step, the encrypted symmetric key E2 is obtained S-pk (key) and encrypted offline bill E1 key (m) thereafter, the encrypted symmetric key E2 may be utilized based on the predetermined message format S-pk (key) and encrypted offline bill E1 key And (m) assembling the offline bill synchronous message. The preset message format may be a message format related to a communication protocol between the terminal device and the server.
Correspondingly, in step S250, the offline bill synchronization message is sent to the server through the TEE, so that the server determines the latest balance corresponding to the target account by using the server private key, the first public key corresponding to the first private key, and the offline bill synchronization message.
And the terminal equipment sends an offline bill synchronous message to the server through the TEE. The server analyzes the off-line bill synchronous message to obtain an encrypted symmetric key E2 S-pk (key) and encrypted offline bill E1 key (m) of the reaction mixture. Then, the server uses the server private key S-Sk corresponding to the public server public key S-Pk locally and safely stored by the server to decrypt the encrypted symmetric key E2 by using a decryption algorithm corresponding to E2 S-pk (key), a symmetric key can be obtained; and then, the symmetric key is used for decrypting the encrypted off-line bill E1 by adopting a decryption algorithm corresponding to the E1 key (m) and recovering the plain text of the offline bill m. Then, the latest balance corresponding to the target account can be determined by using the transaction type and the transaction amount in the offline bill.
The foregoing describes certain embodiments of the present specification, and other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily have to be in the particular order shown or in sequential order to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
Corresponding to the foregoing method embodiment, an embodiment of the present specification provides an offline bill generation apparatus 500, which is applied to a terminal device, where the terminal device includes a trusted execution environment TEE and a secure element based on cryptographic hardware, and a schematic block diagram of the apparatus is shown in fig. 5, and includes:
an information obtaining module 510, configured to, when a target account in an offline scenario is detected to generate a transaction, obtain, in the TEE, basic transaction information corresponding to the transaction and identification information of the target account;
an information sending module 520 configured to send the basic transaction information and the identification information to the secure element;
a signature module 530 configured to sign, in the secure element, the basic transaction information and the identity information by using the stored first private key, so as to obtain a first signature;
a generating and storing module 540 configured to combine the basic transaction information, the identification information, and the first signature in the TEE, generate an offline bill corresponding to the transaction, and store the offline bill.
In one implementation, the terminal device further comprises a common execution environment REE,
the information obtaining module 510 is specifically configured to obtain the basic transaction information from a payment-related application running in the REE;
obtaining the identity information from a secure storage area of the TEE.
In one implementation, the base transaction information includes at least one of:
a transaction amount, a transaction ID, a transaction type, a transaction currency, a transaction time, a target account nickname, and a nickname of another account with which a transaction is to be made.
In one implementation, the identification information includes at least one of the following information:
the ID of the target account, the ID of an operator to which the target account belongs, and the ID of a primary account to which the target account belongs.
In one implementation, the apparatus further comprises:
an updating module (not shown in the figures) configured to update, in the secure element, an account balance of the target account after the transaction has occurred based on the base transaction information after obtaining the first signature.
In one implementation, the base transaction information includes a transaction amount and a transaction type for the transaction;
the signature module 530 includes: a determination unit (not shown in the figure) configured to determine, in the secure element, whether the stored account balance is not less than the transaction amount, in a case where the transaction type is a payment type;
and a signature unit (not shown in the figure) configured to, if the determination result is yes, sign the basic transaction information and the identity information by using the stored first private key to obtain a first signature.
In one implementation, the signature module 430 further includes:
and a prompt information output unit (not shown in the figure) configured to output prompt information indicating insufficient balance if the account balance is judged to be less than the transaction amount.
In one implementation, the method further comprises: a synchronization module (not shown in the figure) configured to synchronize the offline bill to a server through the TEE in case that the terminal device is detected to be in a networking state.
In one implementation, the synchronization module is specifically configured to display a bill synchronization prompt message when detecting that the terminal is in a networking state;
and when the selection operation aiming at the bill synchronization prompt message is detected, synchronizing the offline bill to a server through the TEE.
In one implementation, the method further comprises: a first encryption module (not shown in the figure) configured to encrypt the offline bill by using a randomly generated symmetric key in the TEE to obtain an encrypted offline bill;
a second encryption module (not shown in the figure) configured to encrypt the symmetric key with a preset server public key in the TEE;
a message generating module (not shown in the figure) configured to generate an offline bill synchronization message based on the encrypted symmetric key and the encrypted offline bill;
the synchronization module is specifically configured to send the offline bill synchronization message to a server through the TEE, so that the server determines a latest balance corresponding to the target account by using a server private key, a first public key corresponding to the first private key, and the offline bill synchronization message.
The above device embodiments correspond to the method embodiments, and specific descriptions may refer to descriptions of the method embodiments, which are not repeated herein. The device embodiment is obtained based on the corresponding method embodiment, has the same technical effect as the corresponding method embodiment, and for the specific description, reference may be made to the corresponding method embodiment.
The embodiments of the present specification also provide a computer-readable storage medium on which a computer program is stored, which, when executed in a computer, causes the computer to execute the offline bill generation method provided in the present specification.
The embodiment of the present specification further provides a computing device, which includes a memory and a processor, where the memory stores executable codes, and the processor executes the executable codes to implement the offline bill generation method provided in the present specification.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the storage medium and the computing device embodiments, since they are substantially similar to the method embodiments, they are described relatively simply, and reference may be made to some descriptions of the method embodiments for relevant points.
Those skilled in the art will recognize that, in one or more of the examples described above, the functions described in the embodiments of this specification may be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium.
The above-mentioned embodiments further describe in detail the objects, technical solutions and advantages of the embodiments of the present disclosure. It should be understood that the above description is only a specific implementation manner of the embodiments of the present disclosure, and is not intended to limit the scope of the present disclosure, and any modification, equivalent replacement, improvement, etc. made on the basis of the technical solutions of the present disclosure should be included in the scope of the present disclosure.

Claims (11)

1. An offline bill generation method is applied to a terminal device, wherein the terminal device comprises a Trusted Execution Environment (TEE), a secure element based on encrypted hardware and a common execution environment (REE), and the method comprises the following steps:
under the condition that a target account generates a transaction under an offline scene is detected, obtaining basic transaction information from a payment related application operated in the REE in the TEE; obtaining identity identification information from a secure storage area of the TEE; the identity identification information is information representing the identity of the target account;
sending the basic transaction information and the identity information to the secure element;
in the secure element, signing the basic transaction information and the identity identification information by using a stored first private key to obtain a first signature;
and in the TEE, combining the basic transaction information, the identity identification information and the first signature to generate an offline bill corresponding to the transaction, and storing the offline bill.
2. The method of claim 1, wherein the base transaction information includes at least one of:
a transaction amount, a transaction ID, a transaction type, a transaction currency, a transaction time, a target account nickname, and a nickname of another account with which a transaction is to be made.
3. The method of claim 1, wherein the identification information comprises at least one of:
the ID of the target account, the ID of an operator to which the target account belongs, and the ID of a primary account to which the target account belongs.
4. The method of claim 1, wherein after obtaining the first signature, the method further comprises:
in the secure element, updating, based on the base transaction information, an account balance of the target account after the transaction has occurred.
5. The method of claim 1 or 4, wherein the base transaction information includes a transaction amount and a transaction type for the transaction;
in the secure element, signing the base transaction information and the identification information with the stored first private key, resulting in a first signature, comprising:
in the case where the transaction type is a payment type, determining, in the secure element, whether the stored account balance is not less than the transaction amount;
if the judgment result is yes, the stored first private key is used for signing the basic transaction information and the identity identification information to obtain a first signature.
6. The method of claim 5, further comprising:
and if the account balance is judged to be smaller than the transaction amount, outputting prompting insufficient balance information.
7. The method of any of claims 1-4, further comprising:
and under the condition that the terminal equipment is detected to be in a networking state, synchronizing the offline bill to a server through the TEE.
8. The method of claim 7, wherein the synchronizing the offline bill to a server by the TEE in the event the terminal device is detected to be in a networked state comprises:
under the condition that the terminal is detected to be in the networking state, bill synchronous prompt information is displayed;
and when the selected operation aiming at the bill synchronization prompt information is detected, synchronizing the offline bill to a server through the TEE.
9. The method of claim 7, further comprising:
encrypting the offline bill by using a randomly generated symmetric key in the TEE to obtain an encrypted offline bill;
in the TEE, encrypting the symmetric key by using a preset server public key;
generating an offline bill synchronous message based on the encrypted symmetric key and the encrypted offline bill;
the synchronizing the offline bill to a server via the TEE includes:
and sending the offline bill synchronization message to a server through the TEE, so that the server determines the latest balance corresponding to the target account by using a server private key, a first public key corresponding to the first private key and the offline bill synchronization message.
10. An offline bill generation apparatus applied to a terminal device, wherein the terminal device comprises a trusted execution environment TEE, a secure element based on encrypted hardware, and a common execution environment REE, and the apparatus comprises:
an information obtaining module configured to obtain basic transaction information from a payment related application running in the REE in the TEE when a target account generating a transaction under an offline scenario is detected; obtaining identity identification information from a secure storage area of the TEE; the identity identification information is information representing the identity of the target account;
an information sending module configured to send the basic transaction information and the identification information to the secure element;
a signature module configured to sign the basic transaction information and the identification information with the stored first private key in the secure element to obtain a first signature;
a generation and storage module configured to combine the basic transaction information, the identity information, and the first signature in the TEE, generate an offline bill corresponding to the transaction, and store the offline bill.
11. A computing device comprising a memory having stored therein executable code and a processor that, when executing the executable code, implements the method of any of claims 1-9.
CN202210953387.7A 2021-07-22 2021-07-22 Offline bill generation method and device Pending CN115330383A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210953387.7A CN115330383A (en) 2021-07-22 2021-07-22 Offline bill generation method and device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210953387.7A CN115330383A (en) 2021-07-22 2021-07-22 Offline bill generation method and device
CN202110831756.0A CN113298526B (en) 2021-07-22 2021-07-22 Offline bill generation method and device

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN202110831756.0A Division CN113298526B (en) 2021-07-22 2021-07-22 Offline bill generation method and device

Publications (1)

Publication Number Publication Date
CN115330383A true CN115330383A (en) 2022-11-11

Family

ID=77330826

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202210953387.7A Pending CN115330383A (en) 2021-07-22 2021-07-22 Offline bill generation method and device
CN202110831756.0A Active CN113298526B (en) 2021-07-22 2021-07-22 Offline bill generation method and device

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN202110831756.0A Active CN113298526B (en) 2021-07-22 2021-07-22 Offline bill generation method and device

Country Status (1)

Country Link
CN (2) CN115330383A (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113850579A (en) * 2021-09-27 2021-12-28 支付宝(杭州)信息技术有限公司 Offline payment authorization, offline payment and collection method and device
WO2023066215A1 (en) * 2021-10-22 2023-04-27 中国人民银行数字货币研究所 Digital currency wallet management method, and remote control method, apparatus and system
CN115603943B (en) * 2022-09-07 2024-08-02 支付宝(杭州)信息技术有限公司 Offline identity verification method and device, storage medium and electronic equipment
CN117094722B (en) * 2023-10-19 2024-01-30 深圳薪汇科技有限公司 Security supervision method and system for online payment

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104077533B (en) * 2014-07-17 2017-09-15 北京握奇智能科技有限公司 A kind of method and apparatus for operating sensitive data
CN106850200B (en) * 2017-01-25 2019-10-22 中钞信用卡产业发展有限公司杭州区块链技术研究院 A kind of safety method, system and the terminal of digital cash of the use based on block chain
US10810581B2 (en) * 2017-09-26 2020-10-20 Paypal, Inc. Secure offline transaction system using digital tokens and a secure ledger database
CN108229956A (en) * 2017-12-13 2018-06-29 北京握奇智能科技有限公司 Network bank business method, apparatus, system and mobile terminal
CN111062059B (en) * 2019-11-06 2021-05-25 支付宝(杭州)信息技术有限公司 Method and device for service processing
CN112884473A (en) * 2021-01-25 2021-06-01 北京飞纳泰科信息技术有限公司 POS machine digital currency double-offline safe transaction device and method

Also Published As

Publication number Publication date
CN113298526A (en) 2021-08-24
CN113298526B (en) 2022-07-22

Similar Documents

Publication Publication Date Title
CN113298526B (en) Offline bill generation method and device
US11687920B2 (en) Facilitating a fund transfer between user accounts
US20240296429A1 (en) Information transaction infrastructure
KR102665645B1 (en) Techniques to improve anonymity and traceability of digital asset transactions in a distributed transaction consensus network
CN107358424B (en) Transaction method and device based on digital currency
WO2018115567A1 (en) Method and apparatus for private data transfer between parties
CN111492390A (en) Cash equivalent device for digital currency
CN111507839B (en) Block chain-based data processing method, device, storage medium and equipment
CN111062717B (en) Data transfer processing method, device and computer readable storage medium
TW201626286A (en) System, method and apparatus for updating a stored value card
US20020138729A1 (en) Management of an identity module
US20240305442A1 (en) Data management and encryption in a distributed computing system
CN105827656A (en) Identity authentication method based on NFC payment and device
CN104182876A (en) Secure payment trading method and secure payment trading system
Homoliak et al. An air-gapped 2-factor authentication for smart-contract wallets
EP2053553A1 (en) Method and device for exchanging values between portable personal electronic entities
CN114742649A (en) Transaction data processing method and device and server
CN113592484A (en) Account cubing method, system and device
EP4307611A1 (en) Data communication and cryptographic operations for secure wireless interactions
Atangana et al. Securing Privacy in Offline Payment for Retail Central Bank Digital Currency: A Comprehensive Framework
US12141266B2 (en) Proof of affinity to a secure event for frictionless credential management
EP4432199A1 (en) Cryptographic service delivery in a decentralized transaction system
EP4379631A1 (en) Digital wallet device and dual offline transaction method thereof
Jemin et al. Credit Card Forgery Identification By Location Using Android Based Monitoring
WO2022265732A1 (en) Security for online contactless transactions

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination