Anti-rollback method and device of terminal, computer readable storage medium, computing device
By obtaining the number of power-on/off cycles and transaction verification values when the terminal is powered on, and combining hash operations and key mechanisms, the problems of software version rollback and transaction rollback in smart terminals are solved, thus achieving terminal security protection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-13
- Publication Date
- 2026-03-27
AI Technical Summary
Current technology lacks reliable means to prevent software version rollback and transaction rollback on smart terminals. Hackers or malicious software may use technical means to flash old versions of software back to the terminal, leading to information leakage or illegal activities.
When the terminal is powered on, the number of power-on/off cycles and/or transaction verification values are obtained. Hash operations and key mechanisms are used to determine whether a version rollback or transaction rollback has occurred. One-time programmable memory is used to store the data to prevent tampering and ensure the credibility of the judgment.
Effectively determine whether a terminal has experienced software version rollback or transaction rollback, improve data security, prevent illegal operations, and ensure the security and reliability of the terminal.
Smart Images

Figure CN115048640B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of terminal security, and more particularly to a method and apparatus for preventing terminal rollback, a computer-readable storage medium, and a computing device. Background Technology
[0002] With the development of technology, smart terminals (such as mobile phones and computers) are being used more and more widely around the world. Applications such as mobile payment are also being gradually promoted, and smart terminals are gradually transforming from communication tools to personal information terminals.
[0003] Typically, when a smart device leaves the factory, if manufacturers discover significant software issues, they can upgrade the software (such as system software and application software) to replace the old version with a new one that fixes the problems. However, hackers or malicious software may use technical means to reinstall the problematic old software onto the device, exploiting its known vulnerabilities to steal user information or engage in other illegal activities. Reinstalling the old software is called version rollback or version revert.
[0004] Transaction rollback (or reversal) is the process of turning a transaction that has already occurred back into a state where it never happened. That is, a payment action may have already taken place on the terminal, but an attacker may use certain methods to cause an error in the transfer process, thereby rolling back the entire transaction and achieving the goal of transaction rollback.
[0005] However, there are currently no reliable means to prevent software version rollback or transaction rollback on the terminal. Summary of the Invention
[0006] The technical problem solved by this invention is how to provide a method for preventing rollback on a terminal, so as to detect software version rollback or transaction rollback on the terminal in a timely manner.
[0007] To address the aforementioned issues, this invention provides a method for preventing rollback of a terminal, comprising: acquiring the current power-on / off count and / or transaction verification value when the terminal is powered on; determining whether the terminal has undergone version rollback based on the current power-on / off count, and / or determining whether the terminal has undergone transaction rollback based on the current transaction verification value; wherein, the power-on / off count is incremented by one each time the terminal is powered on / off, and the transaction verification value is randomly generated each time the terminal conducts a transaction.
[0008] Optionally, the method further includes: when the terminal is powered off, obtaining the current power-on / off count as a first key, using the first key to encrypt data in a first preset storage space to obtain and store a first ciphertext; performing a hash operation on the data in the first preset storage space to obtain a first hash value; determining whether the terminal has undergone version rollback based on the current power-on / off count includes: obtaining a reference count, the reference count being the power-on / off count recorded when the terminal underwent a version upgrade; when the current power-on / off count is greater than or equal to the reference count, using the current power-on / off count as a second key, using the second key to decrypt the first ciphertext to obtain a first plaintext; performing a hash operation on the first plaintext to obtain a second hash value; if the first hash value and the second hash value are consistent, then determining that the terminal has not undergone version rollback.
[0009] Optionally, the method further includes: when the terminal is powered off, obtaining the current transaction verification value as a third key, using the third key to encrypt data in the second preset storage space to obtain second ciphertext and storing it; performing a hash operation on the data in the second preset storage space to obtain a third hash value; determining whether the terminal has experienced a transaction rollback based on the current transaction verification value includes: using the current transaction verification value as a fourth key, using the fourth key to decrypt the second ciphertext to obtain second plaintext; performing a hash operation on the second plaintext to obtain a fourth hash value; if the third hash value and the fourth hash value are consistent, then it is determined that the terminal has not experienced a transaction rollback.
[0010] Optionally, the method further includes: when the terminal is powered off, obtaining the current power-on / off count and transaction verification value; calculating a fifth key based on the current power-on / off count and transaction verification value according to a preset algorithm; encrypting data in a third preset storage space using the fifth key to obtain a third ciphertext and storing it; performing a hash operation on the data in the third preset storage space to obtain a fifth hash value; the step of determining whether the terminal has undergone version rollback based on the current power-on / off count and determining whether the terminal has undergone transaction rollback based on the current transaction verification value includes: obtaining a reference count, the reference count being the power-on / off count recorded when the terminal undergoes a version upgrade; when the current power-on / off count is greater than or equal to the reference count, calculating a sixth key based on the current power-on / off count and transaction verification value according to the preset algorithm; decrypting the third ciphertext using the sixth key to obtain a third plaintext; performing a hash operation on the third plaintext to obtain a sixth hash value; if the fifth hash value and the sixth hash value are consistent, then it is determined that the terminal has not undergone version rollback or transaction rollback.
[0011] Optionally, the method further includes storing the transaction verification value upon completion of each transaction or upon abnormal power failure.
[0012] Optionally, the number of power-on / off cycles and / or the transaction verification value are stored in a one-time programmable memory of the terminal.
[0013] Optionally, the power-on / off count and / or the transaction verification value are simultaneously stored in the terminal's one-time programmable memory and backup space; obtaining the current power-on / off count and / or transaction verification value includes: obtaining the power-on / off count and / or the transaction verification value from the one-time programmable memory and the backup space respectively; comparing whether the data stored in the one-time programmable memory and the backup space are consistent; if they are consistent, then continue to determine whether the terminal has undergone version rollback based on the current power-on / off count, and / or determine whether the terminal has undergone transaction rollback based on the current transaction verification value.
[0014] Optionally, the method further includes: if the terminal experiences a version rollback or transaction rollback, then the terminal is not allowed to power on.
[0015] Optionally, the method further includes: if the terminal experiences a transaction rollback, continuing the power-on operation and outputting an alarm reminder.
[0016] This invention also provides a terminal anti-rollback device, comprising: a storage data acquisition module, used to acquire the current power-on / off count and / or transaction verification value when the terminal is powered on; and a rollback judgment module, used to determine whether the terminal has undergone version rollback based on the current power-on / off count, and / or, to determine whether the terminal has undergone transaction rollback based on the current transaction verification value; wherein, the power-on / off count is incremented by one each time the terminal is powered on / off, and the transaction verification value is randomly generated each time the terminal makes a transaction.
[0017] This invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, performs the steps of any of the methods described herein.
[0018] This invention also provides a computing device, including the anti-rollback device of the terminal, or including a memory and a processor, wherein the memory stores a computer program that can run on the processor, and when the processor runs the computer program, it performs the steps of any of the methods described above.
[0019] Compared with the prior art, the technical solution of this application embodiment has the following beneficial effects:
[0020] This invention provides a method for preventing rollback of a terminal, comprising: acquiring the current power-on / off count and / or transaction verification value when the terminal is powered on; determining whether the terminal has experienced a version rollback based on the current power-on / off count, and / or determining whether the terminal has experienced a transaction rollback based on the current transaction verification value; wherein, the power-on / off count is incremented by one each time the terminal is powered on / off, and a transaction verification value is randomly generated each time the terminal makes a transaction. Compared with the prior art, the solution of this invention can determine whether the terminal has experienced a software (such as operating system or application) version rollback based on the current power-on / off count, and / or can determine whether the terminal has experienced a transaction rollback based on the current transaction verification value.
[0021] Furthermore, each time the terminal is powered off, the data in the first preset storage space is encrypted into a first ciphertext, and the hash value of its plaintext is stored therein. Upon the next power-on, the current power-on / off count is used as the key to decrypt the first ciphertext, and the hash value of the decrypted plaintext is compared with the hash value of the plaintext of the data stored in the first preset storage space at the time of power-off to determine whether a version rollback has occurred.
[0022] Furthermore, each time the terminal is powered off, the encrypted second ciphertext and its plaintext hash value are stored in the second preset storage space. Upon the terminal's next power-on, the current transaction verification value is obtained as the key to decrypt the second ciphertext, and the hash value of the decrypted plaintext is compared with the hash value of the plaintext of the data stored in the second preset storage space at the time of power-off to determine whether a transaction rollback has occurred.
[0023] Furthermore, each time the terminal is powered off, the data stored in the third preset storage space is encrypted into a third ciphertext, along with the hash value of its plaintext. The third ciphertext is encrypted using a key obtained from the current power-on / off count and transaction verification value according to a preset algorithm. Upon the terminal's next power-on, the current power-on / off count and transaction verification value are retrieved, and the key to decrypt the third ciphertext is obtained using the same preset algorithm. The hash value of the decrypted plaintext is then compared with the hash value of the plaintext data stored in the third preset storage space at the time of power-off to synchronously determine whether a version rollback and transaction rollback have occurred. Attached Figure Description
[0024] Figure 1 This is a flowchart illustrating the first terminal anti-rollback method according to an embodiment of the present invention.
[0025] Figure 2 This is a flowchart illustrating the second type of anti-rollback method for a terminal according to an embodiment of the present invention.
[0026] Figure 3 This is a flowchart illustrating the third type of anti-rollback method for a terminal according to an embodiment of the present invention.
[0027] Figure 4 This is a flowchart illustrating a version rollback verification method according to an embodiment of the present invention.
[0028] Figure 5 This is a flowchart illustrating a transaction rollback verification method according to an embodiment of the present invention.
[0029] Figure 6 This is a schematic diagram of the anti-rollback device for a terminal according to an embodiment of the present invention;
[0030] Figure 7 This is a schematic diagram illustrating the application of an anti-rollback device for a terminal according to an embodiment of the present invention. Detailed Implementation
[0031] As mentioned in the background section, there is currently a lack of reliable means to prevent software version rollback or transaction rollback on the terminal.
[0032] Currently, there is a software anti-rollback scheme, which verifies the software version number each time the software runs, for example by verifying the hash value of the software version number, to determine whether the software has rolled back. If the verification passes, the software has not rolled back; otherwise, the software may have rolled back. Alternatively, a one-time programmable memory (e.g., efuse) on the terminal can be used to store version information (such as the software version number) of the terminal's core modules / partitions. During terminal startup, the version information stored in efuse is compared with the version information of the currently running software to determine whether a software version rollback has occurred. However, the inventors of this application have discovered that the version information stored in efuse and the version information of the running software can be tampered with. Therefore, the existing anti-rollback method implemented using efuse is not effective in preventing version rollback.
[0033] To address the aforementioned problems, this invention provides a method for preventing rollback of a terminal, comprising: acquiring the current power-on / off count and / or transaction verification value when the terminal is powered on; determining whether the terminal has experienced a version rollback based on the current power-on / off count, and / or determining whether the terminal has experienced a transaction rollback based on the current transaction verification value; wherein, the power-on / off count is incremented by one each time the terminal is powered on / off, and a transaction verification value is randomly generated each time the terminal makes a transaction. Therefore, it is possible to determine whether the terminal has experienced a software (such as an operating system or application) version rollback based on the current power-on / off count, and / or to determine whether the terminal has experienced a transaction rollback based on the current transaction verification value.
[0034] The anti-rollback method for terminals described in this invention is applied to terminals or their chips. The terminals may include devices such as mobile phones, computers, smartwatches, and smart robots. To make the above-mentioned objectives, features, and beneficial effects of this invention more apparent and understandable, specific embodiments of the invention are described in detail below with reference to the accompanying drawings.
[0035] Please see Figures 1 to 3 , Figures 1 to 3 The following are flowcharts illustrating three terminal anti-rollback methods provided in embodiments of the present invention. These three methods are described in detail below as methods 1 to 3.
[0036] Method 1
[0037] Step S101: When the terminal is powered on, obtain the current power-on / off count, wherein the power-on / off count is incremented by one each time the terminal is powered on / off; Step S102: Determine whether the terminal has undergone version rollback based on the current power-on / off count.
[0038] Optionally, the current power-on / off count refers to the value of the power-on / off count stored at this moment on the terminal. This current power-on / off count is stored in a preset location on the terminal. In a specific example, the current power-on / off count is stored in the terminal's one-time programmable memory (EPM), which can refer to the terminal chip's efuse (also known as non-volatile memory). Once written to, the EPM cannot be erased and is not lost when power is off, ensuring that the stored current power-on / off count has not been tampered with, improving data security, and ensuring the reliability of version rollback judgment results.
[0039] Optionally, the power-on / power-off count is incremented by one each time the terminal is powered on / off, including: incrementing the power-on / power-off count by one each time the terminal performs a power-on operation; and incrementing the power-on / power-off count by one each time the terminal performs a power-off operation. Optionally, after each increment of the power-on / power-off count, the updated power-on / power-off count is stored in a one-time programmable memory (such as efuse).
[0040] In a specific example, the efuse includes a partition (denoted as powercnt) for storing power-on / off counts. Each time the terminal powers on, 1 bit is written to this partition (powercnt), incrementing the power-on / off count by one; each time the terminal powers off, 1 bit (1) is written to this partition (powercnt), also incrementing the power-on / off count by one. Since one-time programmable memory cannot be erased, the size of the partition storing power-on / off counts can be determined before the terminal leaves the factory based on the terminal's lifespan, preventing the partition from becoming full and affecting the normal use of the terminal.
[0041] Optionally, determining whether the terminal has undergone version rollback based on the current number of power-on / off cycles includes: there is a correspondence between the current number of power-on / off cycles and the software version installed on the terminal; if the current number of power-on / off cycles satisfies this correspondence, then the terminal has not undergone version rollback; if the current number of power-on / off cycles does not satisfy this correspondence, then the terminal has undergone version rollback.
[0042] The correspondence may include: the current power-on / off count is greater than or equal to the power-on / off count when this version was installed on the terminal (i.e., the "reference count" hereinafter). When this version is installed on the terminal, the power-on / off count at this time is stored on the terminal, such as in a one-time programmable memory. If a software version update occurs on the terminal, the power-on / off counts for the software versions before and after the update will be stored. For example, if the software version on the terminal is upgraded from version V1 to V2, the power-on / off count for version V1 was 100, and the power-on / off count for version V2 was 200.
[0043] In a specific example, if the terminal already stores a power-on / off count of 200 when version V2 was installed, and the current power-on / off count is less than 200, it can be determined that the current power-on / off count may have been tampered with, and a version rollback may have occurred. If the terminal's power-on / off count is greater than or equal to 200, and the terminal already stores a power-on / off count of 200 when version V2 was installed, but the currently installed software version on the terminal is version V1, then a version rollback may have occurred.
[0044] Using the above method 1, a relationship is established between the software version on the terminal and the number of times the terminal is powered on and off. When the terminal is powered on, the current number of power cycles is used to monitor whether the software version installed on it has been rolled back.
[0045] Method 2
[0046] Step S201: When the terminal is powered on, the current transaction verification value is obtained. The terminal randomly generates a transaction verification value each time a transaction is made.
[0047] Step S202: Determine whether the terminal has rolled back the transaction based on the current transaction verification value.
[0048] Optionally, the current transaction verification value refers to the value stored on the terminal at this time to verify whether a transaction rollback has occurred. This current transaction verification value is stored in a preset location on the terminal. A transaction can refer to an electronic payment being executed on the terminal, such as an electronic card swipe or online shopping.
[0049] In a specific example, the current transaction verification value is stored in the terminal's one-time programmable memory, which can refer to the terminal chip's efuse (also known as non-volatile memory). Once written to, the one-time programmable memory cannot be erased and is not lost when power is off, ensuring that the stored current transaction verification value has not been tampered with, improving data security, and ensuring the reliability of the transaction rollback judgment result.
[0050] Optionally, in step S202, determining whether the terminal has rolled back a transaction based on the current transaction verification value may include: if the current transaction verification value is consistent with the transaction verification value generated in the previous transaction, then it is determined that the terminal has not rolled back a transaction; if the current transaction verification value is inconsistent with the transaction verification value generated in the previous transaction, then it is determined that the terminal has rolled back a transaction.
[0051] In a specific example, a random counter inside the terminal chip counts during each transaction, randomly generating a transaction verification value for that transaction. Upon completion of the transaction, an abnormal power outage, or shutdown of the terminal, the randomly generated transaction verification value is stored in a preset location. This preset location can be a one-time programmable memory (such as efuse). Specifically, if the terminal experiences an abnormal power outage and restart due to factors such as chip overheating or operational errors (e.g., watchdog timer errors), there may be security vulnerabilities. In such cases, storing the transaction verification value in a one-time programmable memory prevents tampering and potential transaction rollback.
[0052] In another specific example, the preset location includes two partitions: a first partition (represented by backup cnt) and a second partition (represented by version cnt). Upon completion of a transaction, abnormal power loss of the terminal, or shutdown of the terminal, the randomly generated transaction verification value is first written to the first partition of the preset location. If data overflows in the first partition, it is then written to the second partition. The first and second partitions each include several storage blocks, each used to store the data of a single transaction verification value. Obtaining the current transaction verification value may include retrieving data from the storage blocks corresponding to the first and second partitions respectively to obtain the current transaction verification value. Dividing a single transaction verification value into two partitions for storage further increases the dispersion of data storage, thereby increasing the difficulty of tampering with the transaction verification value.
[0053] In this embodiment, the current transaction verification value can be obtained each time the terminal is powered on to determine whether a transaction rollback has occurred, thereby improving the transaction security of the terminal.
[0054] Method 3
[0055] Step S301: When the terminal is powered on, obtain the current power-on / off count and transaction verification value, wherein the power-on / off count is incremented by one each time the terminal is powered on / off, and the transaction verification value is randomly generated each time the terminal makes a transaction.
[0056] Step S302: Determine whether the terminal has undergone version rollback based on the current number of power-on / off cycles;
[0057] Step S303: Determine whether the terminal has rolled back the transaction based on the current transaction verification value.
[0058] Specifically, step S303 is executed before / after / simultaneously with step S302. For detailed explanations of each step in method 3, please refer to the relevant descriptions of methods 1 and 2; they will not be repeated here. When the terminal powers on, it can obtain the current number of power-on / off cycles and the transaction verification value to determine whether a version rollback and transaction rollback have occurred.
[0059] In one embodiment, see Figure 4 , Figure 4 This is a flowchart illustrating a version rollback verification method according to an embodiment of the present invention. It can be used to verify methods 1 and 3 above to determine whether a version rollback has occurred on the terminal. The method may include steps S401 to S406, and a detailed description of each step is provided below.
[0060] Step S401: When the terminal is powered off, the current number of power on / off cycles is obtained as the first key, and the data in the first preset storage space is encrypted using the first key to obtain the first ciphertext and store it.
[0061] Step S402: Perform a hash operation on the data in the first preset storage space to obtain a first hash value.
[0062] Each time the terminal receives a shutdown command, it first increments the power-on / off count by one to obtain the current power-on / off count, and stores it. Then, it uses the current power-on / off count as a first key to encrypt data in a first preset storage space to obtain the first ciphertext. Optionally, the first preset storage space can refer to any storage space on the terminal, such as the flash memory of the terminal chip. Additionally, the terminal also stores the hash value of the plaintext data in the first preset storage space. Therefore, when the terminal is powered off, some private information (i.e., the data in the first preset storage space) is encrypted and stored to prevent data leakage.
[0063] When the terminal is powered on, step S102 or step S302 is executed to determine whether the terminal has undergone version rollback based on the current number of power-on / off cycles. Specifically, this may include the following steps S403 to S406.
[0064] Step S403: Obtain the reference number of times, which is the number of times the terminal is powered on and off recorded when a version upgrade occurs.
[0065] Step S404: When the current power-on / off count is greater than or equal to the reference count, use the current power-on / off count as the second key, and use the second key to decrypt the first ciphertext to obtain the first plaintext.
[0066] Step S405: Perform a hash operation on the first plaintext to obtain a second hash value.
[0067] Step S406: If the first hash value and the second hash value are consistent, it is determined that the terminal has not undergone version rollback.
[0068] It should be noted that in steps S101 / S301, when the terminal obtains the current power-on / power-off count, the terminal has not yet completed the entire power-on process, and the power-on / power-off count has not been incremented. The current power-on / power-off count obtained in steps S101 / S301 should be the same as the current power-on / power-off count in step S401. If the current power-on / power-off count obtained in steps S101 / S301 is the same as the current power-on / power-off count in step S401, then the second key can successfully decrypt the first ciphertext. By comparing whether the first hash value and the second hash value are consistent, it can be determined whether the second key has successfully decrypted the first ciphertext. If the first hash value and the second hash value are consistent, then the second key has successfully decrypted the first ciphertext, the current power-on / power-off count obtained in steps S101 / S301 is the same as the power-on / power-off count stored at the time of the last power-off, the terminal has not undergone version rollback, and the terminal can continue to execute the power-on process. If the first hash value and the second hash value are inconsistent, the second key cannot successfully decrypt the first ciphertext. The current power-on / off count obtained in steps S101 / S301 is different from the power-on / off count stored at the last power-off, and the terminal may roll back to its previous version.
[0069] In one specific embodiment, the terminal boot process includes the startup of the security module and the startup of the application module. The startup and operation of the application module depend on the startup of the security module. Specifically, the security module is started first during boot, and the security module executes the anti-rollback method of the terminal according to this embodiment of the invention. If the security module determines that no version rollback or transaction rollback has occurred, the terminal then starts the application module, which can run various applications on the terminal.
[0070] In this embodiment, each time the terminal is powered off, the encrypted first ciphertext and its plaintext hash value are stored in the first preset storage space. When the terminal is powered on again, the current power-on / off count is used as the key to decrypt the first ciphertext, and the hash value of the decrypted plaintext (i.e., the first plaintext) is compared with the hash value of the plaintext of the data stored in the first preset storage space when the terminal was powered off to determine whether a version rollback has occurred.
[0071] In one embodiment, see Figure 5 , Figure 5 This is a flowchart illustrating a transaction rollback verification method according to an embodiment of the present invention. It can be used to verify methods 2 and 3 above to determine whether a transaction rollback has occurred at the terminal. The method may include steps S501 to S505, and a detailed description of each step is provided below.
[0072] Step S501: When the terminal is powered off, the current transaction verification value is obtained as the third key, and the data in the second preset storage space is encrypted using the third key to obtain the second ciphertext and store it.
[0073] Step S502: Perform a hash operation on the data in the second preset storage space to obtain a third hash value.
[0074] Each time the terminal receives a shutdown command, it stores data in the second preset storage space and encrypts it using the current transaction verification value as the key (i.e., the third key) to obtain the second ciphertext. Additionally, the terminal also stores the hash value (i.e., the third hash value) of the plaintext data in the second preset storage space.
[0075] Optionally, the second preset storage space can refer to any storage space on the terminal, which can be the same storage space as the first preset storage space or a different storage space. For example, the second preset storage space can refer to the flash memory of the terminal chip.
[0076] When the terminal is powered on, step S202 or step S303 is executed to determine whether the terminal has rolled back a transaction based on the current transaction verification value. Specifically, this may include steps S503 to S505.
[0077] Step S503: Using the current transaction verification value as the fourth key, the second ciphertext is decrypted using the fourth key to obtain the second plaintext.
[0078] Step S504: Perform a hash operation on the second plaintext to obtain a fourth hash value.
[0079] Step S505: If the third hash value and the fourth hash value are consistent, it is determined that no transaction rollback has occurred at the terminal.
[0080] It should be noted that in steps S201 / S301, from the last time the terminal was powered off until the current time it was powered on, no transaction was performed. Therefore, the current transaction verification value obtained in steps S201 / S301 should be the same as the current transaction verification value in step S501, and the fourth key should be able to successfully decrypt the second ciphertext. By comparing the third hash value and the fourth hash value, it can be determined whether the fourth key successfully decrypted the second ciphertext. If the third hash value and the fourth hash value are the same, the fourth key successfully decrypted the second ciphertext, and the current transaction verification value obtained in steps S201 / S301 is the same as the transaction verification value stored during the last power-off. The terminal has not experienced a transaction rollback, and the terminal can continue the power-on process. If the third hash value and the fourth hash value are different, the fourth key cannot successfully decrypt the second ciphertext, and the current transaction verification value obtained in steps S201 / S301 is different from the transaction verification value stored during the last power-off. The terminal may experience a transaction rollback.
[0081] In one specific embodiment, when the terminal is powered on, the security module is started first, and the security module executes the anti-rollback method of the terminal according to the present invention. If the security module determines that no version rollback or transaction rollback has occurred, the terminal then starts the application module, which can run various applications on the terminal.
[0082] In this embodiment, each time the terminal is powered off, the encrypted second ciphertext and its plaintext hash value are stored in the second preset storage space. When the terminal is powered on again, the current transaction verification value is obtained as the key to decrypt the second ciphertext, and the hash value of the decrypted plaintext (i.e., the second plaintext) is compared with the hash value of the plaintext of the data stored in the second preset storage space when the terminal was powered off to determine whether a transaction rollback has occurred.
[0083] In one embodiment, the method further includes: when the terminal is powered off, obtaining the current power-on / off count and transaction verification value; calculating a fifth key using the current power-on / off count and transaction verification value according to a preset algorithm; encrypting data in a third preset storage space using the fifth key to obtain a third ciphertext and storing it; performing a hash operation on the data in the third preset storage space to obtain a fifth hash value; the step of determining whether the terminal has undergone version rollback based on the current power-on / off count and determining whether the terminal has undergone transaction rollback based on the current transaction verification value includes: obtaining a reference count, the reference count being the power-on / off count recorded when the terminal undergoes a version upgrade; when the current power-on / off count is greater than or equal to the reference count, calculating a sixth key using the current power-on / off count and transaction verification value according to the preset algorithm; decrypting the third ciphertext using the sixth key to obtain a third plaintext; performing a hash operation on the third plaintext to obtain a sixth hash value; if the fifth hash value and the sixth hash value are consistent, then it is determined that the terminal has not undergone version rollback or transaction rollback.
[0084] In this embodiment, when the terminal is powered on, it needs to verify whether version rollback and transaction rollback have occurred. It needs to obtain the current number of power-on / off cycles and the transaction verification value, and generate a value from the two according to a preset algorithm, so as to verify version rollback and transaction rollback at the same time.
[0085] Optionally, the preset algorithm can be one or more of addition, subtraction, multiplication, division, etc., and there is no limitation here. The third preset storage space can refer to any storage space on the terminal, which can be the same storage space as the first / second preset storage space, or it can be a different storage space. For example, the third preset storage space can refer to the flash memory of the terminal chip.
[0086] In this embodiment, each time the terminal is powered off, the data in the third preset storage space is encrypted into a third ciphertext, and the hash value of its plaintext is stored. The third ciphertext is encrypted using the value obtained from the current number of power-on / off cycles and the transaction verification value according to a preset algorithm as the key. Upon the next power-on of the terminal, the current number of power-on / off cycles and the transaction verification value are obtained, and the key to decrypt the third ciphertext is obtained using the same preset algorithm. The hash value of the plaintext obtained after decrypting the third ciphertext (i.e., the third plaintext) is compared with the hash value of the plaintext of the data stored in the third preset storage space at the time of power-off to synchronously determine whether the terminal has undergone version rollback and transaction rollback.
[0087] It should be noted that other descriptions in this embodiment can be found in [reference needed]. Figure 4 and Figure 5 The relevant content will not be repeated here.
[0088] In one embodiment, the power-on / off count and / or the transaction verification value are simultaneously stored in the terminal's one-time programmable memory and a backup space. That is, when storing the power-on / off count and / or the transaction verification value in the one-time programmable memory, they are also stored in the backup space. Optionally, the backup space can be a partition within efuse, or it can be another storage location on the terminal, meaning the power-on / off count and / or the transaction verification value are stored using double bits.
[0089] Please see again Figures 1 to 3 In step S101, step S201, or step S301, obtaining the current power-on / off count and / or transaction verification value may include: obtaining the power-on / off count and / or the transaction verification value from the one-time programmable memory and the backup space, respectively; comparing whether the data stored in the one-time programmable memory and the backup space are consistent; if they are consistent, then continuing to determine whether the terminal has undergone version rollback based on the current power-on / off count (i.e., step S102 or S302), and / or determining whether the terminal has undergone transaction rollback based on the current transaction verification value (i.e., step S202 or step S303).
[0090] Since the one-time programmable memory and the backup space store two sets of power-on / off counts and / or transaction verification values, if an attacker were to tamper with these data, inconsistencies would occur between the data stored in the one-time programmable memory and the backup space. When these two sets of data are inconsistent, it indicates that data tampering may have occurred, and the current terminal may have security issues. In such cases, the terminal may be prevented from powering on (e.g., further power-on operations, such as starting application modules, are not permitted) or a risk warning may be issued to the user to mitigate error injection attacks. If the two sets of data are consistent, subsequent steps can be performed to determine whether a version rollback and / or transaction rollback has occurred.
[0091] In one embodiment, the anti-rollback method for the terminal may further include: if it is determined that the terminal has undergone version rollback or transaction rollback according to method 1 to method 3, then the terminal is not allowed to be powered on.
[0092] Specifically, if a version rollback or transaction rollback occurs on the terminal, system vulnerabilities or security risks may emerge, interrupting the current terminal's boot process and causing it to shut down due to power loss. Users can seek assistance from after-sales service personnel to resolve version rollback or transaction rollback issues.
[0093] In one embodiment, the anti-rollback method for the terminal may further include: if a transaction rollback occurs in the terminal according to method 2 or method 3, continuing the power-on operation and outputting an alarm reminder.
[0094] Specifically, if only a transaction rollback occurs on the terminal, the power-on process can continue. After powering on, the terminal is prohibited from performing any transaction operations until the user resolves the risks associated with the transaction through after-sales service or other means. During this time, non-transactional functions on the terminal remain unaffected. Alarm notifications are used to alert the user to potential transaction risks on the terminal; these can be sent via SMS or other similar messages.
[0095] Please see Figure 6 This invention also provides a terminal anti-rollback device 60, comprising: a storage data acquisition module 601, used to acquire the current power-on / off count and / or transaction verification value when the terminal is powered on; and a rollback judgment module 602, used to determine whether the terminal has undergone version rollback based on the current power-on / off count, and / or, to determine whether the terminal has undergone transaction rollback based on the current transaction verification value; wherein, the power-on / off count is incremented by one each time the terminal is powered on / off, and the transaction verification value is randomly generated each time the terminal makes a transaction.
[0096] In one embodiment, the anti-rollback device 60 of the terminal may further include: a first encryption module, configured to obtain the current power-on / off count as a first key when the terminal is powered off, encrypt data in a first preset storage space using the first key to obtain and store first ciphertext; and a first hash calculation module, configured to perform a hash operation on the data in the first preset storage space to obtain a first hash value. The rollback judgment module 602 may include: a first reference count acquisition unit, configured to acquire a reference count, wherein the reference count is the power-on / off count recorded when the terminal undergoes a version upgrade; a first decryption unit, configured to use the current power-on / off count as a second key when the current power-on / off count is greater than or equal to the reference count, and decrypt the first ciphertext using the second key to obtain first plaintext; a second hash calculation unit, configured to perform a hash operation on the first plaintext to obtain a second hash value; and a version rollback judgment unit, configured to determine that the terminal has not undergone a version rollback if the first hash value and the second hash value are consistent.
[0097] In one embodiment, the anti-rollback device 60 of the terminal may further include: a second encryption module, configured to obtain the current transaction verification value as a third key when the terminal is powered off, encrypt data in a second preset storage space using the third key to obtain second ciphertext and store it; and a third hash calculation module, configured to perform a hash operation on the data in the second preset storage space to obtain a third hash value. The rollback judgment module 602 may include: a second decryption unit, configured to use the current transaction verification value as a fourth key to decrypt the second ciphertext to obtain second plaintext; a fourth hash calculation unit, configured to perform a hash operation on the second plaintext to obtain a fourth hash value; and a transaction rollback judgment unit, configured to determine that the terminal has not experienced a transaction rollback if the third hash value and the fourth hash value are consistent.
[0098] In one embodiment, the anti-rollback device 60 of the terminal may further include: a synchronization acquisition module, used to acquire the current power-on / off count and transaction verification value when the terminal is powered off; a third encryption module, used to calculate the current power-on / off count and transaction verification value according to a preset algorithm to obtain a fifth key, and use the fifth key to encrypt data in a third preset storage space to obtain and store a third ciphertext; and a fifth hash calculation module, used to perform a hash operation on the data in the third preset storage space to obtain a fifth hash value. The rollback judgment module 602 may include: a second reference count acquisition unit, used to acquire a reference count, the reference count being the power-on / off count recorded when the terminal undergoes a version upgrade; a third decryption unit, used to calculate the current power-on / off count and transaction verification value according to the preset algorithm to obtain a sixth key when the current power-on / off count is greater than or equal to the reference count, and use the sixth key to decrypt the third ciphertext to obtain a third plaintext; a sixth hash calculation unit, used to perform a hash operation on the third plaintext to obtain a sixth hash value; and a synchronization judgment unit, used to determine that the terminal has not undergone a version rollback or a transaction rollback if the fifth hash value and the sixth hash value are consistent.
[0099] In one embodiment, the anti-rollback device 60 of the terminal may further include: a storage module for storing the transaction verification value after each transaction is completed or after an abnormal power outage.
[0100] In one embodiment, the number of power-on / off cycles and / or the transaction verification value are stored in a one-time programmable memory of the terminal.
[0101] In one embodiment, the power-on / off count and / or the transaction verification value are simultaneously stored in the terminal's one-time programmable memory and backup space; obtaining the current power-on / off count and / or transaction verification value includes: obtaining the power-on / off count and / or the transaction verification value from the one-time programmable memory and the backup space respectively; comparing whether the data stored in the one-time programmable memory and the backup space are consistent; if they are consistent, then continuing to determine whether the terminal has undergone version rollback based on the current power-on / off count, and / or determining whether the terminal has undergone transaction rollback based on the current transaction verification value.
[0102] In one embodiment, the anti-rollback device 60 of the terminal may further include: a first rollback processing module, used to prevent the terminal from powering on when a version rollback or transaction rollback occurs.
[0103] In one embodiment, the terminal's anti-rollback device 60 may further include: a second rollback processing module, used to continue performing the power-on operation and output an alarm reminder when the terminal experiences a transaction rollback.
[0104] For more information on the working principle and operation mode of the anti-rollback device 60 of the terminal, please refer to [link / reference]. Figures 1 to 5 The relevant descriptions of the anti-rollback methods for terminals in the Chinese documentation will not be repeated here.
[0105] Please see Figure 7 , Figure 7 This is a schematic diagram illustrating the application of an anti-rollback device 60 in a terminal according to an embodiment of the present invention. The specific structure of the anti-rollback device 60 in the terminal can be referred to the above. Figure 6 The following is a description of the illustrated embodiment. Each time the terminal powers on / off, it stores the updated number of power-on / off cycles in the partition of the one-time programmable memory 70 that stores the power-on / off cycles. Each time a transaction is completed, or there is an abnormal power outage or the terminal is powered off, the terminal stores the transaction verification value generated during the most recent transaction in the first and second partitions of the one-time programmable memory 70. When the terminal powers on, the terminal's anti-rollback device 60 can retrieve the current number of power-on / off cycles from the partition of the one-time programmable memory 70 that stores the power-on / off cycles to determine whether a version rollback has occurred. When the terminal powers on, the anti-rollback device 60 can also retrieve the current transaction verification value from the first and second partitions of the one-time programmable memory 70 to determine whether a transaction rollback has occurred.
[0106] In specific implementations, the aforementioned anti-rollback device 60 of the terminal may correspond to a chip with communication function in the terminal, or to a chip with data processing function, such as a system-on-a-chip (SOC), radio frequency chip, etc.; or to a chip module in the terminal that includes a chip with communication function; or to a chip module with a chip with data processing function; or to the terminal itself.
[0107] Regarding the modules / units included in the various devices and products described in the above embodiments, they can be software modules / units, hardware modules / units, or a combination of both. For example, for various devices and products applied to or integrated into a chip, all of their modules / units can be implemented using hardware methods such as circuits, or at least some modules / units can be implemented using software programs that run on a processor integrated within the chip, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits; for various devices and products applied to or integrated into a chip module, all of their modules / units can be implemented using hardware methods such as circuits, and different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or different components of the chip module, or at least some modules / units can be implemented using hardware methods such as circuits. The components can be implemented using software programs that run on the processor integrated within the chip module. The remaining (if any) modules / units can be implemented using hardware methods such as circuits. For various devices and products applied to or integrated into the terminal, each of its components / units can be implemented using hardware methods such as circuits. Different modules / units can be located in the same component (e.g., chip, circuit module, etc.) or in different components within the terminal. Alternatively, at least some modules / units can be implemented using software programs that run on the processor integrated within the terminal, while the remaining (if any) modules / units can be implemented using hardware methods such as circuits.
[0108] This application also provides a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor. Figures 1 to 5 The steps of the rollback prevention method for any terminal. The storage medium can be a computer-readable storage medium, such as non-volatile or non-transitory memory, and can also include optical discs, hard disk drives, solid-state drives, etc.
[0109] This application embodiment also provides a computing device, which may include the above-described computing device. Figure 6The terminal shown has an anti-rollback device 60. Alternatively, the computing device may include a memory and a processor, the memory storing a computer program that can run on the processor, which executes the computer program when running the program. Figures 1 to 5 The steps of the rollback prevention method for any terminal.
[0110] In the embodiments of this application, the processor may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.
[0111] In the embodiments of this application, the memory can be non-volatile memory, such as a hard disk drive (HDD) or a solid-state drive (SSD), or it can be volatile memory, such as random-access memory (RAM). Memory is any other medium capable of carrying or storing desired program code in the form of instructions or data structures, and accessible by a computer, but is not limited thereto. The memory in the embodiments of this application can also be a circuit or any other device capable of implementing storage functions for storing computer programs and / or data.
[0112] The methods provided in this application can be implemented entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, they can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program is loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user equipment, or other programmable device. The computer program can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., digital video discs (DVDs)), or semiconductor media (e.g., SSDs), etc.
[0113] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
[0114] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0115] In the above embodiments, the descriptions of each embodiment have their own emphasis, and any multiple embodiments can be used in combination. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0116] In implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software. The steps of the method disclosed in the embodiments of this application can be directly manifested as execution by a hardware processor, or as a combination of hardware and software units within the processor. The software units can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor executes the instructions in the memory, combining them with its hardware to complete the steps of the above method. To avoid repetition, detailed descriptions are omitted here.
[0117] In the embodiments of this application, the processor of the above-described device may be a Central Processing Unit (CPU), which may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.
[0118] This application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps of any of the methods described in the above method embodiments. This computer program product can be a software installation package.
[0119] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical or other forms.
[0120] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of this application, depending on actual needs.
[0121] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0122] If the aforementioned integrated units are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or TRP, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0123] It should be understood that the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article indicates that the preceding and following related objects have an "or" relationship.
[0124] In the embodiments of this application, "multiple" refers to two or more.
[0125] The descriptions of "first," "second," etc., appearing in the embodiments of this application are for illustrative purposes and to distinguish the objects being described. They have no order and do not indicate any special limitation on the number of devices in the embodiments of this application, nor do they constitute any limitation on the embodiments of this application.
[0126] In this application, the term "connection" refers to various connection methods, such as direct connection or indirect connection, to achieve communication between devices. This application does not impose any limitations on this.
[0127] The embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for preventing rollback in a terminal, characterized in that, The method comprises: When the terminal is powered on, obtaining the current power-on / off times and / or transaction verification value; According to the current power-on / off times, determining whether the terminal has version rollback, and / or, according to the current transaction verification value, determining whether the terminal has transaction rollback; the determination of whether the terminal has version rollback according to the current power-on / off times comprises: there is a corresponding relationship between the current power-on / off times and the software version installed on the terminal, if the current power-on / off times satisfy the corresponding relationship, the terminal has no version rollback; if the current power-on / off times do not satisfy the corresponding relationship, the terminal has version rollback; the current power-on / off times are greater than or equal to the power-on / off times when the terminal installs the version; Wherein, the power-on / off times are increased by one each time the terminal is powered on or powered off, and the transaction verification value is randomly generated each time the terminal transacts; When the terminal is powered off, obtaining the current transaction verification value as a third key, encrypting the data of a second preset storage space using the third key, obtaining second ciphertext and storing; performing hash operation on the data of the second preset storage space, obtaining a third hash value; the determination of whether the terminal has transaction rollback according to the current transaction verification value comprises: taking the current transaction verification value as a fourth key, decrypting the second ciphertext using the fourth key to obtain second plaintext; performing hash operation on the second plaintext, obtaining a fourth hash value; if the third hash value and the fourth hash value are consistent, it is determined that the terminal has no transaction rollback.
2. The method of claim 1, wherein, The method further comprises: When the terminal is powered off, obtaining the current power-on / off times as a first key, encrypting the data of a first preset storage space using the first key, obtaining first ciphertext and storing; Performing hash operation on the data of the first preset storage space, obtaining a first hash value; The determination of whether the terminal has version rollback according to the current power-on / off times comprises: Obtaining a reference number, which is the power-on / off times recorded when the terminal has version upgrade; When the current power-on / off times are greater than or equal to the reference number, taking the current power-on / off times as a second key, decrypting the first ciphertext using the second key to obtain first plaintext; Performing hash operation on the first plaintext, obtaining a second hash value; If the first hash value and the second hash value are consistent, it is determined that the terminal has no version rollback.
3. The method of claim 1, wherein, The method further comprises: When the terminal is powered off, obtaining the current power-on / off times and transaction verification value; According to a preset algorithm, calculating the current power-on / off times and transaction verification value to obtain a fifth key, encrypting the data of a third preset storage space using the fifth key, obtaining third ciphertext and storing; Performing hash operation on the data of the third preset storage space, obtaining a fifth hash value; The determination of whether the terminal has version rollback according to the current power-on / off times and the determination of whether the terminal has transaction rollback according to the current transaction verification value comprises: Obtaining a reference number, which is the power-on / off times recorded when the terminal has version upgrade; When the current switch-on / off times is greater than or equal to the reference times, a sixth key is calculated according to the preset algorithm based on the current switch-on / off times and the transaction verification value, and the third ciphertext is decrypted by using the sixth key to obtain a third plaintext; A sixth hash value is obtained by performing a hash operation on the third plaintext; If the fifth hash value and the sixth hash value are consistent, it is determined that the terminal has not undergone version rollback and transaction rollback.
4. The method according to any one of claims 1 to 3, characterized in that, The method further comprises: The transaction verification value is stored after each transaction or abnormal power-off.
5. The method according to any one of claims 1 to 3, characterized in that, The switch-on / off times and / or the transaction verification value are stored in a one-time programmable memory of the terminal.
6. The method according to any one of claims 1 to 3, characterized in that, The switch-on / off times and / or the transaction verification value are stored in a one-time programmable memory and a backup space of the terminal. The current switch-on / off times and / or the transaction verification value are obtained by: The switch-on / off times and / or the transaction verification value are obtained from the one-time programmable memory and the backup space respectively; If the data stored in the one-time programmable memory and the backup space are consistent, the method continues to determine whether the terminal has undergone version rollback according to the current switch-on / off times, and / or determines whether the terminal has undergone transaction rollback according to the current transaction verification value.
7. The method according to any one of claims 1 to 3, characterized in that, The method further comprises: If the terminal has undergone version rollback or transaction rollback, the terminal is not allowed to start up.
8. The method according to any one of claims 1 to 3, characterized in that, The method further comprises: If the terminal has undergone transaction rollback, the start-up operation is continued, and an alarm is output.
9. A terminal's anti-rollback device, characterized by, Comprise: A storage data obtaining module is configured to obtain the current switch-on / off times and / or the transaction verification value when the terminal starts up; A rollback determining module is configured to determine whether the terminal has undergone version rollback according to the current switch-on / off times, and / or determine whether the terminal has undergone transaction rollback according to the current transaction verification value; The determination of whether the terminal has undergone version rollback according to the current switch-on / off times comprises that there is a corresponding relationship between the current switch-on / off times and the software version installed on the terminal, if the current switch-on / off times satisfy the corresponding relationship, the terminal has not undergone version rollback, if the current switch-on / off times do not satisfy the corresponding relationship, the terminal has undergone version rollback, and the current switch-on / off times are greater than or equal to the switch-on / off times when the terminal installs the version; Wherein, the switch-on / off times are increased by one when the terminal starts up or shuts down each time, and the transaction verification value is randomly generated each time the terminal transacts. When the terminal is powered off, a current transaction verification value is obtained as a third key, data in the second preset storage space is encrypted using the third key, second ciphertext is obtained and stored; a hash operation is performed on the data in the second preset storage space, and a third hash value is obtained; the determination of whether the terminal has transaction rollback according to the current transaction verification value comprises: taking the current transaction verification value as a fourth key, decrypting the second ciphertext using the fourth key to obtain second plaintext; performing a hash operation on the second plaintext to obtain a fourth hash value; if the third hash value and the fourth hash value are consistent, it is determined that the terminal has no transaction rollback.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program, when executed by a processor, performs the steps of the method of any one of claims 1 to 8.
11. A computing device comprising the anti-rollback apparatus of the terminal of claim 9, or comprising a memory and a processor, said memory having stored thereon a computer program, executable on said processor, characterized in that, The processor, when executing the computer program, performs the steps of the method of any one of claims 1 to 8.
Citation Information
Patent Citations
Roll-back processing method and device, computing equipment and storage medium
CN110288473A
System and methods for detecting rollback
US20090265348A1