Data processing method, apparatus and computer readable storage medium

By using a trusted execution environment to generate timestamp and monotonic counter value signature data digests in the database, the problems of data tampering, deletion, and insertion are solved, achieving higher data storage security.

CN115935386BActive Publication Date: 2026-01-09BEIJING VOLCANO ENGINE TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211548301.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-05
Publication Date
2026-01-09
Estimated Expiration
2042-12-05

AI Technical Summary

Technical Problem

How to improve the security of data storage in a database, especially to prevent data tampering, deletion, and insertion of illegal data.

Method used

By sending a digest of the data to be stored to the trusted execution environment, and using a timer component to generate a timestamp and a monotonic counter component to generate a monotonic counter value, the digest is combined with the data digest and then signed. The signature result is then stored to ensure the integrity and confidentiality of the data.

Benefits of technology

It improves the security of data storage, enabling timely detection of data deletion or the insertion of illegal data, and enhances data integrity and confidentiality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115935386B_ABST
    Figure CN115935386B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a data processing method, device and computer readable storage medium, and relates to the technical field of data storage and the technical field of computer. The method of the present disclosure comprises: sending an abstract of to-be-stored data to a trusted execution environment; receiving combined information and a signature result thereof returned by the trusted execution environment, wherein the combined information comprises the abstract of the to-be-stored data, a time stamp corresponding to the to-be-stored data generated by the trusted execution environment and a monotonic counter value; and storing the to-be-stored data, the combined information and the signature result thereof correspondingly.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of data storage, the technical field of computer, and particularly relates to a data processing method and device and a computer readable storage medium. BACKGROUND

[0002] With the development and application of database technology, the security of database is more and more concerned by the industry. How to improve the security of data storage in the database has always been a problem for relevant technical personnel to focus on. SUMMARY

[0003] One of the technical problems to be solved by the present disclosure is how to improve the security of data storage.

[0004] According to some embodiments of the present disclosure, a data processing method is provided, which comprises: sending a digest of to-be-stored data to a trusted execution environment; receiving combination information and a signature result returned by the trusted execution environment, wherein the combination information comprises the digest of the to-be-stored data, a timestamp corresponding to the to-be-stored data generated by the trusted execution environment, and a monotonic counter value; and storing the to-be-stored data, the combination information, and the signature result correspondingly.

[0005] In some embodiments, the method further comprises: determining whether the stored data is tampered with according to the combination information and the signature result corresponding to the stored data.

[0006] In some embodiments, the stored data comprises one or more pieces of data, and determining whether the stored data is tampered with according to the combination information and the signature result corresponding to the stored data comprises: for each piece of data, generating a digest of the piece of data and comparing the digest with a digest in the combination information corresponding to the piece of data; in the case of consistent comparison, verifying the signature result corresponding to the piece of data by using a public key of the trusted execution environment and the combination information corresponding to the piece of data; and in the case of successful verification, determining that the piece of data is not tampered with.

[0007] In some embodiments, determining whether the stored data is tampered with according to the combination information and the signature result corresponding to the stored data further comprises: for a piece of data that is the first stored in a preset data table among the one or more pieces of data, obtaining a first timestamp and a first monotonic counter value from the trusted execution environment, and in the case that the timestamp corresponding to the piece of data is equal to the first timestamp and the monotonic counter value corresponding to the piece of data is equal to the first monotonic counter value, determining that there is no deleted data before the piece of data; and / or in the case that the timestamp corresponding to the piece of data is earlier than the timestamp corresponding to the next piece of data, and the monotonic counter value corresponding to the piece of data is continuous with the monotonic counter value corresponding to the next piece of data, determining that there is no deleted or inserted data between the piece of data and the next piece of data.

[0008] In some embodiments, determining whether the stored data is tampered according to the signature result corresponding to the stored data and the combination information further comprises: for each piece of data in the one or more pieces of data that does not belong to the last stored and the first stored data in the preset data table, in a case that the time stamp corresponding to the data is later than the time stamp corresponding to the previous piece of data, and the monotonic counter value corresponding to the data is continuous with the monotonic counter value corresponding to the previous piece of data, determining that there is no data deleted or inserted between the data and the previous piece of data; and / or in a case that the time stamp corresponding to the data is earlier than the time stamp corresponding to the next piece of data, and the monotonic counter value corresponding to the data is continuous with the monotonic counter value corresponding to the next piece of data, determining that there is no data deleted or inserted between the data and the next piece of data.

[0009] In some embodiments, determining whether the stored data is tampered according to the signature result corresponding to the stored data and the combination information further comprises: for each piece of data in the one or more pieces of data that does not belong to the last stored and the first stored data in the preset data table, in a case that the time stamp corresponding to the data is later than the time stamp corresponding to the previous piece of data, and the monotonic counter value corresponding to the data is continuous with the monotonic counter value corresponding to the previous piece of data, determining that there is no data deleted or inserted between the data and the previous piece of data; and / or in a case that the time stamp corresponding to the data is earlier than the time stamp corresponding to the next piece of data, and the monotonic counter value corresponding to the data is continuous with the monotonic counter value corresponding to the next piece of data, determining that there is no data deleted or inserted between the data and the next piece of data.

