WO2017162164A1 - Electronic signature device transaction method - Google Patents

Electronic signature device transaction method Download PDF

Info

Publication number
WO2017162164A1
WO2017162164A1 PCT/CN2017/077652 CN2017077652W WO2017162164A1 WO 2017162164 A1 WO2017162164 A1 WO 2017162164A1 CN 2017077652 W CN2017077652 W CN 2017077652W WO 2017162164 A1 WO2017162164 A1 WO 2017162164A1
Authority
WO
WIPO (PCT)
Prior art keywords
electronic signature
data packet
unit data
signature device
transaction
Prior art date
Application number
PCT/CN2017/077652
Other languages
French (fr)
Chinese (zh)
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
Application filed by 天地融科技股份有限公司 filed Critical 天地融科技股份有限公司
Publication of WO2017162164A1 publication Critical patent/WO2017162164A1/en

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/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3825Use of electronic signatures
    • 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/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists

Definitions

  • the invention relates to the field of electronic technology, and in particular to a method for trading an electronic signature device.
  • the user's funds are stored in the account in the form of numbers.
  • the user holds 100 yuan of funds, and the funds are stored in the user account of the bank server in the form of numbers.
  • the bank server needs to rewrite the funds 100 in the user account to 90 to complete the account clearing.
  • the rewritten fund value 90 is signed. Because the value of the amount in the account changes every time the user makes a transaction, the bank server will process the value after each change. That is to say, the existing electronic transactions must rely on the bank server, and the electronic transactions performed by the users need to be synchronized with the bank server in real time, and it is impossible to independently complete multiple offline transactions without being connected to the Internet.
  • the present invention aims to solve at least one of the above problems.
  • the main object of the present invention is to provide a method of trading an electronic signature device.
  • Another object of the present invention is to provide a method of trading another electronic device.
  • a transaction method of an electronic signature device comprising: an electronic signature device transmitting a transaction request to a server, wherein the transaction request includes at least: a transaction amount; the server receives the transaction request, and deducts the transaction amount from the bank account of the electronic signature device, Obtaining at least one first unit data packet, and transmitting at least one first unit data packet to the electronic signature device; wherein each first unit data packet represents one of a plurality of currency denominations, each first unit The data packet includes at least: the first unit data, the first signature data obtained by the server signing the first unit data, the sum of the currency denominations represented by the at least one first unit data packet is equal to the transaction amount; and the electronic signature device receives the at least one first And a unit data packet, where the first signature data in the at least one first unit data packet is verified, and after the verification is passed, the at least one first unit data packet is stored in the security chip.
  • the transaction request further includes: a device identifier of the electronic signature device; each first unit data packet further includes: a server obtained by signing the first unit data and the device identifier of the electronic signature device Two signature data; at least one first unit data packet is stored in the electronic signature device Before the security chip, the method further comprises: the electronic signature device verifying the second signature data, and performing the step of storing the at least one first unit data packet in the security chip after the verification is passed.
  • the method of claim 1 or 2 after the electronic signature device stores the at least one first unit data packet in the security chip, the method further comprises: the electronic signature device according to the received at least one first unit data packet The number and the currency denomination represented by each first unit data packet calculate whether the sum of the currency face values represented by the received first unit data packet is consistent with the transaction amount in the transaction request, and if not, send a retransmission to the server. Request; the server receives a resend request.
  • the method further includes: the server sending the retransmission information to the electronic signature device according to the retransmission request, wherein the retransmission information includes at least one first unit data packet;
  • the electronic signature device receives the retransmission information, deletes at least one first unit data packet previously stored in the security chip, and re-stores at least one first unit data packet retransmitted by the server.
  • the method further includes: the server sending the retransmission information to the electronic signature device according to the retransmission request, where the retransmission information includes the first unreceived by the electronic signature device One unit data packet; the electronic signature device stores the unreceived first unit data packet in the security chip.
  • Item 6 The transaction method of any one of clauses 1 to 5, before the electronic signature device stores the at least one first unit data packet in the security chip, the method further comprising: the electronic signature device utilizing its security chip allocation for storing at least a storage space of the first unit data packet; the electronic signature device stores the at least one first unit data packet in the security chip, including: the electronic signature device stores the at least one first unit data packet in the corresponding storage space, and The status word of the corresponding storage space is set to be occupied.
  • the method further comprises: the electronic signature device using the counter value of the counter to obtain the currently stored The total number of first unit packets.
  • Item 8 The transaction method according to any one of claims 1 to 7, after the electronic signature device stores the at least one first unit data packet in the security chip, the method further comprises: the electronic signature device counting the transaction amount into the current account balance, Display the transaction amount and/or current account balance to the holding user.
  • the first unit data includes at least: currency denomination data, or currency serial number and currency denomination data; the first unit data packet further includes at least one of the following: issuing bank identifier And the bank certificate serial number.
  • the transaction method of the electronic signature device described above can store the user's funds in the form of a data packet in the electronic signature device of the user, and the number of the data packets is one or more.
  • the electronic signature device does not need to change the stored value by networking with the server, and only needs one or more firsts that meet the consumption amount.
  • the unit data packet can be sent to the payee. Therefore, the electronic signature device does not need to rely on the server for online payment when performing electronic transactions with other electronic signature devices, and the server no longer needs to supervise the electronic signature device, thereby truly Implement offline electronic trading.
  • the transaction method of the electronic signature device includes: the second electronic signature device sends the transaction request to the first electronic signature device, wherein the transaction request includes at least: a transaction amount; and the first electronic signature device receives the transaction request And obtaining at least one second unit data packet from its security chip, and transmitting at least one second unit data packet to the second electronic signature device, wherein each second unit data packet represents one of a plurality of currency denominations Currency denomination, each The second unit data packet includes at least: the second unit data, the third signature data obtained by the server signing the second unit data, the sum of the currency denominations represented by the at least one second unit data packet is equal to the transaction amount; and the second electronic signature device Receiving at least one second unit data packet, verifying the third signature data in the at least one second unit data packet, and storing the at least one second unit data packet in the security chip after the verification is passed.
  • the method further includes: deleting, by the first electronic signature device, the acquired at least one second unit data pack.
  • the first electronic signature device sends the at least one second unit data packet to the second electronic signature device, the first electronic signature device encrypting the at least one second unit data packet to obtain At least one third unit data packet, and transmitting the at least one third unit data packet to the second electronic signature device; the second electronic signature device receiving the at least one second unit data packet, including: the second electronic signature device receiving the at least one The three-unit data packet decrypts at least one third unit data packet to obtain at least one second unit data packet.
  • the first electronic signature device encrypts the at least one second unit data packet, the first electronic signature device using the public key of the second electronic signature device for at least each second unit data
  • the second unit data in the packet is encrypted to obtain the data ciphertext
  • the second electronic signature device decrypts the at least one third unit data packet, including: the second electronic signature device uses the private key of the second electronic signature device to at least The data ciphertext in the third unit data packet is decrypted.
  • the method further comprises: the first electronic signature device overwriting the security chip with each third unit data packet. Each second unit packet.
  • the first electronic signature device encrypts the at least one second unit data packet, including: the first electronic signature device utilizes a symmetric key associated with the second electronic signature device, at least for each The second unit data in the two unit data packet is encrypted to obtain the data ciphertext; the second electronic signature device decrypts the at least one third unit data packet, including: the second electronic signature device uses the first electronic signature device The symmetric key decrypts at least the data ciphertext in each third unit data packet.
  • the method further includes: the first electronic signature device overwriting the security chip with each third unit data packet. Each second unit of data packets and delete the symmetric key.
  • the symmetric key is an exclusive OR factor
  • the first electronic signature device utilizes a symmetric key associated with the second electronic signature device for at least a second of each second unit data packet
  • the unit data is encrypted to obtain the data ciphertext, including: the first electronic signature device uses an exclusive OR factor to perform an exclusive OR operation on at least the second unit data in each second unit data packet to obtain a data ciphertext; the second electronic signature
  • the device decrypts the data ciphertext in each third unit data packet by using a symmetric key associated with the first electronic signature device, including: the second electronic signature device uses an exclusive OR factor for each third unit data packet
  • the data ciphertext in the XOR is XORed.
  • the transaction method according to any one of the items 10 to 17, after the second electronic signature device stores the at least one second unit data packet in the security chip, the method further comprises: the second electronic signature device utilizing the counter value of the counter The total number of second unit packets to the current storage.
  • the transaction method according to any one of the items 10 to 18, wherein the transaction request comprises at least: a device identifier of the second electronic signature device.
  • the transaction method of claim 19 before the first electronic signature device acquires at least one second unit data packet from its security chip, the transaction method The method further includes: the first electronic signature device prompting the holding user with the transaction amount and the device identifier of the second electronic signature device, and receiving the confirmation information of the holding user.
  • the second unit data packet further includes: fourth signature data obtained by the first electronic signature device for the second unit data and the device identifier of the second electronic signature, and the second electronic data according to the transaction method of the party 19; Before the signing device stores the at least one second unit data packet in the security chip, the method further includes: the second electronic signature device verifies the fourth signature data, and after the verification is passed, executing the second electronic signature device to the at least one second unit The step of storing the data packet in the security chip.
  • each third unit data packet further comprises: a device identifier of the second electronic signature device.
  • the transaction request further comprises: a data packet identifier; the second electronic signature device stores the at least one second unit data packet in the security chip, and the second electronic signature device determines the received Whether the data packet identifier in the two-unit data packet is the same as the data packet identifier in the sent transaction request. If not, the second unit data packet with different data packet identifiers is discarded. If they are the same, the data packet identifier is the same. The second unit data packet is stored in the security chip.
  • the transaction request further includes: a data packet identification start value; the second electronic signature device storing the at least one second unit data packet in the security chip, comprising: the second electronic signature device determining each Whether the data packet identifier included in the second unit data packet satisfies the preset range determined according to the start value of the data packet identifier, and if not, the second unit data packet whose data packet identifier does not satisfy the preset range is discarded, if If satisfied, the second unit data packet whose data packet identifier meets the preset range is stored in the security chip.
  • the method before the second electronic signature device sends the transaction request to the first electronic signature device, the method further includes: the second electronic signature device obtaining the data packet identification start value by using the counter value of the counter; After the second electronic signature device stores the at least one second unit data packet in the security chip, the method further includes: the counter of the second electronic signature device adds the data packet identifier start value to the received second unit data packet. The total number of calculations yields a new packet identification start value.
  • the transaction method according to any one of the items 23 to 26, after the second electronic signature device stores the at least one second unit data packet in the security chip, the method further comprises: the second electronic signature device according to the received The number of two unit data packets and the currency denomination value represented by each second unit data packet calculate whether the sum of the currency face values represented by the received second unit data packet is consistent with the transaction amount in the transaction request, and if they are inconsistent, Sending a retransmission request to the first electronic signature device; the first electronic signature device receives the retransmission request, and sends the retransmission information to the second electronic signature device according to the retransmission request, wherein the retransmission request includes at least the second electronic signature The device identifier of the device and/or the packet identifier corresponding to each second unit data packet.
  • the method further includes: the second electronic signature device receiving the retransmission information, wherein The sending information includes at least one second unit data packet, and the at least one second unit data packet previously stored in the security chip is deleted, and the at least one second unit data packet retransmitted by the first electronic signature device is re-stored.
  • the method further includes: the second electronic signature device receiving the retransmission information, wherein The sending information includes a second unit data packet that is not received by the second electronic signature device, and stores the unreceived second unit data packet in its security chip.
  • the transaction method according to any one of the items 10 to 29, wherein the second unit data includes at least: currency denomination data, or currency serial number and currency denomination data; and the second unit data packet includes at least one of the following: issuing bank identification and Bank certificate serial number.
  • the method further comprises: the first electronic signature device to have its account The amount is subtracted from the transaction amount to obtain the current account balance, and the transaction amount and/or the current account balance are displayed to the holding user; after the second electronic signature device stores the at least one second unit data packet in the security chip, the method further includes: The second electronic signature device adds the current account amount to the transaction amount to obtain the current account balance, and displays the transaction amount and/or the current account balance to the holding user.
  • the method further comprises: distributing the security chip of the second electronic signature device And storing the storage space of the at least one second unit data packet; the second electronic signature device storing the at least one second unit data packet in the security chip, the second electronic signature device storing the at least one second unit data packet in the corresponding In the storage space, and set the status word of the corresponding storage space to be occupied.
  • the method further comprises: a security chip of the first electronic signature device Allocating a storage space for storing at least one third unit data packet, and storing at least one third unit data packet in the corresponding storage space; and transmitting, by the first electronic signature device, the retransmission information to the second according to the retransmission request
  • the method further includes: the first electronic signature device receiving the confirmation message of the success of the reception returned by the second electronic signature device, and modifying the status word of the storage space of the at least one third unit data packet to be completed. Or empty the storage space.
  • the user's funds are stored in the first electronic signature device or the second electronic signature device in the form of at least one second unit data packet.
  • the payee user the second electronic signature device side
  • the second electronic signature device since the funds are no longer stored in the second electronic signature device in the form of numerical values, the second electronic signature device does not need to be changed by the server.
  • the second electronic signature device of the payee user only needs to receive a certain number of second unit data packets from the first electronic signature device of the payer user, whereby the electronic signature device is signed with other electronic
  • the device conducts electronic transactions, it no longer needs to rely on the server for online payment, and the server does not need to supervise the electronic signature device of the payee user or the payer user, thereby realizing offline electronic transactions.
  • FIG. 1 is a flowchart of a method for processing an electronic signature device according to Embodiment 1 of the present invention
  • FIG. 2 is a flowchart of another method for processing an electronic signature device according to Embodiment 2 of the present invention.
  • connection In the description of the present invention, it should be noted that the terms “installation”, “connected”, and “connected” are to be understood broadly, and may be fixed or detachable, for example, unless otherwise explicitly defined and defined. Connected, or integrally connected; can be mechanical or electrical; can be directly connected, or indirectly connected through an intermediate medium, can be the internal communication of the two components.
  • Connected, or integrally connected can be mechanical or electrical; can be directly connected, or indirectly connected through an intermediate medium, can be the internal communication of the two components.
  • the specific meaning of the above terms in the present invention can be understood in a specific case by those skilled in the art.
  • FIG. 1 is a flowchart of a method for processing an electronic signature device according to an embodiment of the present invention.
  • the method embodiment shown in FIG. 1 includes the following steps S11 to S13:
  • Step S11 The electronic signature device sends a transaction request to the server, wherein the transaction request includes at least: a transaction amount.
  • the electronic signature device may be an electronic device with a signature function, for example, a smart card with a signature function (a bus card, a bank card, a shopping card, etc.), a U shield of the ICBC, and the like.
  • the electronic signature device sends a transaction request to the server.
  • the electronic signature device may establish a connection with an external device (such as a PC or a mobile terminal, etc.), and the transaction is performed by the external device. The request is sent to the server.
  • the electronic signature device has a wired interface or a wireless interface, establishes a wired connection or a wireless connection with the server, and directly sends the transaction request to the server.
  • the wireless connection method may include Bluetooth, NFC approach communication, and WIFI.
  • the electronic signature device in this embodiment can send a transaction request to the server in a variety of ways.
  • the server includes a bank server or a third-party server.
  • the third-party server may be a shopping card stored value server of a certain mall.
  • the electronic signature device needs to perform a recharge operation, and sends a transaction request for refilling to the server (the bank server or the shopping card stored value server of the shopping mall), and the transaction amount carried in the transaction request is the electronic signature device requesting the server.
  • the value of the recharge amount so that the server returns the first unit data packet corresponding to the transaction amount to the electronic signature device (ie, the sum of the currency denominations of the first unit data packet returned by the server is equal to the transaction amount).
  • Step S12 the server receives the transaction request, deducts the transaction amount from the bank account of the electronic signature device, acquires at least one first unit data packet, and transmits the at least one first unit data packet to the electronic signature device;
  • Each of the first unit data packets represents one of a plurality of currency denominations, and each of the first unit data packets includes at least: the first unit data, and the first signature obtained by the server to sign the first unit data. Data, the sum of the currency denominations represented by the at least one first unit data packet is equal to the transaction amount.
  • each first unit data packet represents one currency face value of the plurality of currency denominations, that is, the currency face value has a plurality of types, when the electronic signature is set
  • the first unit data packet represents only one of the currency denominations.
  • the plurality of first unit data packets may represent a plurality of different currency denominations, for example, the number of the first unit data packets is three, each of the first One unit data packet represents currency face value of 1 yuan, 2 yuan and 5 yuan respectively; or, multiple first unit data packets can represent the same currency face value, for example, the number of first unit data packets is 3, each A unit data packet represents a currency denomination of 1 yuan; or, a plurality of first unit data packets represent a currency denomination that includes both the same and different currency denominations, for example, the number of first unit data packets is 3, each first unit data packet represents currency face value of 1 yuan, 1 yuan and 2 yuan.
  • the currency denomination represented by the at least one first unit data packet received by the electronic signature device from the server has a flexible combination.
  • the first unit data packet includes at least first unit data
  • the first unit data includes at least: currency denomination data, or currency serial number and currency denomination data.
  • the currency denomination data is the currency denomination represented by the first unit data packet, thereby identifying the currency denomination represented by the first unit data packet
  • the currency serial number is the unique serial number of each first unit data packet, that is, different numbers The currency numbers in a unit of data packets are different. Thereby, the uniqueness of each first unit data packet can be guaranteed to facilitate identification of the authenticity of the first unit data packet.
  • the first unit data packet further includes at least one of the following: an issuing bank identifier and a bank certificate serial number.
  • the issuing bank identifier is the identification information of the bank that issued the first unit data packet, so that the related information of the corresponding issuing bank can be queried according to the identifier, and the electronic signature device can obtain the identifier according to the issuing bank identifier and the bank certificate serial number.
  • the bank certificate contains the public key of the issuing bank, so that the electronic signature device can verify the signature of the first unit data by using the public key of the issuing bank in the subsequent operation.
  • the first unit data packet further includes: first unit data and first signature data obtained by the server to sign the first unit data.
  • the server separately signatures the first unit data in each first unit data packet by using its own private key, to obtain first signature data corresponding to each first unit data packet.
  • the server sends at least one first unit data packet carrying the first signature data to the electronic signature device, so that the electronic signature device uses the public key of the server to verify the authenticity of the first unit data packet in subsequent operations.
  • the transaction request sent by the electronic signature device to the server further includes: a device identifier of the electronic signature device; each first unit data packet further includes: the server to the first unit data And the second signature data obtained by the device identification signature of the electronic signature device.
  • the server uses the private key of the server to sign the first unit data and the device identifier of the electronic signature device to obtain second signature data corresponding to each first unit data packet.
  • the server sends at least one first unit data packet carrying the second signature data to the electronic signature device, so that the electronic signature device uses the public key of the server to verify the correctness of the first unit data packet in subsequent operations.
  • the server deducts the transaction amount requested by the electronic signature device from the account corresponding to the electronic signature device, and the sum of the currency denominations issued by the electronic signature device is equal to At least one first unit data packet of the transaction amount, after the electronic signature device receives the first unit data packet, that is, after the recharging is successful, the offline transaction can be completed with other electronic signature devices, that is, the network connection with the server is not needed. Transfer money to other electronic signature devices (ie, forward the first unit data packet to other electronic signature devices).
  • the currency face value represented by each first unit data packet may be the same or different, and the number of first unit data packets sent to the electronic signature device and the currency face value represented by each first unit data packet may be determined by the server according to the transaction amount. It is determined that the electronic signature device can also notify the server after determining the transaction amount.
  • the transaction request sent by the electronic signature device may further carry the type of the first unit data packet and Number.
  • the former server can flexibly implement the delivery of the first unit data packet, and the latter can The user's demand for the number of first unit data packets and the face value is satisfied.
  • each first unit data packet represents one of a plurality of currency denominations.
  • the currency denomination represented by the first unit data packet includes: 1 yuan, 2 Yuan, 5 yuan, 10 yuan, 20 yuan, 50 yuan and 100 yuan.
  • the currency face value of the country is also within the scope of protection of the present invention. In this embodiment, only the RMB denomination is used for illustration.
  • the electronic signature device sends a transaction request to the server, wherein the transaction request includes a transaction amount of 10 yuan, and the electronic signature device receives 5 first unit data packets from the server, and the currency face value represented by the 5 first unit data packets
  • the sum of the currency denominations represented by the five first unit data packets is 1 yuan, 1 yuan, 1 yuan, 2 yuan, and 5 yuan, respectively, which is equal to the transaction amount.
  • the electronic signature device may also receive 10 first unit data packets representing the face value of the 1 dollar currency from the server, or 2 first unit data representing the face value of the 5 dollar currency.
  • a first unit packet representing the face value of a 10-yuan currency a first unit packet representing the face value of a 10-yuan currency. That is to say, the currency denomination and the number represented by the first electronic unit currency data packet can be flexibly combined, and only the sum of the currency denominations represented by the received at least one first unit data packet is equal to the transaction amount.
  • the transaction amount is only 10 yuan as an example.
  • the numerical principle is the same, and is not illustrated here. Therefore, in the case that the server determines the number of the first unit data packets according to the transaction amount and the face value represented by each of the first unit data packets, the server can flexibly implement the delivery of the first unit data packet, and various types of data packets can be implemented.
  • the electronic signature device determines the number of the first unit data packets according to the transaction amount, and the face value represented by each first unit data packet
  • the number of requests and the corresponding first unit data packet may be represented.
  • the currency face value is sent to the server, thereby satisfying the user's demand for the number of first unit data packets and the face value.
  • the electronic signature device may further receive at least one ciphertext of the first unit data packet from the server, in order to further improve the security of the data transmission in the process of delivering the first unit data packet by the server.
  • Data wherein the ciphertext data is obtained by the server encrypting at least one first unit data packet, and the electronic signature device may decrypt the ciphertext data to obtain the first unit data packet original text, and the server and the electronic signature device may pass the symmetric key Secure encryption of data is achieved by means of key encryption or decryption or asymmetric key encryption and decryption.
  • the server encrypts the at least one first unit data packet by using: the server encrypts the at least one first unit data packet by using the public key of the electronic signature device (this is an asymmetric key encryption). Alternatively, the server encrypts the at least one first unit data packet using a symmetric key negotiated with the electronic signature device.
  • the electronic signature device After receiving the ciphertext data, the electronic signature device decrypts the ciphertext data by using a decryption method corresponding to the encryption mode of the server, to obtain at least one first unit data packet plaintext, that is, using the private key of the electronic signature device to the secret
  • the text data is decrypted to obtain the first unit data packet plaintext (this is the way of asymmetric key decryption), or the electronic signature device decrypts the ciphertext data by using the symmetric key negotiated with the server to obtain the first unit data packet plaintext.
  • the first unit data packet can be prevented from being copied or falsified during the transmission process, thereby improving the security of data transmission.
  • Step S13 The electronic signature device receives the at least one first unit data packet, and verifies the first signature data in the at least one first unit data packet, and after the verification is passed, stores the at least one first unit data packet in the security. In the chip.
  • the electronic signature device is provided with a security chip
  • the security chip has an independent processor and a storage unit, and can store the PKI digital certificate and the key, and other characteristic data.
  • the data is subjected to encryption and decryption operations to provide data encryption and identity security authentication services for the user.
  • the first unit data packet stored in the security chip of the electronic signature device cannot be illegally read, and the stored data security can be ensured.
  • the transaction method further includes: the electronic signature device uses its security chip allocation for storing the at least one first unit.
  • the storage space of the packet stores the at least one first unit data packet in the security chip, and specifically includes: the electronic signature device stores the at least one first unit data packet in a corresponding storage space, and stores the corresponding storage.
  • the status word for the space is set to Occupied.
  • the security chip allocates one storage space for each first unit data packet, and one storage space can only store one first unit data packet, and the transaction record of the electronic signature device also records the transaction received from the server in a transaction. The location of the storage space stored by each first unit packet.
  • the status word of the storage space is used to identify whether the storage space has been occupied. If it is already occupied, the electronic signature device cannot store the first unit data packet in the occupied storage space. When all the storage space allocated by the security chip is occupied, the electronic signature device needs to perform an operation of requesting the server to update the data packet or apply for a new storage space, wherein, as an optional implementation manner, the electronic signature device can apply for a new one. Storage space to store the newly received first unit packet. As another optional implementation manner, the electronic signature device may further request the server to update the locally stored first unit data packet.
  • the electronic signature device may request the server to store N locally (N is a positive integer greater than 1
  • N is a positive integer greater than 1
  • the first unit data packet representing the small face value is replaced by 1 or M (M ⁇ N)
  • the first unit data packet representing the face value of the large currency is stored, as long as the stored currency amount is unchanged, thereby releasing Multiple storage spaces, thereby saving storage space to store the newly received first unit data packet.
  • the electronic signature device may further encrypt each first unit data packet to obtain ciphertext data of each first unit data packet, and each confidentiality The text data is stored in the corresponding storage space. Thereby, it can be ensured that the first unit data packet stored in the storage space of the security chip cannot be maliciously copied or changed, thereby ensuring the security of storing the first unit data packet.
  • each first unit data packet includes at least: the first unit data and the server pair.
  • the first unit data is signed by the first unit data, thereby enabling the electronic signature device to verify the authenticity of the first unit data packet.
  • the first signature data is signature data obtained by the server by using the private key of the server to sign the first unit data.
  • the verifying the first signature data by the electronic signature device comprises: the electronic signature device performing the verification of the first signature data by using the public key of the server.
  • the bank server performs HASH operation on the first unit data to obtain the digest message A1 of the first unit data, and uses the private key of the bank server to sign the digest message A1 to obtain the first signature.
  • the data is carried in the first unit data packet and sent to the electronic signature device.
  • the electronic signature device can perform the verification of the first signature data by using the public key of the bank server. Specifically, the electronic signature device uses the public key of the bank server to calculate the first electronic signature data to obtain the operation result A2, and obtains the operation result A2.
  • the first unit data in the first unit data packet is subjected to HASH operation to obtain the digest message A3 of the first unit data, and the operation result A2 is compared with the digest message A3. If the comparison result is consistent, the electronic signature device pairs An electronic signature data check was passed.
  • the electronic signature device may obtain the public key of the bank according to the bank certificate serial number and/or the issuing bank identifier in the first unit data packet. For example, the electronic signature device may wait and receive according to the issuing bank identifier in the first unit data packet.
  • the issuing bank server corresponding to the verified first signature data obtains the bank certificate of the bank, and obtains the bank's public key from the bank certificate; for example, the electronic signature device can pre-store the bank certificate of each bank according to the first unit data packet.
  • the bank certificate serial number in the bank certificate is obtained from the pre-stored bank certificate, and the bank certificate corresponding to the first signature data to be verified is obtained, and the bank public key is obtained from the corresponding bank certificate. Therefore, the electronic signature device uses the public key of the bank to perform verification on the first signature data carried in the first unit data packet, and can verify the authenticity of the first unit data packet.
  • the above description is only taking the server as a bank server as an example, but the embodiment is not limited to the bank server, and the specific implementation manners of other third-party servers, such as a supermarket shopping card stored value server, etc. belong to the protection scope of the present invention. Within the fence.
  • the electronic signature device further confirms whether the object sent by the server is indeed the electronic signature device, so as to ensure that the data packet sent by the storage server is incorrect, in the step of ensuring that the received first unit data packet is authentic.
  • the transaction method further includes: the electronic signature device verifying the second signature data, and executing the storing the at least one first unit data packet after the verification is passed Operation in the security chip.
  • the second signature data is obtained by the server for the first unit data and the device identifier of the electronic signature device.
  • the transaction request sent by the electronic signature device to the server further includes: The device identifier of the electronic signature device; each first unit data packet includes at least: first unit data, second signature data obtained by the server for the first unit data and the device identifier of the electronic signature device, thereby enabling the electronic signature device to Verify the authenticity and correctness of the first unit packet.
  • the second signature data is signature data obtained by the server by using the private key of the server to sign the device identifier of the first unit data and the electronic signature device, that is, each second signature data.
  • the signature object is a combination of each of the first unit data and the device identification of the electronic signature device.
  • the verifying the second signature data by the electronic signature device comprises: the electronic signature device separately checking each second signature data by using a public key of the server.
  • the bank server uses the private key of the server to sign the first unit data and the device identifier of the electronic signature device to obtain the second signature data, which is carried in the first unit data packet and sent to the electronic signature device.
  • the electronic signature device can authenticate the second signature data by using the public key of the bank server.
  • the electronic signature device may obtain the bank certificate of the bank according to the bank certificate serial number and/or the issuing bank identifier in the first unit data packet, and obtain the public key of the bank from the bank certificate.
  • the electronic signature device may be configured according to the The issuing bank identifier in one unit data packet acquires the public key of the bank from the issuing bank server corresponding to the second signature data to be verified; for example, the electronic signature device may pre-store the bank certificate of each bank according to the first unit data
  • the bank certificate serial number in the package obtains the bank certificate corresponding to the second signature data to be verified from the pre-stored bank certificates, and obtains the bank public key from the corresponding bank certificate.
  • the electronic signature device uses the public key of the bank to perform verification on the second signature data carried in the first unit data packet, which can not only verify the authenticity of the first unit data packet, but also prove that the first unit data packet is indeed
  • the bank server sends the electronic signature device to the electronic signature device to verify the correctness of the first unit data packet.
  • the server is a bank server, but the embodiment is not limited to the bank server, and the specific implementation manners of other third-party servers, such as a supermarket shopping card stored value server, are within the protection scope of the present invention.
  • the transaction The method further includes: calculating, by the electronic signature device, the currency face value represented by the received first unit data packet according to the received number of the at least one first unit data packet and the currency face value represented by each first unit data packet The sum is consistent with the transaction amount in the transaction request, and if not, the retransmission request is sent to the server; the server receives the retransmission request.
  • the electronic signature device receives 5 first unit data packets from the server, and calculates whether the sum of the currency face values represented by the 5 first unit data packets is equal to 10 yuan, and if less than 10 yuan, the server Send a resend request.
  • the electronic signature device can solve the problem of insufficient currency face value represented by the received first unit data packet by transmitting a retransmission request to the server.
  • the electronic signature device After the electronic signature device sends a resend request to the server, the electronic signature device receives the retransmission information returned by the server.
  • the retransmission information returned by the server may be different.
  • the retransmission request may be The device identification and transaction record of the electronic signature device (such as the number of each transaction, account information, time stamp, transaction amount, and the number of received first unit data packets and the currency face value represented, etc.) Will also correspond to the record),
  • the retransmission request may also carry the received first unit.
  • the packet identifier of the data packet (which can uniquely identify the identifier of a first unit data packet, such as the unique identifier configured by the server for each first unit data packet, or the currency serial number).
  • the server can query Which first unit data packets are lost during the missed transmission or transmission, and the first unit data packets that are lost or lost during transmission are sent to the electronic signature device.
  • the following is an exemplary illustration of the server resending the first unit of electronic data packets:
  • the transaction method further includes: the server transmitting the retransmission information to the electronic signature device according to the retransmission request, wherein the retransmission information includes at least one first unit data packet; and the electronic signature device receives the retransmission And deleting at least one first unit data packet previously stored in the security chip, and re-storing at least one first unit data packet retransmitted by the server.
  • the electronic signature device after sending the resend request to the server, receives the retransmission information sent by the server according to the retransmission request, where the retransmission request includes at least: the device identifier of the electronic signature device and The transaction record, the retransmission information includes at least one first unit data packet, that is, in the optional implementation, the server resends all the first unit data packets corresponding to a transaction to the electronic signature device, in this embodiment.
  • the server deals with the unit electronic signature tool, it also stores the transaction records corresponding to each transaction (such as the number of each transaction, account information, time stamp, transaction amount, and the number of first unit packets sent).
  • the server will query The first unit data packet of the transaction that the electronic signature device requests to resend is resent to the electronic signature set. To ensure that the electronic signature device receives the correct transaction complete first unit of data packets, the server and the electronic signature device (such as a top-correct).
  • the transaction method further includes: the electronic signature device storing the at least one first stored in the security chip.
  • Unit data packet deletion ie, in this alternative embodiment, since the server will resend the first unit data packet of the transaction to the electronic signature device, the electronic signature device must all the previously received transactions.
  • a unit data packet that is, at least one first unit data packet corresponding to the transaction previously stored in the security chip is deleted, and re-storing at least one first unit data packet retransmitted by the server, wherein the electronic signature device is executing
  • the status word of the occupied storage space is set to be unoccupied, and the electronic signature device can store the re-received first unit data packet into the storage space allocated by the previous security chip.
  • set the status word of the occupied storage space to be occupied, thereby ensuring the electronic signature Preparation will not repeat unit storing a first data packet, and to ensure that the same storage unit can only store a first packet.
  • the transaction amount in the transaction request of the electronic signature device is 10 yuan
  • the electronic signature device receives 5 values representing the face value of the 2 yuan currency respectively sent by the server.
  • the first unit data packet but due to data loss during transmission, the electronic signature device only receives four first unit data packets respectively representing the denomination of the 2-yuan currency, and the sum of the currency denominations is 8 yuan, which is not equal to the transaction amount of 10 yuan.
  • the electronic signature device sends a retransmission request to the server, and receives retransmission information sent by the server according to the retransmission request, where the retransmission request includes: a device identifier of the electronic signature device and a transaction record, and the server receives the After the request is resent, the transaction corresponding to the electronic signature device may be queried according to the device identifier and the transaction record, and the server resends the first unit data packet of the transaction that the queried electronic signature device requests to resend to the transaction.
  • the electronic signature device that is, the retransmission information sent by the server to the electronic signature device, includes five first unit data packets respectively representing the denomination of the 2-yuan currency.
  • the electronic signature device stores the four previously stored in the security chip for the two-yuan currency.
  • the first unit packet of the denomination is deleted, and the first unit packet representing the denomination of the 2-yuan currency, respectively, is re-stored by the server.
  • the server can resend all of the first unit data packets required for the transaction to the electronic signature device, thereby enabling the transaction to enable the transaction. Done successfully.
  • the transaction method further includes: the server sending the retransmission information to the electronic signature device according to the retransmission request, wherein the retransmission information includes the first unit data packet that is not received by the electronic signature device.
  • the electronic signature device stores the unreceived first unit data packet in the security chip.
  • the electronic signature device after sending the resend request to the server, receives the retransmission information sent by the server according to the retransmission request, where the retransmission request includes at least: the device identifier of the electronic signature device, a transaction record and a received packet identifier of each first unit data packet, the retransmission information including a first unit data packet not received by the electronic signature device, that is, in the optional embodiment, the server is heavy to the electronic signature device A first unit data packet missed or lost during transmission is sent, and a corresponding transaction corresponding to the electronic signature device can be queried according to the device identification and the transaction record, and the server will query the electronic signature.
  • the first unit data packet corresponding to the unidentified data packet identifier of the transaction requesting retransmission of the device is resent to the electronic signature device to ensure that the electronic signature device receives the complete first unit data packet, the server and the electronic signature.
  • the transaction of the equipment is correct (such as recharge).
  • the optional implementation manner can reduce the data transmission volume of the server, greatly reduce the workload of the server, and improve the working efficiency of server retransmission.
  • the electronic signature device after the electronic signature device receives the first unit data packet resent by the server, the electronic signature device stores the first unit data packet that has not been received before in the security chip, that is, the electronic signature device The re-received first unit data packet is stored in the storage space allocated before the security chip, and the status word of the occupied storage space is set to be occupied, thereby ensuring that only one first unit data packet can be stored in the same storage space.
  • the transaction amount in the transaction request of the electronic signature device is 5 yuan
  • the electronic signature device receives two of the two face currency values respectively sent by the server.
  • the first unit data packet (referred to as a 2-yuan data packet), and a first unit data packet (referred to as a 1-yuan data packet) representing a denomination of a 1-yuan currency, but the electronic signature device only receives 2 due to data loss during transmission.
  • a 2-yuan data packet, the sum of currency face values is 4 yuan, which is not equal to the transaction amount of 5 yuan.
  • the electronic signature device sends a retransmission request to the server, and receives the retransmission information sent by the server according to the retransmission request, and the retransmission request further carries the data packet identifier of two 2-yuan data packets, and the server receives the packet identifier.
  • the transaction for the electronic signature device can query all the corresponding first unit data packets, and then the packet identifier of the unrequested data packet in the retransmission request can be found, and the server can The metadata packet is retransmitted to the electronic signature device, that is, the retransmission information sent by the server to the electronic signature device includes one 1-yuan data packet.
  • the electronic signature device stores one 1-byte data packet retransmitted by the server in the security chip.
  • the retransmission request sent by the electronic signature device to the server may include the data packet identifier of the part of the first unit data packet that has been received, and the server may determine the retransmission information according to the data packet identifier in the retransmission request.
  • the amount of transmission also ensures that the transaction can be completed smoothly.
  • each transaction in a plurality of transactions can be implemented in the above manner.
  • the storage space of the electronic signature device is limited after all. Therefore, the remaining space of the electronic signature device needs to be monitored at any time, so as to release the storage space in an instant, and avoid the problem that the transaction fails if there is no extra space in the transaction process.
  • the electronic signature device is further configured.
  • a counter is provided through which the remaining storage space of the electronic signature device can be monitored in real time. Specifically, after the step S13, the transaction method further includes: the electronic signature device uses the count value of the counter to obtain the total number of the first unit data packets currently stored.
  • each transaction the counter adds the number of the first unit data packet received by the transaction, and after multiple transactions, the counter value of the counter is accumulated to a value when the value reaches a preset value.
  • the storage space of the electronic signature device has been allocated, there is no redundant storage space.
  • the electronic signature device needs to perform an operation of requesting the server to update the data packet or apply for a new storage space (as described above).
  • each storage space has the same size
  • each first unit data packet has the same size and matches the size of the storage space, for example, the storage space allocated by the electronic signature device to a first unit data packet.
  • the size is 2M
  • the 2M storage space can store a first unit data packet
  • a security chip reserves the space for storing the first unit data packet as 1G
  • the electronic signature device can store up to 512 first unit data.
  • the package, the preset value can be set to 512.
  • the remaining space of the electronic signature device can be monitored in real time, and the redundant storage space is released in time, so as to avoid the problem that the transaction fails if there is no extra space in the transaction process.
  • the electronic signature device can also use the count value of the counter to obtain the total number of first unit data packets of each currency denomination stored in the security chip.
  • the electronic signature device can obtain the total amount of money of the currently stored first unit data packet according to the currency face value and the number of the money represented by each stored first unit data packet.
  • the transaction method further includes: the electronic signature device includes the transaction amount into the current account balance, and displays the transaction amount and/or the current account balance to the holding user.
  • the user holding the electronic signature device can query the transaction amount and the current account balance on his own device.
  • the user's funds can be stored in the user's electronic signature device in the form of data packets, and the number of data packets is one or more.
  • the electronic signature device does not need to change the stored value by networking with the server, and only needs one or more firsts that meet the consumption amount.
  • the unit data packet can be sent to the payee. Therefore, the electronic signature device does not need to rely on the server for online payment when performing electronic transactions with other electronic signature devices, and the server no longer needs to supervise the electronic signature device, thereby truly Implement offline electronic trading.
  • FIG. 2 is a flowchart of another method for processing an electronic signature device according to an embodiment of the present invention. As shown in FIG. 2, the transaction method includes the following steps S21 to S23:
  • Step S21 The second electronic signature device sends a transaction request to the first electronic signature device, where the transaction request includes at least: a transaction amount;
  • the first electronic signature device and the second electronic signature device can perform offline transactions (ie, no need to complete the transaction with the server), and both can be electronic devices with a signature function, for example, having a signature function. Smart cards (bus cards, bank cards, shopping cards, etc.), U-Shields from ICBC, etc.
  • the first electronic signature device and the second electronic signature device may each be provided with a wired interface or a wireless interface, and the second electronic signature device may be connected to the first electronic device by using a wired or wireless connection.
  • the signing device establishes a communication connection, wherein the wireless connection manner includes but is not limited to: Bluetooth, NFC near field communication or WIFI.
  • the second electronic signature device can also establish a connection with the external device through a wired or wireless connection, and send a transaction request to the first electronic signature device through the external device, and the first electronic signature device can also connect to the external device through a wired or wireless connection.
  • an electronic device capable of communicating such as a mobile phone, a PC, or a tablet computer.
  • the second electronic signature device of the cashier at the mall sends a transaction request carrying the transaction amount to the first electronic signature device of the user, and the transaction amount is the amount that the user needs to pay for the purchase.
  • the first electronic signature device sends the second unit data packet corresponding to the transaction amount to the second electronic signature device (ie, the sum of the currency denominations of the second unit data packet sent by the first electronic signature device is equal to the transaction amount)
  • two The electronic signature devices can be completely independent and do not need to be connected to the network.
  • the above transactions can be realized between two cards, and offline transactions can be realized, and the transaction is simple and quick.
  • the second electronic signature device may establish a secure channel with the first electronic signature device. And use the secure channel for data transmission. Thereby, the security of data transmission between the second electronic signature device and the first electronic signature device can be improved.
  • Step S22 The first electronic signature device receives the transaction request, and acquires at least one second unit data packet from the security chip, and sends the at least one second unit data packet to the second electronic signature device.
  • each second unit data packet represents one currency face value of the plurality of currency denominations
  • each second unit data packet includes at least: the second unit data, and the third signature data obtained by the server for signing the second unit data, The sum of the currency denominations represented by the at least one second unit data packet is equal to the transaction amount;
  • each second unit data packet represents one currency denomination of the plurality of currency denominations, and the sum of the currency denominations represented by the at least one second unit data packet is equal to the transaction amount.
  • each second unit data packet represents one of a plurality of currency denominations, that is, a plurality of currency denominations are used, and when the first electronic signature device transmits only one second unit data packet to In the case of the second electronic signature device, the second unit data packet represents only one of the currency denominations.
  • the second unit data packet in this embodiment has the same features as the first unit data packet provided in Embodiment 1. For a detailed description of the second unit data packet, refer to the first unit data packet in Embodiment 1. Description, no longer repeat here.
  • the second unit data packet includes at least second unit data
  • the second unit data includes at least: currency denomination data, or currency serial number and currency denomination data.
  • the currency denomination data is the currency denomination represented by the second unit data packet, thereby identifying the currency denomination represented by the second unit data packet
  • the currency serial number is the unique serial number of each second unit data packet, that is, different numbers The currency numbers in the two-unit data package are different. Thereby, the uniqueness of each second unit data packet can be guaranteed to facilitate identification of the authenticity of the second unit data packet.
  • the second unit data packet further includes at least one of the following: an issuing bank identifier and a bank certificate serial number.
  • the issuing bank identifier is the identification information of the bank that issues the second unit data packet
  • the second electronic signature device can query the related information of the corresponding issuing bank according to the identifier
  • the second electronic signature device can
  • the issuing bank identifier and the bank certificate serial number are used to obtain the corresponding bank certificate of the issuing bank, and the bank certificate includes the issuing bank's public key, so that the subsequent second electronic signature device can verify the signature of the second unit data by using the issuing bank's public key.
  • each second unit data packet includes at least: second unit data, and third signature data obtained by the server to sign the second unit data.
  • the server separately signs the second unit data in each second unit data packet by using its own private key, to obtain third signature data corresponding to each second unit data packet.
  • the server uses its own private key to sign The name refers to the bank server obtaining the corresponding private key according to the issuing bank identifier and the bank certificate serial number, and signing with the private key.
  • the server sends the at least one second unit data packet carrying the third signature data to the first electronic signature device.
  • the device Receiving, by the second electronic signature device, the at least one second unit data packet carrying the third signature data from the first electronic signature device, when the second electronic signature device performs the collection operation from the first electronic signature device, so as to facilitate the second electronic signature in the subsequent step.
  • the device can use the server's public key to verify the authenticity of the second unit packet.
  • the transaction request sent by the second electronic signature device to the first electronic signature device further includes: a device identifier of the second electronic signature device; each second unit data packet is further The method includes: the fourth signature data obtained by the first electronic signature device by using the second unit data and the device identifier of the second electronic signature device.
  • the first electronic signature device uses the private key of the first electronic signature to sign the second unit data and the device identifier of the second electronic signature device to obtain a fourth signature corresponding to each second unit data packet. data.
  • the correctness of the second unit data packet is verified using the public key of the first electronic signature device.
  • the first electronic signature device deducts the transaction amount requested by the second electronic signature device from the account balance of the second electronic signature device, and is the second electronic signature device.
  • the sum of the issued currency face values is equal to at least one second unit data packet of the transaction amount, and after the second electronic signature device receives the second unit data packets, if the transfer is successful, the offline transaction is completed, and the second electronic signature device is completed.
  • the first electronic signature device transfer (ie, receiving at least one second unit data packet sent by the first electronic signature device) may be received without networking with the server.
  • the currency denomination value represented by each second unit data packet may be the same or different, and the number of the second unit data packet sent by the first electronic signature device to the second electronic signature device and the currency represented by each second unit data packet
  • the face value may be determined by the first electronic signature device according to the transaction amount, or may be notified by the second electronic signature device according to the transaction amount, and then notified to the first electronic signature device, for example, as an optional implementation manner in this embodiment, the second
  • the transaction request sent by the electronic signature device may also carry the type and number of the required second unit data packets.
  • the first electronic signature device of the former can flexibly implement the delivery of the second unit data packet, and the latter can satisfy the requirement of the number of the second unit data packet and the face value of the user of the second electronic signature device.
  • the second electronic signature device determines the number of the second unit data packets according to the transaction amount and the currency denomination value represented by each second unit data packet
  • the security chip of the first electronic signature device does not store the second
  • the second unit data packet corresponding to the currency denomination requested by the electronic signature device or the number of stored data is insufficient.
  • the first electronic signature device may be used to the second electronic signature device.
  • the prompt information may include: information that the second unit data packet of the corresponding currency denomination does not exist or the number of the data is insufficient, and the second electronic signature device may replace the currency denomination represented by the second electronic unit currency data packet according to the transaction amount.
  • a combination strategy with the number, or a combination strategy of the currency denomination and the number represented by the second electronic unit currency data packet by the first electronic signature device according to the transaction amount.
  • the first electronic signature device receives the transaction request of the second electronic signature device to transfer 10 yuan, and requests to send 5 second unit data packets representing 2 yuan (hereinafter referred to as 2 yuan data packets), but the first electronic signature device If there are only 4 binary data packets, the message is sent to the second electronic signature device with only 4 binary data packets and the number of 2 metadata packets is insufficient.
  • the second electronic signature device can replace the combination policy, for example, Returning, to the first electronic signature device, a response requesting to send 4 2-yuan data packets and 2 1--value data packets, or the first electronic signature device receiving the second electronic signature after transmitting the prompt information to the second electronic signature device
  • the acknowledgment response of the device the first electronic signature device may randomly determine a combination policy, for example, sending four 2-yuan data packets and two 1-yuan data packets to the second electronic signature device, thereby solving the first electronic One of the second unit data packets stored in the security chip of the signing device A problem with insufficient or non-existent.
  • the embodiment provides The method further includes: the first electronic signature device sends the information to be changed, and the second electronic signature device receives the information to be changed, wherein the information to be changed is determined by the first electronic signature device according to the transaction amount and the number stored in the security chip.
  • the currency denomination represented by the two-unit data packet determines, for example, the information to be changed may include a currency denomination that requires the second electronic signature device to return the change. If the second electronic signature device stores a second unit data packet representing the face value of the change coin currency, or the sum of the currency face values stored is equal to the second unit data packet for retrieving the change, the second electronic signature device may The first electronic signature device returns an acknowledgment response, that is, the first electronic signature device is notified that the second unit data packet for the change is stored, and the first electronic signature device receives the change information sent by the second electronic signature device (ie, returns a confirmation Correspondingly, the first electronic signature device acquires at least one second unit data packet from the security chip, wherein the sum of the currency denominations represented by the at least one second unit data packet is equal to the transaction amount plus the currency for retrieving the change face value.
  • the first electronic signature device cannot use the second unit data packet (hereinafter referred to as a 2-yuan data packet) respectively representing the denomination of the 2-yuan currency in the security chip of the first electronic signature device.
  • the five 2-yuan data packages piece together the 7-yuan currency denomination, and the first electronic signature device can only use the five 2-yuan data packets stored in the security chip to piece together the currency face value that is closest to the transaction amount of 7 yuan and larger than the transaction amount.
  • the first electronic signature device can use the four 2-yuan data packets to piece together the 8-yuan currency denomination, and the second electronic signature device needs to retrieve 1 dollar change, that is, the first electronic signature device sends 4 2-yuan data packets to the first electronic signature device.
  • the second electronic signature device needs to return a 1-yuan data packet (a second unit data packet representing a 1-yuan currency denomination) to the first electronic signature device.
  • the first electronic signature device sends, to the second electronic signature device, the information to be changed that carries the change of change of 1 yuan, wherein the information to be changed is used to ask whether the second electronic signature device can retrieve the sum of the currency values represented by the second electronic signature device.
  • the second unit packet is 1 yuan. If the security chip of the second electronic signature device stores the second unit data packet whose representative currency denomination sum is 1 yuan, sending the change information to the first electronic signature device, that is, agreeing to return the representative to the first electronic signature device The second unit data packet of 1 yuan or the sum of currency face values is 1 yuan. After receiving the change information, the first electronic signature device acquires four 2-yuan data packets from the security chip and sends them to the second electronic signature device, and the second electronic signature device returns to the first electronic signature device for 1 yuan. A packet (a second unit packet representing the face value of a currency). Therefore, when it is impossible to piece together the second unit data packet whose sum of the face value of the money represented is equal to the transaction amount, the electronic transaction can be completed through the zero change mechanism, making the electronic transaction more convenient.
  • the second unit data packet is confusing, and the uniqueness of the same second unit data packet in the payment process is ensured.
  • the manner in which the first electronic signature device sends the at least one second unit data packet to the second electronic signature device includes at least one of the following two types:
  • step S22 after the first electronic signature device transmits the at least one second unit data packet to the second electronic signature device, the first electronic signature device deletes the acquired at least one second unit data packet, because the first electronic signature
  • the device obtains the at least one second unit data packet according to the transaction amount and sends the data to the second electronic signature device the local device data packet that has been sent remains in the local device, and the deletion action is not automatically performed.
  • the transmitted Two unit data packets, and the status word of the corresponding storage space is set to be unoccupied.
  • the first electronic signature device can delete the saved second unit data packet stored by the first electronic signature device after the second unit data packet is saved, thereby ensuring that the first electronic signature device cannot be reused and cannot be restored.
  • the second unit data packet guarantees the uniqueness of the same second unit data packet in the payment process;
  • the second electronic signature device After receiving the at least one second unit data packet sent by the first electronic signature device, the second electronic signature device directly stores, because the first electronic signature device has deleted the at least one second unit data packet, The second unit data packet received by the second electronic signature device is unique, and duplicate data packets do not appear.
  • the at least one second unit data packet sent by the first electronic signature device to the second electronic signature device is in a cipher text form, that is, the first electronic signature device sends the at least one second unit data packet to the second electronic signature.
  • the device includes: the first electronic signature device encrypts the at least one second unit data, obtains at least one third unit data packet, and sends the at least one third unit data packet to the second electronic signature device; Receiving, by the signature device, the at least one second unit data packet sent by the first electronic signature device, the second electronic signature device receiving the at least one third unit data packet, and decrypting the at least one third unit data packet to obtain at least A second unit packet.
  • the second electronic signature device receives five third unit data packets representing two yuan from the first electronic signature device, and decrypts each third unit data packet representing two yuan to obtain five second units representing two yuan. data pack.
  • the at least one third unit data packet received by the second electronic signature device includes a data ciphertext, wherein the data ciphertext is encrypted by the first electronic signature device for some or all of the data in each second unit data packet. of.
  • the second unit data packet may include: second unit data, third signature data, fourth signature data, a data packet identifier, and a device identifier of the second electronic signature device, where the first electronic signature device Encrypting part of the data in the two unit data packet means that the first electronic signature device encrypts at least the second unit data in the second unit data packet, for example, the first electronic signature device may be in the second unit data packet.
  • the second unit data and the packet identifier are encrypted.
  • the encryption operation performed by the first electronic signature device on some or all of the data in each second unit data packet is an irreversible operation, that is, the first electronic signature device can encrypt the third unit data packet, but cannot Decrypting the third unit data packet from the third unit data packet, so that when the obtained at least one third unit data packet covers the corresponding at least one second unit data packet, only the encrypted content is stored in the first electronic signature device
  • the third unit data packet cannot recover the second unit data packet because it cannot decrypt the third unit data packet, and the second unit data packet cannot be reused.
  • the first electronic signature device encrypts the at least one second unit data, including: the first electronic signature device uses the public key of the second electronic signature device for at least each second unit Encrypting the second unit data in the data packet to obtain the data ciphertext; the second electronic signature device decrypting the at least one third unit data packet, including: the second electronic signature device using the private key of the second electronic signature device, at least for each The data ciphertext in the third unit data packet is decrypted.
  • the first electronic signature device encrypts the at least one second unit data packet, including: the first electronic signature device utilizes a symmetric key associated with the second electronic signature device, at least for each The second unit data in the two unit data packet is encrypted to obtain the data ciphertext; the second electronic signature device decrypts the at least one third unit data packet, including: the second electronic signature device uses the first electronic signature device The symmetric key decrypts at least the data ciphertext in each third unit data packet.
  • the second electronic signature device may further include a public key of the second electronic signature device in the transaction request sent to the first electronic signature device, or the first electronic signature device may authenticate the platform to the third party.
  • the first electronic signature device can acquire the public key of the second electronic signature device.
  • the method provided by the embodiment further includes: the first electronic signature device overwrites each second stored in the security chip with each third unit data packet.
  • Unit data packet covering each second unit data packet stored in the security chip with each third unit data packet means that the first electronic signature device writes each generated third unit data packet into a corresponding original
  • the storage space of the two-unit data packet replaces the original second unit data packet.
  • the second unit data packet with the data packet identified as 1*** is encrypted to generate a third unit data packet, and is written into the storage space corresponding to the 1***.
  • the security chip of the first electronic signature device stores only the second electronic signature device for the second unit data packet that has been sent to the second electronic signature device.
  • the third unit data packet obtained by the public key is encrypted, and the first electronic signature device cannot have the private key of the second electronic signature device, so the first electronic signature device cannot decrypt the third unit data packet.
  • the second unit data packet cannot be recovered, and the second unit data packet cannot be reused, the uniqueness of the same second unit data packet is guaranteed, and the third unit data packet is utilized by the second electronic signature device.
  • the public key is encrypted, so the third unit data packet can only be decrypted by the second electronic signature device (only the second electronic signature device stores its own private key), so that only the payee (ie, the second electronic signature device) Can have and can use the unencrypted second unit data packet, even if other electronic signature devices illegally obtain the third unit data packet, because there is no
  • the private key of the second electronic signature device cannot be decrypted and the acquired second unit data packet cannot be used, thereby ensuring the security of the second unit data packet circulation.
  • the symmetric key is negotiated by the first electronic signature device and the second electronic signature device, that is, the symmetric key used by the first electronic signature device in performing the encryption operation and the second The symmetric key used by the electronic signature device to perform the decryption operation is the same.
  • the method provided by the embodiment further includes: the first electronic signature device overwrites each second stored in the security chip with each third unit data packet. Unit the packet and delete the symmetric key.
  • covering each second unit data packet stored in the security chip with each third unit data packet means that the first electronic signature device writes each generated third unit data packet into a corresponding original The storage space of the two-unit data packet replaces the original second unit data packet.
  • the second unit data packet with the data packet identified as 1*** is encrypted to generate a third unit data packet, and is written into the storage space corresponding to the 1***.
  • the third unit data packet can be decrypted and restored to the second unit data packet.
  • the symmetric key must be forcibly deleted, whereby the first electronic signature device sends the second unit data packet after the second unit data packet payment Giving a second unit data packet of the second electronic signature device, the security chip of the first electronic signature device storing only the corresponding third unit data packet obtained by the second electronic signature device using the symmetric key encryption, and The signature device has deleted the symmetric key used for encryption. Therefore, the first electronic signature device can no longer decrypt the third unit data packet, and cannot recover the second unit data packet, and the second unit cannot be reused.
  • the unit data packet guarantees the uniqueness of the same second unit data packet, and the symmetric key has only the first electronic signature And the second electronic signature device knows that, therefore, the third unit data packet can only be decrypted by the second electronic signature device, so that only the payee (ie, the second electronic signature device) can own and can use the unencrypted second Unit data packet, even if the other electronic signature device illegally acquires the third unit data packet, the second unit data packet cannot be obtained by decryption without the symmetric key, thereby ensuring the security of the second unit data packet circulation. Sex.
  • the symmetric key may be an exclusive OR factor
  • the exclusive OR factor may be a set of characters or numbers negotiated by the second electronic signature device and the first electronic signature device.
  • a sequence for performing an exclusive OR operation specifically, the first electronic signature device encrypts at least the second unit data in each second unit data packet by using a symmetric key associated with the second electronic signature device to obtain data
  • the ciphertext includes: the first electronic signature device uses an exclusive OR factor to perform an exclusive OR operation on the second unit data in each second unit data packet to obtain a data ciphertext; and the second electronic signature device utilizes the first electronic signature
  • the symmetric key associated with the device decrypts at least the data ciphertext in each second unit data packet, including: the second electronic signature device uses the XOR factor to perform at least the data ciphertext in each third unit data packet.
  • the XOR operation also belongs to a symmetric decryption operation mode, but the XOR operation is faster than other symmetric decryption operations. Therefore, the second electronic signature device can be modified to decrypt the third unit data packet. The efficiency of two unit packets.
  • step S22 at least the above manners can be prevented to prevent the electronic signature device from illegally reusing the same second unit data packet, thereby causing confusion in the circulation of the second unit data packet, and ensuring the same second unit data packet.
  • Uniqueness in the payment process is not exclude other embodiments as long as the same technical effects can be achieved.
  • the third unit data packet is ciphertext, which ensures the security of the transmitted data, and even if intercepted by other devices, it is difficult to crack, further improving the security of the second unit data packet circulation.
  • the confirmation of the holding user of the first electronic signature device is also required to perform the subsequent transaction operation, which is optional in this embodiment.
  • the transaction request sent by the second electronic signature device includes at least: a device identifier of the second electronic signature device.
  • the first electronic signature device prompts the holding user for the transaction amount and the device identifier of the second electronic signature device, and receives the Hold the user's confirmation message.
  • the device identifier of the second electronic signature device may be a factory serial number of the second electronic signature device, or may be a device name of the second electronic signature device, or may be a second
  • the electronic signature device holds the name of the user.
  • the holding user of the first electronic signature device can confirm whether the second electronic signature device is a transaction object agreed by the user, and the user selects to confirm the transaction only after the user approves the transaction amount and the transaction object.
  • the security of the transaction is guaranteed by the user's confirmation of the transaction.
  • the first electronic signature device is provided with a display screen or a speaker, and displays the transaction amount and the device identifier of the second electronic signature device through the display screen set by itself or through the speaker voice set by itself; or The first electronic signature device establishes a connection with the external device, and prompts the holding user with the transaction amount and the device identifier of the second electronic signature device through the display screen or the speaker of the external device. This makes it easy for the user to confirm the payment amount and whether the payee is correct.
  • the first electronic signature device may be provided with a confirmation button, and the user confirms by using the confirmation button.
  • the confirmation information input component may be further disposed on the first electronic signature device, and the confirmation information input component may specifically include: a PIN code input keyboard or a fingerprint input component. Therefore, the user can input the confirmation information by inputting the PIN code or the fingerprint, and while confirming the related information of the electronic transaction, the first electronic signature device can also verify the identity of the holding user, thereby further improving the electronic transaction. safety.
  • Step S23 The second electronic signature device receives the at least one second unit data packet, and verifies the third signature data in the at least one second unit data packet, and after the verification is passed, the at least one second unit data packet is Stored in a security chip.
  • the second electronic signature device is provided with a security chip, and the security chip has an independent processor and a storage list therein.
  • the device can store the PKI digital certificate and the key, and other feature data, and perform encryption and decryption operations on the data to provide the user with data encryption and identity security authentication services.
  • the second electronic signature device can be used from the first electronic device.
  • the second unit data packet received by the signature device or from another back-end server (such as a third-party server such as a bank server or a shopping mall recharge server) is stored in the security chip, because the data in the storage unit of the security chip cannot be illegally read. This ensures the security of the data stored in the storage unit.
  • the method provided in this embodiment further includes: the security chip allocation of the second electronic signature device is used to store the at least one The storage space of the second unit packet.
  • storing the at least one second unit data packet in the security chip in step S23 specifically: storing the at least one second unit data packet in a corresponding storage space, and corresponding storage space The status word is set to be occupied.
  • the security chip allocates one storage space for each second unit data packet, one storage space can only store one second unit data packet, and the transaction record of the second electronic signature device also records a transaction from other electronic The location of the storage space stored by each of the second unit data packets received by the signature device.
  • the status word of the storage space is used to identify whether the storage space is already occupied, and if it is already occupied, the second electronic signature device cannot store the second unit data packet in the occupied storage space.
  • the second electronic signature device needs to perform an operation of requesting the background server to update the data packet or apply for a new storage space, wherein, as an optional implementation, the second electronic The signing device can request a new storage space to store the newly received second unit data packet.
  • the second electronic signature device may further request to update the locally stored second unit data packet to the background server.
  • the second electronic signature device may request the background server to store the locally stored N (N).
  • the second unit data packet representing the facet value is replaced by one or M (M ⁇ N) second unit data packets representing the face value of the large currency, as long as the stored currency amount is unchanged.
  • M (M ⁇ N) second unit data packets representing the face value of the large currency
  • the second electronic signature device may further encrypt each second unit data packet to obtain ciphertext data of each second unit data packet, and each will be The ciphertext data is stored in the corresponding storage space.
  • the second electronic signature device verifies the third signature data, and after the verification is passed, the at least one second The unit data packet is stored in the security chip.
  • the third signature data is obtained by the server signing the second unit data, and each second unit data packet includes at least: the second unit data and the third signature data obtained by the server for signing the second unit data, thereby The second electronic signature device can verify the authenticity of the second unit data packet.
  • the third signature data is signature data obtained by the server by using the private key of the server to sign the second unit data.
  • the verifying the third signature data by the second electronic signature device comprises: the second electronic signature device performing the verification of the third signature data by using the public key of the server. Therefore, the second electronic signature device uses the public key of the bank to perform the verification of the third signature data carried in the second unit data packet, so that the authenticity of the second unit data packet can be verified.
  • the second electronic signature device further confirms whether the received second unit data packet is sent by the first first electronic signature device and is first, on the premise of ensuring that the received second unit data packet is authentic. Whether the object sent by the electronic signature device is indeed the second electronic signature device itself to avoid storing the data packet that is sent by the first electronic signature device, and the second electronic signature device in step S23 performs the at least one second unit data packet.
  • the transaction method further includes: the second electronic signature device verifies the fourth signature data, and after performing the verification, executing the step of storing the at least one second unit data packet The steps stored in the security chip.
  • the fourth signature data is obtained by the first electronic signature device signing the second unit data and the device identifier of the second electronic signature device.
  • the second electronic signature device The transaction request sent to the first electronic signature device further includes: a device identifier of the second electronic signature device; each second unit data packet sent by the first electronic signature device to the second electronic signature device includes: at least: second unit data And obtaining, by the first electronic signature device, the fourth signature data obtained by signing the second unit data and the device identifier of the second electronic signature device, thereby enabling the second electronic signature device to verify the authenticity and correctness of the second unit data packet.
  • the fourth signature data is signature data obtained by the first electronic signature device by using the private key of the first electronic unit to sign the device identifier of the second unit data and the second electronic signature device, that is, each The signature object of the fourth signature data is a combination of each of the second unit data and the device identifier of the second electronic signature device.
  • the verifying, by the second electronic signature device, the fourth signature data comprises: performing, by the second electronic signature device, each fourth signature data by using a public key of the first electronic signature device.
  • the second electronic signature device may acquire the digital certificate of the first electronic signature device from the first electronic signature device, and obtain the public key of the first electronic signature device from the digital certificate.
  • the second electronic signature device may also pre-store the digital certificate of the first electronic signature device and the other electronic signature device, and obtain the device identifier of the first electronic signature device from the first electronic signature device, and obtain the first pre-stored according to the device identifier.
  • the second unit data packet further includes: a data packet identifier.
  • the transaction request sent by the second electronic signature device to the first electronic signature device further includes: a data packet identifier.
  • the first electronic signature device may add the data packet identifier in the transaction request to one of the first Two unit data packets or one third unit data packet and sent to the second electronic signature device; the first electronic signature device sends at least one second unit data packet or the third unit data packet together to the second electronic signature
  • the first electronic signature device may add the data packet identifier in the transaction request to all the second unit data packets or the third unit data packet corresponding to the transaction amount and send it to the second electronic signature device, specifically The first electronic signature device adds the corresponding data packet identifier to the second unit data packet, and then sends the second unit data packet or the third unit data packet generated by the second unit data packet to the second
  • the second electronic signature device storing the at least one second unit data packet in the security chip in the step S23 includes: the second electronic signature device Determining whether the data packet identifier in the received second unit data packet is the same as the data packet identifier in the sent transaction request, and if not, the second electronic signature device discards the second unit data packet with different data packet identifiers If they are the same, the second electronic signature device stores the second unit data packet with the same data packet identifier in the security chip.
  • the second electronic signature device can check whether the received second unit data packet (ie, the second unit data packet obtained after decrypting the third unit data packet) is the playback data, and because the data packet The identifier is allocated by the second electronic signature device, so the second electronic signature device can determine whether the second unit data packet corresponding to the entire data packet identifier has been received, which is convenient for determining whether to initiate the retransmission request in the subsequent step.
  • the first electronic signature device obtains the data packet identifier from the second electronic signature device before transmitting the second unit data packet.
  • the second electronic signature device may check whether the received data packet identifier carried in the second unit data packet is a random number R1, and if yes, consider that the received second unit data packet is legal; otherwise, the received If the two-unit data packet is for playback data, the data is discarded. Thereby, it is possible to prevent the second electronic signature device from being attacked by the playback.
  • the transaction request sent by the second electronic signature device to the first electronic signature device further includes: a data packet identifier start value.
  • the second electronic signature device is provided with a counter.
  • the method provided by the embodiment further includes: the second electronic signature device uses the counter value of the counter to obtain The data packet identifier start value, that is, the value of the counter is the packet identifier start value, and the data packet identifier start value is obtained according to the number of data packets received by the second electronic signature device each time;
  • the method provided by the embodiment further includes: the counter of the second electronic signature device calculates the data packet identifier start value plus the total number of the received second unit data packet to obtain a new data packet identifier.
  • the second electronic signature device can calculate and update the packet identification start value.
  • the first electronic signature device may identify the data packet identifier corresponding to each second unit data packet according to the data packet identifier starting value and according to the total number of second unit data packets to be sent to the second electronic signature device.
  • the second electronic signature device in step S23 stores the at least one second unit data packet in the security chip, including: the second electronic signature.
  • the device determines whether the data packet identifier included in each second unit data packet satisfies a preset range determined according to the start value of the data packet identifier, and if not, the second electronic signature device determines that the data packet identifier does not satisfy the preset range.
  • the second unit data packet is discarded. If yes, the second electronic signature device stores the second unit data packet whose data packet identifier meets the preset range in the security chip.
  • the identifier of the data packet included in each second unit data packet should be not less than the start value of the data packet identifier, otherwise
  • the incremental counter means that each time a second unit data packet is received by the second electronic signature device, the counter value of the counter is incremented by one.
  • the first electronic signature device needs to send three second unit data packets to the second electronic signature device, and the three second unit data packets respectively represent the currency face value of 1 yuan, 2 yuan, and 5 yuan.
  • the data packet identification starting value obtained by the first electronic signature device from the second electronic signature device is 30, and the data packet identification start value may be the number of current data packets obtained by the counter counting of the second electronic signature device plus one.
  • the second electronic signature device stores a total of 29 second unit data packets, and the packet identification of the 29 second unit data packets can be from 1 to 29, then, the received A data packet can be identified from 30, and the first electronic signature device calculates based on the packet identifier start value 30: the data packet identifier corresponding to the second unit data packet representing the 1-yuan currency denomination is 30, representing 2 The data packet identifier corresponding to the second unit data packet of the face value of the currency currency is 31, and the data packet identifier corresponding to the second unit data packet representing the face value of the three currency currency is 32.
  • the second electronic signature device is receiving After the three second unit data packets are stored, the associated data is stored according to the corresponding data packet identifier, and the original data packet identifier starting value 30 plus 3 is calculated to obtain a new data packet identifier start. 33. Therefore, the first electronic signature device only needs to acquire a data packet identifier starting value from the second electronic signature device, and can flexibly calculate each according to the number of second unit data packets to be sent to the second electronic signature device. The packet identifier corresponding to the second unit data packet. The second electronic signature device determines that the received data identifier of the three second unit data packets is not less than the data packet identifier start value 30, and stores the received three second unit data packets in the security chip.
  • the second electronic signature device can determine, according to the data packet identifier, whether the received second unit data packet is playback data, thereby preventing the second electronic signature device from being Replay attack.
  • the method provided in this embodiment further includes: The second electronic signature device calculates the sum of the currency face values represented by the received second unit data packet and the transaction request according to the received number of the second unit data packets and the currency face value represented by each second unit data packet.
  • the first electronic signature device receives the retransmission request, and sends the retransmission information to the second electronic signature device according to the retransmission request, wherein And the retransmission request includes at least a device identifier of the second electronic signature device and/or a data packet identifier corresponding to each second unit data packet, so that the first electronic signature device can determine retransmission information according to the retransmission request,
  • the sending information is selected by the first electronic signature device from a third unit data packet corresponding to a transaction of the second electronic signature device. All or part of the data packet to ensure that the second electronic signature device gets all the second unit data packets of a transaction.
  • the second electronic signature device receives the retransmission information sent by the first electronic signature device according to the retransmission request, where the retransmission information includes at least one second unit data packet.
  • the second electronic signature device deletes at least one second unit data packet previously stored in the security chip, and re-stores at least one second unit data packet retransmitted by the first electronic signature device.
  • the second electronic signature device receives the retransmission information sent by the first electronic signature device according to the retransmission request, where the retransmission information includes the second unit data that is not received by the second electronic signature device. package.
  • the second electronic signature device stores the unreceived second unit data packet in the security chip.
  • the second unit data packet in the retransmission information can be understood as a cipher text form, that is, the third unit data packet obtained by the first electronic signature device for encrypting the second unit data packet, and therefore, in an optional manner
  • the third unit data packet is actually included in the retransmission information, and the second electronic signature device receives the retransmission information (the third unit data packet) sent by the first electronic signature device, and then the third unit data.
  • the packet decryption gets the second unit packet re-storage.
  • the resend request of the second electronic signature device includes at least the device identifier of the second electronic signature device
  • the retransmission information of the first electronic signature device includes at least one second unit data packet, that is, a transaction that resends a transaction. All the second unit data packets corresponding to the amount, as an optional manner, the first electronic signature device may send the at least one second unit data packet to the second electronic signature device in cipher text, that is, at least one third The unit data packet is sent to the second electronic signature device.
  • the retransmission information herein includes at least one third unit data packet, and the second electronic signature device deletes at least one second unit data packet previously stored in the security chip.
  • the method includes: a packet identifier of the second unit data packet that is not received, and may further include: a device identifier of the second electronic signature device
  • the retransmission information of the first electronic signature device includes a second unit data packet that is not received by the second electronic signature device, that is, a second unit data packet indicated by the data packet identifier in the retransmission request, as an optional manner,
  • An electronic signature device may send the second unit data packet indicated by the data packet identifier to the second electronic signature device in a cipher text format, that is, the third unit data packet indicated by the data packet identifier is sent to the second electronic signature device, where It is understood that the retransmission information herein includes a third unit data packet indicated by the data packet identifier, and the second electronic signature device stores the second unit data packet obtained
  • the transaction amount in the transaction request of the second electronic signature device is 10 yuan
  • the first electronic signature device is to the second electronic signature device.
  • the second electronic signature device sends a retransmission request to the first electronic signature device, where the retransmission request carries at least the device identifier of the second electronic signature device, and the first electronic signature device receives the second electronic signature device.
  • the transaction for the second electronic signature device may query all corresponding third unit data packets, and carry the 5 third unit data packets in the retransmission information and send to the second electronic signature device. That is, the second unit data packet respectively representing the denomination of the 2-yuan currency is carried in the form of ciphertext and the retransmission information is transmitted to the second electronic signature device.
  • the second electronic signature device decrypts the five third unit data packets carried in the retransmission information to obtain five corresponding second unit data packets, and stores the four previously stored in the security chip.
  • the second unit data packet representing the denomination of the 2-yuan currency is deleted, and the 5 second unit data packets obtained by the decryption are re-stored.
  • the second electronic signature device has the function of transmitting a retransmission request to the first electronic signature device when all second unit data packets required for the electronic transaction are not received, the first electronic signature device having the response second electronic signature device The function of resending, thereby ensuring that the second electronic signature device can receive all the second unit data packets required for the electronic transaction, and ensure that the transaction can be successfully completed.
  • the transaction amount in the transaction request of the second electronic signature device is 5 yuan
  • the second electronic signature device receives the first electronic signature
  • the second unit data packet (referred to as a 2-ary data packet) representing the denomination of the 2-yuan currency
  • the second unit data packet (referred to as the 1-ary data packet) representing the denomination of the 1-yuan currency, respectively, but transmitted by the device In the process, the data is lost.
  • the second electronic signature device only receives two 2-yuan data packets, and the sum of the currency face values is 4 yuan, which is not equal to the transaction amount of 5 yuan.
  • the second electronic signature device sends a retransmission request to the first electronic signature device, where the retransmission request carries at least the device identifier of the second electronic signature device and the data packet identifier of the unreceived data packet (ie, a data packet identifier of the 1st data packet or a data packet identifier of the received 2 metadata packet, after the first electronic signature device receives the retransmission request sent by the second electronic signature device, the second electronic signature device
  • the pen transaction may query the corresponding third unit data packet according to the data packet identifier of the 1 yuan data packet, or determine the corresponding data packet identifier of the untransferred 1 metadata packet according to the data packet identifier of the 4 binary data packets.
  • the third unit data packet carries the third unit data packet corresponding to the one-dimensional data packet identifier, and the retransmission information is sent to the second electronic signature device, that is, the second unit data packet corresponding to the data packet identifier is carried in the form of ciphertext.
  • the sending information is sent to the second electronic signature device.
  • the second electronic signature device decrypts the third unit data packet corresponding to the one-dimensional data packet identifier carried in the retransmission information, and obtains a second unit data packet corresponding to the one-dimensional data packet identifier, and the The second unit data packet corresponding to the one-dimensional data packet identifier is stored in the security chip.
  • the second electronic signature device has a function of transmitting a retransmission request to the first electronic signature device when all second unit data packets required for the electronic transaction are not received, and receiving a second retransmission by the first electronic signature device
  • the second unit data packet not received by the electronic signature device reduces the transmission amount of the retransmitted data, and ensures that the second electronic signature device can receive all the second unit data packets required for the electronic transaction.
  • the security chip of the first electronic signature device allocates a storage space for storing at least one third unit data packet (or a second unit data packet), and at least one third unit The data packet is stored in the corresponding storage space.
  • the storage space of the security chip may store at least one second unit data packet, so that the first electronic signature device obtains the second unit data packet required for the transaction amount from the security chip after receiving the transaction request of the second electronic signature device.
  • the at least one third unit data packet is stored in the corresponding In the storage space.
  • the first electronic signature device After the first electronic signature device sends the retransmission information to the second electronic signature device according to the retransmission request, the first electronic signature device receives the confirmation information that the second electronic signature device returns the success of the reception, and the first electronic signature device will The status word storing the storage space of the at least one third unit data packet is modified to complete the transaction, or the storage space is cleared, and the status word of the corresponding storage space is modified to be unoccupied. Among them, the status word is the storage space where the transaction is completed, and can be overwritten by new data. Thereby, the first electronic signature device confirms the second electronic signature After receiving all the second unit data packets required for the electronic transaction, the name device can clear the storage space of the security chip, so as to release more storage space and ensure the subsequent transactions proceed smoothly.
  • each transaction in a plurality of transactions can be implemented in the above manner.
  • the storage space of the second electronic signature device is limited, and therefore, the remaining space of the second electronic signature device needs to be monitored at any time, so as to release the storage space in an instant, and avoid unnecessary transactions in the transaction process.
  • the remaining storage space of the second electronic signature device may also be monitored in real time by using a counter in the second electronic signature device. Specifically, after each transaction ends, that is, after step S23, the second electronic signature device uses the count value of the counter to obtain the total number of currently stored second unit data packets. Specifically, in each transaction, the counter adds the number of second unit data packets received by the transaction.
  • each storage space has the same size
  • each second unit data packet has the same size and matches the size of the storage space, for example, the second electronic signature device allocates storage for a second unit data packet.
  • the size of the space is 2M
  • the 2M storage space can store a second unit data packet
  • the space reserved by a security chip for storing the second unit data packet is 1G
  • the second electronic signature device can store up to 512
  • the two-unit data packet that is, the preset value can be set to 512.
  • the second electronic signature device can also use the count value of the counter to obtain the total number of second unit data packets of each currency denomination stored in the security chip.
  • the second electronic signature device can obtain the total amount of money of the currently stored second unit data packet according to the currency face value and the number of the money represented by each stored second unit data packet.
  • the first electronic signature device after transmitting the at least one second unit data packet to the second electronic signature device, the first electronic signature device subtracts the transaction amount from the account amount to obtain the current account balance, and Displaying the transaction amount and/or the current account balance to the holding user; after storing the at least one second unit data packet in the security chip, the second electronic signature device adds the current account amount to the transaction amount to obtain the current account balance, Display the transaction amount and/or current account balance to the holding user.
  • the user holding the electronic signature device can query the transaction amount and the current account balance on his own device.
  • the user's funds are stored in the first electronic signature device or the second electronic signature device in the form of at least one second unit data packet.
  • the payee user the second electronic signature device side
  • the second electronic signature device since the funds are no longer stored in the second electronic signature device in the form of numerical values, the second electronic signature device does not need to be changed by the server.
  • the second electronic signature device of the payee user only needs to receive a certain number of second unit data packets from the first electronic signature device of the payer user, whereby the electronic signature device is signed with other electronic
  • the device conducts electronic transactions, it no longer needs to rely on the server for online payment, and the server does not need to supervise the electronic signature device of the payee user or the payer user, thereby realizing offline electronic transactions.
  • the second electronic signature device may receive the third unit data packet in the cipher text form from the first electronic signature device, further improving the security of the electronic transaction; further, adding the data packet identifier and the second in the second unit data packet
  • the device identifier of the electronic signature device can effectively prevent the second electronic signature device from being attacked by the playback, and can facilitate the first electronic signature device to determine the retransmission information.
  • portions of the invention may be implemented in hardware, software, firmware or a combination thereof.
  • multiple steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system.
  • a suitable instruction execution system For example, if implemented in hardware, as in another embodiment, it can be implemented by any one or combination of the following techniques well known in the art: having logic gates for implementing logic functions on data signals. Discrete logic circuits, application specific integrated circuits with suitable combinational logic gates, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc.
  • each functional unit in each embodiment of the present invention may be integrated into one processing module, or each unit may exist physically separately, or two or more units may be integrated into one module.
  • the above integrated modules can be implemented in the form of hardware or in the form of software functional modules.
  • the integrated modules, if implemented in the form of software functional modules and sold or used as stand-alone products, may also be stored in a computer readable storage medium.
  • the above mentioned storage medium may be a read only memory, a magnetic disk or an optical disk or the like.

Abstract

An electronic signature device transaction method, comprising: an electronic signature device sending a transaction request to a server, wherein the transaction request at least comprises a transaction amount (S11); the server receiving the transaction request, deducting the transaction amount from a band account of the electronic signature device, acquiring at least one first unit data packet, and sending the at least one first unit data packet to the electronic signature device (S12), wherein each first unit data packet represents one currency denomination among a plurality of currency denominations, and the sum of the currency denominations represented by the at least one first unit data packet is equal to the transaction amount; and the electronic signature device receiving the at least one first unit data packet, and storing the at least one first unit data packet in a secure chip (S13). By means of the present solution, off-line electronic transaction can be realized.

Description

电子签名设备的交易方法Electronic signature device transaction method
相关申请的交叉引用Cross-reference to related applications
本申请基于申请号为201610178325.8,申请日为2016年3月25日的中国专利申请,以及申请号为201610178067.3,申请日为2016年3月25日的中国专利申请,并要求上述中国专利申请的优先权,上述中国专利申请的全部内容在此引入本申请作为参考。This application is based on the Chinese patent application with the application number of 201610178325.8, the application date is March 25, 2016, and the application number is 201610178067.3, and the application date is March 25, 2016, and the priority of the above-mentioned Chinese patent application is required. The entire disclosure of the above-identified Chinese patent application is incorporated herein by reference.
技术领域Technical field
本发明涉及一种电子技术领域,尤其涉及电子签名设备的交易方法。The invention relates to the field of electronic technology, and in particular to a method for trading an electronic signature device.
背景技术Background technique
现有的电子交易中,用户的资金以数字的形式存在账户中,例如:用户持有100元的资金,该资金以数字的形式存储于银行服务器的用户账户中,当用户消费了10元以后,银行服务器需要将用户账户中的资金100改写为90,以完成账户的清算。为了保证资金数值的安全,在银行服务器改写数值后,要对改写后的资金数值90进行签名。因为用户每次进行交易后账户中的金额数值都会发生变动,所以银行服务器要针对每次变动后的数值进行处理。也就是说,现有的电子交易要依托于银行服务器,用户进行的电子交易需要与银行服务器进行实时同步,不能实现在不联网的情况下独立完成多笔线下交易。In the existing electronic transaction, the user's funds are stored in the account in the form of numbers. For example, the user holds 100 yuan of funds, and the funds are stored in the user account of the bank server in the form of numbers. When the user consumes 10 yuan, The bank server needs to rewrite the funds 100 in the user account to 90 to complete the account clearing. In order to ensure the security of the fund value, after the bank server rewrites the value, the rewritten fund value 90 is signed. Because the value of the amount in the account changes every time the user makes a transaction, the bank server will process the value after each change. That is to say, the existing electronic transactions must rely on the bank server, and the electronic transactions performed by the users need to be synchronized with the bank server in real time, and it is impossible to independently complete multiple offline transactions without being connected to the Internet.
发明内容Summary of the invention
本发明旨在至少解决上述问题之一。The present invention aims to solve at least one of the above problems.
本发明的主要目的在于提供一种电子签名设备的交易方法。The main object of the present invention is to provide a method of trading an electronic signature device.
本发明的另一目的在于提供另一种电子设备的交易方法。Another object of the present invention is to provide a method of trading another electronic device.
为达到上述目的,本发明的技术方案具体是这样实现的:In order to achieve the above object, the technical solution of the present invention is specifically implemented as follows:
方案1、一种电子签名设备的交易方法,包括:电子签名设备将交易请求发送至服务器,其中,交易请求至少包括:交易金额;服务器接收交易请求,在电子签名设备的银行账户扣除交易金额,获取至少一个第一单位数据包,并将至少一个第一单位数据包发送至电子签名设备;其中,每个第一单位数据包代表多种货币面值中的一种货币面值,每个第一单位数据包至少包括:第一单位数据、服务器对第一单位数据签名得到的第一签名数据,至少一个第一单位数据包所代表的货币面值的总和等于交易金额;电子签名设备接收至少一个第一单位数据包,对至少一个第一单位数据包中的第一签名数据进行验证,在验证通过后,将至少一个第一单位数据包存储于安全芯片中。A transaction method of an electronic signature device, comprising: an electronic signature device transmitting a transaction request to a server, wherein the transaction request includes at least: a transaction amount; the server receives the transaction request, and deducts the transaction amount from the bank account of the electronic signature device, Obtaining at least one first unit data packet, and transmitting at least one first unit data packet to the electronic signature device; wherein each first unit data packet represents one of a plurality of currency denominations, each first unit The data packet includes at least: the first unit data, the first signature data obtained by the server signing the first unit data, the sum of the currency denominations represented by the at least one first unit data packet is equal to the transaction amount; and the electronic signature device receives the at least one first And a unit data packet, where the first signature data in the at least one first unit data packet is verified, and after the verification is passed, the at least one first unit data packet is stored in the security chip.
方案2、根据方案1的交易方法,交易请求中还包括:电子签名设备的设备标识;每个第一单位数据包还包括:服务器对第一单位数据和电子签名设备的设备标识签名得到的第二签名数据;在电子签名设备将至少一个第一单位数据包存储于 安全芯片中之前,方法还包括:电子签名设备对第二签名数据进行验证,在验证通过后执行电子签名设备将至少一个第一单位数据包存储于安全芯片中的步骤。According to the transaction method of the solution 1, the transaction request further includes: a device identifier of the electronic signature device; each first unit data packet further includes: a server obtained by signing the first unit data and the device identifier of the electronic signature device Two signature data; at least one first unit data packet is stored in the electronic signature device Before the security chip, the method further comprises: the electronic signature device verifying the second signature data, and performing the step of storing the at least one first unit data packet in the security chip after the verification is passed.
方案3、根据方案1或2的交易方法,在电子签名设备将至少一个第一单位数据包存储于安全芯片中之后,方法还包括:电子签名设备根据接收到的至少一个第一单位数据包的个数以及每个第一单位数据包所代表的货币面值计算接收到的第一单位数据包所代表的货币面值的总和与交易请求中的交易金额是否一致,如果不一致,则向服务器发送重发请求;服务器接收重发请求。The method of claim 1 or 2, after the electronic signature device stores the at least one first unit data packet in the security chip, the method further comprises: the electronic signature device according to the received at least one first unit data packet The number and the currency denomination represented by each first unit data packet calculate whether the sum of the currency face values represented by the received first unit data packet is consistent with the transaction amount in the transaction request, and if not, send a retransmission to the server. Request; the server receives a resend request.
方案4、根据方案3的交易方法,在服务器接收重发请求之后,方法还包括:服务器根据重发请求向电子签名设备发送重发信息,其中,重发信息包括至少一个第一单位数据包;电子签名设备接收重发信息,将之前存储于安全芯片中的至少一个第一单位数据包删除,并重新存储服务器重发的至少一个第一单位数据包。The method of claim 3, after the server receives the resend request, the method further includes: the server sending the retransmission information to the electronic signature device according to the retransmission request, wherein the retransmission information includes at least one first unit data packet; The electronic signature device receives the retransmission information, deletes at least one first unit data packet previously stored in the security chip, and re-stores at least one first unit data packet retransmitted by the server.
方案5、根据方案3的交易方法,在服务器接收重发请求之后,方法还包括:服务器根据重发请求向电子签名设备发送重发信息,其中,重发信息包括电子签名设备未接收到的第一单位数据包;电子签名设备将未接收到的第一单位数据包存储于安全芯片中。The method of claim 3, after the server receives the resend request, the method further includes: the server sending the retransmission information to the electronic signature device according to the retransmission request, where the retransmission information includes the first unreceived by the electronic signature device One unit data packet; the electronic signature device stores the unreceived first unit data packet in the security chip.
方案6、根据方案1至5任一项的交易方法,在电子签名设备将至少一个第一单位数据包存储于安全芯片中之前,方法还包括:电子签名设备利用其安全芯片分配用于存储至少一个第一单位数据包的存储空间;电子签名设备将至少一个第一单位数据包存储于安全芯片中,包括:电子签名设备将至少一个第一单位数据包存储于对应的存储空间中,并将对应的存储空间的状态字置为已占用。Item 6. The transaction method of any one of clauses 1 to 5, before the electronic signature device stores the at least one first unit data packet in the security chip, the method further comprising: the electronic signature device utilizing its security chip allocation for storing at least a storage space of the first unit data packet; the electronic signature device stores the at least one first unit data packet in the security chip, including: the electronic signature device stores the at least one first unit data packet in the corresponding storage space, and The status word of the corresponding storage space is set to be occupied.
方案7、根据方案1至6任一项的交易方法,在电子签名设备将至少一个第一单位数据包存储于安全芯片中之后,方法还包括:电子签名设备利用计数器的计数值得到当前存储的第一单位数据包的总个数。The transaction method according to any one of claims 1 to 6, after the electronic signature device stores the at least one first unit data packet in the security chip, the method further comprises: the electronic signature device using the counter value of the counter to obtain the currently stored The total number of first unit packets.
方案8、根据方案1至7任一项的交易方法,在电子签名设备将至少一个第一单位数据包存储于安全芯片中之后,方法还包括:电子签名设备将交易金额计入当前账户余额,向持有用户显示交易金额和/或当前账户余额。Item 8. The transaction method according to any one of claims 1 to 7, after the electronic signature device stores the at least one first unit data packet in the security chip, the method further comprises: the electronic signature device counting the transaction amount into the current account balance, Display the transaction amount and/or current account balance to the holding user.
方案9、根据方案1至8任一项的交易方法,第一单位数据至少包括:货币面值数据,或者,货币序号和货币面值数据;第一单位数据包至少还包括以下之一:发行银行标识和银行证书序号。Item 9. The transaction method according to any one of the items 1 to 8, the first unit data includes at least: currency denomination data, or currency serial number and currency denomination data; the first unit data packet further includes at least one of the following: issuing bank identifier And the bank certificate serial number.
采用上述电子签名设备的交易方法,可以将用户的资金以数据包的形式存储于用户的电子签名设备中,且数据包的个数为一个或多个。用户在消费时,因为资金不再是以数值的形式存储于电子签名设备中,所以电子签名设备不需要通过与服务器联网来更改存储的数值,仅需将符合消费金额的一个或多个第一单位数据包发送给收款方即可,由此,电子签名设备在与其他电子签名设备进行电子交易时不再需要依托服务器进行联网支付,服务器不再需要对电子签名设备进行监管,从而真正地实现脱机电子交易。The transaction method of the electronic signature device described above can store the user's funds in the form of a data packet in the electronic signature device of the user, and the number of the data packets is one or more. When the user is consuming, since the funds are no longer stored in the electronic signature device in the form of numerical values, the electronic signature device does not need to change the stored value by networking with the server, and only needs one or more firsts that meet the consumption amount. The unit data packet can be sent to the payee. Therefore, the electronic signature device does not need to rely on the server for online payment when performing electronic transactions with other electronic signature devices, and the server no longer needs to supervise the electronic signature device, thereby truly Implement offline electronic trading.
方案10、一种电子签名设备的交易方法,交易方法包括:第二电子签名设备将交易请求发送至第一电子签名设备,其中,交易请求至少包括:交易金额;第一电子签名设备接收交易请求,并从其安全芯片中获取至少一个第二单位数据包,将至少一个第二单位数据包发送至第二电子签名设备,其中,每个第二单位数据包代表多种货币面值中的一种货币面值,每个 第二单位数据包至少包括:第二单位数据、服务器对第二单位数据签名得到的第三签名数据,至少一个第二单位数据包所代表的货币面值的总和等于交易金额;第二电子签名设备接收至少一个第二单位数据包,对至少一个第二单位数据包中的第三签名数据进行验证,在验证通过后,将至少一个第二单位数据包存储于安全芯片中。The transaction method of the electronic signature device includes: the second electronic signature device sends the transaction request to the first electronic signature device, wherein the transaction request includes at least: a transaction amount; and the first electronic signature device receives the transaction request And obtaining at least one second unit data packet from its security chip, and transmitting at least one second unit data packet to the second electronic signature device, wherein each second unit data packet represents one of a plurality of currency denominations Currency denomination, each The second unit data packet includes at least: the second unit data, the third signature data obtained by the server signing the second unit data, the sum of the currency denominations represented by the at least one second unit data packet is equal to the transaction amount; and the second electronic signature device Receiving at least one second unit data packet, verifying the third signature data in the at least one second unit data packet, and storing the at least one second unit data packet in the security chip after the verification is passed.
方案11、根据方案10的交易方法,在第一电子签名设备将至少一个第二单位数据包发送至第二电子签名设备之后,方法还包括:第一电子签名设备删除获取的至少一个第二单位数据包。The method of claim 10, after the first electronic signature device sends the at least one second unit data packet to the second electronic signature device, the method further includes: deleting, by the first electronic signature device, the acquired at least one second unit data pack.
方案12、根据方案10的交易方法,第一电子签名设备将至少一个第二单位数据包发送至第二电子签名设备,包括:第一电子签名设备对至少一个第二单位数据包进行加密,得到至少一个第三单位数据包,并将至少一个第三单位数据包发送至第二电子签名设备;第二电子签名设备接收至少一个第二单位数据包,包括:第二电子签名设备接收至少一个第三单位数据包,对至少一个第三单位数据包进行解密,得到至少一个第二单位数据包。The method of claim 10, wherein the first electronic signature device sends the at least one second unit data packet to the second electronic signature device, the first electronic signature device encrypting the at least one second unit data packet to obtain At least one third unit data packet, and transmitting the at least one third unit data packet to the second electronic signature device; the second electronic signature device receiving the at least one second unit data packet, including: the second electronic signature device receiving the at least one The three-unit data packet decrypts at least one third unit data packet to obtain at least one second unit data packet.
方案13、根据方案12的交易方法,第一电子签名设备对至少一个第二单位数据包进行加密,包括:第一电子签名设备利用第二电子签名设备的公钥至少对每个第二单位数据包中的第二单位数据进行加密,得到数据密文;第二电子签名设备对至少一个第三单位数据包进行解密,包括:第二电子签名设备利用第二电子签名设备的私钥至少对每个第三单位数据包中的数据密文进行解密。The method of claim 12, wherein the first electronic signature device encrypts the at least one second unit data packet, the first electronic signature device using the public key of the second electronic signature device for at least each second unit data The second unit data in the packet is encrypted to obtain the data ciphertext; the second electronic signature device decrypts the at least one third unit data packet, including: the second electronic signature device uses the private key of the second electronic signature device to at least The data ciphertext in the third unit data packet is decrypted.
方案14、根据方案13的交易方法,在第一电子签名设备对至少一个第二单位数据包进行加密之后,方法还包括:第一电子签名设备用每个第三单位数据包覆盖安全芯片中存储的每个第二单位数据包。The method of claim 13, after the first electronic signature device encrypts the at least one second unit data packet, the method further comprises: the first electronic signature device overwriting the security chip with each third unit data packet. Each second unit packet.
方案15、根据方案12的交易方法,第一电子签名设备对至少一个第二单位数据包进行加密,包括:第一电子签名设备利用与第二电子签名设备关联的对称密钥至少对每个第二单位数据包中的第二单位数据进行加密,得到数据密文;第二电子签名设备对至少一个第三单位数据包进行解密,包括:第二电子签名设备利用与第一电子签名设备关联的对称密钥至少对每个第三单位数据包中的数据密文进行解密。The method of claim 12, wherein the first electronic signature device encrypts the at least one second unit data packet, including: the first electronic signature device utilizes a symmetric key associated with the second electronic signature device, at least for each The second unit data in the two unit data packet is encrypted to obtain the data ciphertext; the second electronic signature device decrypts the at least one third unit data packet, including: the second electronic signature device uses the first electronic signature device The symmetric key decrypts at least the data ciphertext in each third unit data packet.
方案16、根据方案15的交易方法,在第一电子签名设备对至少一个第二单位数据包进行加密之后,方法还包括:第一电子签名设备用每个第三单位数据包覆盖安全芯片中存储的每个第二单位数据包,并删除对称密钥。The method of claim 15, after the first electronic signature device encrypts the at least one second unit data packet, the method further includes: the first electronic signature device overwriting the security chip with each third unit data packet. Each second unit of data packets and delete the symmetric key.
方案17、根据方案15或16的交易方法,对称密钥为异或因子;第一电子签名设备利用与第二电子签名设备关联的对称密钥至少对每个第二单位数据包中的第二单位数据进行加密,得到数据密文,包括:第一电子签名设备利用异或因子至少对每个第二单位数据包中的第二单位数据进行异或运算,得到数据密文;第二电子签名设备利用与第一电子签名设备关联的对称密钥至少对每个第三单位数据包中的数据密文进行解密,包括:第二电子签名设备利用异或因子分别对每个第三单位数据包中的数据密文进行异或运算。The method of claim 15 or 16, wherein the symmetric key is an exclusive OR factor; the first electronic signature device utilizes a symmetric key associated with the second electronic signature device for at least a second of each second unit data packet The unit data is encrypted to obtain the data ciphertext, including: the first electronic signature device uses an exclusive OR factor to perform an exclusive OR operation on at least the second unit data in each second unit data packet to obtain a data ciphertext; the second electronic signature The device decrypts the data ciphertext in each third unit data packet by using a symmetric key associated with the first electronic signature device, including: the second electronic signature device uses an exclusive OR factor for each third unit data packet The data ciphertext in the XOR is XORed.
方案18、根据方案10至17任一项的交易方法,在第二电子签名设备将至少一个第二单位数据包存储于安全芯片中之后,方法还包括:第二电子签名设备利用计数器的计数值得到当前存储的第二单位数据包的总个数。The transaction method according to any one of the items 10 to 17, after the second electronic signature device stores the at least one second unit data packet in the security chip, the method further comprises: the second electronic signature device utilizing the counter value of the counter The total number of second unit packets to the current storage.
方案19、根据方案10至18任一项的交易方法,交易请求至少包括:第二电子签名设备的设备标识。The transaction method according to any one of the items 10 to 18, wherein the transaction request comprises at least: a device identifier of the second electronic signature device.
方案20、根据方案19的交易方法,在第一电子签名设备从其安全芯片中获取至少一个第二单位数据包之前,交易方法 还包括:第一电子签名设备向持有用户提示交易金额和第二电子签名设备的设备标识,并接收到持有用户的确认信息。Item 20. The transaction method of claim 19, before the first electronic signature device acquires at least one second unit data packet from its security chip, the transaction method The method further includes: the first electronic signature device prompting the holding user with the transaction amount and the device identifier of the second electronic signature device, and receiving the confirmation information of the holding user.
方案21、根据方19的交易方法,每个第二单位数据包还包括:第一电子签名设备对第二单位数据和第二电子签名的设备标识签名得到的第四签名数据;在第二电子签名设备将至少一个第二单位数据包存储于安全芯片中之前,方法还包括:第二电子签名设备对第四签名数据进行验证,在验证通过后执行第二电子签名设备将至少一个第二单位数据包存储于安全芯片中的步骤。The second unit data packet further includes: fourth signature data obtained by the first electronic signature device for the second unit data and the device identifier of the second electronic signature, and the second electronic data according to the transaction method of the party 19; Before the signing device stores the at least one second unit data packet in the security chip, the method further includes: the second electronic signature device verifies the fourth signature data, and after the verification is passed, executing the second electronic signature device to the at least one second unit The step of storing the data packet in the security chip.
方案22、根据方案19的交易方法,每个第三单位数据包还包括:第二电子签名设备的设备标识。The method of claim 19, wherein each third unit data packet further comprises: a device identifier of the second electronic signature device.
方案23、根据方案10至22任一项的交易方法,第二单位数据包包括:数据包标识。The transaction method according to any one of the items 10 to 22, wherein the second unit data packet comprises: a data packet identifier.
方案24、根据方案23的交易方法,交易请求还包括:数据包标识;第二电子签名设备将至少一个第二单位数据包存储于安全芯片中,包括:第二电子签名设备判断接收到的第二单位数据包中的数据包标识是否与发送的交易请求中的数据包标识相同,如果不相同,则将数据包标识不相同的第二单位数据包丢弃,如果相同,则将数据包标识相同的第二单位数据包存储于安全芯片中。The method of claim 23, wherein the transaction request further comprises: a data packet identifier; the second electronic signature device stores the at least one second unit data packet in the security chip, and the second electronic signature device determines the received Whether the data packet identifier in the two-unit data packet is the same as the data packet identifier in the sent transaction request. If not, the second unit data packet with different data packet identifiers is discarded. If they are the same, the data packet identifier is the same. The second unit data packet is stored in the security chip.
方案25、根据方案23的交易方法,交易请求还包括:数据包标识起始值;第二电子签名设备将至少一个第二单位数据包存储于安全芯片中,包括:第二电子签名设备判断每个第二单位数据包中包含的数据包标识是否满足根据数据包标识起始值确定的预设范围,如果不满足,则将数据包标识不满足预设范围的第二单位数据包丢弃,如果满足,则将数据包标识满足预设范围的第二单位数据包存储于安全芯片中。The transaction method of claim 23, the transaction request further includes: a data packet identification start value; the second electronic signature device storing the at least one second unit data packet in the security chip, comprising: the second electronic signature device determining each Whether the data packet identifier included in the second unit data packet satisfies the preset range determined according to the start value of the data packet identifier, and if not, the second unit data packet whose data packet identifier does not satisfy the preset range is discarded, if If satisfied, the second unit data packet whose data packet identifier meets the preset range is stored in the security chip.
方案26、根据方案25的交易方法,在第二电子签名设备将交易请求发送至第一电子签名设备之前,方法还包括:第二电子签名设备利用计数器的计数值得到数据包标识起始值;在第二电子签名设备将至少一个第二单位数据包存储于安全芯片中之后,方法还包括:第二电子签名设备的计数器将数据包标识起始值加上接收到的第二单位数据包的总个数计算得到新的数据包标识起始值。The method of claim 25, before the second electronic signature device sends the transaction request to the first electronic signature device, the method further includes: the second electronic signature device obtaining the data packet identification start value by using the counter value of the counter; After the second electronic signature device stores the at least one second unit data packet in the security chip, the method further includes: the counter of the second electronic signature device adds the data packet identifier start value to the received second unit data packet. The total number of calculations yields a new packet identification start value.
方案27、根据方案23至26任一项的交易方法,在第二电子签名设备将至少一个第二单位数据包存储于安全芯片中之后,方法还包括:第二电子签名设备根据接收到的第二单位数据包的个数以及每个第二单位数据包所代表的货币面值计算接收到的第二单位数据包所代表的货币面值的总和与交易请求中的交易金额是否一致,如果不一致,则向第一电子签名设备发送重发请求;第一电子签名设备接收重发请求,并根据重发请求将重发信息发送至第二电子签名设备,其中,重发请求中至少包括第二电子签名设备的设备标识和/或每个第二单位数据包对应的数据包标识。The transaction method according to any one of the items 23 to 26, after the second electronic signature device stores the at least one second unit data packet in the security chip, the method further comprises: the second electronic signature device according to the received The number of two unit data packets and the currency denomination value represented by each second unit data packet calculate whether the sum of the currency face values represented by the received second unit data packet is consistent with the transaction amount in the transaction request, and if they are inconsistent, Sending a retransmission request to the first electronic signature device; the first electronic signature device receives the retransmission request, and sends the retransmission information to the second electronic signature device according to the retransmission request, wherein the retransmission request includes at least the second electronic signature The device identifier of the device and/or the packet identifier corresponding to each second unit data packet.
方案28、根据方案27的交易方法,在第一电子签名设备根据重发请求将重发信息发送至第二电子签名设备之后,方法还包括:第二电子签名设备接收重发信息,其中,重发信息包括至少一个第二单位数据包,并将之前存储于安全芯片中的至少一个第二单位数据包删除,重新存储第一电子签名设备重发的至少一个第二单位数据包。The method of claim 27, after the first electronic signature device sends the retransmission information to the second electronic signature device according to the retransmission request, the method further includes: the second electronic signature device receiving the retransmission information, wherein The sending information includes at least one second unit data packet, and the at least one second unit data packet previously stored in the security chip is deleted, and the at least one second unit data packet retransmitted by the first electronic signature device is re-stored.
方案29、根据方案27的交易方法,在第一电子签名设备根据重发请求将重发信息发送至第二电子签名设备之后,方法还包括:第二电子签名设备接收重发信息,其中,重发信息包括第二电子签名设备未收到的第二单位数据包,并将未接收到的第二单位数据包存储于其安全芯片中。 The method of claim 27, after the first electronic signature device sends the retransmission information to the second electronic signature device according to the retransmission request, the method further includes: the second electronic signature device receiving the retransmission information, wherein The sending information includes a second unit data packet that is not received by the second electronic signature device, and stores the unreceived second unit data packet in its security chip.
方案30、根据方案10至29任一项的交易方法,第二单位数据至少包括:货币面值数据,或者,货币序号和货币面值数据;第二单位数据包包括以下至少之一:发行银行标识和银行证书序号。The transaction method according to any one of the items 10 to 29, wherein the second unit data includes at least: currency denomination data, or currency serial number and currency denomination data; and the second unit data packet includes at least one of the following: issuing bank identification and Bank certificate serial number.
方案31、根据方案10至30任一项的交易方法,在第一电子签名设备将至少一个第二单位数据包发送至第二电子签名设备之后,方法还包括:第一电子签名设备将其账户金额减去交易金额得到当前账户余额,并向持有用户显示交易金额和/或当前账户余额;在第二电子签名设备将至少一个第二单位数据包存储于安全芯片中之后,方法还包括:第二电子签名设备将其当前账户金额加上交易金额得到当前账户余额,并向持有用户显示交易金额和/或当前账户余额。The method of any one of the aspects 10 to 30, after the first electronic signature device transmits the at least one second unit data packet to the second electronic signature device, the method further comprises: the first electronic signature device to have its account The amount is subtracted from the transaction amount to obtain the current account balance, and the transaction amount and/or the current account balance are displayed to the holding user; after the second electronic signature device stores the at least one second unit data packet in the security chip, the method further includes: The second electronic signature device adds the current account amount to the transaction amount to obtain the current account balance, and displays the transaction amount and/or the current account balance to the holding user.
方案32、根据方案10至31任一项的交易方法,在第二电子签名设备将至少一个第二单位数据包存储于安全芯片中之前,方法还包括:第二电子签名设备的安全芯片分配用于存储至少一个第二单位数据包的存储空间;第二电子签名设备将至少一个第二单位数据包存储于安全芯片中,包括:第二电子签名设备将至少一个第二单位数据包存储于对应的存储空间中,并将对应的存储空间的状态字置为已占用。The method of any one of the aspects 10 to 31, before the second electronic signature device stores the at least one second unit data packet in the security chip, the method further comprises: distributing the security chip of the second electronic signature device And storing the storage space of the at least one second unit data packet; the second electronic signature device storing the at least one second unit data packet in the security chip, the second electronic signature device storing the at least one second unit data packet in the corresponding In the storage space, and set the status word of the corresponding storage space to be occupied.
方案33、根据方案27至32任一项的交易方法,在第一电子签名设备将至少一个第二单位数据包发送至第二电子签名设备之前,方法还包括:第一电子签名设备的安全芯片分配用于存储至少一个第三单位数据包的存储空间,并将至少一个第三单位数据包存储于对应的存储空间中;在第一电子签名设备根据重发请求将重发信息发送至第二电子签名设备之后,方法还包括:第一电子签名设备接收到第二电子签名设备返回的接收成功的确认信息,将之前存储至少一个第三单位数据包的存储空间的状态字修改为交易完成,或者将存储空间清空。The method of claim 27, wherein before the first electronic signature device transmits the at least one second unit data packet to the second electronic signature device, the method further comprises: a security chip of the first electronic signature device Allocating a storage space for storing at least one third unit data packet, and storing at least one third unit data packet in the corresponding storage space; and transmitting, by the first electronic signature device, the retransmission information to the second according to the retransmission request After the electronic signature device, the method further includes: the first electronic signature device receiving the confirmation message of the success of the reception returned by the second electronic signature device, and modifying the status word of the storage space of the at least one third unit data packet to be completed. Or empty the storage space.
采用上述电子签名设备的交易方法,用户的资金以至少一个第二单位数据包的形式存储于第一电子签名设备或第二电子签名设备中。收款方用户(第二电子签名设备侧)在收取第二单位数据包时,因为资金不再是以数值的形式存储于第二电子签名设备中,所以第二电子签名设备不需要通过服务器更改存储的数值,收款方用户的第二电子签名设备仅需从付款方用户的第一电子签名设备中收取一定数量的第二单位数据包即可,由此,电子签名设备在与其他电子签名设备进行电子交易时,不再需要依托服务器进行联网支付,服务器不需要再对收款方用户或付款方用户的电子签名设备进行监管,从而真正地实现脱机电子交易。With the above-described electronic signature device transaction method, the user's funds are stored in the first electronic signature device or the second electronic signature device in the form of at least one second unit data packet. When the payee user (the second electronic signature device side) receives the second unit data packet, since the funds are no longer stored in the second electronic signature device in the form of numerical values, the second electronic signature device does not need to be changed by the server. The stored value, the second electronic signature device of the payee user only needs to receive a certain number of second unit data packets from the first electronic signature device of the payer user, whereby the electronic signature device is signed with other electronic When the device conducts electronic transactions, it no longer needs to rely on the server for online payment, and the server does not need to supervise the electronic signature device of the payee user or the payer user, thereby realizing offline electronic transactions.
附图说明DRAWINGS
为了更清楚地说明本发明实施例的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他附图。In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present invention, Those of ordinary skill in the art will be able to obtain other figures from these drawings without the inventive effort.
图1为本发明实施例1提供的电子签名设备的交易方法的流程图;1 is a flowchart of a method for processing an electronic signature device according to Embodiment 1 of the present invention;
图2为本发明实施例2提供的另一种电子签名设备的交易方法的流程图。FIG. 2 is a flowchart of another method for processing an electronic signature device according to Embodiment 2 of the present invention.
具体实施方式 detailed description
下面结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明的保护范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
在本发明的描述中,需要理解的是,术语“中心”、“纵向”、“横向”、“上”、“下”、“前”、“后”、“左”、“右”、“竖直”、“水平”、“顶”、“底”、“内”、“外”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本发明和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本发明的限制。此外,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或数量或位置。In the description of the present invention, it is to be understood that the terms "center", "longitudinal", "lateral", "upper", "lower", "front", "back", "left", "right", " The orientation or positional relationship of the indications of "upright", "horizontal", "top", "bottom", "inside", "outside", etc. is based on the orientation or positional relationship shown in the drawings, only for the convenience of describing the present invention and The simplification of the description is not intended to limit or imply that the device or component that is referred to has a particular orientation, is constructed and operated in a particular orientation, and thus is not to be construed as limiting. Moreover, the terms "first" and "second" are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or quantity or location.
在本发明的描述中,需要说明的是,除非另有明确的规定和限定,术语“安装”、“相连”、“连接”应做广义理解,例如,可以是固定连接,也可以是可拆卸连接,或一体地连接;可以是机械连接,也可以是电连接;可以是直接相连,也可以通过中间媒介间接相连,可以是两个元件内部的连通。对于本领域的普通技术人员而言,可以具体情况理解上述术语在本发明中的具体含义。In the description of the present invention, it should be noted that the terms "installation", "connected", and "connected" are to be understood broadly, and may be fixed or detachable, for example, unless otherwise explicitly defined and defined. Connected, or integrally connected; can be mechanical or electrical; can be directly connected, or indirectly connected through an intermediate medium, can be the internal communication of the two components. The specific meaning of the above terms in the present invention can be understood in a specific case by those skilled in the art.
下面将结合附图对本发明实施例作进一步地详细描述。The embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
实施例1Example 1
图1为本实施例提供的一种电子签名设备的交易方法的流程图。图1所示的方法实施例,包括以下步骤S11至S13:FIG. 1 is a flowchart of a method for processing an electronic signature device according to an embodiment of the present invention. The method embodiment shown in FIG. 1 includes the following steps S11 to S13:
步骤S11,电子签名设备将交易请求发送至服务器,其中,所述交易请求至少包括:交易金额。Step S11: The electronic signature device sends a transaction request to the server, wherein the transaction request includes at least: a transaction amount.
本实施例中,电子签名设备可以为具有签名功能的电子设备,例如,具有签名功能的智能卡(公交卡、银行卡、购物卡等等)、工行的U盾等等。在本实施例一种可选的实施方式中,电子签名设备将交易请求发送至服务器,具体地,电子签名设备可以与外接设备(如PC或移动终端等)建立连接,通过该外接设备将交易请求发送至服务器。或者,电子签名设备具有有线接口或无线接口,与服务器建立有线连接或无线连接,直接将交易请求发送至服务器。其中,无线连接方式可以包括蓝牙、NFC进场通讯以及WIFI等方式。由此,本实施例中电子签名设备可以通过多种方式将交易请求发送至服务器。作为一种可选的实施方式,服务器包括银行服务器或第三方服务器,例如,第三方服务器可以是某商场的购物卡储值服务器。In this embodiment, the electronic signature device may be an electronic device with a signature function, for example, a smart card with a signature function (a bus card, a bank card, a shopping card, etc.), a U shield of the ICBC, and the like. In an optional implementation manner of this embodiment, the electronic signature device sends a transaction request to the server. Specifically, the electronic signature device may establish a connection with an external device (such as a PC or a mobile terminal, etc.), and the transaction is performed by the external device. The request is sent to the server. Alternatively, the electronic signature device has a wired interface or a wireless interface, establishes a wired connection or a wireless connection with the server, and directly sends the transaction request to the server. Among them, the wireless connection method may include Bluetooth, NFC approach communication, and WIFI. Thus, the electronic signature device in this embodiment can send a transaction request to the server in a variety of ways. As an optional implementation manner, the server includes a bank server or a third-party server. For example, the third-party server may be a shopping card stored value server of a certain mall.
例如,该电子签名设备需要执行充值的操作,便向服务器(银行服务器或商场的购物卡储值服务器)发送用于充值的交易请求,该交易请求中携带的交易金额便是电子签名设备请求服务器充值的金额数值,以便服务器向电子签名设备返回与交易金额对应的第一单位数据包(即服务器返回的第一单位数据包的货币面值的总和等于交易金额)。For example, the electronic signature device needs to perform a recharge operation, and sends a transaction request for refilling to the server (the bank server or the shopping card stored value server of the shopping mall), and the transaction amount carried in the transaction request is the electronic signature device requesting the server. The value of the recharge amount, so that the server returns the first unit data packet corresponding to the transaction amount to the electronic signature device (ie, the sum of the currency denominations of the first unit data packet returned by the server is equal to the transaction amount).
步骤S12,服务器接收交易请求,在电子签名设备的银行账户扣除交易金额,获取至少一个第一单位数据包,并将上述至少一个第一单位数据包发送至电子签名设备;Step S12, the server receives the transaction request, deducts the transaction amount from the bank account of the electronic signature device, acquires at least one first unit data packet, and transmits the at least one first unit data packet to the electronic signature device;
其中,每个第一单位数据包代表多种货币面值中的一种货币面值,每个第一单位数据包至少包括:第一单位数据、所述服务器对第一单位数据签名得到的第一签名数据,上述至少一个第一单位数据包所代表的货币面值的总和等于交易金额。Each of the first unit data packets represents one of a plurality of currency denominations, and each of the first unit data packets includes at least: the first unit data, and the first signature obtained by the server to sign the first unit data. Data, the sum of the currency denominations represented by the at least one first unit data packet is equal to the transaction amount.
本实施例中,每个第一单位数据包代表多种货币面值中的一种货币面值,也就是说,货币面值共有多种,当电子签名设 备仅从服务器接收到一个第一单位数据包时,该第一单位数据包仅代表其中的一种货币面值。当电子签名设备从服务器接收到多个第一单位数据包时,多个第一单位数据包可以代表多种不同的货币面值,例如,第一单位数据包的个数为3个,每个第一单位数据包分别代表货币面值1元、2元以及5元;或者,多个第一单位数据包可以代表相同的货币面值,例如,第一单位数据包的个数为3个,每个第一单位数据包均代表货币面值1元;再或者,多个第一单位数据包所代表的货币面值中既包括相同的也包括不相同的货币面值,例如,第一单位数据包的个数为3个,每个第一单位数据包分别代表货币面值1元、1元以及2元。由此,电子签名设备从服务器接收的至少一个第一单位数据包所代表的货币面值具有灵活的组合方式。In this embodiment, each first unit data packet represents one currency face value of the plurality of currency denominations, that is, the currency face value has a plurality of types, when the electronic signature is set When a first unit data packet is received only from the server, the first unit data packet represents only one of the currency denominations. When the electronic signature device receives a plurality of first unit data packets from the server, the plurality of first unit data packets may represent a plurality of different currency denominations, for example, the number of the first unit data packets is three, each of the first One unit data packet represents currency face value of 1 yuan, 2 yuan and 5 yuan respectively; or, multiple first unit data packets can represent the same currency face value, for example, the number of first unit data packets is 3, each A unit data packet represents a currency denomination of 1 yuan; or, a plurality of first unit data packets represent a currency denomination that includes both the same and different currency denominations, for example, the number of first unit data packets is 3, each first unit data packet represents currency face value of 1 yuan, 1 yuan and 2 yuan. Thus, the currency denomination represented by the at least one first unit data packet received by the electronic signature device from the server has a flexible combination.
在本实施例一种可选的实施方式中,第一单位数据包中至少包括第一单位数据,该第一单位数据至少包括:货币面值数据,或者,货币序号和货币面值数据。其中,货币面值数据为第一单位数据包所代表的货币面值,以此来标识第一单位数据包所代表的货币面值,货币序号为每个第一单位数据包的唯一序号,即不同的第一单位数据包中的货币序号是不同的。由此,能够保证每个第一单位数据包的唯一性,以便于辨认第一单位数据包的真伪。作为一种可选的实施方式,第一单位数据包至少还包括以下之一:发行银行标识和银行证书序号。其中,发行银行标识为发行该第一单位数据包的银行的标识信息,由此可以根据该标识查询到对应的发行银行的相关信息,而且,电子签名设备可以根据发行银行标识和银行证书序号获取对应的发行银行的银行证书,银行证书中包含有发行银行的公钥,以便于后续操作中电子签名设备利用发行银行的公钥对第一单位数据的签名完成验证。In an optional implementation manner of this embodiment, the first unit data packet includes at least first unit data, and the first unit data includes at least: currency denomination data, or currency serial number and currency denomination data. Wherein, the currency denomination data is the currency denomination represented by the first unit data packet, thereby identifying the currency denomination represented by the first unit data packet, and the currency serial number is the unique serial number of each first unit data packet, that is, different numbers The currency numbers in a unit of data packets are different. Thereby, the uniqueness of each first unit data packet can be guaranteed to facilitate identification of the authenticity of the first unit data packet. As an optional implementation manner, the first unit data packet further includes at least one of the following: an issuing bank identifier and a bank certificate serial number. The issuing bank identifier is the identification information of the bank that issued the first unit data packet, so that the related information of the corresponding issuing bank can be queried according to the identifier, and the electronic signature device can obtain the identifier according to the issuing bank identifier and the bank certificate serial number. Corresponding bank certificate of the issuing bank, the bank certificate contains the public key of the issuing bank, so that the electronic signature device can verify the signature of the first unit data by using the public key of the issuing bank in the subsequent operation.
在本实施例一种可选的实施方式中,第一单位数据包至少还包括:第一单位数据以及服务器对第一单位数据签名得到的第一签名数据。作为一种可选的实施方式,服务器利用自身的私钥分别对每个第一单位数据包中的第一单位数据进行签名,得到与每个第一单位数据包对应的第一签名数据。服务器将至少一个携带有第一签名数据的第一单位数据包发送至电子签名设备,以便于后续操作中电子签名设备利用服务器的公钥验证第一单位数据包的真实性。In an optional implementation manner of this embodiment, the first unit data packet further includes: first unit data and first signature data obtained by the server to sign the first unit data. As an optional implementation manner, the server separately signatures the first unit data in each first unit data packet by using its own private key, to obtain first signature data corresponding to each first unit data packet. The server sends at least one first unit data packet carrying the first signature data to the electronic signature device, so that the electronic signature device uses the public key of the server to verify the authenticity of the first unit data packet in subsequent operations.
在本实施例另一种可选的实施方式中,电子签名设备发送给服务器的交易请求中还包括:电子签名设备的设备标识;每个第一单位数据包还包括:服务器对第一单位数据和电子签名设备的设备标识签名得到的第二签名数据。作为一种可选的实施方式,服务器利用自身的私钥对第一单位数据和电子签名设备的设备标识签名,得到与每个第一单位数据包对应的第二签名数据。服务器将至少一个携带有第二签名数据的第一单位数据包发送至电子签名设备,以便于后续操作中电子签名设备利用服务器的公钥验证第一单位数据包的正确性。In another optional implementation manner of this embodiment, the transaction request sent by the electronic signature device to the server further includes: a device identifier of the electronic signature device; each first unit data packet further includes: the server to the first unit data And the second signature data obtained by the device identification signature of the electronic signature device. As an optional implementation manner, the server uses the private key of the server to sign the first unit data and the device identifier of the electronic signature device to obtain second signature data corresponding to each first unit data packet. The server sends at least one first unit data packet carrying the second signature data to the electronic signature device, so that the electronic signature device uses the public key of the server to verify the correctness of the first unit data packet in subsequent operations.
在本实施例中,服务器在收到电子签名设备发送的交易请求后,会从该电子签名设备对应的账户中扣除电子签名设备请求的交易金额,并为电子签名设备下发货币面值的总和等于交易金额的至少一个第一单位数据包,在电子签名设备接收到这些第一单位数据包,即充值成功后,便可以与其他电子签名设备完成线下交易,即不需要再与服务器联网便可以给其他电子签名设备转账(即将第一单位数据包转发给其他电子签名设备)。每个第一单位数据包所代表的货币面值可以相同也可以不同,发送给电子签名设备的第一单位数据包的个数以及各个第一单位数据包所代表的货币面值可以由服务器根据交易金额确定,也可以由电子签名设备根据交易金额确定后告知服务器,例如,作为本实施例中的一种可选实施方式,电子签名设备发送的交易请求中还可以携带第一单位数据包的种类以及个数。前者服务器可以灵活实现第一单位数据包的下发,后者可以 满足用户对第一单位数据包的个数以及面值的需求。在本实施例一种可选的实施方式中,每个第一单位数据包代表多种货币面值中的一种货币面值,例如,第一单位数据包所代表的货币面值包括:1元、2元、5元、10元、20元、50元和100元,当然,如果未来国家发行了新的货币面值、或者除了使用人民币之外的其他地区、国家的货币面值也属于本发明的保护范围,本实施例中仅以人民币面值进行举例说明。例如,电子签名设备将交易请求发送至服务器,其中,交易请求包括的交易金额为10元,电子签名设备从服务器接收5个第一单位数据包,5个第一单位数据包所代表的货币面值分别为1元、1元、1元、2元和5元,5个第一单位数据包所代表的货币面值的总和为10元,与交易金额相等。当然,当交易请求包括的交易金额为10元时,电子签名设备还可以从服务器接收10个代表1元货币面值的第一单位数据包,或者,2个代表5元货币面值的第一单位数据包,或者,1个代表10元货币面值的第一单位数据包。也就是说,第一电子单位货币数据包所代表的货币面值与个数可以灵活组合,仅需使接收到的至少一个第一单位数据包所代表的货币面值的总和等于交易金额即可,此处仅以交易金额为10元为例,对于其他金额数值原理相同,此处不再举例说明。由此,在服务器根据交易金额确定第一单位数据包的个数,以及各个第一单位数据包所代表的面值的情况下,服务器可以灵活实现第一单位数据包的下发,可以有各种组合;在电子签名设备根据交易金额确定第一单位数据包的个数,以及各个第一单位数据包所代表的面值的情况下,可以将请求的个数以及对应的第一单位数据包所代表的货币面值发送至服务器,由此可以满足用户对第一单位数据包的个数以及面值的需求。In this embodiment, after receiving the transaction request sent by the electronic signature device, the server deducts the transaction amount requested by the electronic signature device from the account corresponding to the electronic signature device, and the sum of the currency denominations issued by the electronic signature device is equal to At least one first unit data packet of the transaction amount, after the electronic signature device receives the first unit data packet, that is, after the recharging is successful, the offline transaction can be completed with other electronic signature devices, that is, the network connection with the server is not needed. Transfer money to other electronic signature devices (ie, forward the first unit data packet to other electronic signature devices). The currency face value represented by each first unit data packet may be the same or different, and the number of first unit data packets sent to the electronic signature device and the currency face value represented by each first unit data packet may be determined by the server according to the transaction amount. It is determined that the electronic signature device can also notify the server after determining the transaction amount. For example, as an optional implementation manner in this embodiment, the transaction request sent by the electronic signature device may further carry the type of the first unit data packet and Number. The former server can flexibly implement the delivery of the first unit data packet, and the latter can The user's demand for the number of first unit data packets and the face value is satisfied. In an optional implementation manner of this embodiment, each first unit data packet represents one of a plurality of currency denominations. For example, the currency denomination represented by the first unit data packet includes: 1 yuan, 2 Yuan, 5 yuan, 10 yuan, 20 yuan, 50 yuan and 100 yuan. Of course, if the future country issues a new currency denomination, or other regions other than the RMB, the currency face value of the country is also within the scope of protection of the present invention. In this embodiment, only the RMB denomination is used for illustration. For example, the electronic signature device sends a transaction request to the server, wherein the transaction request includes a transaction amount of 10 yuan, and the electronic signature device receives 5 first unit data packets from the server, and the currency face value represented by the 5 first unit data packets The sum of the currency denominations represented by the five first unit data packets is 1 yuan, 1 yuan, 1 yuan, 2 yuan, and 5 yuan, respectively, which is equal to the transaction amount. Of course, when the transaction request includes a transaction amount of 10 yuan, the electronic signature device may also receive 10 first unit data packets representing the face value of the 1 dollar currency from the server, or 2 first unit data representing the face value of the 5 dollar currency. Package, or, a first unit packet representing the face value of a 10-yuan currency. That is to say, the currency denomination and the number represented by the first electronic unit currency data packet can be flexibly combined, and only the sum of the currency denominations represented by the received at least one first unit data packet is equal to the transaction amount. The transaction amount is only 10 yuan as an example. For other amounts, the numerical principle is the same, and is not illustrated here. Therefore, in the case that the server determines the number of the first unit data packets according to the transaction amount and the face value represented by each of the first unit data packets, the server can flexibly implement the delivery of the first unit data packet, and various types of data packets can be implemented. Combining; in the case where the electronic signature device determines the number of the first unit data packets according to the transaction amount, and the face value represented by each first unit data packet, the number of requests and the corresponding first unit data packet may be represented. The currency face value is sent to the server, thereby satisfying the user's demand for the number of first unit data packets and the face value.
为了进一步提高服务器下发第一单位数据包过程中数据传输的安全性,在本实施例一种可选的实施方式中,电子签名设备还可以从服务器接收至少一个第一单位数据包的密文数据,其中,该密文数据由服务器对至少一个第一单位数据包进行加密得到的,电子签名设备可以对该密文数据解密得到第一单位数据包原文,服务器和电子签名设备可以通过对称密钥加解密或非对称密钥加解密的方式实现数据的安全传输。作为一种可选的方式,服务器对至少一个第一单位数据包进行加密的加密方式包括:服务器利用电子签名设备的公钥对至少一个第一单位数据包进行加密(此为非对称密钥加密的方式),或者,服务器利用与电子签名设备协商得到的对称密钥对至少一个第一单位数据包进行加密。电子签名设备在接收到密文数据之后,利用与服务器的加密方式对应的解密方式将密文数据进行解密,得到至少一个第一单位数据包明文,即,利用电子签名设备的私钥对该密文数据解密得到第一单位数据包明文(此为非对称密钥解密的方式),或者,电子签名设备利用与服务器协商得到的对称密钥对该密文数据解密得到第一单位数据包明文。由此,可以防止第一单位数据包在传输过程中被复制或篡改,提高数据传输的安全性。In an optional implementation manner of the embodiment, the electronic signature device may further receive at least one ciphertext of the first unit data packet from the server, in order to further improve the security of the data transmission in the process of delivering the first unit data packet by the server. Data, wherein the ciphertext data is obtained by the server encrypting at least one first unit data packet, and the electronic signature device may decrypt the ciphertext data to obtain the first unit data packet original text, and the server and the electronic signature device may pass the symmetric key Secure encryption of data is achieved by means of key encryption or decryption or asymmetric key encryption and decryption. As an optional manner, the server encrypts the at least one first unit data packet by using: the server encrypts the at least one first unit data packet by using the public key of the electronic signature device (this is an asymmetric key encryption). Alternatively, the server encrypts the at least one first unit data packet using a symmetric key negotiated with the electronic signature device. After receiving the ciphertext data, the electronic signature device decrypts the ciphertext data by using a decryption method corresponding to the encryption mode of the server, to obtain at least one first unit data packet plaintext, that is, using the private key of the electronic signature device to the secret The text data is decrypted to obtain the first unit data packet plaintext (this is the way of asymmetric key decryption), or the electronic signature device decrypts the ciphertext data by using the symmetric key negotiated with the server to obtain the first unit data packet plaintext. Thereby, the first unit data packet can be prevented from being copied or falsified during the transmission process, thereby improving the security of data transmission.
步骤S13,电子签名设备接收上述至少一个第一单位数据包,对至少一个第一单位数据包中的第一签名数据进行验证,在验证通过后,将上述至少一个第一单位数据包存储于安全芯片中。Step S13: The electronic signature device receives the at least one first unit data packet, and verifies the first signature data in the at least one first unit data packet, and after the verification is passed, stores the at least one first unit data packet in the security. In the chip.
在本实施例一种可选的实施方式中,电子签名设备中设置有安全芯片,该安全芯片内部拥有独立的处理器和存储单元,可存储PKI数字证书和密钥,以及其他特征数据,对数据进行加解密运算,为用户提供数据加密和身份安全认证服务,本实施例中,电子签名设备的安全芯片中存储的第一单位数据包不能被非法读出,可以保证存储的数据安全性。In an optional implementation manner of the embodiment, the electronic signature device is provided with a security chip, and the security chip has an independent processor and a storage unit, and can store the PKI digital certificate and the key, and other characteristic data. The data is subjected to encryption and decryption operations to provide data encryption and identity security authentication services for the user. In this embodiment, the first unit data packet stored in the security chip of the electronic signature device cannot be illegally read, and the stored data security can be ensured.
本实施例中,在步骤S13之前,该交易方法还包括:电子签名设备利用其安全芯片分配用于存储上述至少一个第一单位 数据包的存储空间。步骤S13中的电子签名设备将上述至少一个第一单位数据包存储于安全芯片中,具体包括:电子签名设备将上述至少一个第一单位数据包存储于对应的存储空间中,并将对应的存储空间的状态字置为已占用。其中,安全芯片为每个第一单位数据包分配一个存储空间,一个存储空间只能存储一个第一单位数据包,且电子签名设备的交易记录中也会记录一笔交易中从服务器接收到的各个第一单位数据包存储的存储空间的位置。存储空间的状态字用于标识该存储空间是否已经被占用,如果已经被占用,则电子签名设备不能在该被占用的存储空间存储第一单位数据包。当安全芯片分配的所有存储空间都已被占用时,电子签名设备需要进行请求服务器更新数据包或者申请新的存储空间的操作,其中,作为一种可选的实施方式,电子签名设备可以申请新的存储空间以存储新接收到的第一单位数据包。作为另一种可选的实施方式,电子签名设备还可以向服务器请求更新本地存储的第一单位数据包,例如,电子签名设备可以请求服务器将本地存储的N个(N为大于1的正整数)代表小面值的第一单位数据包替换为1个或M个(M<N)代表大货币面值的第一单位数据包进行存储,只要存储的货币金额不变即可,由此便可以释放多个存储空间,从而节省出存储空间以存储新接收到的第一单位数据包。此外,为了进一步提高数据存储的安全性,在本实施方式中,电子签名设备还可以将每个第一单位数据包进行加密得到每个第一单位数据包的密文数据,并将每个密文数据存储于对应的存储空间中。由此,可以保证存储在安全芯片的存储空间中的第一单位数据包不能被恶意复制或更改,以此确保存储第一单位数据包的安全性。In this embodiment, before the step S13, the transaction method further includes: the electronic signature device uses its security chip allocation for storing the at least one first unit. The storage space of the packet. The electronic signature device in step S13 stores the at least one first unit data packet in the security chip, and specifically includes: the electronic signature device stores the at least one first unit data packet in a corresponding storage space, and stores the corresponding storage. The status word for the space is set to Occupied. The security chip allocates one storage space for each first unit data packet, and one storage space can only store one first unit data packet, and the transaction record of the electronic signature device also records the transaction received from the server in a transaction. The location of the storage space stored by each first unit packet. The status word of the storage space is used to identify whether the storage space has been occupied. If it is already occupied, the electronic signature device cannot store the first unit data packet in the occupied storage space. When all the storage space allocated by the security chip is occupied, the electronic signature device needs to perform an operation of requesting the server to update the data packet or apply for a new storage space, wherein, as an optional implementation manner, the electronic signature device can apply for a new one. Storage space to store the newly received first unit packet. As another optional implementation manner, the electronic signature device may further request the server to update the locally stored first unit data packet. For example, the electronic signature device may request the server to store N locally (N is a positive integer greater than 1 The first unit data packet representing the small face value is replaced by 1 or M (M < N), the first unit data packet representing the face value of the large currency is stored, as long as the stored currency amount is unchanged, thereby releasing Multiple storage spaces, thereby saving storage space to store the newly received first unit data packet. In addition, in order to further improve the security of the data storage, in the embodiment, the electronic signature device may further encrypt each first unit data packet to obtain ciphertext data of each first unit data packet, and each confidentiality The text data is stored in the corresponding storage space. Thereby, it can be ensured that the first unit data packet stored in the storage space of the security chip cannot be maliciously copied or changed, thereby ensuring the security of storing the first unit data packet.
在本实施例中,为了进一步保证电子签名设备存储的第一单位数据包的真实性,电子签名设备对第一签名数据进行验证,在验证通过后将上述至少一个第一单位数据包存储于安全芯片中。其中,第一签名数据是服务器对第一单位数据进行签名得到的,因此,在本实施例一种可选的实施方式中,每个第一单位数据包至少包括:第一单位数据以及服务器对第一单位数据签名得到的第一签名数据,由此使得电子签名设备可以验证第一单位数据包的真实性。作为一种可选的实施方式,第一签名数据为服务器利用自身的私钥对第一单位数据进行签名得到的签名数据。相应的,电子签名设备对第一签名数据进行验证具体包括:电子签名设备利用该服务器的公钥对第一签名数据进行验签。以服务器为银行服务器为例,银行服务器对第一单位数据进行HASH运算得到第一单位数据的摘要报文A1,并利用银行服务器自身的私钥对该摘要报文A1进行签名运算得到第一签名数据,并携带在第一单位数据包中下发至电子签名设备。电子签名设备可以利用该银行服务器的公钥对第一签名数据进行验签,具体地,电子签名设备利用银行服务器的公钥对第一电子签名数据进行运算得到运算结果A2,并对接收到的第一单位数据包中的第一单位数据进行HASH运算得到第一单位数据的摘要报文A3,将运算结果A2与摘要报文A3进行比对,如果比对结果一致,则电子签名设备对第一电子签名数据验签通过。其中,电子签名设备可以根据第一单位数据包中的银行证书序号和/或发行银行标识获取银行的公钥,例如,电子签名设备可以根据第一单位数据包中的发行银行标识,从与待验证的第一签名数据对应的发行银行服务器获取该银行的银行证书,并从银行证书中获取该银行的公钥;再例如,电子签名设备可以预存各个银行的银行证书,根据第一单位数据包中的银行证书序号从预存的各个银行证书中获取与待验证的第一签名数据对应的银行证书,并从对应的银行证书中获取银行的公钥。由此,电子签名设备利用银行的公钥对第一单位数据包中携带的第一签名数据进行验签,可以验证第一单位数据包的真实性。上述描述仅以服务器为银行服务器为例进行说明,但本实施例并不限于银行服务器,其他第三方服务器如超市购物卡储值服务器等的具体实施方式均属于本发明的保护范 围之内。In this embodiment, in order to further ensure the authenticity of the first unit data packet stored by the electronic signature device, the electronic signature device verifies the first signature data, and stores the at least one first unit data packet in the security after the verification is passed. In the chip. The first signature data is obtained by the server signing the first unit data. Therefore, in an optional implementation manner of the embodiment, each first unit data packet includes at least: the first unit data and the server pair. The first unit data is signed by the first unit data, thereby enabling the electronic signature device to verify the authenticity of the first unit data packet. As an optional implementation manner, the first signature data is signature data obtained by the server by using the private key of the server to sign the first unit data. Correspondingly, the verifying the first signature data by the electronic signature device comprises: the electronic signature device performing the verification of the first signature data by using the public key of the server. Taking the server as the bank server as an example, the bank server performs HASH operation on the first unit data to obtain the digest message A1 of the first unit data, and uses the private key of the bank server to sign the digest message A1 to obtain the first signature. The data is carried in the first unit data packet and sent to the electronic signature device. The electronic signature device can perform the verification of the first signature data by using the public key of the bank server. Specifically, the electronic signature device uses the public key of the bank server to calculate the first electronic signature data to obtain the operation result A2, and obtains the operation result A2. The first unit data in the first unit data packet is subjected to HASH operation to obtain the digest message A3 of the first unit data, and the operation result A2 is compared with the digest message A3. If the comparison result is consistent, the electronic signature device pairs An electronic signature data check was passed. The electronic signature device may obtain the public key of the bank according to the bank certificate serial number and/or the issuing bank identifier in the first unit data packet. For example, the electronic signature device may wait and receive according to the issuing bank identifier in the first unit data packet. The issuing bank server corresponding to the verified first signature data obtains the bank certificate of the bank, and obtains the bank's public key from the bank certificate; for example, the electronic signature device can pre-store the bank certificate of each bank according to the first unit data packet. The bank certificate serial number in the bank certificate is obtained from the pre-stored bank certificate, and the bank certificate corresponding to the first signature data to be verified is obtained, and the bank public key is obtained from the corresponding bank certificate. Therefore, the electronic signature device uses the public key of the bank to perform verification on the first signature data carried in the first unit data packet, and can verify the authenticity of the first unit data packet. The above description is only taking the server as a bank server as an example, but the embodiment is not limited to the bank server, and the specific implementation manners of other third-party servers, such as a supermarket shopping card stored value server, etc. belong to the protection scope of the present invention. Within the fence.
进一步地,电子签名设备在确保收到的第一单位数据包是真实的前提下,还想再确认服务器发送的对象是否确实为本电子签名设备,以避免存储服务器误发的数据包,在步骤S13中将至少一个第一单位数据包存储于安全芯片中之前,该交易方法还包括:电子签名设备对第二签名数据进行验证,在验证通过后执行将上述至少一个第一单位数据包存储于安全芯片中的操作。第二签名数据是服务器对第一单位数据和电子签名设备的设备标识签名得到的,因此,在本实施例一种可选的实施方式中,电子签名设备发送给服务器的交易请求中还包括:电子签名设备的设备标识;每个第一单位数据包至少包括:第一单位数据、服务器对第一单位数据和电子签名设备的设备标识签名得到的第二签名数据,由此使得电子签名设备可以验证第一单位数据包的真实性和正确性。作为一种可选的实施方式,第二签名数据为服务器利用服务器自身的私钥对第一单位数据和电子签名设备的设备标识进行签名得到的签名数据,也就是说,每个第二签名数据的签名对象为每个第一单位数据和电子签名设备的设备标识的组合。相应的,电子签名设备对第二签名数据进行验证具体包括:电子签名设备利用服务器的公钥分别对每个第二签名数据进行验签。以服务器为银行服务器为例,银行服务器利用自身的私钥对第一单位数据和电子签名设备的设备标识进行签名得到第二签名数据,并携带在第一单位数据包中下发至电子签名设备。电子签名设备可以利用该银行服务器的公钥对第二签名数据进行验签。其中,电子签名设备可以根据第一单位数据包中的银行证书序号和/或发行银行标识获取该银行的银行证书,并从银行证书中获取该银行的公钥,例如,电子签名设备可以根据第一单位数据包中的发行银行标识,从与待验证的第二签名数据对应的发行银行服务器获取该银行的公钥;再例如,电子签名设备可以预存各个银行的银行证书,根据第一单位数据包中的银行证书序号从预存的各个银行证书中获取与待验证的第二签名数据对应的银行证书,并从对应的银行证书中获取银行的公钥。由此,电子签名设备利用银行的公钥对第一单位数据包中携带的第二签名数据进行验签,不仅可以验证第一单位数据包的真实性,还可以证明第一单位数据包确实是银行服务器下发给该电子签名设备的,即验证第一单位数据包的正确性。上述描述仅以服务器为银行服务器为例进行说明,但本实施例并不限于银行服务器,其他第三方服务器如超市购物卡储值服务器等的具体实施方式均属于本发明的保护范围之内。Further, the electronic signature device further confirms whether the object sent by the server is indeed the electronic signature device, so as to ensure that the data packet sent by the storage server is incorrect, in the step of ensuring that the received first unit data packet is authentic. Before storing at least one first unit data packet in the security chip in S13, the transaction method further includes: the electronic signature device verifying the second signature data, and executing the storing the at least one first unit data packet after the verification is passed Operation in the security chip. The second signature data is obtained by the server for the first unit data and the device identifier of the electronic signature device. Therefore, in an optional implementation manner of the embodiment, the transaction request sent by the electronic signature device to the server further includes: The device identifier of the electronic signature device; each first unit data packet includes at least: first unit data, second signature data obtained by the server for the first unit data and the device identifier of the electronic signature device, thereby enabling the electronic signature device to Verify the authenticity and correctness of the first unit packet. As an optional implementation manner, the second signature data is signature data obtained by the server by using the private key of the server to sign the device identifier of the first unit data and the electronic signature device, that is, each second signature data. The signature object is a combination of each of the first unit data and the device identification of the electronic signature device. Correspondingly, the verifying the second signature data by the electronic signature device comprises: the electronic signature device separately checking each second signature data by using a public key of the server. Taking the server as the bank server as an example, the bank server uses the private key of the server to sign the first unit data and the device identifier of the electronic signature device to obtain the second signature data, which is carried in the first unit data packet and sent to the electronic signature device. . The electronic signature device can authenticate the second signature data by using the public key of the bank server. The electronic signature device may obtain the bank certificate of the bank according to the bank certificate serial number and/or the issuing bank identifier in the first unit data packet, and obtain the public key of the bank from the bank certificate. For example, the electronic signature device may be configured according to the The issuing bank identifier in one unit data packet acquires the public key of the bank from the issuing bank server corresponding to the second signature data to be verified; for example, the electronic signature device may pre-store the bank certificate of each bank according to the first unit data The bank certificate serial number in the package obtains the bank certificate corresponding to the second signature data to be verified from the pre-stored bank certificates, and obtains the bank public key from the corresponding bank certificate. Therefore, the electronic signature device uses the public key of the bank to perform verification on the second signature data carried in the first unit data packet, which can not only verify the authenticity of the first unit data packet, but also prove that the first unit data packet is indeed The bank server sends the electronic signature device to the electronic signature device to verify the correctness of the first unit data packet. The foregoing description is only for the example that the server is a bank server, but the embodiment is not limited to the bank server, and the specific implementation manners of other third-party servers, such as a supermarket shopping card stored value server, are within the protection scope of the present invention.
为了保证电子签名设备没有少收钱,即保证电子签名设备接收到的第一单位数据包的总金额等于交易金额,在本实施例一种可选的实施方式中,在步骤S13之后,该交易方法还包括:电子签名设备根据接收到的上述至少一个第一单位数据包的个数以及每个第一单位数据包所代表的货币面值计算接收到的第一单位数据包所代表的货币面值的总和与交易请求中的交易金额是否一致,如果不一致,则向服务器发送重发请求;服务器接收该重发请求。例如,交易金额为10元,电子签名设备从服务器接收到5个第一单位数据包,计算5个第一单位数据包所代表的货币面值的总和是否等于10元,如果不足10元,则服务器发送重发请求。由此,电子签名设备可以通过向服务器发送重发请求,来解决接收到的第一单位数据包所代表的货币面值不足的问题。In order to ensure that the electronic signature device does not receive less money, that is, the total amount of the first unit data packet received by the electronic signature device is equal to the transaction amount, in an optional implementation manner of this embodiment, after the step S13, the transaction The method further includes: calculating, by the electronic signature device, the currency face value represented by the received first unit data packet according to the received number of the at least one first unit data packet and the currency face value represented by each first unit data packet The sum is consistent with the transaction amount in the transaction request, and if not, the retransmission request is sent to the server; the server receives the retransmission request. For example, if the transaction amount is 10 yuan, the electronic signature device receives 5 first unit data packets from the server, and calculates whether the sum of the currency face values represented by the 5 first unit data packets is equal to 10 yuan, and if less than 10 yuan, the server Send a resend request. Thus, the electronic signature device can solve the problem of insufficient currency face value represented by the received first unit data packet by transmitting a retransmission request to the server.
在电子签名设备向服务器发送重发请求后,电子签名设备会接收到服务器返回的重发信息,根据重发请求的内容不同,服务器返回的重发信息也会不同,例如,重发请求中可以携带电子签名设备的设备标识、交易记录(如每笔交易的编号、账户信息、时间戳、交易金额以及接收到的第一单位数据包的个数以及所代表的货币面值等等,这些服务器侧也会对应记录), 以便于服务器查询到该电子签名设备对应的某一笔交易,全部重发该笔交易对应的第一单位数据包至电子签名设备,又例如,重发请求中还可以携带接收到的第一单位数据包的数据包标识(可以唯一标识一个第一单位数据包的标识,如服务器为每个第一单位数据包配置的唯一标识,或者货币序号),服务器接收到这些数据包标识后,可以查询到漏发或传输过程中丢失了哪些第一单位数据包,将这些漏发的或传输过程中丢失的第一单位数据包发送至电子签名设备。下面就服务器重发第一单位电子数据包进行示例性说明:After the electronic signature device sends a resend request to the server, the electronic signature device receives the retransmission information returned by the server. According to the content of the retransmission request, the retransmission information returned by the server may be different. For example, the retransmission request may be The device identification and transaction record of the electronic signature device (such as the number of each transaction, account information, time stamp, transaction amount, and the number of received first unit data packets and the currency face value represented, etc.) Will also correspond to the record), In order to facilitate the server to query a certain transaction corresponding to the electronic signature device, all the first unit data packets corresponding to the transaction are resent to the electronic signature device, and, for example, the retransmission request may also carry the received first unit. The packet identifier of the data packet (which can uniquely identify the identifier of a first unit data packet, such as the unique identifier configured by the server for each first unit data packet, or the currency serial number). After receiving the data packet identifiers, the server can query Which first unit data packets are lost during the missed transmission or transmission, and the first unit data packets that are lost or lost during transmission are sent to the electronic signature device. The following is an exemplary illustration of the server resending the first unit of electronic data packets:
例如,在服务器接收重发请求之后,该交易方法还包括:服务器根据重发请求向电子签名设备发送重发信息,其中,重发信息包括至少一个第一单位数据包;电子签名设备接收重发信息,将之前存储于安全芯片中的至少一个第一单位数据包删除,并重新存储服务器重发的至少一个第一单位数据包。作为一种可选的实施方式,电子签名设备在向服务器发送重发请求后,接收服务器根据重发请求发送的重发信息,其中,该重发请求中至少包括:电子签名设备的设备标识以及交易记录,重发信息包括至少一个第一单位数据包,即在该可选的实施方式中,服务器向电子签名设备重发了一笔交易对应的全部第一单位数据包,在本实施例中,服务器在与单位电子签名工具进行交易时,也会存储每一笔交易对应的交易记录(如每笔交易的编号、账户信息、时间戳、交易金额以及发送的第一单位数据包的个数以及所代表的货币面值等等)以及电子签名设备的设备标识,根据设备标识以及交易记录可以查询到该电子签名设备对应的某一笔交易,在该可选实施方式中,服务器会将查询到的电子签名设备请求重发的该笔交易的第一单位数据包全部重发给电子签名设备,以保证电子签名设备收到完整的第一单位数据包,服务器与电子签名设备的交易无误(如充值无误)。For example, after the server receives the retransmission request, the transaction method further includes: the server transmitting the retransmission information to the electronic signature device according to the retransmission request, wherein the retransmission information includes at least one first unit data packet; and the electronic signature device receives the retransmission And deleting at least one first unit data packet previously stored in the security chip, and re-storing at least one first unit data packet retransmitted by the server. As an optional implementation, the electronic signature device, after sending the resend request to the server, receives the retransmission information sent by the server according to the retransmission request, where the retransmission request includes at least: the device identifier of the electronic signature device and The transaction record, the retransmission information includes at least one first unit data packet, that is, in the optional implementation, the server resends all the first unit data packets corresponding to a transaction to the electronic signature device, in this embodiment. When the server deals with the unit electronic signature tool, it also stores the transaction records corresponding to each transaction (such as the number of each transaction, account information, time stamp, transaction amount, and the number of first unit packets sent). And the device identifier of the electronic signature device, and the device identifier of the electronic signature device, according to the device identifier and the transaction record, a certain transaction corresponding to the electronic signature device can be queried, in the optional implementation manner, the server will query The first unit data packet of the transaction that the electronic signature device requests to resend is resent to the electronic signature set. To ensure that the electronic signature device receives the correct transaction complete first unit of data packets, the server and the electronic signature device (such as a top-correct).
为了保证电子签名设备不会重复存储数据包,在电子签名设备接收到服务器重发的第一单位数据包之前,该交易方法还包括:电子签名设备将之前存储于安全芯片中的至少一个第一单位数据包删除(即在该可选实施方式中,由于服务器会将该笔交易的第一单位数据包全部重新发送给电子签名设备,电子签名设备必须将之前接收到的该笔交易的全部第一单位数据包,即之前存储于安全芯片中的该笔交易对应的至少一个第一单位数据包删除),并重新存储服务器重发的至少一个第一单位数据包,其中,电子签名设备在执行上述删除第一单位数据包的操作之后,会将所占用的存储空间的状态字置为未占用,电子签名设备可以将重新接收到的第一单位数据包存储至之前安全芯片分配的存储空间中,并将占用的存储空间的状态字置为已占用,由此保证电子签名设备不会重复存储相同的第一单位数据包,且保证同一存储空间只能存储一个第一单位数据包。In order to ensure that the electronic signature device does not repeatedly store the data packet, before the electronic signature device receives the first unit data packet retransmitted by the server, the transaction method further includes: the electronic signature device storing the at least one first stored in the security chip. Unit data packet deletion (ie, in this alternative embodiment, since the server will resend the first unit data packet of the transaction to the electronic signature device, the electronic signature device must all the previously received transactions. a unit data packet, that is, at least one first unit data packet corresponding to the transaction previously stored in the security chip is deleted, and re-storing at least one first unit data packet retransmitted by the server, wherein the electronic signature device is executing After the operation of deleting the first unit data packet is performed, the status word of the occupied storage space is set to be unoccupied, and the electronic signature device can store the re-received first unit data packet into the storage space allocated by the previous security chip. And set the status word of the occupied storage space to be occupied, thereby ensuring the electronic signature Preparation will not repeat unit storing a first data packet, and to ensure that the same storage unit can only store a first packet.
举例来说,对于一笔编号为1*******的交易,电子签名设备的交易请求中的交易金额为10元,电子签名设备接收服务器发送的5个分别代表2元货币面值的第一单位数据包,但由于传输过程中数据丢失,电子签名设备仅接收到4个分别代表2元货币面值的第一单位数据包,货币面值总和为8元,与交易金额10元不相等。针对该笔交易,电子签名设备向服务器发送重发请求,并接收服务器根据重发请求发送的重发信息,该重发请求中包括:电子签名设备的设备标识以及交易记录,服务器在接收到该重发请求后,可以根据设备标识以及交易记录查询到该电子签名设备对应的该笔交易,服务器会将查询到的电子签名设备请求重发的该笔交易的第一单位数据包全部重发给电子签名设备,即服务器发送给电子签名设备的该重发信息包括5个分别代表2元货币面值的第一单位数据包。电子签名设备将之前存储于安全芯片中的4个分别代表2元货币 面值的第一单位数据包删除,并重新存储服务器重发的5个分别代表2元货币面值的第一单位数据包。由此,当电子签名设备没有接收到一笔交易所需的全部第一单位数据包时,服务器可以将该笔交易所需的全部第一单位数据包重发给电子签名设备,从而使交易能够顺利完成。For example, for a transaction numbered 1*******, the transaction amount in the transaction request of the electronic signature device is 10 yuan, and the electronic signature device receives 5 values representing the face value of the 2 yuan currency respectively sent by the server. The first unit data packet, but due to data loss during transmission, the electronic signature device only receives four first unit data packets respectively representing the denomination of the 2-yuan currency, and the sum of the currency denominations is 8 yuan, which is not equal to the transaction amount of 10 yuan. For the transaction, the electronic signature device sends a retransmission request to the server, and receives retransmission information sent by the server according to the retransmission request, where the retransmission request includes: a device identifier of the electronic signature device and a transaction record, and the server receives the After the request is resent, the transaction corresponding to the electronic signature device may be queried according to the device identifier and the transaction record, and the server resends the first unit data packet of the transaction that the queried electronic signature device requests to resend to the transaction. The electronic signature device, that is, the retransmission information sent by the server to the electronic signature device, includes five first unit data packets respectively representing the denomination of the 2-yuan currency. The electronic signature device stores the four previously stored in the security chip for the two-yuan currency. The first unit packet of the denomination is deleted, and the first unit packet representing the denomination of the 2-yuan currency, respectively, is re-stored by the server. Thus, when the electronic signature device does not receive all of the first unit data packets required for a transaction, the server can resend all of the first unit data packets required for the transaction to the electronic signature device, thereby enabling the transaction to enable the transaction. Done successfully.
再例如,在服务器接收重发请求之后,该交易方法还包括:服务器根据重发请求向电子签名设备发送重发信息,其中,重发信息包括电子签名设备未接收到的第一单位数据包。电子签名设备将未接收到的第一单位数据包存储于安全芯片中。For another example, after the server receives the resend request, the transaction method further includes: the server sending the retransmission information to the electronic signature device according to the retransmission request, wherein the retransmission information includes the first unit data packet that is not received by the electronic signature device. The electronic signature device stores the unreceived first unit data packet in the security chip.
作为一种可选的实施方式,电子签名设备在向服务器发送重发请求后,接收服务器根据重发请求发送的重发信息,其中,该重发请求中至少包括:电子签名设备的设备标识、交易记录以及接收到的各个第一单位数据包的数据包标识,重发信息包括电子签名设备未接收到的第一单位数据包,即在该可选的实施方式中,服务器向电子签名设备重发了一笔交易中漏发的或传输过程中丢失的第一单位数据包,根据设备标识以及交易记录可以查询到该电子签名设备对应的某一笔交易,服务器会将查询到的该电子签名设备请求重发的该笔交易中没有查询到的数据包标识对应的那些第一单位数据包重发给电子签名设备,以保证电子签名设备收到完整的第一单位数据包,服务器与电子签名设备的交易无误(如充值无误)。与上一例中的可选实施方式相比,本可选实施方式可以减少服务器的数据传输量,大大降低服务器的工作负荷,提高服务器重发的工作效率。As an optional implementation, the electronic signature device, after sending the resend request to the server, receives the retransmission information sent by the server according to the retransmission request, where the retransmission request includes at least: the device identifier of the electronic signature device, a transaction record and a received packet identifier of each first unit data packet, the retransmission information including a first unit data packet not received by the electronic signature device, that is, in the optional embodiment, the server is heavy to the electronic signature device A first unit data packet missed or lost during transmission is sent, and a corresponding transaction corresponding to the electronic signature device can be queried according to the device identification and the transaction record, and the server will query the electronic signature. The first unit data packet corresponding to the unidentified data packet identifier of the transaction requesting retransmission of the device is resent to the electronic signature device to ensure that the electronic signature device receives the complete first unit data packet, the server and the electronic signature. The transaction of the equipment is correct (such as recharge). Compared with the optional implementation in the previous example, the optional implementation manner can reduce the data transmission volume of the server, greatly reduce the workload of the server, and improve the working efficiency of server retransmission.
在该可选实施方式中,在电子签名设备接收到服务器重发的第一单位数据包后,电子签名设备将之前未接收到的第一单位数据包存储于安全芯片中,即电子签名设备将重新接收到的第一单位数据包存储在安全芯片之前分配的存储空间中,并将占用的存储空间的状态字置为已占用,由此保证同一存储空间只能存储一个第一单位数据包。In the optional implementation, after the electronic signature device receives the first unit data packet resent by the server, the electronic signature device stores the first unit data packet that has not been received before in the security chip, that is, the electronic signature device The re-received first unit data packet is stored in the storage space allocated before the security chip, and the status word of the occupied storage space is set to be occupied, thereby ensuring that only one first unit data packet can be stored in the same storage space.
举例来说,对于一笔编号为1*******的交易,电子签名设备的交易请求中的交易金额为5元,电子签名设备接收服务器发送的2个分别代表2元货币面值的第一单位数据包(简称2元数据包),以及1个代表1元货币面值的第一单位数据包(简称1元数据包),但由于传输过程中数据丢失,电子签名设备仅接收到2个2元数据包,货币面值总和为4元,与交易金额5元不相等。针对该笔交易,电子签名设备向服务器发送重发请求,并接收服务器根据重发请求发送的重发信息,在重发请求中还携带有2个2元数据包的数据包标识,服务器接收到该重发请求后,针对该电子签名设备的该笔交易可以查询到其对应的所有第一单位数据包,便可以发现重发请求中没有1元数据包的数据包标识,服务器可以将该1元数据包重发给电子签名设备,即服务器发送给电子签名设备的该重发信息包括1个1元数据包。电子签名设备将服务器重发的1个1元数据包存储于安全芯片中。本实施例中,电子签名设备向服务器发送的重发请求中可以包括已经被接收到的部分第一单位数据包的数据包标识,服务器可以根据重发请求中的数据包标识来确定重发信息中需要携带的第一单位数据包。由此,当电子签名设备没有接收到一笔交易所需的全部第一单位数据包时,服务器可以将未收到的部分第一单位数据包重发给电子签名设备,不仅减少了重发数据的传输量,也保证了交易能够顺利完成。For example, for a transaction numbered 1*******, the transaction amount in the transaction request of the electronic signature device is 5 yuan, and the electronic signature device receives two of the two face currency values respectively sent by the server. The first unit data packet (referred to as a 2-yuan data packet), and a first unit data packet (referred to as a 1-yuan data packet) representing a denomination of a 1-yuan currency, but the electronic signature device only receives 2 due to data loss during transmission. A 2-yuan data packet, the sum of currency face values is 4 yuan, which is not equal to the transaction amount of 5 yuan. For the transaction, the electronic signature device sends a retransmission request to the server, and receives the retransmission information sent by the server according to the retransmission request, and the retransmission request further carries the data packet identifier of two 2-yuan data packets, and the server receives the packet identifier. After the retransmission request, the transaction for the electronic signature device can query all the corresponding first unit data packets, and then the packet identifier of the unrequested data packet in the retransmission request can be found, and the server can The metadata packet is retransmitted to the electronic signature device, that is, the retransmission information sent by the server to the electronic signature device includes one 1-yuan data packet. The electronic signature device stores one 1-byte data packet retransmitted by the server in the security chip. In this embodiment, the retransmission request sent by the electronic signature device to the server may include the data packet identifier of the part of the first unit data packet that has been received, and the server may determine the retransmission information according to the data packet identifier in the retransmission request. The first unit packet that needs to be carried. Therefore, when the electronic signature device does not receive all the first unit data packets required for a transaction, the server may resend some of the first unit data packets that are not received to the electronic signature device, thereby reducing retransmission data. The amount of transmission also ensures that the transaction can be completed smoothly.
以上均是以一笔交易的实施方式为例进行说明的,在本实施例中,对于多笔交易中的每笔交易都可以按照上述方式来实现。The above is described by taking an implementation manner of a transaction as an example. In this embodiment, each transaction in a plurality of transactions can be implemented in the above manner.
在本实施例中,电子签名设备的存储空间毕竟是有限的,因此,需要随时监控电子签名设备的剩余空间,以便于即时释放存储空间,避免在交易过程中没有多余空间造成交易失败的问题。在本实施例一种可选的实施方式中,电子签名设备还设 置有计数器,通过该计数器可以实时监控电子签名设备的剩余存储空间。具体地,在步骤S13之后,该交易方法还包括:电子签名设备利用计数器的计数值得到当前存储的第一单位数据包的总个数。具体地,在每一笔交易中计数器都会加上该笔交易接收到第一单位数据包的个数,在多笔交易之后,计数器的计数值会累计到一个数值,当该数值达到预设数值时,说明电子签名设备的存储空间已分配完毕,没有多余的存储空间了,此时,电子签名设备需要进行请求服务器更新数据包或者申请新的存储空间的操作(如上所述)。在本实施例中,每个存储空间的大小相同,每个第一单位数据包的大小相同,且与存储空间的大小匹配,例如,电子签名设备给一个第一单位数据包分配的存储空间的大小为2M,该2M的存储空间可以存储一个第一单位数据包,而一个安全芯片预留存储第一单位数据包的空间为1G,那么,该电子签名设备最多可以存储512个第一单位数据包,即预设数值可以设为512。由此,可以实时监控电子签名设备的剩余空间,并及时释放出多余的存储空间,避免在交易过程中没有多余空间造成交易失败的问题。当然,电子签名设备还可以利用计数器的计数值得到安全芯片中存储的每种货币面值的第一单位数据包的总个数。由此,电子签名设备可以根据存储的每种第一单位数据包所代表的货币面值以及个数得到当前存储的第一单位数据包的货币总额。In this embodiment, the storage space of the electronic signature device is limited after all. Therefore, the remaining space of the electronic signature device needs to be monitored at any time, so as to release the storage space in an instant, and avoid the problem that the transaction fails if there is no extra space in the transaction process. In an optional implementation manner of this embodiment, the electronic signature device is further configured. A counter is provided through which the remaining storage space of the electronic signature device can be monitored in real time. Specifically, after the step S13, the transaction method further includes: the electronic signature device uses the count value of the counter to obtain the total number of the first unit data packets currently stored. Specifically, in each transaction, the counter adds the number of the first unit data packet received by the transaction, and after multiple transactions, the counter value of the counter is accumulated to a value when the value reaches a preset value. When the storage space of the electronic signature device has been allocated, there is no redundant storage space. At this time, the electronic signature device needs to perform an operation of requesting the server to update the data packet or apply for a new storage space (as described above). In this embodiment, each storage space has the same size, and each first unit data packet has the same size and matches the size of the storage space, for example, the storage space allocated by the electronic signature device to a first unit data packet. The size is 2M, the 2M storage space can store a first unit data packet, and a security chip reserves the space for storing the first unit data packet as 1G, then the electronic signature device can store up to 512 first unit data. The package, the preset value can be set to 512. Thereby, the remaining space of the electronic signature device can be monitored in real time, and the redundant storage space is released in time, so as to avoid the problem that the transaction fails if there is no extra space in the transaction process. Of course, the electronic signature device can also use the count value of the counter to obtain the total number of first unit data packets of each currency denomination stored in the security chip. Thus, the electronic signature device can obtain the total amount of money of the currently stored first unit data packet according to the currency face value and the number of the money represented by each stored first unit data packet.
在本实施例一种可选的实施方式中,在步骤S13之后,该交易方法还包括:电子签名设备将交易金额计入当前账户余额,向持有用户显示交易金额和/或当前账户余额。由此,持有电子签名设备的用户可以在自己的设备上查询交易金额以及当前账户余额。In an optional implementation manner of this embodiment, after the step S13, the transaction method further includes: the electronic signature device includes the transaction amount into the current account balance, and displays the transaction amount and/or the current account balance to the holding user. Thus, the user holding the electronic signature device can query the transaction amount and the current account balance on his own device.
采用本实施例提供的电子签名设备的交易方法,可以将用户的资金以数据包的形式存储于用户的电子签名设备中,且数据包的个数为一个或多个。用户在消费时,因为资金不再是以数值的形式存储于电子签名设备中,所以电子签名设备不需要通过与服务器联网来更改存储的数值,仅需将符合消费金额的一个或多个第一单位数据包发送给收款方即可,由此,电子签名设备在与其他电子签名设备进行电子交易时不再需要依托服务器进行联网支付,服务器不再需要对电子签名设备进行监管,从而真正地实现脱机电子交易。With the transaction method of the electronic signature device provided in this embodiment, the user's funds can be stored in the user's electronic signature device in the form of data packets, and the number of data packets is one or more. When the user is consuming, since the funds are no longer stored in the electronic signature device in the form of numerical values, the electronic signature device does not need to change the stored value by networking with the server, and only needs one or more firsts that meet the consumption amount. The unit data packet can be sent to the payee. Therefore, the electronic signature device does not need to rely on the server for online payment when performing electronic transactions with other electronic signature devices, and the server no longer needs to supervise the electronic signature device, thereby truly Implement offline electronic trading.
实施例2Example 2
图2为本实施例提供的另一种电子签名设备的交易方法的流程图。如图2所示,该交易方法包括以下步骤S21~S23:FIG. 2 is a flowchart of another method for processing an electronic signature device according to an embodiment of the present invention. As shown in FIG. 2, the transaction method includes the following steps S21 to S23:
步骤S21,第二电子签名设备将交易请求发送至第一电子签名设备,其中,交易请求至少包括:交易金额;Step S21: The second electronic signature device sends a transaction request to the first electronic signature device, where the transaction request includes at least: a transaction amount;
在本实施例中,第一电子签名设备和第二电子签名设备可以进行线下交易(即无需与服务器联网完成交易),两者均可以为具有签名功能的电子设备,例如,具有签名功能的智能卡(公交卡、银行卡、购物卡等等)、工行的U盾等等。在本实施例一种可选的实施方式中,第一电子签名设备与第二电子签名设备均可设有有线接口或无线接口,第二电子签名设备可以通过有线或无线连接方式与第一电子签名设备建立通信连接,其中,无线连接方式包括但不限于:蓝牙、NFC近场通讯或WIFI。当然,第二电子签名设备还可以通过有线或无线连接方式与外接设备建立连接,通过外接设备向第一电子签名设备发送交易请求,第一电子签名设备也可以通过有线或无线连接方式与外接设备建立连接,通过外接设备接收第二电子签名设备发送的交易请求,其中,外接设备包括但不限于:手机、PC或平板电脑等可以进行通讯的电子设备。由此,两个电子签名 设备之间可以直接接收对方的交易请求,进而执行后续的交易流程,无需再与后台服务器联网获取对方的交易请求,执行后续的交易流程,能够实现真正意义上的线下交易。In this embodiment, the first electronic signature device and the second electronic signature device can perform offline transactions (ie, no need to complete the transaction with the server), and both can be electronic devices with a signature function, for example, having a signature function. Smart cards (bus cards, bank cards, shopping cards, etc.), U-Shields from ICBC, etc. In an optional implementation manner of the embodiment, the first electronic signature device and the second electronic signature device may each be provided with a wired interface or a wireless interface, and the second electronic signature device may be connected to the first electronic device by using a wired or wireless connection. The signing device establishes a communication connection, wherein the wireless connection manner includes but is not limited to: Bluetooth, NFC near field communication or WIFI. Of course, the second electronic signature device can also establish a connection with the external device through a wired or wireless connection, and send a transaction request to the first electronic signature device through the external device, and the first electronic signature device can also connect to the external device through a wired or wireless connection. Establishing a connection, and receiving, by the external device, a transaction request sent by the second electronic signature device, where the external device includes but is not limited to: an electronic device capable of communicating, such as a mobile phone, a PC, or a tablet computer. Thus, two electronic signatures The device can directly receive the transaction request of the other party, and then execute the subsequent transaction process, and no need to network with the background server to obtain the transaction request of the other party, execute the subsequent transaction process, and realize the offline transaction in a true sense.
例如,用户在商场购物,在需要支付时,商场收银台的第二电子签名设备会向用户的第一电子签名设备发送携带有交易金额的交易请求,该交易金额便是用户购物需要支付的金额,以便第一电子签名设备向第二电子签名设备发送与交易金额对应的第二单位数据包(即第一电子签名设备发送的第二单位数据包的货币面值的总和等于交易金额),两个电子签名设备都可以是完全独立、无需联网的设备,例如两张卡片之间就可以实现上述交易,实现线下交易,交易简便快捷。For example, when the user purchases at the mall, when the payment is needed, the second electronic signature device of the cashier at the mall sends a transaction request carrying the transaction amount to the first electronic signature device of the user, and the transaction amount is the amount that the user needs to pay for the purchase. So that the first electronic signature device sends the second unit data packet corresponding to the transaction amount to the second electronic signature device (ie, the sum of the currency denominations of the second unit data packet sent by the first electronic signature device is equal to the transaction amount), two The electronic signature devices can be completely independent and do not need to be connected to the network. For example, the above transactions can be realized between two cards, and offline transactions can be realized, and the transaction is simple and quick.
为了进一步提高两个电子签名设备之间数据传输的安全性,在步骤S21之前,在本实施例一种可选的实施方式中,第二电子签名设备可以与第一电子签名设备建立安全通道,并利用安全通道进行数据传输。由此可以提高第二电子签名设备与第一电子签名设备之间数据传输的安全性。In order to further improve the security of the data transmission between the two electronic signature devices, in an optional implementation manner of the embodiment, the second electronic signature device may establish a secure channel with the first electronic signature device. And use the secure channel for data transmission. Thereby, the security of data transmission between the second electronic signature device and the first electronic signature device can be improved.
步骤S22,第一电子签名设备接收交易请求,并从其安全芯片中获取至少一个第二单位数据包,将上述至少一个第二单位数据包发送至第二电子签名设备。Step S22: The first electronic signature device receives the transaction request, and acquires at least one second unit data packet from the security chip, and sends the at least one second unit data packet to the second electronic signature device.
其中,每个第二单位数据包代表多种货币面值中的一种货币面值,每个第二单位数据包至少包括:第二单位数据、服务器对第二单位数据签名得到的第三签名数据,至少一个第二单位数据包所代表的货币面值的总和等于交易金额;Wherein, each second unit data packet represents one currency face value of the plurality of currency denominations, and each second unit data packet includes at least: the second unit data, and the third signature data obtained by the server for signing the second unit data, The sum of the currency denominations represented by the at least one second unit data packet is equal to the transaction amount;
本实施例中,每个第二单位数据包代表多种货币面值中的一种货币面值,上述至少一个第二单位数据包所代表的货币面值的总和等于交易金额。In this embodiment, each second unit data packet represents one currency denomination of the plurality of currency denominations, and the sum of the currency denominations represented by the at least one second unit data packet is equal to the transaction amount.
本实施例中,每个第二单位数据包代表多种货币面值中的一种货币面值,也就是说,货币面值共有多种,当第一电子签名设备仅将一个第二单位数据包发送至第二电子签名设备时,该第二单位数据包仅代表其中的一种货币面值。本实施例中的第二单位数据包与实施例1中所提供的第一单位数据包具有相同的特征,对第二单位数据包的具体描述可以参见实施例1中对第一单位数据包的描述,在此不再赘述。In this embodiment, each second unit data packet represents one of a plurality of currency denominations, that is, a plurality of currency denominations are used, and when the first electronic signature device transmits only one second unit data packet to In the case of the second electronic signature device, the second unit data packet represents only one of the currency denominations. The second unit data packet in this embodiment has the same features as the first unit data packet provided in Embodiment 1. For a detailed description of the second unit data packet, refer to the first unit data packet in Embodiment 1. Description, no longer repeat here.
在本实施例一种可选的实施方式中,第二单位数据包中至少包括第二单位数据,该第二单位数据至少包括:货币面值数据,或者,货币序号和货币面值数据。其中,货币面值数据为第二单位数据包所代表的货币面值,以此来标识第二单位数据包所代表的货币面值,货币序号为每个第二单位数据包的唯一序号,即不同的第二单位数据包中的货币序号是不同的。由此,能够保证每个第二单位数据包的唯一性,以便于辨认第二单位数据包的真伪。作为一种可选的实施方式,第二单位数据包至少还包括以下之一:发行银行标识和银行证书序号。其中,发行银行标识为发行该第二单位数据包的银行的标识信息,由此,第二电子签名设备可以根据该标识查询到对应的发行银行的相关信息,而且,第二电子签名设备可以根据发行银行标识和银行证书序号获取对应的发行银行的银行证书,银行证书中包含有发行银行的公钥,以便于后续第二电子签名设备利用发行银行的公钥对第二单位数据的签名完成验证。In an optional implementation manner of this embodiment, the second unit data packet includes at least second unit data, and the second unit data includes at least: currency denomination data, or currency serial number and currency denomination data. Wherein, the currency denomination data is the currency denomination represented by the second unit data packet, thereby identifying the currency denomination represented by the second unit data packet, and the currency serial number is the unique serial number of each second unit data packet, that is, different numbers The currency numbers in the two-unit data package are different. Thereby, the uniqueness of each second unit data packet can be guaranteed to facilitate identification of the authenticity of the second unit data packet. As an optional implementation manner, the second unit data packet further includes at least one of the following: an issuing bank identifier and a bank certificate serial number. The issuing bank identifier is the identification information of the bank that issues the second unit data packet, and the second electronic signature device can query the related information of the corresponding issuing bank according to the identifier, and the second electronic signature device can The issuing bank identifier and the bank certificate serial number are used to obtain the corresponding bank certificate of the issuing bank, and the bank certificate includes the issuing bank's public key, so that the subsequent second electronic signature device can verify the signature of the second unit data by using the issuing bank's public key. .
在本实施例一种可选的实施方式中,每个第二单位数据包至少包括:第二单位数据、服务器对所述第二单位数据签名得到的第三签名数据。作为一种可选的实施方式,服务器利用自身的私钥分别对每个第二单位数据包中的第二单位数据进行签名,得到与每个第二单位数据包对应的第三签名数据。具体地,以服务器为银行服务器为例,服务器利用自身的私钥进行签 名是指银行服务器根据发行银行标识和银行证书序号获取对应的私钥,利用该私钥进行签名。服务器将上述至少一个携带有第三签名数据的第二单位数据包发送至第一电子签名设备。第二电子签名设备在从第一电子签名设备进行收款操作时,从第一电子签名设备接收上述至少一个携带有第三签名数据的第二单位数据包,以便于后续步骤中第二电子签名设备可以利用服务器的公钥验证第二单位数据包的真实性。In an optional implementation manner of this embodiment, each second unit data packet includes at least: second unit data, and third signature data obtained by the server to sign the second unit data. As an optional implementation manner, the server separately signs the second unit data in each second unit data packet by using its own private key, to obtain third signature data corresponding to each second unit data packet. Specifically, taking the server as a bank server as an example, the server uses its own private key to sign The name refers to the bank server obtaining the corresponding private key according to the issuing bank identifier and the bank certificate serial number, and signing with the private key. The server sends the at least one second unit data packet carrying the third signature data to the first electronic signature device. Receiving, by the second electronic signature device, the at least one second unit data packet carrying the third signature data from the first electronic signature device, when the second electronic signature device performs the collection operation from the first electronic signature device, so as to facilitate the second electronic signature in the subsequent step. The device can use the server's public key to verify the authenticity of the second unit packet.
在本实施例另一种可选的实施方式中,第二电子签名设备发送至第一电子签名设备的交易请求中还包括:第二电子签名设备的设备标识;每个第二单位数据包还包括:第一电子签名设备对第二单位数据和第二电子签名设备的设备标识签名得到的第四签名数据。作为一种可选的实施方式,第一电子签名设备利用自身的私钥对第二单位数据和第二电子签名设备的设备标识进行签名,得到与每个第二单位数据包对应的第四签名数据。第二电子签名设备在从第一电子签名设备进行收款操作时,从第一电子签名设备接收至少一个携带有第四签名数据的第二单位数据包,以便于后续步骤中第二电子签名设备利用第一电子签名设备的公钥验证第二单位数据包的正确性。In another optional implementation manner of this embodiment, the transaction request sent by the second electronic signature device to the first electronic signature device further includes: a device identifier of the second electronic signature device; each second unit data packet is further The method includes: the fourth signature data obtained by the first electronic signature device by using the second unit data and the device identifier of the second electronic signature device. As an optional implementation manner, the first electronic signature device uses the private key of the first electronic signature to sign the second unit data and the device identifier of the second electronic signature device to obtain a fourth signature corresponding to each second unit data packet. data. Receiving, by the second electronic signature device, at least one second unit data packet carrying the fourth signature data from the first electronic signature device, when the second electronic signature device performs the collection operation from the first electronic signature device, so as to facilitate the second electronic signature device in the subsequent step. The correctness of the second unit data packet is verified using the public key of the first electronic signature device.
在本实施例中,第一电子签名设备在收到第二电子签名设备发送的交易请求后,会从自身的账户余额中扣除第二电子签名设备请求的交易金额,并为第二电子签名设备下发货币面值的总和等于交易金额的至少一个第二单位数据包,在第二电子签名设备接收到这些第二单位数据包,如转账成功后,便完成了线下交易,第二电子签名设备不需要再与服务器联网便可以接收第一电子签名设备转账(即接收第一电子签名设备发送的至少一个第二单位数据包)。每个第二单位数据包所代表的货币面值可以相同也可以不同,第一电子签名设备发送给第二电子签名设备的第二单位数据包的个数以及各个第二单位数据包所代表的货币面值可以由第一电子签名设备根据交易金额确定,也可以由第二电子签名设备根据交易金额确定后告知第一电子签名设备,例如,作为本实施例中的一种可选实施方式,第二电子签名设备发送的交易请求中还可以携带所需第二单位数据包的种类以及个数。前者第一电子签名设备可以灵活实现第二单位数据包的下发,后者可以满足第二电子签名设备的用户对第二单位数据包的个数以及面值的需求。In this embodiment, after receiving the transaction request sent by the second electronic signature device, the first electronic signature device deducts the transaction amount requested by the second electronic signature device from the account balance of the second electronic signature device, and is the second electronic signature device. The sum of the issued currency face values is equal to at least one second unit data packet of the transaction amount, and after the second electronic signature device receives the second unit data packets, if the transfer is successful, the offline transaction is completed, and the second electronic signature device is completed. The first electronic signature device transfer (ie, receiving at least one second unit data packet sent by the first electronic signature device) may be received without networking with the server. The currency denomination value represented by each second unit data packet may be the same or different, and the number of the second unit data packet sent by the first electronic signature device to the second electronic signature device and the currency represented by each second unit data packet The face value may be determined by the first electronic signature device according to the transaction amount, or may be notified by the second electronic signature device according to the transaction amount, and then notified to the first electronic signature device, for example, as an optional implementation manner in this embodiment, the second The transaction request sent by the electronic signature device may also carry the type and number of the required second unit data packets. The first electronic signature device of the former can flexibly implement the delivery of the second unit data packet, and the latter can satisfy the requirement of the number of the second unit data packet and the face value of the user of the second electronic signature device.
对于第二电子签名设备根据交易金额确定第二单位数据包的个数,以及各个第二单位数据包所代表的货币面值的情况,第一电子签名设备的安全芯片中很有可能没有存储第二电子签名设备请求的货币面值对应的第二单位数据包或者存储的个数不足请求的个数,作为本实施例中的一种可选实施方式,第一电子签名设备可以向第二电子签名设备发送提示信息,该提示信息可以包括:对应货币面值的第二单位数据包不存在或者个数不足的信息,第二电子签名设备可以根据交易金额更换第二电子单位货币数据包所代表的货币面值与个数的组合策略,或者,由第一电子签名设备根据交易金额更换第二电子单位货币数据包所代表的货币面值与个数的组合策略。例如,第一电子签名设备收到第二电子签名设备转账10元的交易请求,并请求发送5个代表2元的第二单位数据包(下称2元数据包),但第一电子签名设备只有4个2元数据包,则向第二电子签名设备发送只有4个2元数据包,2元数据包个数不足的提示信息,此时,第二电子签名设备可以更换组合策略,例如,向第一电子签名设备返回请求发送4个2元数据包、2个1元数据包的响应,或者,第一电子签名设备在向第二电子签名设备发送提示信息后,收到第二电子签名设备的确认响应,则第一电子签名设备可以随机确定一种组合策略,例如,将4个2元数据包、2个1元数据包发送至第二电子签名设备,由此,解决第一电子签名设备的安全芯片中存储的第二单位数据包的个 数不足或不存在的问题。For the case where the second electronic signature device determines the number of the second unit data packets according to the transaction amount and the currency denomination value represented by each second unit data packet, there is a possibility that the security chip of the first electronic signature device does not store the second The second unit data packet corresponding to the currency denomination requested by the electronic signature device or the number of stored data is insufficient. As an optional implementation manner in this embodiment, the first electronic signature device may be used to the second electronic signature device. Sending the prompt information, the prompt information may include: information that the second unit data packet of the corresponding currency denomination does not exist or the number of the data is insufficient, and the second electronic signature device may replace the currency denomination represented by the second electronic unit currency data packet according to the transaction amount. A combination strategy with the number, or a combination strategy of the currency denomination and the number represented by the second electronic unit currency data packet by the first electronic signature device according to the transaction amount. For example, the first electronic signature device receives the transaction request of the second electronic signature device to transfer 10 yuan, and requests to send 5 second unit data packets representing 2 yuan (hereinafter referred to as 2 yuan data packets), but the first electronic signature device If there are only 4 binary data packets, the message is sent to the second electronic signature device with only 4 binary data packets and the number of 2 metadata packets is insufficient. At this time, the second electronic signature device can replace the combination policy, for example, Returning, to the first electronic signature device, a response requesting to send 4 2-yuan data packets and 2 1--value data packets, or the first electronic signature device receiving the second electronic signature after transmitting the prompt information to the second electronic signature device The acknowledgment response of the device, the first electronic signature device may randomly determine a combination policy, for example, sending four 2-yuan data packets and two 1-yuan data packets to the second electronic signature device, thereby solving the first electronic One of the second unit data packets stored in the security chip of the signing device A problem with insufficient or non-existent.
此外,在具体实施时,还存在第一电子签名设备的安全芯片中存储的第二单位数据包所代表的货币面值无法拼凑出与交易金额相等的上述至少一个第二单位数据包的问题,为了解决该问题,在本实施例一种可选的实施方式中,在步骤S21之后,步骤S22中第一电子签名设备从其安全芯片中获取至少一个第二单位数据包之前,本实施例提供的方法还包括:第一电子签名设备发送待找零信息,第二电子签名设备接收该待找零信息,其中,待找零信息由第一电子签名设备根据交易金额以及自身安全芯片中存储的第二单位数据包所代表的货币面值确定,例如,待找零信息可以包括需要第二电子签名设备返回的找回零钱的货币面值。如果第二电子签名设备存储有代表该找回零钱货币面值的第二单位数据包,或者,存储有货币面值的总和等于该找回零钱的第二单位数据包,则第二电子签名设备可以向第一电子签名设备返回确认响应,即告知第一电子签名设备自己存有找零用的第二单位数据包,第一电子签名设备在接收到第二电子签名设备发送的找零信息(即返回确认相应)之后,第一电子签名设备从安全芯片中获取至少一个第二单位数据包,其中,上述至少一个第二单位数据包所代表的货币面值的总和应等于交易金额加上找回零钱的货币面值。In addition, in a specific implementation, there is also a problem that the currency denomination represented by the second unit data packet stored in the security chip of the first electronic signature device cannot piece together the at least one second unit data packet equal to the transaction amount, in order to To solve the problem, in an optional implementation manner of this embodiment, after the step S21, before the first electronic signature device acquires at least one second unit data packet from the security chip in the step S22, the embodiment provides The method further includes: the first electronic signature device sends the information to be changed, and the second electronic signature device receives the information to be changed, wherein the information to be changed is determined by the first electronic signature device according to the transaction amount and the number stored in the security chip. The currency denomination represented by the two-unit data packet determines, for example, the information to be changed may include a currency denomination that requires the second electronic signature device to return the change. If the second electronic signature device stores a second unit data packet representing the face value of the change coin currency, or the sum of the currency face values stored is equal to the second unit data packet for retrieving the change, the second electronic signature device may The first electronic signature device returns an acknowledgment response, that is, the first electronic signature device is notified that the second unit data packet for the change is stored, and the first electronic signature device receives the change information sent by the second electronic signature device (ie, returns a confirmation Correspondingly, the first electronic signature device acquires at least one second unit data packet from the security chip, wherein the sum of the currency denominations represented by the at least one second unit data packet is equal to the transaction amount plus the currency for retrieving the change face value.
例如,交易金额为7元,第一电子签名设备的安全芯片中存储有5个分别代表2元货币面值的第二单位数据包(下称2元数据包),则第一电子签名设备无法利用该5个2元数据包拼凑出7元货币面值,第一电子签名设备只能利用安全芯片中存储的5个2元数据包拼凑出与交易金额7元最接近且大于交易金额的货币面值,即第一电子签名设备可以利用4个2元数据包拼凑出8元货币面值,还需要第二电子签名设备找回1元零钱,即在第一电子签名设备将4个2元数据包发送给第二电子签名设备后,第二电子签名设备需要向第一电子签名设备返回1个1元数据包(代表1元货币面值的第二单位数据包)。第一电子签名设备向第二电子签名设备发送携带有找回零钱为1元的待找零信息,其中,待找零信息用于询问第二电子签名设备是否可以找回所代表的货币面值总和为1元的第二单位数据包。如果第二电子签名设备的安全芯片中存储有所代表的货币面值总和为1元的第二单位数据包,则向第一电子签名设备发送找零信息,即同意向第一电子签名设备返回代表1元或者货币面值总和为1元的第二单位数据包。第一电子签名设备在接收到找零信息之后,从安全芯片中获取4个2元数据包发送至第二电子签名设备,第二电子签名设备会再返回给第一电子签名设备1个1元数据包(代表1元货币面值的第二单位数据包)。由此,当无法拼凑出所代表的货币面值总和与交易金额相等的第二单位数据包时,可以通过找零机制完成电子交易,使得电子交易更加方便。For example, if the transaction amount is 7 yuan, the first electronic signature device cannot use the second unit data packet (hereinafter referred to as a 2-yuan data packet) respectively representing the denomination of the 2-yuan currency in the security chip of the first electronic signature device. The five 2-yuan data packages piece together the 7-yuan currency denomination, and the first electronic signature device can only use the five 2-yuan data packets stored in the security chip to piece together the currency face value that is closest to the transaction amount of 7 yuan and larger than the transaction amount. That is, the first electronic signature device can use the four 2-yuan data packets to piece together the 8-yuan currency denomination, and the second electronic signature device needs to retrieve 1 dollar change, that is, the first electronic signature device sends 4 2-yuan data packets to the first electronic signature device. After the second electronic signature device, the second electronic signature device needs to return a 1-yuan data packet (a second unit data packet representing a 1-yuan currency denomination) to the first electronic signature device. The first electronic signature device sends, to the second electronic signature device, the information to be changed that carries the change of change of 1 yuan, wherein the information to be changed is used to ask whether the second electronic signature device can retrieve the sum of the currency values represented by the second electronic signature device. The second unit packet is 1 yuan. If the security chip of the second electronic signature device stores the second unit data packet whose representative currency denomination sum is 1 yuan, sending the change information to the first electronic signature device, that is, agreeing to return the representative to the first electronic signature device The second unit data packet of 1 yuan or the sum of currency face values is 1 yuan. After receiving the change information, the first electronic signature device acquires four 2-yuan data packets from the security chip and sends them to the second electronic signature device, and the second electronic signature device returns to the first electronic signature device for 1 yuan. A packet (a second unit packet representing the face value of a currency). Therefore, when it is impossible to piece together the second unit data packet whose sum of the face value of the money represented is equal to the transaction amount, the electronic transaction can be completed through the zero change mechanism, making the electronic transaction more convenient.
本实施例中,为了防止电子签名设备非法重复使用同一个第二单位数据包,造成第二单位数据包流通的混乱,保证同一个第二单位数据包在支付过程中的唯一性,本实施例第一电子签名设备将上述至少一个第二单位数据包发送至第二电子签名设备的方式至少包括以下两种之一:In this embodiment, in order to prevent the electronic signature device from illegally reusing the same second unit data packet, the second unit data packet is confusing, and the uniqueness of the same second unit data packet in the payment process is ensured. The manner in which the first electronic signature device sends the at least one second unit data packet to the second electronic signature device includes at least one of the following two types:
方式一:method one:
在步骤S22中,在第一电子签名设备将上述至少一个第二单位数据包发送至第二电子签名设备之后,第一电子签名设备删除获取的至少一个第二单位数据包,由于第一电子签名设备在根据交易金额获取到该至少一个第二单位数据包并发送至第二电子签名设备之后,本地其实还保留着已发送的这些第二单位数据包,并不会自动执行删除的动作,因此,本方式中, 为了保证第一电子签名设备无法再重复使用这些第二单位数据,在第一电子签名设备将上述至少一个第二单位数据包发送至第二电子签名设备之后,会强制删除已发送过的这些第二单位数据包,并将对应的存储空间的状态字置为未占用。由此,第一电子签名设备可以在支付第二单位数据包之后,将自身存储的已支付的第二单位数据包删除,保证了第一电子签名设备不能重复使用也无法恢复出已发送过的第二单位数据包,即保证了同一个第二单位数据包在支付过程中的唯一性;In step S22, after the first electronic signature device transmits the at least one second unit data packet to the second electronic signature device, the first electronic signature device deletes the acquired at least one second unit data packet, because the first electronic signature After the device obtains the at least one second unit data packet according to the transaction amount and sends the data to the second electronic signature device, the local device data packet that has been sent remains in the local device, and the deletion action is not automatically performed. In this way, In order to ensure that the second electronic signature device can no longer reuse the second unit data, after the first electronic signature device sends the at least one second unit data packet to the second electronic signature device, the transmitted Two unit data packets, and the status word of the corresponding storage space is set to be unoccupied. Therefore, the first electronic signature device can delete the saved second unit data packet stored by the first electronic signature device after the second unit data packet is saved, thereby ensuring that the first electronic signature device cannot be reused and cannot be restored. The second unit data packet guarantees the uniqueness of the same second unit data packet in the payment process;
在该方式一中,第二电子签名设备接收到第一电子签名设备发送的至少一个第二单位数据包后,便直接存储,由于第一电子签名设备已经删除该至少一个第二单位数据包,第二电子签名设备接收到的第二单位数据包都是唯一的,不会出现重复的数据包。In the first mode, after receiving the at least one second unit data packet sent by the first electronic signature device, the second electronic signature device directly stores, because the first electronic signature device has deleted the at least one second unit data packet, The second unit data packet received by the second electronic signature device is unique, and duplicate data packets do not appear.
方式二:Method 2:
在步骤S22中,第一电子签名设备发送给第二电子签名设备的至少一个第二单位数据包为密文形式,即第一电子签名设备将至少一个第二单位数据包发送至第二电子签名设备,包括:第一电子签名设备对上述至少一个第二单位数据进行加密,得到至少一个第三单位数据包,并将上述至少一个第三单位数据包发送至第二电子签名设备;第二电子签名设备接收第一电子签名设备发送的上述至少一个第二单位数据包,包括:第二电子签名设备接收上述至少一个第三单位数据包,对上述至少一个第三单位数据包进行解密,得到至少一个第二单位数据包。例如,第二电子签名设备从第一电子签名设备接收到5个代表2元的第三单位数据包,对每个代表2元的第三单位数据包解密得到5个代表2元的第二单位数据包。第二电子签名设备接收到的至少一个第三单位数据包中包括数据密文,其中,数据密文由第一电子签名设备对每个第二单位数据包中的部分或全部数据进行加密操作得到的。具体地,第二单位数据包中可以包括:第二单位数据、第三签名数据、第四签名数据、数据包标识和第二电子签名设备的设备标识等,第一电子签名设备对每个第二单位数据包中的部分数据进行加密是指:第一电子签名设备至少对第二单位数据包中的第二单位数据进行加密,例如,第一电子签名设备可以对第二单位数据包中的第二单位数据和数据包标识进行加密。本实施例中,第一电子签名设备对每个第二单位数据包中的部分或全部数据进行的加密操作为不可逆操作,即,第一电子签名设备可以加密得到第三单位数据包,却不能从第三单位数据包解密得到第二单位数据包,因此,当得到的至少一个第三单位数据包覆盖了对应的至少一个第二单位数据包时,第一电子签名设备中仅仅存储了加密的第三单位数据包,由于其不能对第三单位数据包解密,所以无法恢复出第二单位数据包,也就不能再重复使用这些第二单位数据包。In step S22, the at least one second unit data packet sent by the first electronic signature device to the second electronic signature device is in a cipher text form, that is, the first electronic signature device sends the at least one second unit data packet to the second electronic signature. The device includes: the first electronic signature device encrypts the at least one second unit data, obtains at least one third unit data packet, and sends the at least one third unit data packet to the second electronic signature device; Receiving, by the signature device, the at least one second unit data packet sent by the first electronic signature device, the second electronic signature device receiving the at least one third unit data packet, and decrypting the at least one third unit data packet to obtain at least A second unit packet. For example, the second electronic signature device receives five third unit data packets representing two yuan from the first electronic signature device, and decrypts each third unit data packet representing two yuan to obtain five second units representing two yuan. data pack. The at least one third unit data packet received by the second electronic signature device includes a data ciphertext, wherein the data ciphertext is encrypted by the first electronic signature device for some or all of the data in each second unit data packet. of. Specifically, the second unit data packet may include: second unit data, third signature data, fourth signature data, a data packet identifier, and a device identifier of the second electronic signature device, where the first electronic signature device Encrypting part of the data in the two unit data packet means that the first electronic signature device encrypts at least the second unit data in the second unit data packet, for example, the first electronic signature device may be in the second unit data packet. The second unit data and the packet identifier are encrypted. In this embodiment, the encryption operation performed by the first electronic signature device on some or all of the data in each second unit data packet is an irreversible operation, that is, the first electronic signature device can encrypt the third unit data packet, but cannot Decrypting the third unit data packet from the third unit data packet, so that when the obtained at least one third unit data packet covers the corresponding at least one second unit data packet, only the encrypted content is stored in the first electronic signature device The third unit data packet cannot recover the second unit data packet because it cannot decrypt the third unit data packet, and the second unit data packet cannot be reused.
具体地,作为一种可选的实施方式,第一电子签名设备对至少一个第二单位数据进行加密,包括:第一电子签名设备利用第二电子签名设备的公钥至少对每个第二单位数据包中的第二单位数据加密,得到数据密文;第二电子签名设备对至少一个第三单位数据包进行解密,包括:第二电子签名设备利用第二电子签名设备的私钥至少对每个第三单位数据包中的数据密文进行解密。作为另一种可选的实施方式,第一电子签名设备对至少一个第二单位数据包进行加密,包括:第一电子签名设备利用与第二电子签名设备关联的对称密钥至少对每个第二单位数据包中的第二单位数据进行加密,得到数据密文;第二电子签名设备对至少一个第三单位数据包进行解密,包括:第二电子签名设备利用与第一电子签名设备关联的对称密钥至少对每个第三单位数据包中的数据密文进行解密。 Specifically, as an optional implementation manner, the first electronic signature device encrypts the at least one second unit data, including: the first electronic signature device uses the public key of the second electronic signature device for at least each second unit Encrypting the second unit data in the data packet to obtain the data ciphertext; the second electronic signature device decrypting the at least one third unit data packet, including: the second electronic signature device using the private key of the second electronic signature device, at least for each The data ciphertext in the third unit data packet is decrypted. As another optional implementation manner, the first electronic signature device encrypts the at least one second unit data packet, including: the first electronic signature device utilizes a symmetric key associated with the second electronic signature device, at least for each The second unit data in the two unit data packet is encrypted to obtain the data ciphertext; the second electronic signature device decrypts the at least one third unit data packet, including: the second electronic signature device uses the first electronic signature device The symmetric key decrypts at least the data ciphertext in each third unit data packet.
对于前一种可选实施方式,第二电子签名设备可以在发送给第一电子签名设备的交易请求中还包括第二电子签名设备的公钥,或者第一电子签名设备可以向第三方认证平台获取第二电子签名设备的数字证书,该数字证书中保存有第二电子签名设备的公钥。由此,第一电子签名设备可以获取到第二电子签名设备的公钥。For the foregoing optional implementation manner, the second electronic signature device may further include a public key of the second electronic signature device in the transaction request sent to the first electronic signature device, or the first electronic signature device may authenticate the platform to the third party. Obtaining a digital certificate of the second electronic signature device, where the public key of the second electronic signature device is stored in the digital certificate. Thereby, the first electronic signature device can acquire the public key of the second electronic signature device.
在第一电子签名设备对至少一个第二单位数据包进行加密之后,本实施例提供的方法还包括:第一电子签名设备用每个第三单位数据包覆盖安全芯片中存储的每个第二单位数据包。本实施例中,用每个第三单位数据包覆盖安全芯片中存储的每个第二单位数据包是指,第一电子签名设备将生成的每个第三单位数据包写入对应的原第二单位数据包的存储空间,替换掉原来的第二单位数据包。例如,将数据包标识为1***的第二单位数据包加密生成第三单位数据包,并写入该1***对应的存储空间中。由此,第一电子签名设备在进行第二单位数据包支付之后,对于已发送给第二电子签名设备的第二单位数据包,第一电子签名设备的安全芯片仅存储由第二电子签名设备公钥进行加密后得到的对应的第三单位数据包,而第一电子签名设备不可能有第二电子签名设备的私钥,因此第一电子签名设备无法对该第三单位数据包进行解密,无法恢复出第二单位数据包,也就不能再重复使用这些第二单位数据包,保证了同一个第二单位数据包的唯一性,而且该第三单位数据包是利用第二电子签名设备的公钥加密的,所以该第三单位数据包仅可由第二电子签名设备进行解密(只有第二电子签名设备存有自己的私钥),从而仅有收款方(即第二电子签名设备)可以拥有并能够使用未加密的第二单位数据包,其他电子签名设备即便非法获取到该第三单位数据包,也因为没有第二电子签名设备的私钥而无法解密不能使用获取到的第二单位数据包,从而保证了第二单位数据包流通的安全性。After the first electronic signature device encrypts the at least one second unit data packet, the method provided by the embodiment further includes: the first electronic signature device overwrites each second stored in the security chip with each third unit data packet. Unit data packet. In this embodiment, covering each second unit data packet stored in the security chip with each third unit data packet means that the first electronic signature device writes each generated third unit data packet into a corresponding original The storage space of the two-unit data packet replaces the original second unit data packet. For example, the second unit data packet with the data packet identified as 1*** is encrypted to generate a third unit data packet, and is written into the storage space corresponding to the 1***. Thus, after the second unit data packet device performs the second unit data packet payment, the security chip of the first electronic signature device stores only the second electronic signature device for the second unit data packet that has been sent to the second electronic signature device. The third unit data packet obtained by the public key is encrypted, and the first electronic signature device cannot have the private key of the second electronic signature device, so the first electronic signature device cannot decrypt the third unit data packet. The second unit data packet cannot be recovered, and the second unit data packet cannot be reused, the uniqueness of the same second unit data packet is guaranteed, and the third unit data packet is utilized by the second electronic signature device. The public key is encrypted, so the third unit data packet can only be decrypted by the second electronic signature device (only the second electronic signature device stores its own private key), so that only the payee (ie, the second electronic signature device) Can have and can use the unencrypted second unit data packet, even if other electronic signature devices illegally obtain the third unit data packet, because there is no The private key of the second electronic signature device cannot be decrypted and the acquired second unit data packet cannot be used, thereby ensuring the security of the second unit data packet circulation.
对于后一种可选实施方式,对称密钥由第一电子签名设备与第二电子签名设备进行协商得到,也就是说,第一电子签名设备在进行加密操作时使用的对称密钥与第二电子签名设备在进行解密操作时使用的对称密钥是相同的。在第一电子签名设备对至少一个第二单位数据包进行加密之后,本实施例提供的方法还包括:第一电子签名设备用每个第三单位数据包覆盖安全芯片中存储的每个第二单位数据包,并删除该对称密钥。本实施例中,用每个第三单位数据包覆盖安全芯片中存储的每个第二单位数据包是指,第一电子签名设备将生成的每个第三单位数据包写入对应的原第二单位数据包的存储空间,替换掉原来的第二单位数据包。例如,将数据包标识为1***的第二单位数据包加密生成第三单位数据包,并写入该1***对应的存储空间中。在该利用对称密钥加解密的方式中,如果第一电子签名设备中还拥有对称密钥,就可以对第三单位数据包解密恢复出第二单位数据包,因此,本实施例中,在第一电子签名设备将至少一个第二单位数据包发送至第二电子签名设备之后,必须强制删除对称密钥,由此,第一电子签名设备在进行第二单位数据包支付之后,对于已发送给第二电子签名设备的第二单位数据包,第一电子签名设备的安全芯片仅存储由第二电子签名设备利用对称密钥加密后得到的对应的第三单位数据包,而由于第一电子签名设备已将进行加密使用的对称密钥删除,所以,第一电子签名设备无法再对该第三单位数据包进行解密,无法恢复出第二单位数据包,也就不能再重复使用这些第二单位数据包,保证了同一个第二单位数据包的唯一性,而且,该对称密钥只有第一电子签名设备和第二电子签名设备知道,因此,该第三单位数据包仅可由第二电子签名设备进行解密,从而仅有收款方(即第二电子签名设备)可以拥有并能够使用未加密的第二单位数据包,其他电子签名设备即便非法获取到该第三单位数据包,也因为没有该对称密钥无法通过解密获取到第二单位数据包,从而保证了第二单位数据包流通的安全 性。For the latter optional implementation, the symmetric key is negotiated by the first electronic signature device and the second electronic signature device, that is, the symmetric key used by the first electronic signature device in performing the encryption operation and the second The symmetric key used by the electronic signature device to perform the decryption operation is the same. After the first electronic signature device encrypts the at least one second unit data packet, the method provided by the embodiment further includes: the first electronic signature device overwrites each second stored in the security chip with each third unit data packet. Unit the packet and delete the symmetric key. In this embodiment, covering each second unit data packet stored in the security chip with each third unit data packet means that the first electronic signature device writes each generated third unit data packet into a corresponding original The storage space of the two-unit data packet replaces the original second unit data packet. For example, the second unit data packet with the data packet identified as 1*** is encrypted to generate a third unit data packet, and is written into the storage space corresponding to the 1***. In the manner of using the symmetric key encryption and decryption, if the first electronic signature device further has a symmetric key, the third unit data packet can be decrypted and restored to the second unit data packet. Therefore, in this embodiment, After the first electronic signature device sends the at least one second unit data packet to the second electronic signature device, the symmetric key must be forcibly deleted, whereby the first electronic signature device sends the second unit data packet after the second unit data packet payment Giving a second unit data packet of the second electronic signature device, the security chip of the first electronic signature device storing only the corresponding third unit data packet obtained by the second electronic signature device using the symmetric key encryption, and The signature device has deleted the symmetric key used for encryption. Therefore, the first electronic signature device can no longer decrypt the third unit data packet, and cannot recover the second unit data packet, and the second unit cannot be reused. The unit data packet guarantees the uniqueness of the same second unit data packet, and the symmetric key has only the first electronic signature And the second electronic signature device knows that, therefore, the third unit data packet can only be decrypted by the second electronic signature device, so that only the payee (ie, the second electronic signature device) can own and can use the unencrypted second Unit data packet, even if the other electronic signature device illegally acquires the third unit data packet, the second unit data packet cannot be obtained by decryption without the symmetric key, thereby ensuring the security of the second unit data packet circulation. Sex.
在该可选实施方式中,作为一种可选的方式,对称密钥可以为异或因子,该异或因子可以是第二电子签名设备和第一电子签名设备协商得到的一组字符或数字的序列,用于进行异或运算;具体地,第一电子签名设备利用与第二电子签名设备关联的对称密钥至少对每个第二单位数据包中的第二单位数据进行加密,得到数据密文,包括:第一电子签名设备利用异或因子至少对每个第二单位数据包中的第二单位数据进行异或运算,得到数据密文;第二电子签名设备利用与第一电子签名设备关联的对称密钥至少对每个第二单位数据包中的数据密文进行解密,包括:第二电子签名设备利用异或因子至少对每个第三单位数据包中的数据密文进行异或运算。异或运算也属于一种对称解密运算方式,但相比其他对称解密运算的方式,异或运算的速度较快,由此,可以提高第二电子签名设备对第三单位数据包进行解密生成第二单位数据包的效率。In this optional implementation manner, as an optional manner, the symmetric key may be an exclusive OR factor, and the exclusive OR factor may be a set of characters or numbers negotiated by the second electronic signature device and the first electronic signature device. a sequence for performing an exclusive OR operation; specifically, the first electronic signature device encrypts at least the second unit data in each second unit data packet by using a symmetric key associated with the second electronic signature device to obtain data The ciphertext includes: the first electronic signature device uses an exclusive OR factor to perform an exclusive OR operation on the second unit data in each second unit data packet to obtain a data ciphertext; and the second electronic signature device utilizes the first electronic signature The symmetric key associated with the device decrypts at least the data ciphertext in each second unit data packet, including: the second electronic signature device uses the XOR factor to perform at least the data ciphertext in each third unit data packet. Or operation. The XOR operation also belongs to a symmetric decryption operation mode, but the XOR operation is faster than other symmetric decryption operations. Therefore, the second electronic signature device can be modified to decrypt the third unit data packet. The efficiency of two unit packets.
本实施例中,在步骤S22中至少可以通过以上几种方式来防止电子签名设备非法重复使用同一个第二单位数据包,造成第二单位数据包流通的混乱,保证同一个第二单位数据包在支付过程中的唯一性。当然本实施例并不排除其他实施方式,只要可以达到相同的技术效果即可。In this embodiment, in step S22, at least the above manners can be prevented to prevent the electronic signature device from illegally reusing the same second unit data packet, thereby causing confusion in the circulation of the second unit data packet, and ensuring the same second unit data packet. Uniqueness in the payment process. Of course, this embodiment does not exclude other embodiments as long as the same technical effects can be achieved.
此外,在方式二中,第三单位数据包为密文,保证了传输数据的安全性,且即便被其他设备截获,也很难破解,进一步提高了第二单位数据包流通的安全性。此外,在第一电子签名设备收到交易请求后,为了保证交易的安全,还需要得到第一电子签名设备的持有用户的确认,才能执行后续的交易操作,在本实施例一种可选的实施方式中,第二电子签名设备发送的交易请求至少包括:第二电子签名设备的设备标识。在步骤S22中的第一电子签名设备从其安全芯片中获取至少一个第二单位数据包之前,第一电子签名设备向持有用户提示交易金额和第二电子签名设备的设备标识,并接收到持有用户的确认信息。在本实施例一种可选的实施方式中,第二电子签名设备的设备标识可以为第二电子签名设备的出厂序列号,也可以为第二电子签名设备的设备名称,还可以为第二电子签名设备持有用户的姓名。通过该设备标识,第一电子签名设备的持有用户可以确认该第二电子签名设备是否为用户同意的交易对象,只有用户对交易金额和交易对象都认可后,用户才会选择确认这笔交易,由此通过用户对交易的确认来保证该笔交易的安全。In addition, in the second mode, the third unit data packet is ciphertext, which ensures the security of the transmitted data, and even if intercepted by other devices, it is difficult to crack, further improving the security of the second unit data packet circulation. In addition, after the first electronic signature device receives the transaction request, in order to ensure the security of the transaction, the confirmation of the holding user of the first electronic signature device is also required to perform the subsequent transaction operation, which is optional in this embodiment. In an implementation manner, the transaction request sent by the second electronic signature device includes at least: a device identifier of the second electronic signature device. Before the first electronic signature device in step S22 acquires at least one second unit data packet from its security chip, the first electronic signature device prompts the holding user for the transaction amount and the device identifier of the second electronic signature device, and receives the Hold the user's confirmation message. In an optional implementation manner of the embodiment, the device identifier of the second electronic signature device may be a factory serial number of the second electronic signature device, or may be a device name of the second electronic signature device, or may be a second The electronic signature device holds the name of the user. Through the device identification, the holding user of the first electronic signature device can confirm whether the second electronic signature device is a transaction object agreed by the user, and the user selects to confirm the transaction only after the user approves the transaction amount and the transaction object. Thus, the security of the transaction is guaranteed by the user's confirmation of the transaction.
作为一种可选的实施方式,第一电子签名设备设置有显示屏或扬声器,通过自身设置的显示屏显示或者通过自身设置的扬声器语音播报交易金额和第二电子签名设备的设备标识;或者,第一电子签名设备与外接设备建立连接,通过外接设备的显示屏或扬声器向持有用户提示交易金额和第二电子签名设备的设备标识。由此,可以方便用户确认付款金额以及收款方是否正确。作为一种可选的实施方式,第一电子签名设备上可以设置有确认按键,用户通过该确认按键进行确认。当然,第一电子签名设备上还可以设置确认信息输入组件,该确认信息输入组件具体可以包括:PIN码输入键盘或指纹输入组件。由此,用户可以通过输入PIN码或者指纹的方式输入确认信息,在对电子交易的相关信息进行确认的同时,第一电子签名设备也可以对持有用户的身份进行验证,进一步提高电子交易的安全性。As an optional implementation manner, the first electronic signature device is provided with a display screen or a speaker, and displays the transaction amount and the device identifier of the second electronic signature device through the display screen set by itself or through the speaker voice set by itself; or The first electronic signature device establishes a connection with the external device, and prompts the holding user with the transaction amount and the device identifier of the second electronic signature device through the display screen or the speaker of the external device. This makes it easy for the user to confirm the payment amount and whether the payee is correct. As an optional implementation manner, the first electronic signature device may be provided with a confirmation button, and the user confirms by using the confirmation button. Certainly, the confirmation information input component may be further disposed on the first electronic signature device, and the confirmation information input component may specifically include: a PIN code input keyboard or a fingerprint input component. Therefore, the user can input the confirmation information by inputting the PIN code or the fingerprint, and while confirming the related information of the electronic transaction, the first electronic signature device can also verify the identity of the holding user, thereby further improving the electronic transaction. safety.
步骤S23,第二电子签名设备接收上述至少一个第二单位数据包,对上述至少一个第二单位数据包中的第三签名数据进行验证,在验证通过后,将上述至少一个第二单位数据包存储于安全芯片中。Step S23: The second electronic signature device receives the at least one second unit data packet, and verifies the third signature data in the at least one second unit data packet, and after the verification is passed, the at least one second unit data packet is Stored in a security chip.
在本实施例一种可选的实施方式中,第二电子签名设备中设置有安全芯片,该安全芯片内部拥有独立的处理器和存储单 元,可存储PKI数字证书和密钥,以及其他特征数据,对数据进行加解密运算,为用户提供数据加密和身份安全认证服务,本实施例中,第二电子签名设备可以将从第一电子签名设备或从其他后台服务器(如银行服务器或商场购物充值服务器等第三方服务器)接收到的第二单位数据包存储于安全芯片中,由于安全芯片的存储单元内的数据不能被非法读出,由此可以保证存储单元中存储数据的安全性。In an optional implementation manner of this embodiment, the second electronic signature device is provided with a security chip, and the security chip has an independent processor and a storage list therein. The device can store the PKI digital certificate and the key, and other feature data, and perform encryption and decryption operations on the data to provide the user with data encryption and identity security authentication services. In this embodiment, the second electronic signature device can be used from the first electronic device. The second unit data packet received by the signature device or from another back-end server (such as a third-party server such as a bank server or a shopping mall recharge server) is stored in the security chip, because the data in the storage unit of the security chip cannot be illegally read. This ensures the security of the data stored in the storage unit.
在步骤S23中的第二电子签名设备将上述至少一个第二单位数据包存储于安全芯片中之前,本实施例提供的方法还包括:第二电子签名设备的安全芯片分配用于存储上述至少一个第二单位数据包的存储空间。在本实施例中,步骤S23中将上述至少一个第二单位数据包存储于安全芯片中,具体包括:将上述至少一个第二单位数据包存储于对应的存储空间中,并将对应的存储空间的状态字置为已占用。其中,安全芯片为每个第二单位数据包分配一个存储空间,一个存储空间只能存储一个第二单位数据包,且第二电子签名设备的交易记录中也会记录一笔交易中从其他电子签名设备接收到的各个第二单位数据包存储的存储空间的位置。存储空间的状态字用于标识该存储空间是否已经被占用,如果已经被占用,则第二电子签名设备不能在该被占用的存储空间存储第二单位数据包。当安全芯片分配的所有存储空间都已被占用时,第二电子签名设备需要进行请求后台服务器更新数据包或者申请新的存储空间的操作,其中,作为一种可选的实施方式,第二电子签名设备可以申请新的存储空间以存储新接收到的第二单位数据包。作为另一种可选的实施方式,第二电子签名设备还可以向后台服务器请求更新本地存储的第二单位数据包,例如,第二电子签名设备可以请求后台服务器将本地存储的N个(N为大于1的正整数)代表小面值的第二单位数据包替换为1个或M个(M<N)代表大货币面值的第二单位数据包进行存储,只要存储的货币金额不变即可,由此便可以释放多个存储空间,从而节省出存储空间以存储新接收到的第二单位数据包。此外,为了进一步提高数据存储的安全性,在本步骤中,第二电子签名设备还可以将每个第二单位数据包进行加密得到每个第二单位数据包的密文数据,并将每个密文数据存储于对应的存储空间中。由此,可以保证存储在安全芯片的存储空间中的第二单位数据包不能被恶意复制或更改,以此确保存储第二单位数据包的安全性。Before the second electronic signature device in the step S23 stores the at least one second unit data packet in the security chip, the method provided in this embodiment further includes: the security chip allocation of the second electronic signature device is used to store the at least one The storage space of the second unit packet. In this embodiment, storing the at least one second unit data packet in the security chip in step S23, specifically: storing the at least one second unit data packet in a corresponding storage space, and corresponding storage space The status word is set to be occupied. Wherein, the security chip allocates one storage space for each second unit data packet, one storage space can only store one second unit data packet, and the transaction record of the second electronic signature device also records a transaction from other electronic The location of the storage space stored by each of the second unit data packets received by the signature device. The status word of the storage space is used to identify whether the storage space is already occupied, and if it is already occupied, the second electronic signature device cannot store the second unit data packet in the occupied storage space. When all the storage space allocated by the security chip is occupied, the second electronic signature device needs to perform an operation of requesting the background server to update the data packet or apply for a new storage space, wherein, as an optional implementation, the second electronic The signing device can request a new storage space to store the newly received second unit data packet. As another optional implementation manner, the second electronic signature device may further request to update the locally stored second unit data packet to the background server. For example, the second electronic signature device may request the background server to store the locally stored N (N). The second unit data packet representing the facet value is replaced by one or M (M<N) second unit data packets representing the face value of the large currency, as long as the stored currency amount is unchanged. Thus, a plurality of storage spaces can be released, thereby saving storage space to store newly received second unit data packets. In addition, in order to further improve the security of data storage, in this step, the second electronic signature device may further encrypt each second unit data packet to obtain ciphertext data of each second unit data packet, and each will be The ciphertext data is stored in the corresponding storage space. Thereby, it can be ensured that the second unit data packet stored in the storage space of the security chip cannot be maliciously copied or changed, thereby ensuring the security of storing the second unit data packet.
在本实施例中,为了保证步骤S23中第二电子签名设备存储的第二单位数据包的真实性,第二电子签名设备对第三签名数据进行验证,在验证通过后将上述至少一个第二单位数据包存储于安全芯片中。其中,第三签名数据是服务器对第二单位数据进行签名得到的,每个第二单位数据包至少包括:第二单位数据以及服务器对第二单位数据签名得到的第三签名数据,由此使得第二电子签名设备可以验证第二单位数据包的真实性。作为一种可选的实施方式,第三签名数据为服务器利用自身的私钥对第二单位数据进行签名得到的签名数据。相应的,第二电子签名设备对第三签名数据进行验证具体包括:第二电子签名设备利用该服务器的公钥对第三签名数据进行验签。由此,第二电子签名设备利用银行的公钥对第二单位数据包中携带的第三签名数据进行验签,可以验证第二单位数据包的真实性。In this embodiment, in order to ensure the authenticity of the second unit data packet stored by the second electronic signature device in step S23, the second electronic signature device verifies the third signature data, and after the verification is passed, the at least one second The unit data packet is stored in the security chip. The third signature data is obtained by the server signing the second unit data, and each second unit data packet includes at least: the second unit data and the third signature data obtained by the server for signing the second unit data, thereby The second electronic signature device can verify the authenticity of the second unit data packet. As an optional implementation manner, the third signature data is signature data obtained by the server by using the private key of the server to sign the second unit data. Correspondingly, the verifying the third signature data by the second electronic signature device comprises: the second electronic signature device performing the verification of the third signature data by using the public key of the server. Therefore, the second electronic signature device uses the public key of the bank to perform the verification of the third signature data carried in the second unit data packet, so that the authenticity of the second unit data packet can be verified.
进一步地,第二电子签名设备在确保收到的第二单位数据包是真实的前提下,还想再确认接收到的第二单位数据包是否为真实的第一电子签名设备所发送以及第一电子签名设备发送的对象是否确实为第二电子签名设备本身,以避免存储第一电子签名设备误发的数据包,在执行步骤S23中的第二电子签名设备将上述至少一个第二单位数据包存储于安全芯片中之前,该交易方法还包括:第二电子签名设备对第四签名数据进行验证,在验证通过后执行步骤将至少一个第二单位数据包存 储于安全芯片中的步骤。其中,第四签名数据是第一电子签名设备对第二单位数据和第二电子签名设备的设备标识签名得到的,因此,在本实施例一种可选的实施方式中,第二电子签名设备发送给第一电子签名设备的交易请求中还包括:第二电子签名设备的设备标识;第一电子签名设备发送给第二电子签名设备的每个第二单位数据包至少包括:第二单位数据、第一电子签名设备对第二单位数据和第二电子签名设备的设备标识签名得到的第四签名数据,由此使得第二电子签名设备可以验证第二单位数据包的真实性和正确性。作为一种可选的实施方式,第四签名数据为第一电子签名设备利用自身的私钥对第二单位数据和第二电子签名设备的设备标识进行签名得到的签名数据,也就是说,每个第四签名数据的签名对象为每个第二单位数据和第二电子签名设备的设备标识的组合。相应的,第二电子签名设备对第四签名数据进行验证具体包括:第二电子签名设备利用第一电子签名设备的公钥分别对每个第四签名数据进行验签。第二电子签名设备可以从第一电子签名设备获取第一电子签名设备的数字证书,并从该数字证书中获取第一电子签名设备的公钥。当然,第二电子签名设备也可以预存第一电子签名设备以及其他电子签名设备的数字证书,并从第一电子签名设备获取第一电子签名设备的设备标识,根据该设备标识获取预存的第一电子签名设备的数字证书,从该数字证书中获取第一电子签名设备的公钥。由此,第二电子签名设备利用第一电子签名设备的公钥对第二单位数据包中携带的第四签名数据进行验签,可以证明第二单位数据包确实是第一电子签名设备下发给该第二电子签名设备的,即验证第二单位数据包的正确性。Further, the second electronic signature device further confirms whether the received second unit data packet is sent by the first first electronic signature device and is first, on the premise of ensuring that the received second unit data packet is authentic. Whether the object sent by the electronic signature device is indeed the second electronic signature device itself to avoid storing the data packet that is sent by the first electronic signature device, and the second electronic signature device in step S23 performs the at least one second unit data packet. Before being stored in the security chip, the transaction method further includes: the second electronic signature device verifies the fourth signature data, and after performing the verification, executing the step of storing the at least one second unit data packet The steps stored in the security chip. The fourth signature data is obtained by the first electronic signature device signing the second unit data and the device identifier of the second electronic signature device. Therefore, in an optional implementation manner of the embodiment, the second electronic signature device The transaction request sent to the first electronic signature device further includes: a device identifier of the second electronic signature device; each second unit data packet sent by the first electronic signature device to the second electronic signature device includes: at least: second unit data And obtaining, by the first electronic signature device, the fourth signature data obtained by signing the second unit data and the device identifier of the second electronic signature device, thereby enabling the second electronic signature device to verify the authenticity and correctness of the second unit data packet. As an optional implementation manner, the fourth signature data is signature data obtained by the first electronic signature device by using the private key of the first electronic unit to sign the device identifier of the second unit data and the second electronic signature device, that is, each The signature object of the fourth signature data is a combination of each of the second unit data and the device identifier of the second electronic signature device. Correspondingly, the verifying, by the second electronic signature device, the fourth signature data comprises: performing, by the second electronic signature device, each fourth signature data by using a public key of the first electronic signature device. The second electronic signature device may acquire the digital certificate of the first electronic signature device from the first electronic signature device, and obtain the public key of the first electronic signature device from the digital certificate. Of course, the second electronic signature device may also pre-store the digital certificate of the first electronic signature device and the other electronic signature device, and obtain the device identifier of the first electronic signature device from the first electronic signature device, and obtain the first pre-stored according to the device identifier. A digital certificate of the electronic signature device, from which the public key of the first electronic signature device is obtained. Therefore, the second electronic signature device uses the public key of the first electronic signature device to perform the verification of the fourth signature data carried in the second unit data packet, and can prove that the second unit data packet is actually sent by the first electronic signature device. For the second electronic signature device, the correctness of the second unit data packet is verified.
为了方便第二电子签名设备验证从第一电子签名设备接收到的至少一个第二单位数据包是否为重放数据,本实施例中,第二单位数据包中还包括:数据包标识。In order to facilitate the second electronic signature device to verify whether the at least one second unit data packet received from the first electronic signature device is the playback data, in the embodiment, the second unit data packet further includes: a data packet identifier.
作为一种可选的实施方式,第二电子签名设备向第一电子签名设备发送的交易请求中还包括:数据包标识。在第一电子签名设备将至少一个第二单位数据包或第三单位数据包逐一发送至第二电子签名设备的情况下,第一电子签名设备可以将交易请求中的数据包标识添加在一个第二单位数据包或一个第三单位数据包中并将其发送至第二电子签名设备;在第一电子签名设备将至少一个第二单位数据包或第三单位数据包一起发送至第二电子签名设备的情况下,第一电子签名设备可以将交易请求中的数据包标识添加在交易金额对应的所有第二单位数据包或第三单位数据包中并将其发送至第二电子签名设备,具体地,第一电子签名设备将对应的数据包标识添加至第二单位数据包中后,再将该第二单位数据包或将该第二单位数据包生成的第三单位数据包发送给第二电子签名设备,第二电子签名设备接收该第三单位数据包。本实施例中,为了防止重复接收到某个第二单位数据包,具体地,步骤S23中第二电子签名设备将上述至少一个第二单位数据包存储于安全芯片中包括:第二电子签名设备判断接收到的第二单位数据包中的数据包标识是否与发送的交易请求中的数据包标识相同,如果不相同,则第二电子签名设备将数据包标识不相同的第二单位数据包丢弃,如果相同,则第二电子签名设备将数据包标识相同的第二单位数据包存储于安全芯片中。由此,可以方便第二电子签名设备对接收到的第二单位数据包(即接收到第三单位数据包后解密得到的第二单位数据包)是否为重放数据进行检验,并且由于数据包标识由第二电子签名设备分配,所以第二电子签名设备能够判断是否已收到全部数据包标识对应的第二单位数据包,为后续步骤中判断是否需要发起重发请求提供便利。以防止重放攻击举例来说,数据包标识为第二电子签名设备生成的随机数R1时,第一电子签名设备在发送一个第二单位数据包之前,从第二电子签名设备获取数据包标识,即随机数R1,并将包括有随机数R1的第二单位数据包发送至第二电子签 名设备。第二电子签名设备可以检验接收到的第二单位数据包中携带的数据包标识是否为随机数R1,如果是,则认为接收到的第二单位数据包为合法的;否则认为接收到的第二单位数据包为重放数据,则丢弃该数据。由此,可以避免第二电子签名设备被重放攻击。As an optional implementation manner, the transaction request sent by the second electronic signature device to the first electronic signature device further includes: a data packet identifier. In a case where the first electronic signature device transmits at least one second unit data packet or the third unit data packet to the second electronic signature device one by one, the first electronic signature device may add the data packet identifier in the transaction request to one of the first Two unit data packets or one third unit data packet and sent to the second electronic signature device; the first electronic signature device sends at least one second unit data packet or the third unit data packet together to the second electronic signature In the case of the device, the first electronic signature device may add the data packet identifier in the transaction request to all the second unit data packets or the third unit data packet corresponding to the transaction amount and send it to the second electronic signature device, specifically The first electronic signature device adds the corresponding data packet identifier to the second unit data packet, and then sends the second unit data packet or the third unit data packet generated by the second unit data packet to the second The electronic signature device receives the third unit data packet by the second electronic signature device. In this embodiment, in order to prevent the second electronic data packet from being repeatedly received, the second electronic signature device storing the at least one second unit data packet in the security chip in the step S23 includes: the second electronic signature device Determining whether the data packet identifier in the received second unit data packet is the same as the data packet identifier in the sent transaction request, and if not, the second electronic signature device discards the second unit data packet with different data packet identifiers If they are the same, the second electronic signature device stores the second unit data packet with the same data packet identifier in the security chip. Thereby, it can be convenient for the second electronic signature device to check whether the received second unit data packet (ie, the second unit data packet obtained after decrypting the third unit data packet) is the playback data, and because the data packet The identifier is allocated by the second electronic signature device, so the second electronic signature device can determine whether the second unit data packet corresponding to the entire data packet identifier has been received, which is convenient for determining whether to initiate the retransmission request in the subsequent step. To prevent the replay attack, for example, when the data packet is identified as the random number R1 generated by the second electronic signature device, the first electronic signature device obtains the data packet identifier from the second electronic signature device before transmitting the second unit data packet. , that is, the random number R1, and send the second unit data packet including the random number R1 to the second electronic signature Name device. The second electronic signature device may check whether the received data packet identifier carried in the second unit data packet is a random number R1, and if yes, consider that the received second unit data packet is legal; otherwise, the received If the two-unit data packet is for playback data, the data is discarded. Thereby, it is possible to prevent the second electronic signature device from being attacked by the playback.
作为另一种可选的实施方式,第二电子签名设备向第一电子签名设备发送的交易请求中还包括:数据包标识起始值。具体地,在本实施例一种可选的实施方式中,第二电子签名设备设有计数器,在步骤S21之前,本实施例提供的方法还包括:第二电子签名设备利用计数器的计数值得到数据包标识起始值,即该计数器的值即为数据包标识起始值,该数据包标识起始值是根据第二电子签名设备每次接收到的数据包的个数累计得到的;因此,在步骤S23之后,本实施例提供的方法还包括:第二电子签名设备的计数器将数据包标识起始值加上接收到的第二单位数据包的总个数计算得到新的数据包标识起始值。由此,第二电子签名设备可以计算并更新数据包标识起始值。第一电子签名设备可以基于数据包标识起始值,并根据待发送给第二电子签名设备的第二单位数据包的总个数计算得到的每个第二单位数据包对应的数据包标识。本实施例中,为了防止重复接收到某个第二单位数据包,具体地,步骤S23中的第二电子签名设备将上述至少一个第二单位数据包存储于安全芯片中包括:第二电子签名设备判断每个第二单位数据包中包含的数据包标识是否满足根据数据包标识起始值确定的预设范围,如果不满足,则第二电子签名设备将数据包标识不满足预设范围的第二单位数据包丢弃,如果满足,则第二电子签名设备将数据包标识满足预设范围的第二单位数据包存储于安全芯片中。As another optional implementation manner, the transaction request sent by the second electronic signature device to the first electronic signature device further includes: a data packet identifier start value. Specifically, in an optional implementation manner of this embodiment, the second electronic signature device is provided with a counter. Before the step S21, the method provided by the embodiment further includes: the second electronic signature device uses the counter value of the counter to obtain The data packet identifier start value, that is, the value of the counter is the packet identifier start value, and the data packet identifier start value is obtained according to the number of data packets received by the second electronic signature device each time; After the step S23, the method provided by the embodiment further includes: the counter of the second electronic signature device calculates the data packet identifier start value plus the total number of the received second unit data packet to obtain a new data packet identifier. Starting value. Thus, the second electronic signature device can calculate and update the packet identification start value. The first electronic signature device may identify the data packet identifier corresponding to each second unit data packet according to the data packet identifier starting value and according to the total number of second unit data packets to be sent to the second electronic signature device. In this embodiment, in order to prevent the second electronic data packet from being repeatedly received, the second electronic signature device in step S23 stores the at least one second unit data packet in the security chip, including: the second electronic signature. The device determines whether the data packet identifier included in each second unit data packet satisfies a preset range determined according to the start value of the data packet identifier, and if not, the second electronic signature device determines that the data packet identifier does not satisfy the preset range. The second unit data packet is discarded. If yes, the second electronic signature device stores the second unit data packet whose data packet identifier meets the preset range in the security chip.
作为一种可选的实施方式,当第二电子签名设备中的计数器为递增型的计数器时,每个第二单位数据包中包含的数据包标识应不小于数据包标识起始值,否则视为重放数据,其中,递增性的计数器是指:第二电子签名设备每接收到一个第二单位数据包,其计数器的计数值增加1。As an optional implementation manner, when the counter in the second electronic signature device is an incremental counter, the identifier of the data packet included in each second unit data packet should be not less than the start value of the data packet identifier, otherwise In order to replay data, wherein the incremental counter means that each time a second unit data packet is received by the second electronic signature device, the counter value of the counter is incremented by one.
举例来说,当交易金额为8元时,第一电子签名设备需要发送给第二电子签名设备三个第二单位数据包,三个第二单位数据包分别代表货币面值1元、2元和5元。第一电子签名设备从第二电子签名设备获取的数据包标识起始值为30,该数据包标识起始值可以为第二电子签名设备的计数器计数累计得到的当前数据包的个数加1,例如,在发起本次交易之前,第二电子签名设备总共存储有29个第二单位数据包,这29个第二单位数据包的数据包标识可以从1至29,那么,接收到的下一个数据包就可以从30起开始标识,则第一电子签名设备基于数据包标识起始值30计算得到:代表1元货币面值的第二单位数据包所对应的数据包标识为30、代表2元货币面值的第二单位数据包所对应的数据包标识为31以及代表3元货币面值的第二单位数据包所对应的数据包标识为32,本实施例中,第二电子签名设备在接收到这3个第二单位数据包后,按照对应的数据包标识进行关联存储,并将原数据包标识起始值30加上3计算得到新的数据包标识起始值33。由此,第一电子签名设备仅需从第二电子签名设备获取一个数据包标识起始值,即可根据待发送给第二电子签名设备的第二单位数据包的个数,灵活计算每个第二单位数据包对应的数据包标识。第二电子签名设备判断接收到的三个第二单位数据包所携带的数据包标识不小于数据包标识起始值30,则将接收到的三个第二单位数据包存储于安全芯片中。当然,本实施例仅以第二电子签名设置的计数器为递增计数器为例,其他形式的计数器(如递减计数器)也在本发明的保护范围内,在此不进行举例说明。由此,第二电子签名设备可以根据数据包标识判断接收到的第二单位数据包是否为重放数据,从而避免第二电子签名设备被 重放攻击。For example, when the transaction amount is 8 yuan, the first electronic signature device needs to send three second unit data packets to the second electronic signature device, and the three second unit data packets respectively represent the currency face value of 1 yuan, 2 yuan, and 5 yuan. The data packet identification starting value obtained by the first electronic signature device from the second electronic signature device is 30, and the data packet identification start value may be the number of current data packets obtained by the counter counting of the second electronic signature device plus one. For example, before initiating the transaction, the second electronic signature device stores a total of 29 second unit data packets, and the packet identification of the 29 second unit data packets can be from 1 to 29, then, the received A data packet can be identified from 30, and the first electronic signature device calculates based on the packet identifier start value 30: the data packet identifier corresponding to the second unit data packet representing the 1-yuan currency denomination is 30, representing 2 The data packet identifier corresponding to the second unit data packet of the face value of the currency currency is 31, and the data packet identifier corresponding to the second unit data packet representing the face value of the three currency currency is 32. In this embodiment, the second electronic signature device is receiving After the three second unit data packets are stored, the associated data is stored according to the corresponding data packet identifier, and the original data packet identifier starting value 30 plus 3 is calculated to obtain a new data packet identifier start. 33. Therefore, the first electronic signature device only needs to acquire a data packet identifier starting value from the second electronic signature device, and can flexibly calculate each according to the number of second unit data packets to be sent to the second electronic signature device. The packet identifier corresponding to the second unit data packet. The second electronic signature device determines that the received data identifier of the three second unit data packets is not less than the data packet identifier start value 30, and stores the received three second unit data packets in the security chip. Of course, in this embodiment, only the counter set by the second electronic signature is an incremental counter. Other types of counters (such as a down counter) are also within the protection scope of the present invention, and are not illustrated herein. Therefore, the second electronic signature device can determine, according to the data packet identifier, whether the received second unit data packet is playback data, thereby preventing the second electronic signature device from being Replay attack.
在步骤S23之后,如果第二电子签名设备没有收到请求的交易金额对应的全部第二单位数据包时,在本实施例一种可选的实施方式中,本实施例提供的方法还包括:第二电子签名设备根据接收到的第二单位数据包的个数以及每个第二单位数据包所代表的货币面值计算接收到的第二单位数据包所代表的货币面值的总和与交易请求中的交易金额是否一致,如果不一致,则向第一电子签名设备发送重发请求;第一电子签名设备接收该重发请求,并根据重发请求将重发信息发送至第二电子签名设备,其中,重发请求中至少包括第二电子签名设备的设备标识和/或每个第二单位数据包对应的数据包标识,以使得第一电子签名设备可以根据该重发请求确定重发信息,重发信息即为第一电子签名设备从给该第二电子签名设备的一笔交易对应的第三单位数据包中选出的全部或部分数据包,以保证第二电子签名设备得到一笔交易的全部第二单位数据包。After the step S23, if the second electronic signature device does not receive all the second unit data packets corresponding to the requested transaction amount, in an optional implementation manner of the embodiment, the method provided in this embodiment further includes: The second electronic signature device calculates the sum of the currency face values represented by the received second unit data packet and the transaction request according to the received number of the second unit data packets and the currency face value represented by each second unit data packet. Whether the transaction amount is consistent, if not, sending a retransmission request to the first electronic signature device; the first electronic signature device receives the retransmission request, and sends the retransmission information to the second electronic signature device according to the retransmission request, wherein And the retransmission request includes at least a device identifier of the second electronic signature device and/or a data packet identifier corresponding to each second unit data packet, so that the first electronic signature device can determine retransmission information according to the retransmission request, The sending information is selected by the first electronic signature device from a third unit data packet corresponding to a transaction of the second electronic signature device. All or part of the data packet to ensure that the second electronic signature device gets all the second unit data packets of a transaction.
在本实施例中,作为一种可选的实施方式,第二电子签名设备接收第一电子签名设备根据重发请求发送的重发信息,其中,重发信息包括至少一个第二单位数据包。第二电子签名设备将之前存储于安全芯片中的至少一个第二单位数据包删除,并重新存储第一电子签名设备重发的至少一个第二单位数据包。作为另一种可选的实施方式,第二电子签名设备接收第一电子签名设备根据重发请求发送的重发信息,其中,重发信息包括第二电子签名设备未接收到的第二单位数据包。第二电子签名设备将未接收到的第二单位数据包存储于安全芯片中。需要说明的是,重发信息中的第二单位数据包可以理解为密文形式,即第一电子签名设备对第二单位数据包加密得到的第三单位数据包,因此,在一种可选的实施方式中,重发信息中实际包括的是第三单位数据包,第二电子签名设备接收到第一电子签名设备发送的重发信息(第三单位数据包)后,对第三单位数据包解密得到第二单位数据包重新存储。In this embodiment, as an optional implementation manner, the second electronic signature device receives the retransmission information sent by the first electronic signature device according to the retransmission request, where the retransmission information includes at least one second unit data packet. The second electronic signature device deletes at least one second unit data packet previously stored in the security chip, and re-stores at least one second unit data packet retransmitted by the first electronic signature device. As another optional implementation manner, the second electronic signature device receives the retransmission information sent by the first electronic signature device according to the retransmission request, where the retransmission information includes the second unit data that is not received by the second electronic signature device. package. The second electronic signature device stores the unreceived second unit data packet in the security chip. It should be noted that the second unit data packet in the retransmission information can be understood as a cipher text form, that is, the third unit data packet obtained by the first electronic signature device for encrypting the second unit data packet, and therefore, in an optional manner In the implementation manner, the third unit data packet is actually included in the retransmission information, and the second electronic signature device receives the retransmission information (the third unit data packet) sent by the first electronic signature device, and then the third unit data. The packet decryption gets the second unit packet re-storage.
对于前者,第二电子签名设备的重发请求中至少包括第二电子签名设备的设备标识,第一电子签名设备的重发信息包括至少一个第二单位数据包,即重发一笔交易的交易金额对应的全部第二单位数据包,作为一种可选的方式,第一电子签名设备可以将该至少一个第二单位数据包以密文形式发送至第二电子签名设备,即将至少一个第三单位数据包发送至第二电子签名设备,可以理解此处的重发信息包括至少一个第三单位数据包,第二电子签名设备将之前存储于安全芯片中的至少一个第二单位数据包删除,并重新存储第一电子签名设备重发的至少一个第二单位数据包(对第三单位数据包解密得到的第二单位数据包);对于后者,第二电子签名设备的重发请求中至少包括:未收到的第二单位数据包的数据包标识,还可以包括:第二电子签名设备的设备标识,第一电子签名设备的重发信息包括第二电子签名设备未接收到的第二单位数据包,即重发请求中数据包标识指示的第二单位数据包,作为一种可选的方式,第一电子签名设备可以将该数据包标识指示的第二单位数据包以密文形式发送至第二电子签名设备,即将该数据包标识指示的第三单位数据包发送至第二电子签名设备,可以理解此处的重发信息包括该数据包标识指示的第三单位数据包,第二电子签名设备将接收到的数据包标识指示的第三单位数据包解密得到的第二单位数据包存储于安全芯片中。For the former, the resend request of the second electronic signature device includes at least the device identifier of the second electronic signature device, and the retransmission information of the first electronic signature device includes at least one second unit data packet, that is, a transaction that resends a transaction. All the second unit data packets corresponding to the amount, as an optional manner, the first electronic signature device may send the at least one second unit data packet to the second electronic signature device in cipher text, that is, at least one third The unit data packet is sent to the second electronic signature device. It can be understood that the retransmission information herein includes at least one third unit data packet, and the second electronic signature device deletes at least one second unit data packet previously stored in the security chip. And re-storing at least one second unit data packet retransmitted by the first electronic signature device (the second unit data packet obtained by decrypting the third unit data packet); for the latter, at least the second electronic signature device resending the request The method includes: a packet identifier of the second unit data packet that is not received, and may further include: a device identifier of the second electronic signature device The retransmission information of the first electronic signature device includes a second unit data packet that is not received by the second electronic signature device, that is, a second unit data packet indicated by the data packet identifier in the retransmission request, as an optional manner, An electronic signature device may send the second unit data packet indicated by the data packet identifier to the second electronic signature device in a cipher text format, that is, the third unit data packet indicated by the data packet identifier is sent to the second electronic signature device, where It is understood that the retransmission information herein includes a third unit data packet indicated by the data packet identifier, and the second electronic signature device stores the second unit data packet obtained by decrypting the third unit data packet indicated by the received data packet identifier in security. In the chip.
对于前者,举例来说,对于一笔编号为1*******的交易,第二电子签名设备的交易请求中的交易金额为10元,第一电子签名设备向第二电子签名设备发送5个分别代表2元货币面值的第二单位数据包,但由于传输过程中数据丢失,第二电子签名设备仅接收到4个分别代表2元货币面值的第二单位数据包,货币面值总和为8元,与交易金额10元不相等。针对 该笔交易,第二电子签名设备向第一电子签名设备发送重发请求,该重发请求中至少携带有第二电子签名设备的设备标识,第一电子签名设备接收第二电子签名设备发送的重发请求后,针对该第二电子签名设备的该笔交易可以查询到其对应的全部第三单位数据包,将5个第三单位数据包携带在重发信息中发送至第二电子签名设备,即将5个分别代表2元货币面值的第二单位数据包以密文的形式携带在重发信息发送至第二电子签名设备。第二电子签名设备接收该重发信息,将重发信息中携带的5个第三单位数据包进行解密,得到对应的5个第二单位数据包,并将之前存储于安全芯片中的4个分别代表2元货币面值的第二单位数据包删除,重新存储解密得到的5个第二单位数据包。由此,第二电子签名设备具有在未接收到电子交易所需的全部第二单位数据包时向第一电子签名设备发送重发请求的功能,第一电子签名设备具有响应第二电子签名设备重发的功能,从而保证了第二电子签名设备可以接收到电子交易所需的全部第二单位数据包,保证交易能够顺利完成。For the former, for example, for a transaction numbered 1*******, the transaction amount in the transaction request of the second electronic signature device is 10 yuan, and the first electronic signature device is to the second electronic signature device. Sending 5 second unit data packets respectively representing the denomination of the 2 yuan currency, but due to data loss during transmission, the second electronic signature device only receives 4 second unit data packets respectively representing the denomination of the 2 yuan currency, and the sum of the currency denominations It is 8 yuan, which is not equal to the transaction amount of 10 yuan. For In the transaction, the second electronic signature device sends a retransmission request to the first electronic signature device, where the retransmission request carries at least the device identifier of the second electronic signature device, and the first electronic signature device receives the second electronic signature device. After the resend request, the transaction for the second electronic signature device may query all corresponding third unit data packets, and carry the 5 third unit data packets in the retransmission information and send to the second electronic signature device. That is, the second unit data packet respectively representing the denomination of the 2-yuan currency is carried in the form of ciphertext and the retransmission information is transmitted to the second electronic signature device. Receiving the retransmission information, the second electronic signature device decrypts the five third unit data packets carried in the retransmission information to obtain five corresponding second unit data packets, and stores the four previously stored in the security chip. The second unit data packet representing the denomination of the 2-yuan currency is deleted, and the 5 second unit data packets obtained by the decryption are re-stored. Thereby, the second electronic signature device has the function of transmitting a retransmission request to the first electronic signature device when all second unit data packets required for the electronic transaction are not received, the first electronic signature device having the response second electronic signature device The function of resending, thereby ensuring that the second electronic signature device can receive all the second unit data packets required for the electronic transaction, and ensure that the transaction can be successfully completed.
对于后者,举例来说,对于一笔编号为1*******的交易,第二电子签名设备的交易请求中的交易金额为5元,第二电子签名设备接收第一电子签名设备发送的2个分别代表2元货币面值的第二单位数据包(简称2元数据包),以及1个代表1元货币面值的第二单位数据包(简称1元数据包),但由于传输过程中数据丢失,第二电子签名设备仅接收到2个2元数据包,货币面值总和为4元,与交易金额5元不相等。针对该笔交易,第二电子签名设备向第一电子签名设备发送重发请求,该重发请求中至少携带有第二电子签名设备的设备标识以及未收到的数据包的数据包标识(即1元数据包的数据包标识)或者已收到的2元数据包的数据包标识,第一电子签名设备接收第二电子签名设备发送的重发请求后,针对该第二电子签名设备的该笔交易可以根据1元数据包的数据包标识查询到对应的第三单位数据包,或者根据4个2元数据包的数据包标识确定未发送成功的1元数据包的数据包标识对应的第三单位数据包,将1元数据包标识对应的第三单位数据包携带在重发信息发送至第二电子签名设备,即将数据包标识对应的第二单位数据包以密文的形式携带在重发信息发送至第二电子签名设备。第二电子签名设备接收该重发信息,将重发信息中携带的1元数据包标识对应的第三单位数据包进行解密,得到1元数据包标识对应的第二单位数据包,并将该1元数据包标识对应的第二单位数据包存储于安全芯片中。由此,第二电子签名设备具有在未接收到电子交易所需的全部第二单位数据包时向第一电子签名设备发送重发请求的功能,并接收第一电子签名设备重发的第二电子签名设备未接收到的第二单位数据包,减少了重发数据的传输量,保证了第二电子签名设备可以接收到电子交易所需的全部第二单位数据包。For the latter, for example, for a transaction numbered 1*******, the transaction amount in the transaction request of the second electronic signature device is 5 yuan, and the second electronic signature device receives the first electronic signature The second unit data packet (referred to as a 2-ary data packet) representing the denomination of the 2-yuan currency, and the second unit data packet (referred to as the 1-ary data packet) representing the denomination of the 1-yuan currency, respectively, but transmitted by the device In the process, the data is lost. The second electronic signature device only receives two 2-yuan data packets, and the sum of the currency face values is 4 yuan, which is not equal to the transaction amount of 5 yuan. For the transaction, the second electronic signature device sends a retransmission request to the first electronic signature device, where the retransmission request carries at least the device identifier of the second electronic signature device and the data packet identifier of the unreceived data packet (ie, a data packet identifier of the 1st data packet or a data packet identifier of the received 2 metadata packet, after the first electronic signature device receives the retransmission request sent by the second electronic signature device, the second electronic signature device The pen transaction may query the corresponding third unit data packet according to the data packet identifier of the 1 yuan data packet, or determine the corresponding data packet identifier of the untransferred 1 metadata packet according to the data packet identifier of the 4 binary data packets. The third unit data packet carries the third unit data packet corresponding to the one-dimensional data packet identifier, and the retransmission information is sent to the second electronic signature device, that is, the second unit data packet corresponding to the data packet identifier is carried in the form of ciphertext. The sending information is sent to the second electronic signature device. Receiving the retransmission information, the second electronic signature device decrypts the third unit data packet corresponding to the one-dimensional data packet identifier carried in the retransmission information, and obtains a second unit data packet corresponding to the one-dimensional data packet identifier, and the The second unit data packet corresponding to the one-dimensional data packet identifier is stored in the security chip. Thereby, the second electronic signature device has a function of transmitting a retransmission request to the first electronic signature device when all second unit data packets required for the electronic transaction are not received, and receiving a second retransmission by the first electronic signature device The second unit data packet not received by the electronic signature device reduces the transmission amount of the retransmitted data, and ensures that the second electronic signature device can receive all the second unit data packets required for the electronic transaction.
在本实施例一种可选的实施方式中,第一电子签名设备的安全芯片分配用于存储至少一个第三单位数据包(或第二单位数据包)的存储空间,将至少一个第三单位数据包存储于对应的存储空间中。安全芯片的这些存储空间可以存储至少一个第二单位数据包,以便于第一电子签名设备在收到第二电子签名设备的交易请求后从安全芯片中获取交易金额所需的第二单位数据包,此外,在对至少一个第二单位数据包加密得到至少一个第三单位数据包后,至少一个第三单位数据包覆盖至少一个第二单位数据后,该至少一个第三单位数据包存储于对应的存储空间中。在第一电子签名设备根据重发请求将重发信息发送至第二电子签名设备之后,第一电子签名设备接收到第二电子签名设备返回的接收成功的确认信息,第一电子签名设备将之前存储至少一个第三单位数据包的存储空间的状态字修改为交易完成,或者将存储空间清空,并将对应的存储空间的状态字修改为未占用。其中,状态字为交易完成的存储空间,可以被新的数据覆盖。由此,第一电子签名设备在确认第二电子签 名设备接收到电子交易所需的全部第二单位数据包之后,可以清理安全芯片的存储空间,以便释放更多的存储空间,保证后续的交易顺利进行。In an optional implementation manner of this embodiment, the security chip of the first electronic signature device allocates a storage space for storing at least one third unit data packet (or a second unit data packet), and at least one third unit The data packet is stored in the corresponding storage space. The storage space of the security chip may store at least one second unit data packet, so that the first electronic signature device obtains the second unit data packet required for the transaction amount from the security chip after receiving the transaction request of the second electronic signature device. In addition, after encrypting the at least one second unit data packet to obtain at least one third unit data packet, after the at least one third unit data packet covers at least one second unit data packet, the at least one third unit data packet is stored in the corresponding In the storage space. After the first electronic signature device sends the retransmission information to the second electronic signature device according to the retransmission request, the first electronic signature device receives the confirmation information that the second electronic signature device returns the success of the reception, and the first electronic signature device will The status word storing the storage space of the at least one third unit data packet is modified to complete the transaction, or the storage space is cleared, and the status word of the corresponding storage space is modified to be unoccupied. Among them, the status word is the storage space where the transaction is completed, and can be overwritten by new data. Thereby, the first electronic signature device confirms the second electronic signature After receiving all the second unit data packets required for the electronic transaction, the name device can clear the storage space of the security chip, so as to release more storage space and ensure the subsequent transactions proceed smoothly.
以上均是以一笔交易的实施方式为例进行说明的,在本实施例中,对于多笔交易中的每笔交易都可以按照上述方式来实现。The above is described by taking an implementation manner of a transaction as an example. In this embodiment, each transaction in a plurality of transactions can be implemented in the above manner.
在本实施例中,第二电子签名设备的存储空间毕竟是有限的,因此,需要随时监控第二电子签名设备的剩余空间,以便于即时释放存储空间,避免在交易过程中没有多余空间造成交易失败的问题。在本实施例一种可选的实施方式中,还可以通过第二电子签名设备中的计数器实时监控第二电子签名设备的剩余存储空间。具体地,在每一笔交易结束后,即在步骤S23之后,第二电子签名设备利用计数器的计数值得到当前存储的第二单位数据包的总个数。具体地,在每一笔交易中计数器都会加上该笔交易接收到第二单位数据包的个数,在多笔交易之后,计数器的计数值会累计到一个数值,当该数值达到预设数值时,说明第二电子签名设备的存储空间已分配完毕,没有多余的存储空间了,此时,第二电子签名设备需要进行请求服务器更新数据包或者申请新的存储空间的操作(如上所述)。在本实施例中,每个存储空间的大小相同,每个第二单位数据包的大小相同,且与存储空间的大小匹配,例如,第二电子签名设备给一个第二单位数据包分配的存储空间的大小为2M,该2M的存储空间可以存储一个第二单位数据包,而一个安全芯片预留存储第二单位数据包的空间为1G,那么,第二电子签名设备最多可以存储512个第二单位数据包,即预设数值可以设为512。由此,可以实时监控第二电子签名设备的剩余空间,并及时释放出多余的存储空间,避免在交易过程中没有多余空间造成交易失败的问题。当然,第二电子签名设备还可以利用计数器的计数值得到安全芯片中存储的每种货币面值的第二单位数据包的总个数。由此,第二电子签名设备可以根据存储的每种第二单位数据包所代表的货币面值以及个数得到当前存储的第二单位数据包的货币总额。In this embodiment, the storage space of the second electronic signature device is limited, and therefore, the remaining space of the second electronic signature device needs to be monitored at any time, so as to release the storage space in an instant, and avoid unnecessary transactions in the transaction process. The problem of failure. In an optional implementation manner of this embodiment, the remaining storage space of the second electronic signature device may also be monitored in real time by using a counter in the second electronic signature device. Specifically, after each transaction ends, that is, after step S23, the second electronic signature device uses the count value of the counter to obtain the total number of currently stored second unit data packets. Specifically, in each transaction, the counter adds the number of second unit data packets received by the transaction. After multiple transactions, the counter's count value is accumulated to a value when the value reaches a preset value. When the storage space of the second electronic signature device has been allocated, there is no unnecessary storage space. At this time, the second electronic signature device needs to perform an operation of requesting the server to update the data packet or apply for a new storage space (as described above). . In this embodiment, each storage space has the same size, and each second unit data packet has the same size and matches the size of the storage space, for example, the second electronic signature device allocates storage for a second unit data packet. The size of the space is 2M, the 2M storage space can store a second unit data packet, and the space reserved by a security chip for storing the second unit data packet is 1G, then the second electronic signature device can store up to 512 The two-unit data packet, that is, the preset value can be set to 512. Thereby, the remaining space of the second electronic signature device can be monitored in real time, and the redundant storage space is released in time, thereby avoiding the problem that the transaction fails if there is no extra space in the transaction process. Of course, the second electronic signature device can also use the count value of the counter to obtain the total number of second unit data packets of each currency denomination stored in the security chip. Thus, the second electronic signature device can obtain the total amount of money of the currently stored second unit data packet according to the currency face value and the number of the money represented by each stored second unit data packet.
在本实施例一种可选的实施方式中,第一电子签名设备在将至少一个第二单位数据包发送至第二电子签名设备后,将其账户金额减去交易金额得到当前账户余额,并向持有用户显示交易金额和/或当前账户余额;第二电子签名设备在将上述至少一个第二单位数据包存储于安全芯片中之后,将其当前账户金额加上交易金额得到当前账户余额,向持有用户显示交易金额和/或当前账户余额。由此,持有电子签名设备的用户可以在自己的设备上查询交易金额以及当前账户余额。In an optional implementation manner of this embodiment, after transmitting the at least one second unit data packet to the second electronic signature device, the first electronic signature device subtracts the transaction amount from the account amount to obtain the current account balance, and Displaying the transaction amount and/or the current account balance to the holding user; after storing the at least one second unit data packet in the security chip, the second electronic signature device adds the current account amount to the transaction amount to obtain the current account balance, Display the transaction amount and/or current account balance to the holding user. Thus, the user holding the electronic signature device can query the transaction amount and the current account balance on his own device.
采用本实施例提供的一种电子签名设备的交易方法,用户的资金以至少一个第二单位数据包的形式存储于第一电子签名设备或第二电子签名设备中。收款方用户(第二电子签名设备侧)在收取第二单位数据包时,因为资金不再是以数值的形式存储于第二电子签名设备中,所以第二电子签名设备不需要通过服务器更改存储的数值,收款方用户的第二电子签名设备仅需从付款方用户的第一电子签名设备中收取一定数量的第二单位数据包即可,由此,电子签名设备在与其他电子签名设备进行电子交易时,不再需要依托服务器进行联网支付,服务器不需要再对收款方用户或付款方用户的电子签名设备进行监管,从而真正地实现脱机电子交易。此外,第二电子签名设备可以从第一电子签名设备接收密文形式的第三单位数据包,进一步提高了电子交易的安全性;此外,在第二单位数据包中添加数据包标识以及第二电子签名设备的设备标识,可以有效的防止第二电子签名设备被重放攻击,同时可以方便第一电子签名设备确定重发信息。 With the transaction method of the electronic signature device provided by the embodiment, the user's funds are stored in the first electronic signature device or the second electronic signature device in the form of at least one second unit data packet. When the payee user (the second electronic signature device side) receives the second unit data packet, since the funds are no longer stored in the second electronic signature device in the form of numerical values, the second electronic signature device does not need to be changed by the server. The stored value, the second electronic signature device of the payee user only needs to receive a certain number of second unit data packets from the first electronic signature device of the payer user, whereby the electronic signature device is signed with other electronic When the device conducts electronic transactions, it no longer needs to rely on the server for online payment, and the server does not need to supervise the electronic signature device of the payee user or the payer user, thereby realizing offline electronic transactions. In addition, the second electronic signature device may receive the third unit data packet in the cipher text form from the first electronic signature device, further improving the security of the electronic transaction; further, adding the data packet identifier and the second in the second unit data packet The device identifier of the electronic signature device can effectively prevent the second electronic signature device from being attacked by the playback, and can facilitate the first electronic signature device to determine the retransmission information.
流程图中或在此以其他方式描述的任何过程或方法描述可以被理解为,表示包括一个或更多个用于实现特定逻辑功能或过程的步骤的可执行指令的代码的模块、片段或部分,并且本发明的优选实施方式的范围包括另外的实现,其中可以不按所示出或讨论的顺序,包括根据所涉及的功能按基本同时的方式或按相反的顺序,来执行功能,这应被本发明的实施例所属技术领域的技术人员所理解。Any process or method description in the flowcharts or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a particular logical function or process. And the scope of the preferred embodiments of the invention includes additional implementations, in which the functions may be performed in a substantially simultaneous manner or in an opposite order depending on the functions involved, in the order shown or discussed. It will be understood by those skilled in the art to which the embodiments of the present invention pertain.
应当理解,本发明的各部分可以用硬件、软件、固件或它们的组合来实现。在上述实施方式中,多个步骤或方法可以用存储在存储器中且由合适的指令执行系统执行的软件或固件来实现。例如,如果用硬件来实现,和在另一实施方式中一样,可用本领域公知的下列技术中的任一项或他们的组合来实现:具有用于对数据信号实现逻辑功能的逻辑门电路的离散逻辑电路,具有合适的组合逻辑门电路的专用集成电路,可编程门阵列(PGA),现场可编程门阵列(FPGA)等。It should be understood that portions of the invention may be implemented in hardware, software, firmware or a combination thereof. In the above-described embodiments, multiple steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented by any one or combination of the following techniques well known in the art: having logic gates for implementing logic functions on data signals. Discrete logic circuits, application specific integrated circuits with suitable combinational logic gates, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc.
本技术领域的普通技术人员可以理解实现上述实施例方法携带的全部或部分步骤是可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,该程序在执行时,包括方法实施例的步骤之一或其组合。One of ordinary skill in the art can understand that all or part of the steps carried by the method of implementing the above embodiments can be completed by a program to instruct related hardware, and the program can be stored in a computer readable storage medium. When executed, one or a combination of the steps of the method embodiments is included.
此外,在本发明各个实施例中的各功能单元可以集成在一个处理模块中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. The integrated modules, if implemented in the form of software functional modules and sold or used as stand-alone products, may also be stored in a computer readable storage medium.
上述提到的存储介质可以是只读存储器,磁盘或光盘等。The above mentioned storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本发明的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不一定指的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任何的一个或多个实施例或示例中以合适的方式结合。In the description of the present specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" and the like means a specific feature described in connection with the embodiment or example. A structure, material or feature is included in at least one embodiment or example of the invention. In the present specification, the schematic representation of the above terms does not necessarily mean the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in a suitable manner in any one or more embodiments or examples.
尽管上面已经示出和描述了本发明的实施例,可以理解的是,上述实施例是示例性的,不能理解为对本发明的限制,本领域的普通技术人员在不脱离本发明的原理和宗旨的情况下在本发明的范围内可以对上述实施例进行变化、修改、替换和变型。本发明的范围由所附权利要求及其等同限定。 Although the embodiments of the present invention have been shown and described, it is understood that the foregoing embodiments are illustrative and not restrictive Variations, modifications, alterations and variations of the above-described embodiments are possible within the scope of the invention. The scope of the invention is defined by the appended claims and their equivalents.

Claims (21)

  1. 一种电子签名设备的交易方法,其特征在于,包括:A method for trading an electronic signature device, comprising:
    电子签名设备将交易请求发送至服务器,其中,所述交易请求至少包括:交易金额;The electronic signature device sends a transaction request to the server, wherein the transaction request includes at least: a transaction amount;
    所述服务器接收所述交易请求,在所述电子签名设备的银行账户扣除所述交易金额,获取至少一个第一单位数据包,并将所述至少一个第一单位数据包发送至所述电子签名设备;Receiving, by the server, the transaction request, deducting the transaction amount from a bank account of the electronic signature device, acquiring at least one first unit data packet, and transmitting the at least one first unit data packet to the electronic signature device;
    其中,每个第一单位数据包代表多种货币面值中的一种货币面值,所述每个第一单位数据包至少包括:第一单位数据、所述服务器对所述第一单位数据签名得到的第一签名数据,所述至少一个第一单位数据包所代表的货币面值的总和等于所述交易金额;Wherein each first unit data packet represents one of a plurality of currency denominations, and each of the first unit data packets includes at least: first unit data, and the server signs the first unit data The first signature data, the sum of the currency denominations represented by the at least one first unit data packet is equal to the transaction amount;
    所述电子签名设备接收所述至少一个第一单位数据包,对所述至少一个第一单位数据包中的第一签名数据进行验证,在验证通过后,将所述至少一个第一单位数据包存储于安全芯片中。Receiving, by the electronic signature device, the at least one first unit data packet, verifying the first signature data in the at least one first unit data packet, and after the verification is passed, the at least one first unit data packet Stored in a security chip.
  2. 根据权利要求1所述的交易方法,其特征在于,The transaction method according to claim 1, wherein
    所述交易请求中还包括:所述电子签名设备的设备标识;The transaction request further includes: a device identifier of the electronic signature device;
    所述每个第一单位数据包还包括:所述服务器对所述第一单位数据和所述电子签名设备的设备标识签名得到的第二签名数据;Each of the first unit data packets further includes: second signature data obtained by the server from the first unit data and the device identifier of the electronic signature device;
    在所述电子签名设备将所述至少一个第一单位数据包存储于安全芯片中之前,所述方法还包括:Before the electronic signature device stores the at least one first unit data packet in the security chip, the method further includes:
    所述电子签名设备对所述第二签名数据进行验证,在验证通过后执行所述电子签名设备将所述至少一个第一单位数据包存储于安全芯片中的步骤。The electronic signature device verifies the second signature data, and after the verification is passed, performs the step of the electronic signature device storing the at least one first unit data packet in the security chip.
  3. 根据权利要求1或2所述的交易方法,其特征在于,在所述电子签名设备将所述至少一个第一单位数据包存储于安全芯片中之后,所述方法还包括:The transaction method according to claim 1 or 2, wherein after the electronic signature device stores the at least one first unit data packet in a security chip, the method further includes:
    所述电子签名设备根据接收到的所述至少一个第一单位数据包的个数以及所述每个第一单位数据包所代表的货币面值计算接收到的第一单位数据包所代表的货币面值的总和与所述交易请求中的交易金额是否一致,如果不一致,则向所述服务器发送重发请求;The electronic signature device calculates, according to the received number of the at least one first unit data packet and the currency face value represented by each of the first unit data packets, a currency face value represented by the received first unit data packet. Whether the sum of the transactions is consistent with the transaction amount in the transaction request, and if not, sends a resend request to the server;
    所述服务器接收所述重发请求。The server receives the resend request.
  4. 根据权利要求3所述的交易方法,其特征在于,在所述服务器接收所述重发请求之后,所述方法还包括:The method of claim 3, wherein after the server receives the resend request, the method further comprises:
    所述服务器根据所述重发请求向所述电子签名设备发送重发信息,其中,所述重发信息包括所述至少一个第一单位数据包;Sending, by the server, retransmission information to the electronic signature device according to the retransmission request, where the retransmission information includes the at least one first unit data packet;
    所述电子签名设备接收所述重发信息,将之前存储于所述安全芯片中的所述至少一个第一单位数据包删除,并重新存储所述服务器重发的所述至少一个第一单位数据包。Receiving, by the electronic signature device, the retransmission information, deleting the at least one first unit data packet previously stored in the security chip, and re-storing the at least one first unit data resent by the server package.
  5. 根据权利要求3所述的交易方法,其特征在于,在所述服务器接收所述重发请求之后,所述方法还包括: The method of claim 3, wherein after the server receives the resend request, the method further comprises:
    所述服务器根据所述重发请求向所述电子签名设备发送重发信息,其中,所述重发信息包括所述电子签名设备未接收到的第一单位数据包;Sending, by the server, retransmission information to the electronic signature device according to the retransmission request, where the retransmission information includes a first unit data packet that is not received by the electronic signature device;
    所述电子签名设备将所述未接收到的第一单位数据包存储于所述安全芯片中。The electronic signature device stores the unreceived first unit data packet in the security chip.
  6. 根据权利要求1至5任一项所述的交易方法,其特征在于,在所述电子签名设备将所述至少一个第一单位数据包存储于安全芯片中之前,所述方法还包括:The transaction method according to any one of claims 1 to 5, wherein before the electronic signature device stores the at least one first unit data packet in a security chip, the method further includes:
    所述电子签名设备利用其安全芯片分配用于存储所述至少一个第一单位数据包的存储空间;The electronic signature device allocates, by its security chip, a storage space for storing the at least one first unit data packet;
    所述电子签名设备将所述至少一个第一单位数据包存储于安全芯片中,包括:The electronic signature device stores the at least one first unit data packet in a security chip, including:
    所述电子签名设备将所述至少一个第一单位数据包存储于对应的所述存储空间中,并将所述对应的存储空间的状态字置为已占用。The electronic signature device stores the at least one first unit data packet in the corresponding storage space, and sets the status word of the corresponding storage space to be occupied.
  7. 根据权利要求1至6任一项所述的交易方法,其特征在于,A transaction method according to any one of claims 1 to 6, wherein
    所述第一单位数据至少包括:货币面值数据,或者,货币序号和货币面值数据;The first unit data includes at least: currency denomination data, or currency serial number and currency denomination data;
    所述第一单位数据包至少还包括以下之一:发行银行标识和银行证书序号。The first unit data packet further includes at least one of the following: an issuing bank identifier and a bank certificate serial number.
  8. 一种电子签名设备的交易方法,其特征在于,所述交易方法包括:A method for trading an electronic signature device, characterized in that the transaction method comprises:
    第二电子签名设备将交易请求发送至第一电子签名设备,其中,所述交易请求至少包括:交易金额;The second electronic signature device sends the transaction request to the first electronic signature device, wherein the transaction request includes at least: a transaction amount;
    所述第一电子签名设备接收所述交易请求,并从其安全芯片中获取至少一个第二单位数据包,将所述至少一个第二单位数据包发送至所述第二电子签名设备,其中,每个第二单位数据包代表多种货币面值中的一种货币面值,所述每个第二单位数据包至少包括:第二单位数据、服务器对所述第二单位数据签名得到的第三签名数据,所述至少一个第二单位数据包所代表的货币面值的总和等于所述交易金额;Receiving, by the first electronic signature device, the transaction request, and acquiring at least one second unit data packet from the security chip, and transmitting the at least one second unit data packet to the second electronic signature device, where Each second unit data packet represents one of a plurality of currency denominations, and each of the second unit data packets includes at least: second unit data, a third signature obtained by the server to sign the second unit data signature Data, the sum of the currency denominations represented by the at least one second unit data packet is equal to the transaction amount;
    所述第二电子签名设备接收所述至少一个第二单位数据包,对所述至少一个第二单位数据包中的第三签名数据进行验证,在验证通过后,将所述至少一个第二单位数据包存储于安全芯片中。Receiving, by the second electronic signature device, the at least one second unit data packet, verifying the third signature data in the at least one second unit data packet, and after the verification is passed, the at least one second unit The data packet is stored in a security chip.
  9. 根据权利要求8所述的交易方法,其特征在于,在所述第一电子签名设备将所述至少一个第二单位数据包发送至所述第二电子签名设备之后,所述方法还包括:The method of claim 8, wherein after the first electronic signature device sends the at least one second unit data packet to the second electronic signature device, the method further comprises:
    所述第一电子签名设备删除获取的所述至少一个第二单位数据包。The first electronic signature device deletes the acquired at least one second unit data packet.
  10. 根据权利要求8或9所述的交易方法,其特征在于,A transaction method according to claim 8 or 9, wherein
    所述交易请求至少包括:所述第二电子签名设备的设备标识;The transaction request includes at least: a device identifier of the second electronic signature device;
  11. 根据权利要求10所述的交易方法,其特征在于,The transaction method according to claim 10, characterized in that
    所述每个第二单位数据包还包括:所述第一电子签名设备对所述第二单位数据和所述第二电子签名的设备标识签名得到的第四签名数据;Each of the second unit data packets further includes: fourth signature data obtained by the first electronic signature device signing the second unit data and the device identifier of the second electronic signature;
    在所述第二电子签名设备将所述至少一个第二单位数据包存储于安全芯片中之前,所述方法还包括:Before the second electronic signature device stores the at least one second unit data packet in the security chip, the method further includes:
    所述第二电子签名设备对所述第四签名数据进行验证,在验证通过后执行所述第二电子签名设备将所述至少一个第二 单位数据包存储于安全芯片中的步骤。The second electronic signature device verifies the fourth signature data, and after the verification is passed, executing the second electronic signature device to the at least one second The step of storing the unit data packet in the security chip.
  12. 根据权利要求10所述的交易方法,其特征在于,The transaction method according to claim 10, characterized in that
    每个所述第三单位数据包还包括:所述第二电子签名设备的设备标识。Each of the third unit data packets further includes: a device identifier of the second electronic signature device.
  13. 根据权利要求8至12任一项所述的交易方法,其特征在于,A transaction method according to any one of claims 8 to 12, characterized in that
    所述第二单位数据包包括:数据包标识。The second unit data packet includes: a data packet identifier.
  14. 根据权利要求13所述的交易方法,其特征在于,The transaction method according to claim 13, wherein
    所述交易请求还包括:数据包标识;The transaction request further includes: a data packet identifier;
    所述第二电子签名设备将所述至少一个第二单位数据包存储于安全芯片中,包括:The second electronic signature device stores the at least one second unit data packet in the security chip, including:
    所述第二电子签名设备判断接收到的第二单位数据包中的数据包标识是否与发送的交易请求中的数据包标识相同,如果不相同,则将数据包标识不相同的第二单位数据包丢弃,如果相同,则将数据包标识相同的第二单位数据包存储于所述安全芯片中。Determining, by the second electronic signature device, whether the data packet identifier in the received second unit data packet is the same as the data packet identifier in the sent transaction request, and if not identical, identifying the second unit data that is different from the data packet identifier The packet is discarded. If they are the same, the second unit data packet with the same packet identifier is stored in the security chip.
  15. 根据权利要求13所述的交易方法,其特征在于,The transaction method according to claim 13, wherein
    所述交易请求还包括:数据包标识起始值;The transaction request further includes: a data packet identification start value;
    所述第二电子签名设备将所述至少一个第二单位数据包存储于安全芯片中,包括:The second electronic signature device stores the at least one second unit data packet in the security chip, including:
    所述第二电子签名设备判断所述每个第二单位数据包中包含的数据包标识是否满足根据所述数据包标识起始值确定的预设范围,如果不满足,则将数据包标识不满足所述预设范围的第二单位数据包丢弃,如果满足,则将数据包标识满足所述预设范围的第二单位数据包存储于所述安全芯片中。The second electronic signature device determines whether the data packet identifier included in each second unit data packet satisfies a preset range determined according to the data packet identifier start value, and if not, the data packet identifier is not The second unit data packet that satisfies the preset range is discarded, and if so, the second unit data packet whose data packet identifier meets the preset range is stored in the security chip.
  16. 根据权利要求15所述的交易方法,其特征在于,在所述第二电子签名设备将交易请求发送至所述第一电子签名设备之前,所述方法还包括:The method of claim 15, wherein the method further comprises: before the second electronic signature device sends the transaction request to the first electronic signature device, the method further comprising:
    所述第二电子签名设备利用计数器的计数值得到所述数据包标识起始值;The second electronic signature device uses the count value of the counter to obtain the data packet identification start value;
    在所述第二电子签名设备将所述至少一个第二单位数据包存储于安全芯片中之后,所述方法还包括:After the second electronic signature device stores the at least one second unit data packet in the security chip, the method further includes:
    所述第二电子签名设备的计数器将所述数据包标识起始值加上接收到的所述第二单位数据包的总个数计算得到新的数据包标识起始值。The counter of the second electronic signature device calculates a new packet identifier start value by adding the data packet identifier start value to the total number of the received second unit data packets.
  17. 根据权利要求13至16任一项所述的交易方法,其特征在于,在所述第二电子签名设备将所述至少一个第二单位数据包存储于安全芯片中之后,所述方法还包括:The transaction method according to any one of claims 13 to 16, wherein after the second electronic signature device stores the at least one second unit data packet in the security chip, the method further includes:
    所述第二电子签名设备根据接收到的所述第二单位数据包的个数以及每个第二单位数据包所代表的货币面值计算所述接收到的第二单位数据包所代表的货币面值的总和与所述交易请求中的交易金额是否一致,如果不一致,则向所述第一电子签名设备发送重发请求;The second electronic signature device calculates, according to the received number of the second unit data packets and the currency face value represented by each second unit data packet, a currency face value represented by the received second unit data packet. Whether the sum of the transactions is consistent with the transaction amount in the transaction request, and if not, sending a retransmission request to the first electronic signature device;
    所述第一电子签名设备接收所述重发请求,并根据所述重发请求将重发信息发送至所述第二电子签名设备,其中,所述重发请求中至少包括所述第二电子签名设备的设备标识和/或所述每个第二单位数据包对应的数据包标识。 The first electronic signature device receives the retransmission request, and sends retransmission information to the second electronic signature device according to the retransmission request, where the retransmission request includes at least the second electronic The device identifier of the signature device and/or the packet identifier corresponding to each of the second unit data packets.
  18. 根据权利要求17所述的交易方法,其特征在于,在所述第一电子签名设备根据所述重发请求将重发信息发送至所述第二电子签名设备之后,所述方法还包括:The method of claim 17, wherein after the first electronic signature device sends the resend information to the second electronic signature device according to the resend request, the method further includes:
    所述第二电子签名设备接收所述重发信息,其中,所述重发信息包括所述至少一个第二单位数据包,并将之前存储于所述安全芯片中的所述至少一个第二单位数据包删除,重新存储所述第一电子签名设备重发的所述至少一个第二单位数据包。Receiving, by the second electronic signature device, the retransmission information, wherein the retransmission information includes the at least one second unit data packet, and storing the at least one second unit previously stored in the security chip And deleting the data packet, and re-storing the at least one second unit data packet retransmitted by the first electronic signature device.
  19. 根据权利要求17所述的交易方法,其特征在于,在所述第一电子签名设备根据所述重发请求将重发信息发送至所述第二电子签名设备之后,所述方法还包括:The method of claim 17, wherein after the first electronic signature device sends the resend information to the second electronic signature device according to the resend request, the method further includes:
    所述第二电子签名设备接收所述重发信息,其中,所述重发信息包括所述第二电子签名设备未收到的第二单位数据包,并将所述未接收到的第二单位数据包存储于其安全芯片中。Receiving, by the second electronic signature device, the retransmission information, where the retransmission information includes a second unit data packet that is not received by the second electronic signature device, and the second unit that is not received The data packet is stored in its security chip.
  20. 根据权利要求9至19任一项所述的交易方法,其特征在于,A transaction method according to any one of claims 9 to 19, characterized in that
    所述第二单位数据至少包括:货币面值数据,或者,货币序号和货币面值数据;The second unit data includes at least: currency denomination data, or currency serial number and currency denomination data;
    所述第二单位数据包包括以下至少之一:发行银行标识和银行证书序号。The second unit data packet includes at least one of the following: an issuing bank identifier and a bank certificate serial number.
  21. 根据权利要求9至20任一项所述的交易方法,其特征在于,在所述第二电子签名设备将所述至少一个第二单位数据包存储于安全芯片中之前,所述方法还包括:The transaction method according to any one of claims 9 to 20, wherein before the storing, by the second electronic signature device, the at least one second unit data packet in the security chip, the method further comprises:
    所述第二电子签名设备的安全芯片分配用于存储所述至少一个第二单位数据包的存储空间;The security chip of the second electronic signature device allocates a storage space for storing the at least one second unit data packet;
    所述第二电子签名设备将所述至少一个第二单位数据包存储于安全芯片中,包括:The second electronic signature device stores the at least one second unit data packet in the security chip, including:
    所述第二电子签名设备将所述至少一个第二单位数据包存储于对应的所述存储空间中,并将所述对应的存储空间的状态字置为已占用。 The second electronic signature device stores the at least one second unit data packet in the corresponding storage space, and sets the status word of the corresponding storage space to be occupied.
PCT/CN2017/077652 2016-01-22 2017-03-22 Electronic signature device transaction method WO2017162164A1 (en)

Applications Claiming Priority (5)

Application Number Priority Date Filing Date Title
CN201610045339 2016-01-22
CN201610178067.3 2016-03-25
CN201610178067.3A CN105956855B (en) 2016-01-22 2016-03-25 Transaction method and transaction system of electronic signature device
CN201610178325.8 2016-03-25
CN201610178325.8A CN105913256A (en) 2016-01-22 2016-03-25 Trade method and trade system of electronic signature device

Publications (1)

Publication Number Publication Date
WO2017162164A1 true WO2017162164A1 (en) 2017-09-28

Family

ID=56744518

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/077652 WO2017162164A1 (en) 2016-01-22 2017-03-22 Electronic signature device transaction method

Country Status (2)

Country Link
CN (6) CN105931049A (en)
WO (1) WO2017162164A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114612269A (en) * 2022-05-11 2022-06-10 山东国盾网信息科技有限公司 Electronic labor contract platform based on electronic signature technology

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105931049A (en) * 2016-01-22 2016-09-07 天地融科技股份有限公司 Electronic signature device, and trading method and trading system thereof
CN106228349B (en) * 2016-07-22 2021-01-15 天地融科技股份有限公司 Transaction method of electronic signature device and electronic signature device
CN107067241A (en) * 2017-02-06 2017-08-18 吕文华 A kind of runtime of binary system digital currency
CN107665427A (en) * 2017-08-22 2018-02-06 阿里巴巴集团控股有限公司 A kind of offline electronic payment, business processing, the method and device of payment processes
CN111915431A (en) * 2019-05-09 2020-11-10 天地融科技股份有限公司 Off-line electronic money transaction method and system
CN112184450B (en) * 2020-10-13 2023-06-20 中国联合网络通信集团有限公司 Transaction settlement method, transaction node, device and medium based on blockchain

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020128983A1 (en) * 2000-11-10 2002-09-12 Konrad Wrona Method and device for returning of change in an electronic payment system
CN101593338A (en) * 2009-07-13 2009-12-02 招商银行股份有限公司 A kind of method and system of handling electronic transaction request
US8285991B2 (en) * 2000-10-25 2012-10-09 Tecsec Inc. Electronically signing a document
CN105956855A (en) * 2016-01-22 2016-09-21 天地融科技股份有限公司 Transaction method and system of electronic signature device

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
IL120585A0 (en) * 1997-04-01 1997-08-14 Teicher Mordechai Countable electronic monetary system and method
US7506812B2 (en) * 2004-09-07 2009-03-24 Semtek Innovative Solutions Corporation Transparently securing data for transmission on financial networks
JP4391375B2 (en) * 2004-09-30 2009-12-24 フェリカネットワークス株式会社 Information management apparatus and method, and program
CN101051907B (en) * 2007-05-14 2012-08-22 北京握奇数据系统有限公司 Safety certifying method and its system for facing signature data
CN101408970A (en) * 2008-11-21 2009-04-15 李东声 Method, system and apparatus for implementing batch electronic transaction, and electronic signing tool
CN101719251A (en) * 2010-01-15 2010-06-02 陈发勇 Internet electronic money system
CN102468960A (en) * 2010-11-16 2012-05-23 卓望数码技术(深圳)有限公司 Off-line mode identity and transaction authentication method and terminal
CN102694795B (en) * 2012-05-06 2018-02-27 北京深思数盾科技股份有限公司 A kind of method for using application service in off-line case
CN102999570B (en) * 2012-11-09 2016-06-08 北京深思数盾科技股份有限公司 The Off-line control method of application program critical data and system in mobile equipment
CN103413159B (en) * 2013-08-15 2016-09-21 成都市易恒信科技有限公司 A kind of RFID electronic certificate off-line false proof realization method and system of Jianzhen based on CPK
CN103560886B (en) * 2013-11-04 2016-08-17 北京旋极信息技术股份有限公司 Authentication method for electronic signature equipment
EP2924637A1 (en) * 2014-03-24 2015-09-30 The Roberto Giori Company Ltd. System and method for electronic money transfer of fractional amounts

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8285991B2 (en) * 2000-10-25 2012-10-09 Tecsec Inc. Electronically signing a document
US20020128983A1 (en) * 2000-11-10 2002-09-12 Konrad Wrona Method and device for returning of change in an electronic payment system
CN101593338A (en) * 2009-07-13 2009-12-02 招商银行股份有限公司 A kind of method and system of handling electronic transaction request
CN105956855A (en) * 2016-01-22 2016-09-21 天地融科技股份有限公司 Transaction method and system of electronic signature device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114612269A (en) * 2022-05-11 2022-06-10 山东国盾网信息科技有限公司 Electronic labor contract platform based on electronic signature technology

Also Published As

Publication number Publication date
CN105913256A (en) 2016-08-31
CN105956855B (en) 2022-02-22
CN105913255A (en) 2016-08-31
CN105956855A (en) 2016-09-21
CN105931048A (en) 2016-09-07
CN113159763A (en) 2021-07-23
CN105931049A (en) 2016-09-07

Similar Documents

Publication Publication Date Title
WO2017162164A1 (en) Electronic signature device transaction method
AU2021203184B2 (en) Transaction messaging
US11687920B2 (en) Facilitating a fund transfer between user accounts
RU2710897C2 (en) Methods for safe generation of cryptograms
US9647845B2 (en) Key downloading method, management method, downloading management method, device and system
CN103714637B (en) A kind of transmission security key sending method and system, operating terminal
CN109756582A (en) Information recording method, device, node and storage medium in block chain network
EP3422275A1 (en) Electronic payment method and electronic device using id-based public key cryptography
CN109064324A (en) Method of commerce, electronic device and readable storage medium storing program for executing based on alliance&#39;s chain
KR101976027B1 (en) Method for generating and backing up electric wallet and user terminal and server using the same
KR20160119803A (en) Authentication system and method
CN103903129A (en) Remitting system and remitting method realized based on text message mode
CN108764912A (en) A kind of method of payment and device based on short message verification code
EP1142194A1 (en) Method and system for implementing a digital signature
CN106228349B (en) Transaction method of electronic signature device and electronic signature device
CN109816525A (en) A kind of data processing method and its device, medium, terminal
Kisore et al. A secure SMS protocol for implementing digital cash system
WO2014187363A1 (en) Wireless terminal network locking method and system
CN112041897A (en) Control method, ticket selling rule server, ticket checking rule server and device
KR20180089951A (en) Method and system for processing transaction of electronic cash
CN105913253A (en) Trade method and trade system of electronic signature device, and electronic signature device
JP2015146187A (en) Method of performing financial transaction via unsecured public telecommunication infrastructure and apparatus for the same
CN117787985A (en) Resource transfer method, device, system, computer equipment and storage medium
CN116415946A (en) Payment method, device and system based on hardware wallet
CN115310976A (en) Non-contact transaction processing method, device and system

Legal Events

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

Ref document number: 17769441

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 17769441

Country of ref document: EP

Kind code of ref document: A1