[0010] In some embodiments, the method further comprises: reading a type of the preset data table in which the stored data is stored, wherein the type of the preset data table is configured as a first type or a second type, the first type indicating that verification is based on the trusted execution environment, and the second type indicating that verification is based on a manner other than the trusted execution environment; and wherein determining whether the stored data is tampered according to the combination information and the signature result corresponding to the stored data comprises: in a case that the type of the preset data table in which the stored data is stored is the first type, determining whether the stored data is tampered according to the combination information and the signature result corresponding to the stored data.

[0011] In some embodiments, sending the digest of the to-be-stored data to the trusted execution environment comprises: generating the digest of the to-be-stored data; and calling a component predefined inside the trusted execution environment through an interface of the trusted execution environment, and sending the digest of the to-be-stored data to the trusted execution environment.

[0012] In some embodiments, the predefined components include: a timer component, a monotonic counter component, and a signature component, wherein the timer component is configured to generate a current timestamp as the timestamp corresponding to the to-be-stored data in response to receiving the digest of the to-be-stored data, the monotonic counter component is configured to generate a current monotonic counter value as the monotonic counter value corresponding to the to-be-stored data in a preset monotonic direction and with a preset step size, and the signature component is configured to sign binary data composed of the digest of the to-be-stored data, the timestamp corresponding to the to-be-stored data, and the monotonic counter value.

[0013] In some embodiments, the method further includes: creating a trusted execution environment, and configuring the predefined components to execute in the trusted execution environment; initializing the timer component and the monotonic counter component in the trusted execution environment.

[0014] In some embodiments, the corresponding storage of the to-be-stored data, the combined information, and the signature result thereof includes: writing the to-be-stored data in a preset data table of the database, and writing the combined information and the signature result thereof in a preset column of a row where the to-be-stored data is located, wherein the preset column includes an implicit column.

[0015] According to some other embodiments of the present disclosure, a data processing apparatus is provided, which includes: a sending module configured to send a digest of to-be-stored data to a trusted execution environment; a receiving module configured to receive combined information and a signature result thereof returned by the trusted execution environment, wherein the combined information includes the digest of the to-be-stored data, a timestamp corresponding to the to-be-stored data generated by the trusted execution environment, and a monotonic counter value; and a storage module configured to store the to-be-stored data, the combined information, and the signature result thereof correspondingly.

[0016] According to some other embodiments of the present disclosure, a data processing apparatus is provided, which includes: a processor; and a memory coupled to the processor and configured to store instructions, which, when executed by the processor, cause the processor to perform the data processing method of any of the preceding embodiments.

[0017] According to some other embodiments of the present disclosure, a non-transitory computer-readable storage medium is provided, which stores a computer program, wherein the program, when executed by a processor, implements the data processing method of any of the preceding embodiments.

[0018] According to some other embodiments of the present disclosure, a computer program is provided, which includes: instructions, which, when executed by a processor, cause the processor to perform the data processing method of any of the preceding embodiments.

[0019] In the scheme of the present disclosure, the digest of the data to be stored is sent to the trusted execution environment, the trusted execution environment generates the timestamp and the monotonic counter value corresponding to the data to be stored, combines the digest of the data to be stored to obtain the combined information, and signs the combined information. Then the combined information returned by the trusted execution environment and the signature result thereof are stored in correspondence with the data to be stored. The trusted execution environment is a secure area constructed based on hardware, which guarantees the confidentiality and integrity of the programs and data running in the trusted execution environment. The trusted execution environment adopts a hardware protection method, and the timestamp and the monotonic counter value generated by the trusted execution environment and signed can effectively improve the security of data storage, and have higher security than a software protection method. In addition, due to the setting of the timestamp and the monotonic counter value corresponding to the data to be stored, it can be found in time that any data is deleted or illegal data is inserted, thereby further improving the security of data storage.

[0020] Other features and advantages of the present disclosure will become apparent from the following detailed description of illustrative embodiments thereof, which proceeds with reference to the accompanying drawings. BRIEF DESCRIPTION OF DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are only some embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without creative labor under the premise of the drawings.

[0022] Figure 1 A flowchart of a data processing method according to some embodiments of the present disclosure is shown.

[0023] Figure 2 A flowchart of a data processing method according to some other embodiments of the present disclosure is shown.

[0024] Figure 3 A structural diagram of a data processing apparatus according to some embodiments of the present disclosure is shown.

[0025] Figure 4 A structural diagram of a data processing apparatus according to some other embodiments of the present disclosure is shown.

[0026] Figure 5 A structural diagram of a data processing apparatus according to some other embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0027] The technical solutions in the embodiments of the present disclosure will be clearly and completely described with reference to the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all the embodiments. The description of the following at least one exemplary embodiment is actually only illustrative, but not as any limitation on the present disclosure and its application or use. Based on the embodiments in the present disclosure, all other embodiments obtained by those of ordinary skill in the art without creative labor are within the scope of protection of the present disclosure.

[0028] Improving the storage mode of data helps to improve the security of data in the database, and the present disclosure provides a data processing method based on a hardware protection mechanism to improve the security of data storage in the database. The following will be described in combination with Figures 1-2 .

[0029] Figure 1 is a flowchart of some embodiments of the data processing method of the present disclosure. As shown in the figure, the method of this embodiment includes steps S102-S106. Figure 1

[0030] In step S102, the digest of the data to be stored is sent to the trusted execution environment.

[0031] The data to be stored is, for example, data intended to be inserted into a predetermined data table by a DBMS (Database Management System). The data to be stored can be any form of data such as structured storage, unstructured storage, or semi-structured storage.

[0032] The trusted execution environment (Trusted Execute Environment, TEE) is a secure area based on hardware (CPU, memory, etc.) to ensure the confidentiality and integrity of the programs and data running inside it. The trusted execution environment can be implemented by creating an Enclave (Enclave or secure area) using SGX (Software Guard eXtensions) technology, without being limited to the examples shown.

[0033] In some embodiments, the trusted execution environment can be created first, and a predefined component can be configured to execute in the trusted execution environment. The predefined component can include a timer component, a monotonic counter component, and a signature component, which will be described in subsequent embodiments. Further, the timer component and the monotonic counter component in the trusted execution environment are initialized. The monotonic counter component assigns a corresponding monotonic counter to the predetermined data table, and different data tables correspond to different monotonic counters.

[0034] ​For example, an Enclave is created as an independent secure environment for protecting predefined components and data. When the Enclave is created, the predefined components are configured to run in the Enclave. The predefined components belong to trusted components located inside the secure enclave and executed in the EPC (Enclave Page Cache). The Enclave can be developed and deployed using a confidential VM (Virtual Machine) enabled with SGX. After the Enclave is created, the Enclave can be initialized.

[0035] In some embodiments, a digest of the data to be stored is generated; a predefined component inside the trusted execution environment is invoked through an interface of the trusted execution environment, and the digest of the data to be stored is sent to the trusted execution environment.

[0036] For example, a hash function is used to generate a digest of the data to be stored. The first component for generating the digest of the data to be stored is located outside the trusted execution environment, and the predefined component (i.e., the second component) inside the trusted execution environment can be invoked through the interface and the digest of the data to be stored is sent to the trusted execution environment for secure operation. For example, the first component can invoke the second component in the Enclave through a first hardware instruction, which can switch the processor mode to the secure enclave mode. The first component can be configured in the DBMS.

[0037] In some embodiments, in the trusted execution environment, a timestamp and a monotonic counter value corresponding to the data to be stored are generated, the digest of the data to be stored, the corresponding timestamp and the monotonic counter value are combined to obtain combined information, and the combined information is signed.

[0038] Specifically, the timer component is configured to generate a current timestamp as the timestamp corresponding to the data to be stored in response to receiving the digest of the data to be stored, the monotonic counter component is configured to generate a current monotonic counter value as the monotonic counter value corresponding to the data to be stored according to a preset monotonic direction and a preset step size, and the signature component is configured to sign the binary data composed of the digest of the data to be stored, the timestamp corresponding to the data to be stored and the monotonic counter value.

[0039] The monotonic counter is, for example, monotonically increasing, and the preset step size is 1. For example, the monotonic counter value corresponding to the previous data to be stored is 1, and the monotonic counter value corresponding to the current data to be stored generated is 2.

[0040] The digest of the data to be stored, the corresponding timestamp and the monotonic counter value generated by the trusted execution environment can be combined in a preset order to form binary data, and then signed by a signing component in the trusted execution environment. The signing component can include a private key for signing. The signing process, for example, is to hash the combined information to obtain a corresponding hash value, and encrypt the hash value corresponding to the combined information using the private key to obtain a signature result. The signature result obtained by signing through the trusted execution environment is tamper-proof, and can be used later to verify whether each item in the combined information has been tampered with.

[0041] In step S104, the combined information and its signature result returned by the trusted execution environment are received.

[0042] The combined information includes the digest of the data to be stored, the timestamp and the monotonic counter value corresponding to the data to be stored generated by the trusted execution environment. For example, the first component can be called by the trusted execution environment to return the combined information and its signature. For example, the second component in the Enclave can call the first component through the second hardware instruction, and the second hardware instruction can switch the processor mode out of the secure zone mode.

[0043] In step S106, the data to be stored, the combined information and its signature result are stored correspondingly.

[0044] In some embodiments, in a preset data table of the database, the data to be stored is written, and the combined information and its signature result are written in a preset column of the row where the data to be stored is located, wherein the preset column includes an implicit column. Writing the combined information and its signature result in the implicit column can have a hiding effect and improve security. The column name of the implicit column can be configured to indicate that the data stored in the column is data signed by the trusted execution environment, for example, tee_sign.

[0045] The preset data table can be created initially, and the type of the preset data table is configured as a first type, the first type representing a type of verification based on a trusted execution environment, and a second type representing a type of verification based on a method other than the trusted execution environment. Subsequently, it can be determined how to audit, trace, and verify data in the preset data table according to the type of the preset data table. The preset data table is an immutable data table, and tampering with data in the preset data table can be detected. For example, the preset data table can be created by using a data definition language (DDL), and the type of the preset data table is configured. For example, the TYPE in the DDL is used to define the type of the preset data table and the type of an implicit column, and the default value LOCAL represents verification based on a software method (VE-S), that is, the second type, and TEE represents verification based on a hardware method, that is, the first type based on the trusted execution environment. The software method is stored in the form of a ledger table, that is, based on ledger technology, and the digest of the previous data is introduced when the digest of each piece of data is calculated, which is not described herein again.

[0046] In the scheme of the above embodiment, the digest of the to-be-stored data is sent to the trusted execution environment, the trusted execution environment generates a timestamp and a monotonic counter value corresponding to the to-be-stored data, combines the timestamp and the monotonic counter value with the digest of the to-be-stored data to obtain combined information, and signs the combined information. Further, the combined information returned by the trusted execution environment and the signature result thereof are stored in correspondence with the to-be-stored data. The trusted execution environment is a secure area constructed based on hardware, which guarantees the confidentiality and integrity of programs and data running in the trusted execution environment. The trusted execution environment adopts a hardware protection method, and the timestamp and the monotonic counter value generated by the trusted execution environment and signed can effectively improve the security of data storage, and have higher security than a software protection method. In addition, due to the setting of the timestamp and the monotonic counter value corresponding to the to-be-stored data, it can be found in time that any data is deleted or illegal data is inserted, thereby further improving the security of data storage.

[0047] In some embodiments, it is determined whether the stored data is tampered with according to the combined information and the signature result corresponding to the stored data. In other embodiments, the type of the preset data table in which the stored data is stored is read, wherein the type of the preset data table is configured as a first type or a second type, the first type representing verification based on a trusted execution environment, and the second type representing verification based on a method other than the trusted execution environment; and in a case where the type of the preset data table in which the stored data is stored is the first type, it is determined whether the stored data is tampered with according to the combined information and the signature result corresponding to the stored data. The process of verifying the stored data is described below. Figure 2 The process of verifying the stored data is described below.

[0048] Figure 2 Flowcharts are shown for some other embodiments of the data processing method disclosed herein. For example... Figure 2 As shown, the method of this embodiment includes steps S202 to S210.

[0049] It can validate any one or more stored data entries, a portion of a stored data entry, or the entire data in a preset data table. In other words, the stored data can include one or more data entries.

[0050] In step S202, for each piece of data, a summary of that data is generated and compared with the summary in the combined information corresponding to that data. If the comparison matches, step S204 is executed.

[0051] It can read stored data from a preset data table and generate a summary for each data entry.

[0052] In step S204, the signature result corresponding to each piece of data is verified using the public key corresponding to the trusted execution environment and the combined information corresponding to each piece of data. For each piece of data, if the signature verification is successful, it is determined that the data has not been tampered with; otherwise, it is determined that the data has been tampered with. If the signature verification is successful, steps S206 to S210 are executed.

[0053] After finding the public key corresponding to the trusted execution environment, the signature result corresponding to the data can be decrypted using the public key to obtain the hash value of the combined information corresponding to the data. This combined information is then hashed to obtain another hash value. The two hash values ​​are compared; if they match, the signature verification is successful. Signature verification can determine whether the combined information corresponding to each piece of data has been tampered with. Steps S202 and S204 can determine whether each piece of data has been tampered with.

[0054] In some embodiments, the existence of deleted or inserted data before and / or after each data entry can be determined based on the timestamp and monotonic counter value corresponding to each data entry.

[0055] The method disclosed herein can not only determine whether any data has been tampered with, but also whether data has been deleted or illegal data has been inserted. Deleted or inserted data is often difficult to detect and is a challenging problem in database security. This disclosure, through the application of timestamps and monotonic counter values, can promptly detect data deletion or insertion, thereby improving data storage security.

[0056] In step S206, for one or more data entries that are the first data entries stored in a preset data table, it is determined whether there is any deleted data before that data entry, and / or whether there is any deleted or inserted data between that data entry and the next data entry.

[0057] In some embodiments, for each data in the one or more data, if the data is the first data stored in the preset data table, the first timestamp and the first monotonic counter value are obtained from the trusted execution environment, and in a case that the timestamp corresponding to the data is equal to the first timestamp, and the monotonic counter value corresponding to the data is equal to the first monotonic counter value, it is determined that there is no deleted data before the data; and / or in a case that the timestamp corresponding to the data is earlier than the timestamp corresponding to the next data, and the monotonic counter value corresponding to the data is continuous with the monotonic counter value corresponding to the next data, it is determined that there is no deleted or inserted data between the data and the next data.

[0058] In step S208, for each data in the one or more data, it is determined whether there is deleted or inserted data between the data and the previous data, and / or whether there is deleted or inserted data between the data and the next data. In some embodiments, for each data in the one or more data, if the data is not the first data and the last data stored in the preset data table, in a case that the timestamp corresponding to the data is later than the timestamp corresponding to the previous data, and the monotonic counter value corresponding to the data is continuous with the monotonic counter value corresponding to the previous data, it is determined that there is no deleted or inserted data between the data and the previous data; and / or in a case that the timestamp corresponding to the data is earlier than the timestamp corresponding to the next data, and the monotonic counter value corresponding to the data is continuous with the monotonic counter value corresponding to the next data, it is determined that there is no deleted or inserted data between the data and the next data.

[0059] In step S210, for each data in the one or more data, it is determined whether there is deleted or inserted data between the data and the previous data, and / or whether there is deleted or inserted data after the data.

[0060] In some embodiments, for each data in the one or more data, if the data is the last data stored in the preset data table, in a case that the timestamp corresponding to the data is later than the timestamp corresponding to the previous data, and the monotonic counter value corresponding to the data is continuous with the monotonic counter value corresponding to the previous data, it is determined that there is no deleted or inserted data between the data and the previous data; and / or in a case that the timestamp corresponding to the data is earlier than the current time, and the monotonic counter value corresponding to the data is the same as the current monotonic counter value, the current monotonic counter value is obtained from the trusted execution environment, and it is determined that there is no deleted data after the data.

[0061] For a plurality of data (which can be the full amount of data in the entire preset data table), the time stamp and the monotonic counter value of each data can be traversed according to the storage order from front to back in the preset data table. If the time stamp is sequentially increasing and the monotonic counter value is continuous, it is determined that there is no deleted data or inserted data between the plurality of data. Otherwise, it is determined that there is deleted data or inserted data between the plurality of data. In this way, it can be determined whether the intermediate data is deleted or inserted, but it cannot be determined whether there is deleted data before the first stored data or after the last stored data. The monotonic counter value is continuous, that is, the monotonic direction of the monotonic counter value of each data is a preset monotonic direction, and the difference between the monotonic counter values of any two adjacent data is a preset step.

[0062] For the first stored data in the preset data table, the first time stamp and the first monotonic counter value are obtained from the trusted execution environment. In addition to judging whether it is less than the time stamp of the subsequent data and whether it is continuous with the monotonic counter value of the subsequent data, it is also necessary to judge whether the time stamp corresponding to the first stored data is equal to the first time stamp and whether the monotonic counter value corresponding to the first stored data is equal to the first monotonic counter value. If so, it is determined that there is no deleted data before the first stored data in the preset data table, and the first stored data is not illegal inserted data.

[0063] For the last stored data in the preset data table, the current monotonic counter value is obtained from the trusted execution environment. In addition to judging whether the time stamp of the previous data is sequentially increasing and whether the monotonic counter value of the previous data is continuous when traversing to the last stored data according to the storage order from front to back in the preset data table, it is also necessary to judge whether the monotonic counter value corresponding to the last stored data is equal to the current monotonic counter value. If so, it is determined that there is no deleted data after the last stored data in the preset data table, and the last stored data is not illegal inserted data.

[0064] For each data, it can only be determined whether there is deleted or inserted data before the data, or only be determined whether there is deleted or inserted data after the data. The deleted or inserted data can be one or more, which can be determined according to the difference between the monotonic counters corresponding to the adjacent two data.

[0065] The method of the above embodiment can verify the integrity of the stored data, and can realize finding tampered data, finding illegal inserted data, and finding deleted data. Moreover, the method of the above embodiment can verify any stored data, and only needs to compare the time stamp and the monotonic counter value to find the deleted or inserted data, thereby improving the verification efficiency.

[0066] The present disclosure also provides a data processing apparatus, which is described below in conjunction with Figure 3 .

[0067] Figure 3 is a structural diagram of some embodiments of the data processing apparatus of the present disclosure. As shown in the figure, the apparatus 30 of the embodiments comprises a sending module 310, a receiving module 320 and a storage module 330. Figure 3

[0068] The sending module 310 is configured to send, to the trusted execution environment, a digest of the data to be stored.

[0069] In some embodiments, the sending module 310 is configured to generate the digest of the data to be stored, call a predefined component inside the trusted execution environment through an interface of the trusted execution environment, and send the digest of the data to be stored to the trusted execution environment.

[0070] In some embodiments, the predefined component comprises a timer component, a monotonic counter component and a signature component, wherein the timer component is configured to generate a current timestamp as a timestamp corresponding to the data to be stored in response to receiving the digest of the data to be stored, the monotonic counter component is configured to generate a current monotonic counter value as a monotonic counter value corresponding to the data to be stored in a preset monotonic direction and at a preset step length, and the signature component is configured to sign binary data composed of the digest of the data to be stored, the timestamp corresponding to the data to be stored and the monotonic counter value.

[0071] The receiving module 320 is configured to receive combined information returned by the trusted execution environment and a signature result thereof, wherein the combined information comprises the digest of the data to be stored, the timestamp corresponding to the data to be stored and the monotonic counter value generated by the trusted execution environment.

[0072] The storage module 330 is configured to store the data to be stored, the combined information and the signature result thereof correspondingly.

[0073] In some embodiments, the storage module 330 is configured to write the data to be stored in a preset data table of a database, and write the combined information and the signature result thereof in a preset column of a row where the data to be stored is located, wherein the preset column comprises an implicit column.

[0074] In some embodiments, the apparatus 30 further comprises a verification module 340 configured to determine whether the stored data has been tampered with according to the combined information and the signature result corresponding to the stored data.

[0075] ​In some embodiments, the stored data comprises one or more pieces of data, and the verification module 340 is configured to, for each piece of data, generate a digest of the piece of data, and compare the digest with a digest in the combination information corresponding to the piece of data; in a case where the comparison is consistent, use a public key corresponding to the trusted execution environment and the combination information corresponding to the piece of data to verify a signature result corresponding to the piece of data; and in a case where the verification is successful, determine that the piece of data has not been tampered with.

[0076] In some embodiments, the verification module 340 is further configured to, for a piece of data that is the first stored data in the preset data table among the one or more pieces of data, obtain a first timestamp and a first monotonic counter value from the trusted execution environment, and in a case where a timestamp corresponding to the piece of data is equal to the first timestamp and a monotonic counter value corresponding to the piece of data is equal to the first monotonic counter value, determine that there is no deleted data before the piece of data; and / or in a case where the timestamp corresponding to the piece of data is earlier than a timestamp corresponding to a next piece of data, and the monotonic counter value corresponding to the piece of data is continuous with a monotonic counter value corresponding to the next piece of data, determine that there is no deleted or inserted data between the piece of data and the next piece of data.

[0077] In some embodiments, the verification module 340 is further configured to, for each piece of data that is neither the last stored data nor the first stored data in the preset data table among the one or more pieces of data, in a case where a timestamp corresponding to the piece of data is later than a timestamp corresponding to a previous piece of data, and a monotonic counter value corresponding to the piece of data is continuous with a monotonic counter value corresponding to the previous piece of data, determine that there is no deleted or inserted data between the piece of data and the previous piece of data; and / or in a case where the timestamp corresponding to the piece of data is earlier than a timestamp corresponding to a next piece of data, and the monotonic counter value corresponding to the piece of data is continuous with a monotonic counter value corresponding to the next piece of data, determine that there is no deleted or inserted data between the piece of data and the next piece of data.

[0078] In some embodiments, the verification module 340 is further configured to, for a piece of data that is the last stored data in the preset data table among the one or more pieces of data, in a case where a timestamp corresponding to the piece of data is later than a timestamp corresponding to a previous piece of data, and a monotonic counter value corresponding to the piece of data is continuous with a monotonic counter value corresponding to the previous piece of data, determine that there is no deleted or inserted data between the piece of data and the previous piece of data; and / or obtain a current monotonic counter value from the trusted execution environment, and in a case where the timestamp corresponding to the piece of data is earlier than a current time, and the monotonic counter value corresponding to the piece of data is the same as the current monotonic counter value, determine that there is no deleted data after the piece of data.

[0079] In some embodiments, the verification module 340 is configured to read the type of the preset data table in which the stored data is located, wherein the type of the preset data table is configured as a first type or a second type, the first type indicating verification based on the trusted execution environment, and the second type indicating verification based on a manner other than the trusted execution environment; and in a case where the type of the preset data table in which the stored data is located is the first type, the stored data is determined to be tampered with or not according to the combination information corresponding to the stored data and the signature result.

[0080] In some embodiments, the apparatus 30 further includes a creation module 350 configured to create a trusted execution environment and configure a predefined component to execute in the trusted execution environment; and initialize a timer component and a monotonic counter component in the trusted execution environment.

[0081] In some embodiments, the creation module 350 is further configured to create a preset data table; and configure the type of the preset data table as a type indicating verification through the trusted execution environment.

[0082] Each of the modules in the above embodiments is configured to perform the corresponding steps in the data processing method of any of the preceding embodiments, and thus no further description is provided.

[0083] The data processing apparatus in the embodiments of the present disclosure can each be implemented by various computing devices or computer systems, which are described below in conjunction with Figure 4 and Figure 5 .

[0084] Figure 4 is a structural diagram of some embodiments of the data processing apparatus of the present disclosure. As shown in the figure, the apparatus 40 of this embodiment includes a memory 410 and a processor 420 coupled to the memory 410, and the processor 420 is configured to perform the data processing method in any of the embodiments of the present disclosure based on instructions stored in the memory 410. Figure 4

[0085] The memory 410 may, for example, include system memory, fixed non-volatile storage media, etc. The system memory may, for example, store an operating system, application programs, a Boot Loader, a database, and other programs, etc.

[0086] Figure 5 is a structural diagram of some other embodiments of the data processing apparatus of the present disclosure. As shown in the figure, the apparatus 40 of this embodiment includes a memory 410 and a processor 420 coupled to the memory 410, and the processor 420 is configured to perform the data processing method in any of the embodiments of the present disclosure based on instructions stored in the memory 410. Figure 5 ​As shown, the apparatus 50 of the embodiment includes a memory 510 and a processor 520, which are similar to the memory 410 and the processor 420 respectively. It can also include an input / output interface 530, a network interface 540, a storage interface 550, etc. These interfaces 530, 540, 550 and the memory 510 and the processor 520 can be connected through a bus 560, for example. The input / output interface 530 provides a connection interface for display, mouse, keyboard, touch screen, and other input / output devices. The network interface 540 provides a connection interface for various networking devices, which can be connected to a database server or a cloud storage server, etc. The storage interface 550 provides a connection interface for external storage devices such as SD card and U disk.

[0087] In the data processing apparatus 40 / 50 in the above embodiments, the memory and the processor can allocate a part of the secure area as a trusted execution environment, and a predefined component in the trusted execution environment as an instruction, which can be executed in the trusted execution environment.

[0088] The present disclosure also provides a computer program, which includes instructions that, when executed by a processor, cause the processor to perform the data processing method of any of the preceding embodiments.

[0089] Those skilled in the art should understand that the embodiments of the present disclosure can be provided as a method, a system, or a computer program product. Therefore, the present disclosure can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present disclosure can take the form of a computer program product implemented on one or more computer-usable non-transitory storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, etc.) containing computer usable program code.

[0090] The present disclosure is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as a combination of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus produce a device that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in a flow or multiple flows and / or blocks Figure 1 The apparatus that implements the functions specified in a flow or multiple flows and / or blocks.

[0091] These computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture including instructions which implement the flow Figure 1 The flow or flows and / or blocks Figure 1 The flow or flows and / or blocks

[0092] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions that are executed on the computer or other programmable apparatus provide steps for implementing the flow Figure 1 The flow or flows and / or blocks Figure 1 The flow or flows and / or blocks

[0093] The above description is merely illustrative of the application, and not restrictive. Since certain changes can be made in the above construction without departing from the scope of the application, it is intended that all such changes come within the scope of the application as claimed below.

Claims

1. A data processing method, comprising: generating a digest of data to be stored; invoking, through an interface of a trusted execution environment, a predefined component inside the trusted execution environment to send the digest of the data to be stored to the trusted execution environment, wherein the predefined component comprises a timer component, a monotonic counter component and a signature component, wherein the timer component is configured to generate a current timestamp as a timestamp corresponding to the data to be stored in response to receiving the digest of the data to be stored, the monotonic counter component is configured to generate a current monotonic counter value as a monotonic counter value corresponding to the data to be stored in a preset monotonic direction and a preset step, and the signature component is configured to sign binary data composed of the digest of the data to be stored, the timestamp and the monotonic counter value corresponding to the data to be stored; receiving combined information returned by the trusted execution environment and a signature result of the combined information, wherein the combined information comprises the digest of the data to be stored, the timestamp and the monotonic counter value corresponding to the data to be stored and generated by the trusted execution environment; and storing the data to be stored, the combined information and the signature result of the combined information correspondingly, wherein the signature result of the combined information is used to verify based on a public key of the trusted execution environment to determine whether the data to be stored is tampered, and the timestamp and the monotonic counter value in the combined information are used to determine whether there is data deleted or inserted before and / or after the data to be stored. 2.The data processing method of claim 1, further comprising: determining whether stored data is tampered according to the combined information and the signature result corresponding to the stored data. The stored data comprises one or more pieces of data, and the determining whether the stored data is tampered according to the signature result and the combined information corresponding to the stored data comprises: for each piece of data, generating a digest of the piece of data and comparing the digest with a digest in the combined information corresponding to the piece of data; in a case of consistent comparison, verifying a signature result corresponding to the piece of data by using a public key of the trusted execution environment and the combined information corresponding to the piece of data; and in a case of successful verification, determining that the piece of data is not tampered. The determining whether the stored data is tampered according to the signature result and the combined information corresponding to the stored data further comprises: for a piece of data that is the first stored in a preset data table among the one or more pieces of data, obtaining a first timestamp and a first monotonic counter value from the trusted execution environment, and in a case that a timestamp corresponding to the piece of data is equal to the first timestamp and a monotonic counter value corresponding to the piece of data is equal to the first monotonic counter value, determining that there is no deleted data before the piece of data; and / or in a case that the timestamp corresponding to the piece of data is earlier than a timestamp corresponding to a next piece of data, and the monotonic counter value corresponding to the piece of data is continuous with a monotonic counter value corresponding to the next piece of data, determining that there is no deleted or inserted data between the piece of data and the next piece of data. ​ ​ ​ 3. The data processing method of claim 2, wherein, ​ ​ ​ ​ 4. The data processing method of claim 3, wherein, ​ ​ ​ ​ 5. The data processing method of claim 3, wherein, The determining whether the stored data is tampered with according to the signature result corresponding to the stored data and the combination information further comprises: For each data in the one or more data that does not belong to the last stored and the first stored data in the preset data table, In a case that the timestamp corresponding to the data is later than the timestamp corresponding to the previous data, and the monotonic counter value corresponding to the data is continuous with the monotonic counter value corresponding to the previous data, it is determined that there is no data deleted or inserted between the data and the previous data; and / or In a case that the timestamp corresponding to the data is earlier than the timestamp corresponding to the next data, and the monotonic counter value corresponding to the data is continuous with the monotonic counter value corresponding to the next data, it is determined that there is no data deleted or inserted between the data and the next data.

6. The data processing method of claim 3, wherein, The determining whether the stored data is tampered with according to the signature result corresponding to the stored data and the combination information further comprises: For each data in the one or more data that does not belong to the last stored and the first stored data in the preset data table, In a case that the timestamp corresponding to the data is later than the timestamp corresponding to the previous data, and the monotonic counter value corresponding to the data is continuous with the monotonic counter value corresponding to the previous data, it is determined that there is no data deleted or inserted between the data and the previous data; and / or In a case that the timestamp corresponding to the data is earlier than the timestamp corresponding to the next data, and the monotonic counter value corresponding to the data is continuous with the monotonic counter value corresponding to the next data, it is determined that there is no data deleted or inserted between the data and the next data.

7. The data processing method of claim 2, further comprising: reading a type of the preset data table in which the stored data is located, wherein the type of the preset data table is configured as a first type or a second type, the first type indicating verification based on a trusted execution environment, and the second type indicating verification based on a manner other than the trusted execution environment; wherein the determining whether the stored data is tampered with according to the combination information and the signature result corresponding to the stored data comprises: in a case that the type of the preset data table in which the stored data is located is the first type, determining whether the stored data is tampered with according to the combination information and the signature result corresponding to the stored data.

8. The data processing method of claim 1, further comprising: creating the trusted execution environment, and configuring the predefined component to execute in the trusted execution environment; initializing a timer component and a monotonic counter component in the trusted execution environment.

9. The data processing method of claim 1, wherein, The corresponding storage of the to-be-stored data, the combination information and the signature result thereof comprises: writing the to-be-stored data in a preset data table of a database, and writing the combination information and the signature result thereof in a preset column of a row in which the to-be-stored data is located, wherein the preset column comprises an implicit column.

10. A data processing apparatus, comprising: The sending module is configured to generate a digest of the to-be-stored data, and send the digest of the to-be-stored data to a predefined component inside the trusted execution environment through an interface of the trusted execution environment, wherein the predefined component comprises a timer component, a monotonic counter component and a signature component; the timer component is configured to generate a current time stamp as a time stamp corresponding to the to-be-stored data in response to receiving the digest of the to-be-stored data; the monotonic counter component is configured to generate a current monotonic counter value as a monotonic counter value corresponding to the to-be-stored data in a preset monotonic direction and at a preset step length; and the signature component is configured to sign binary data composed of the digest of the to-be-stored data, the time stamp corresponding to the to-be-stored data and the monotonic counter value; The receiving module is configured to receive combined information returned by the trusted execution environment and a signature result of the combined information, wherein the combined information comprises the digest of the to-be-stored data, the time stamp corresponding to the to-be-stored data and the monotonic counter value generated by the trusted execution environment. The storage module is configured to store the to-be-stored data, the combined information and the signature result of the combined information correspondingly, and the signature result of the combined information is used for verification based on a public key of the trusted execution environment to determine whether the to-be-stored data is tampered with, and the time stamp and the monotonic counter value in the combined information are used to determine whether there is deleted or inserted data before and / or after the to-be-stored data.

11. A data processing apparatus comprising: a processor; and a memory coupled to the processor for storing instructions which, when executed by the processor, cause the processor to perform the data processing method of any one of claims 1-9. The program, when executed by the processor, implements the steps of the method of any one of claims 1-9.

12. A non-transitory computer readable storage medium having stored thereon a computer program, wherein, Instructions which, when executed by the processor, cause the processor to perform the data processing method of any one of claims 1-9.

13. A computer program product, comprising: ​

Citation Information

Patent Citations

  • ARM TrustZone-based mobile terminal security service method and device

    CN107835185A

  • Creating and verifying a sequence of consecutive data

    US20040054901A1