Database integrity checking method, device, system, medium and equipment
By injecting aspect enhancement code at the point of entry in the database and utilizing a symmetric key approach with hash-based message authentication codes from a trusted third-party cryptographic service, the issues of database integrity and security are resolved, enabling dynamic data protection and flexible verification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2026-03-24
AI Technical Summary
Existing technologies cannot effectively guarantee the integrity and security of database data, leading to a decline in user trust and threats from external attacks and internal malicious tampering.
By injecting aspect enhancement code at preset cut-off points in the database, a verification hash value is generated, and a trusted third-party cryptographic service is used for data signing and verification. The hash operation message authentication code symmetric key method is adopted to ensure data integrity and authenticity.
It enables dynamic protection of data integrity without modifying the original database code, adapts to different types of databases, supports flexible configuration, and improves data security and reliability.
Smart Images

Figure CN119670158B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a database integrity verification method, apparatus, system, medium, and device. Background Technology
[0002] With the advent of the big data era, data has become a crucial asset for enterprises, making effective analysis and utilization of data paramount. However, as the value of data increases, databases face security threats such as attacks from external hackers and potential malicious tampering by internal personnel (e.g., database administrators). These threats can lead to a decline in user trust in database products, causing concerns that data integrity and security cannot be effectively guaranteed.
[0003] Currently, there is an urgent need to provide a highly secure database integrity verification scheme to protect the integrity of database data, thereby enhancing users' confidence in the database system. Summary of the Invention
[0004] This specification provides a database integrity verification method. It verifies data integrity and authenticity using a hash-based message authentication code symmetric key approach, further enhances database trustworthiness by leveraging cryptographic services provided by a trusted third party, and employs aspect injection to enhance logic. Data signing and verification can be implemented without modifying the database code, supporting multiple databases and flexible configuration. The database integrity verification method includes:
[0005] Inject aspect enhancement code at the preset point locations in the database;
[0006] When a modification operation is received for the database, the aspect enhancement code is executed to generate a verification hash value corresponding to the modification operation;
[0007] Invoke the cryptographic service of a trusted third party, and use the cryptographic service to sign the target data corresponding to the modification operation with the verification hash value;
[0008] The database data is verified based on the hash operation message authentication code obtained from the verification hash value and data signature to determine whether the database has been tampered with.
[0009] Furthermore, in some embodiments, the database includes at least one data table, and the verification hash value includes a row hash value and a link hash value;
[0010] When a modification operation is received for the database, the aspect enhancement code is executed to generate a verification hash value corresponding to the modification operation, including:
[0011] When a modification operation is received for a target data table in the database, the row hash value of the target row data that has been modified in the target data table is calculated by executing the aspect enhancement code;
[0012] And determine the link hash value of the target row data based on the row hash value of the target row data and the link hash value of the previous row data.
[0013] Furthermore, in some embodiments, the method further includes:
[0014] A tamper-proof table corresponding to the target data table is created by executing the aspect enhancement code.
[0015] The row hash value, row identifier, and link hash value of the target row data are stored in the anti-tampering table.
[0016] Furthermore, in some embodiments, the step of invoking a trusted third-party cryptographic service to sign the target data corresponding to the modification operation using the verification hash value includes:
[0017] The trusted third party's cryptographic service is asynchronously invoked according to a preset data signature period;
[0018] A signature calculation is performed based on the signature key generated by the cryptographic service and the link hash value of the target row data to obtain the hash operation message authentication code of the target row data.
[0019] Furthermore, in some embodiments, the method further includes:
[0020] The signature key is derived from the database access password and the private key of the trusted third party.
[0021] Furthermore, in some embodiments, the method further includes:
[0022] The hash operation message authentication code of the target row data is stored in the anti-tampering table.
[0023] Furthermore, in some embodiments, the step of verifying the database data based on the hash operation message authentication code obtained from the verification hash value and the data signature to determine whether the database has been tampered with includes:
[0024] The target data table is polled according to a preset data verification cycle to obtain the row data to be verified, including the target row data.
[0025] Calculate the row hash value and link hash value of the row data to be verified, and compare the row hash value and link hash value of the row data to be verified with the row hash value and link hash value of the corresponding row in the anti-tampering table respectively;
[0026] If all comparisons are consistent, the hash operation message authentication code obtained from the data signature is used to verify the data of the row to be verified.
[0027] If any comparison is inconsistent, it is determined that the data of the row to be verified has been tampered with.
[0028] Furthermore, in some embodiments, the step of calculating the row hash value and link hash value of the row data to be verified, and comparing the row hash value and link hash value of the row data to be verified with the row hash value and link hash value of the corresponding row in the anti-tampering table, includes:
[0029] Calculate the row hash value of the row data to be verified, and compare the row hash value of the row data to be verified with the row hash value of the corresponding row in the anti-tampering table;
[0030] If the comparison matches, the link hash value of the row data to be verified is calculated, and the link hash value of the row data to be verified is compared with the link hash value of the corresponding row in the anti-tampering table.
[0031] Furthermore, in some embodiments, the step of using the hash operation message authentication code obtained from the data signature to further verify the data to be verified includes:
[0032] The chain hash value of the row data to be verified is used to calculate the hash operation message authentication code of the row data to be verified through the cryptographic service of a trusted third party;
[0033] The hash message authentication code of the row data to be verified is compared with the hash message authentication code of the corresponding row in the anti-tampering table;
[0034] If the comparison is inconsistent, it is determined that the data of the row to be verified has been tampered with.
[0035] Furthermore, in some embodiments, before injecting aspect enhancement code at a preset point location in the database, the method further includes:
[0036] Upon receiving a verification command for the database, configuration data is sent to the aspect enhancement code to determine the target data table that needs to be verified for data integrity based on the configuration data; wherein, the configuration data includes the target data table;
[0037] It also allows configuring trusted third-party cryptographic service interface information, data signature cycles, and data verification cycles through the configuration channel.
[0038] Furthermore, in some embodiments, the method further includes:
[0039] If it is determined that the database has been tampered with, an alarm will be issued or the tampered database will be replaced with a backup database.
[0040] This specification also provides an embodiment of a database integrity verification device, the device comprising:
[0041] The code injection module is used to inject aspect enhancement code at preset pointcut locations in the database;
[0042] The code execution module is used to execute the aspect enhancement code when a modification operation is received for the database, so as to generate a verification hash value corresponding to the modification operation;
[0043] The data signature module is used to call the cryptographic service of a trusted third party to sign the target data corresponding to the modification operation by using the cryptographic service to verify the hash value.
[0044] The data verification module is used to verify the database data using the verification hash value and the hash operation message authentication code obtained from the data signature, in order to determine whether the database has been tampered with.
[0045] This specification also proposes a database integrity verification system, the system comprising:
[0046] An aspect engine is used to inject aspect enhancement code at preset point location positions in the database based on a list of point points.
[0047] The database is used to execute the aspect enhancement code for timed signing and timed verification when a modification operation is received for the database.
[0048] A trusted third party is used to provide cryptographic services to the database, enabling the database to invoke the cryptographic services for periodic signing and periodic verification.
[0049] Furthermore, in some embodiments, the aspect engine includes an aspect injection module, which is used to maintain the pointcut list, manage the aspect enhancement code, and control configuration data.
[0050] Furthermore, in some embodiments, the database includes a scheduled task aspect module, which is used to start a scheduled signing task and asynchronously call the cryptographic service of the trusted third party according to a preset data signing period, so as to use the cryptographic service to perform data signing on the target data corresponding to the modification operation, and to start a scheduled verification task, and verify the database data according to a preset data verification period based on the data signing result, so as to determine whether the database has been tampered with.
[0051] Furthermore, in some embodiments, the trusted third party includes a cryptographic service module, which provides a signature key, performs signature calculations based on the signature key to obtain a data signature result, and feeds back the data signature result to the scheduled task aspect module, so that the database data can be signed and verified based on the data signature result through the scheduled task aspect module.
[0052] This specification also provides a storage medium storing a computer program adapted to be loaded by a processor and to execute the steps of the method described above.
[0053] This specification also provides an electronic device, including a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to execute the steps of the method described above.
[0054] This specification also provides a computer program product that stores at least one instruction adapted to be loaded by a processor and executed in accordance with the above-described method steps.
[0055] In the embodiments described in this specification, firstly, aspect enhancement code is injected at a preset point location in the database. Then, upon receiving a modification operation on the database, the aspect enhancement code is executed to generate a verification hash value corresponding to the modification operation. Further, a trusted third-party cryptographic service is invoked to perform a data signature on the target data corresponding to the modification operation using the verification hash value. Finally, the database data is verified based on the hash operation message authentication code obtained from the verification hash value and the data signature to determine whether the database has been tampered with. On the one hand, by generating a verification hash value corresponding to each modification operation each time data is modified, the integrity of the data can still be verified after modification, improving the protection performance of database integrity. On the other hand, the data anti-tampering signature and verification adopts a hash operation message authentication code symmetric key method, which can not only further verify the integrity of the data, but also verify the authenticity of the data source. Moreover, the cryptographic service provided by a trusted third party ensures the security of the signature process. Furthermore, without modifying the original database code, enhanced logic is dynamically injected through aspect injection, which can realize data signature and verification functions without modifying the database, thereby achieving the purpose of data integrity verification. Importantly, aspect injection can be adapted to different types of databases and supports management configuration methods, making the database integrity verification process more flexible and adaptable. Attached Figure Description
[0056] Figure 1 This is a schematic diagram of the architecture of a database integrity verification system according to an embodiment of this specification;
[0057] Figure 2 A flowchart illustrating a database integrity verification method provided in the embodiments of this specification;
[0058] Figure 3 A flowchart illustrating another database integrity verification method provided in the embodiments of this specification;
[0059] Figure 4 A schematic diagram of an anti-tampering table provided for an embodiment of this specification;
[0060] Figure 5 This is a schematic diagram of the structure of a database integrity verification device provided in the embodiments of this specification;
[0061] Figure 6 This is a schematic diagram of a database integrity verification system provided in the embodiments of this specification;
[0062] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this specification. Detailed Implementation
[0063] To make the objectives, technical solutions, and advantages of this specification clearer, the technical solutions of this specification will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this specification, and not all of them. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this specification.
[0064] Figure 1 A schematic diagram of the architecture of a database integrity verification system that can be applied to embodiments of this specification is shown.
[0065] like Figure 1 As shown, system architecture 100 may include one or more terminal devices such as smartphone 101, portable computer 102, and desktop computer 103, network 104, and server 105. Network 104 serves as the medium for providing a communication link between the terminal devices and server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables. Terminal devices may be various electronic devices with data management functions. For example, users can query and modify database data through electronic devices. Server 105 can be used to process requests from terminal devices and perform functions such as signing and verifying database data.
[0066] It is understood that server 105 can host components such as a database, an aspect engine, and a trusted third-party cryptographic service. The database can be a relational database, such as MySQL (an open-source relational database) or PostgreSQL (an object-relational database), or a non-relational database, such as MongoDB (an open-source document database based on distributed file storage). The aspect engine can run as middleware on the server, such as a service implemented based on the Spring AOP (Aspect-Oriented Programming) framework, used to execute aspect logic at appropriate times. The trusted third party can provide secure communication links and cryptographic services. The trusted third-party cryptographic service can be a locally deployed service or a remote service called via an API (Application Programming Interface); this specification does not limit the specific services offered in this embodiment.
[0067] For example, a user sends a database integrity verification request to the server via a terminal device. The aspect engine on the server injects enhanced logic at preset pointcuts in the database. Then, the server calls a trusted third-party cryptographic service to sign the relevant data to ensure data integrity and the reliability of its source. Finally, the server stores the signed data in the database and verifies its integrity. It's important to note that the aspect logic is executed in the business logic layer, not directly on the database.
[0068] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, there can be any number of terminal devices, networks, and servers. For example, server 105 could be a server cluster composed of multiple servers.
[0069] Please see Figure 2 This document provides a flowchart illustrating a database integrity verification method as described in an embodiment of this specification. In this embodiment, the database integrity verification method is applied to a database integrity verification device or an electronic device equipped with such a device. The following will focus on... Figure 2 The process shown will be described in detail. The database integrity verification method may specifically include the following steps:
[0070] S202, inject aspect enhancement code at the preset point location in the database;
[0071] In one or more embodiments of this specification, a preset pointcut location in the database refers to a predefined location in database operations suitable for injecting additional logic. This location may correspond to important operation points in the database, such as before or after data insertion, update, or deletion operations. That is, code or logic injected at the preset pointcut location will be activated. Aspect-enhanced code refers to the specific logic injected at the preset pointcut location to implement data integrity protection functions, which may include, but is not limited to, data signing and data verification. For example, data signing may involve generating a data hash value before or after a data modification operation and signing it using the HMAC (Hash-based Message Authentication Code) algorithm based on the data hash value. Data verification may involve verifying the integrity of the database data before or after a data modification operation to ensure that the database data has not been tampered with.
[0072] Optionally, injecting aspect-based enhancement code at preset pointcut locations in the database refers to dynamically inserting additional logic at specific operation points in the database management system to implement functions such as data signing and verification. For example, the Spring AOP framework can be used to inject aspect logic, thereby separating aspect logic from business logic and making the original database code more modular and easier to maintain. As another example, if the database management system supports plugins or extension mechanisms, aspect logic can be injected using these mechanisms without modifying the original database code; only the corresponding plugins need to be installed and configured.
[0073] Of course, after injecting aspect enhancement code at the preset point of contact in the database, comprehensive testing and verification can be performed to ensure that the aspect enhancement code can be executed correctly at the preset point of contact without interfering with the original database operation process.
[0074] The embodiments in this specification demonstrate that by instrumenting (i.e. injecting aspect enhancement code) at key operation points in the database and executing integrity protection logic, such as data signing and verification, through the insertion points, the integrity of database data can be managed and protected more flexibly, while also facilitating the later maintenance and upgrade of the database.
[0075] S204, when a modification operation is received for the database, the aspect enhancement code is executed to generate a verification hash value corresponding to the modification operation;
[0076] The modification operation to the database can be inserting, updating, or deleting a row of data; this specification does not limit this. Upon receiving a modification operation to the database, the aspect enhancement code corresponding to the modification operation is activated, and preparatory work for data signing and verification begins.
[0077] In one or more embodiments of this specification, verification hash values, such as rowhash and linkhash, are calculated for modified data rows by executing aspect-oriented enhancement code. For example, the inserted or updated data rows can be hashed to obtain verification hash values, which can then be used for subsequent data integrity checks. The verification hash values can be calculated using secure hash algorithms such as SHA-256 (Secure Hash Algorithm 256) or MD5 (Message Digest Algorithm 5) to ensure that even small changes produce significantly different hash values.
[0078] The embodiments in this specification ensure that a verification hash value corresponding to each modification operation is generated every time database data is modified, providing a basis for subsequent data integrity verification. Furthermore, by generating a verification hash value corresponding to each modification operation each time data is modified, it can be ensured that the integrity of the data can still be verified after modification, thus improving the database integrity protection performance.
[0079] Additionally, it should be noted that when data integrity protection for database data is enabled through management configuration, the corresponding aspect enhancement code will simultaneously create a corresponding anti-tampering table. When a modification operation is received on the database, the anti-tampering table will be maintained at the preset point location via aspect enhancement code. Optionally, a verification hash value corresponding to the modification operation can be generated and stored in the anti-tampering table, and associated with the corresponding data record for subsequent data integrity verification. For example, the row hash value, row identifier, and link hash value of the target row data can all be stored in the anti-tampering table.
[0080] Of course, in addition to storing the verification hash value, other metadata, such as operation timestamps and operation types (insert, update, or delete), can also be saved to facilitate subsequent data verification.
[0081] S206, invoke the cryptographic service of a trusted third party to perform data signature on the target data corresponding to the modification operation using the cryptographic service with the verification hash value;
[0082] In one or more embodiments of this specification, the aspect enhancement code calls a cryptographic service interface provided by a trusted third party, and passes the calculated verification hash value to the cryptographic service of the trusted third party through the cryptographic service interface. For example, by establishing a connection with the trusted third party and sending a request carrying the verification hash value to the trusted third party, the cryptographic service of the trusted third party is requested to perform data signing on the target data corresponding to the modification operation. The target data may be an unsigned data row that is inserted or updated; this specification does not limit this aspect.
[0083] Upon receiving a request, a trusted third-party cryptographic service can sign the received verification hash value using a preset key, such as a private key. Optionally, an HMAC algorithm combined with a shared key can be used to calculate the signature value. For example, the signature value can be obtained by inputting the verification hash value corresponding to the target data and the shared key into a hash function. The shared key can be derived from the preset key, and this specification does not limit this aspect. It is understood that the signature value will serve as proof of data integrity in subsequent data verification processes.
[0084] Then, the trusted third party returns the calculated signature value to the database. By associating the signature value with the verification hash value of the target data, the data signature of the target data is achieved. It is understandable that the signature value of the target data corresponding to the modification operation can also be stored in the appropriate location in the anti-tampering table for subsequent data integrity verification.
[0085] The embodiments in this specification ensure that a signature result corresponding to the modification operation is generated every time the database data is modified, thereby providing an effective means of verifying the integrity of the data.
[0086] S208, the database data is verified based on the hash operation message authentication code obtained from the verification hash value and data signature to determine whether the database has been tampered with.
[0087] In one or more embodiments of this specification, taking a data table in a database as an example, the data verification process starts from the first row of the data table and retrieves the data rows to be verified row by row. For the current data row to be verified, the corresponding verification hash value, such as rowhash or linkhash, is recalculated. This verification hash value is used to compare with the verification hash value recorded in the anti-tampering table to confirm the integrity of the data row to be verified. Furthermore, the signature value of the current data row to be verified is recalculated using the same HMAC algorithm and shared key. The calculated HMAC value is compared with the signature value recorded in the anti-tampering table to further verify the consistency of the data signature.
[0088] For example, if the verification hash value of the data to be verified matches the verification hash value in the anti-tampering table, and the calculated signature value also matches the signature value in the anti-tampering table, then the data is considered to have not been tampered with. If either value does not match, it indicates that the data may have been tampered with, requiring further inspection or appropriate alerts or maintenance measures.
[0089] The data tamper-proof signature and verification methods in the embodiments of this specification employ a hash-based message authentication code symmetric key approach. This not only further verifies data integrity but also the authenticity of the data source. Furthermore, cryptographic services are provided by a trusted third party, ensuring the security of the signature process. Additionally, without modifying the original database code, enhanced logic is dynamically injected via aspect injection, enabling data signing and verification functions without database modifications, thus achieving the goal of data integrity verification. Importantly, aspect injection can adapt to different types of databases and supports various configuration methods, making the database integrity verification process more flexible and adaptable.
[0090] Please see Figure 3This document provides a flowchart illustrating another database integrity verification method for embodiments of this specification. The database may include at least one data table. The database integrity verification method specifically includes the following steps:
[0091] S302, inject aspect enhancement code at the preset point location in the database;
[0092] The preset cutoff point of the database can be when a user or application requests to enable the anti-tampering function of a certain data table, when a new data row is inserted into the protected table, or when an existing data row is updated. This specification does not limit this to the embodiments.
[0093] For step S302, please refer to the detailed description of step S202 in another embodiment of this specification, which will not be repeated here.
[0094] S304, when a modification operation is received for the target data table in the database, the row hash value of the target row data that has been modified in the target data table is calculated by executing the aspect enhancement code, and the link hash value of the target row data is determined based on the row hash value of the target row data and the link hash value of the previous row data;
[0095] In one or more embodiments of this specification, the user data table shown in Table 1 is used as an example for illustration:
[0096] Table 1
[0097] id name account money 1 Bob Zfb1001 1000 2 Alice Zfb1001 2000 … … … … n-1 Jack Zfbn0n0 3000 n John Zfb n1n1 4000 … … … …
[0098] Each user record in Table 1 contains the following information: id (user identifier), name (user name), account (user account), and money (amount).
[0099] By enabling data integrity protection for this user's data table through management configuration, the corresponding aspect enhancement code will simultaneously create a tamper-proof table as shown in Table 2:
[0100] Table 2
[0101] id rowid rowhash linkhash hmac 10001 1 aaaaa aaaaa a1a1a 10002 2 bbbbb ababa b2b2b … … … … … 1000n-1 n-1 nnnnm nmnmn mxmxm 1000n n nnnnn mnmnm nxnxn … … … …
[0102] Each piece of user data in Table 2 contains the following information: id (user identifier), rowid (row identifier), rowhash (row hash value), linkhash (link hash value), and hmac (hash message authentication code).
[0103] When a user inserts or updates the user data table shown in Table 1, at the preset cutoff point position after the insertion or update is completed, the corresponding aspect enhancement code will perform data integrity verification on the anti-tampering table shown in Table 2.
[0104] For example, the target data row is a row of data inserted or updated in a user data table. The row hash value of the target data row can be calculated by executing aspect enhancement code, as follows:
[0105] rowhash n =hash(rowdata(column1 | column2 | ...)) (1)
[0106] Among them, rowhash n The hash value is the row hash of the target data row, where hash is the hash function, such as SHA-256, MD5, etc. rowdata(column1|column2|...) represents a row record composed of multiple columns of data in the target data row. "|" represents the concatenation operation, which can concatenate multiple columns of data into a string and use it as input to the hash function.
[0107] Use the rowhash of the target data row n The rowid of that row is stored together in the tamper-proof table shown in Table 2. Then, the link hash value of the target data row is calculated:
[0108] linkhash n =hash(rowhash) n +linkhash n-1 (2)
[0109] Among them, linkhash n The chain hash value of the target data row, where hash is the hash function, such as SHA-256, MD5, etc., and rowhash is the hash value of the target data row. n Linkhash is the row hash value of the target data row. n-1 This is the link hash value of the previous row of data.
[0110] refer to Figure 4 The diagram shown illustrates a tamper-proof table. Figure 4 As can be seen, the chain hash value of each row of data depends on the chain hash value of the previous row of data, thus forming a chain structure, which enhances the ability to detect data tampering. Moreover, it is more suitable for distributed scenarios. If you want to attack the tamper-proof table, you need to modify the signature data of all rows and break the private key of the trusted third party, making it very secure.
[0111] The aspect enhancement code can be seamlessly integrated into the existing database architecture to protect data integrity without modifying the database application itself. Moreover, the database system can transparently implement data integrity protection without affecting the original business logic.
[0112] S306, asynchronously call the cryptographic service according to the preset data signature period, perform signature calculation based on the signature key generated by the cryptographic service and the link hash value of the target row data, and obtain the hash operation message authentication code of the target row data;
[0113] The data signature period can be defined in the configuration data. For example, the preset data signature period can be once a day or once a week, and this embodiment does not limit this. Accordingly, an asynchronous task can be triggered periodically according to the data signature period. When the preset time point is reached, an asynchronous call is initiated to request a trusted third-party cryptographic service to generate a new signature key.
[0114] To obtain the latest unsigned data row in the anti-tampering table shown in Table 2, i.e., the target row data that has been modified but not signed, the link hash value of the target row data can be used as the data to be signed. This means that the link hash value of the target row data needs to be passed to a trusted third party for signing. The link hash value of the target row data is a hash value used to ensure the integrity of the linked rows; it is obtained by calculating the row hash value of the current row and the link hash value of the previous row.
[0115] For example, the signing process can use the HMAC algorithm to calculate the signature based on the signing key generated by the cryptographic service and the chain hash value of the target line data, as follows:
[0116] hmac=hmac_sha256(hmac_key, linkhash n (3)
[0117] Where hmac is the signature value of the target row data, hmac_sha256 indicates that HMAC is implemented using SHA-256 as the underlying hash function, hmac_key is the signature key, and linkhash is the signature key. n The link hash value for the target data row.
[0118] Optionally, the signature key in formula (3) can be derived from the database access password and the private key of a trusted third party, as follows:
[0119] hmac_key=KDF(password+cakey) (4)
[0120] Wherein, hmac_key is the signature key, password is the database access password, cakey is the private key of a trusted third party, and KDF (Key Derivation Function) can be any secure key derivation function, such as HKDF (HMAC-based Extract-and-Expand), KBKDF (Key-Based Extract-and-Expand), PBKDF (Password-Based Key Derivation Function), etc., which are not limited in this specification.
[0121] Then, the hash operation message authentication code of the target row data can be stored in the anti-tampering table shown in Table 2 to achieve the signature of the target row data. In this embodiment, the entire data signing process is implemented using a symmetric key, resulting in higher computational efficiency. Furthermore, this step ensures that each row of data has a signature value based on the current row and the previous row, thereby verifying data integrity.
[0122] In this embodiment, data rows stored in the anti-tampering table are periodically signed to ensure that data tampering can be detected. Furthermore, the signing process is performed by a trusted third party, guaranteeing signature security. And by returning the signed HMAC value to the anti-tampering table, it facilitates subsequent verification of data integrity during data integrity checks.
[0123] Furthermore, to ensure data security, this specification's embodiments introduce a trusted third party to perform cryptographic calculations. Specifically, a trusted certificate is used to verify the identity of the trusted third party and ensure its legitimacy. In addition, the trusted third party holds a confidential private key, which does not leave the third-party organization; all cryptographic operations based on this private key are performed internally within the third-party organization, such as calculating the HMAC value.
[0124] Authentication and services from trusted third parties enhance the protection of database integrity because the calculation of the HMAC value involves the private key, which remains confidential and does not leave the third-party organization, reducing the risk of key leakage. Furthermore, since the HMAC value calculation is performed internally by the third-party organization, the security of the calculation is also improved, ensuring that only certified services can correctly generate and verify the HMAC value, thereby increasing the effectiveness of data tampering detection.
[0125] S308, Poll the target data table according to the preset data verification cycle to obtain the row data to be verified, including the target row data;
[0126] The data verification period can also be defined in the configuration data. For example, the preset data verification period can be once a day or once a week. This embodiment of the specification does not limit this. When the preset data verification period is reached, a polling task will be started to access the target data table.
[0127] Optionally, a query can be executed to retrieve the rows to be verified, including the target rows. The rows to be verified can include all rows or only the most recently modified rows, depending on the specific business logic and verification strategy. For example, the rows to be verified can be retrieved starting from the first row of the target table and proceeding sequentially until the last row.
[0128] This step helps ensure data consistency and integrity in the database. Regular data validation allows for the timely detection and response to any attempts at data tampering, increasing the difficulty for perpetrators. Furthermore, automating data validation significantly reduces the need for manual intervention and improves the efficiency and accuracy of data management.
[0129] S310, calculate the row hash value and link hash value of the row data to be verified, and compare the row hash value and link hash value of the row data to be verified with the row hash value and link hash value of the corresponding row in the anti-tampering table respectively;
[0130] For example, the row hash value of the row data to be verified can be calculated, and then compared with the row hash value of the corresponding row in the anti-tampering table. If they match, the link hash value of the row data to be verified is calculated, and then compared with the link hash value of the corresponding row in the anti-tampering table.
[0131] For example, the rowhash of the data to be verified is calculated as shown in formula (1) to obtain rowhash1, and the latest anti-tampering record row is obtained from the anti-tampering table, such as the rowid with the same rowid and the largest id. Further, rowhash1 is compared with the rowhash value of the anti-tampering record row. If the comparison is consistent, the process continues. If the comparison is inconsistent, it indicates that the data of the data to be verified has been tampered with, and an error alarm can be issued.
[0132] When the comparison is consistent, the linkhash of the data to be verified is calculated as shown in formula (2) to obtain linkhash1. Then, linkhash1 is compared with the linkhash value of the anti-tampering record. If the comparison is consistent, continue. If the comparison is inconsistent, it means that the data of the data to be verified has been tampered with, and an error alarm can be issued.
[0133] S312, if all comparisons are consistent, the hash operation message authentication code obtained from the data signature is used to verify the data to be verified; if any comparison is inconsistent, it is determined that the data to be verified has been tampered with.
[0134] Based on the comparison results of step S310, if all comparisons are consistent, the linkhash value of the data to be verified is used to calculate the hmac value through the cryptographic service of a trusted third party, that is, according to formula (3) and formula (4), and the calculated value is compared with the hmac value of the anti-tampering record line. If the comparison is consistent, it indicates that the verification is passed and the data to be verified has not been tampered with. If the comparison is inconsistent, it indicates that the data to be verified has been tampered with and an error alarm can be issued.
[0135] This process is repeated for each row of data in the target data table. If all checks pass, it indicates that the target data table has not been tampered with. If the target data table has been tampered with, an alarm is triggered or a backup database is used to replace the tampered database.
[0136] Understandably, before injecting aspect enhancement code at the preset point of contact in the database, if a verification instruction for the database is received, configuration data can be sent to the aspect enhancement code to determine the target data table that needs to be verified for data integrity. This configuration data includes the target data table, as well as information about trusted third-party cryptographic service interfaces (such as API addresses), data signature periods, and data verification periods, all set through a configuration channel. By dynamically determining when and how to execute data verification logic through configuration management, the consistency and security of the database data are ensured.
[0137] Please see Figure 5 This is a schematic diagram of a database integrity verification device provided in an embodiment of this specification. Figure 5 As shown, the database integrity verification device 1 can be implemented as all or part of an electronic device through software, hardware, or a combination of both. According to some embodiments, the database integrity verification device 1 includes a code injection module 11, a code execution module 12, a data signature module 13, and a data verification module 14, specifically including:
[0138] Code injection module 11 is used to inject aspect enhancement code at preset point locations in the database;
[0139] The code execution module 12 is used to execute the aspect enhancement code when a modification operation is received for the database, so as to generate a verification hash value corresponding to the modification operation;
[0140] The data signature module 13 is used to call the cryptographic service of a trusted third party to sign the target data corresponding to the modification operation by using the cryptographic service to verify the hash value.
[0141] The data verification module 14 is used to verify the database data using the verification hash value and the hash operation message authentication code obtained from the data signature, so as to determine whether the database has been tampered with.
[0142] Optionally, the database includes at least one data table, and the verification hash value includes a row hash value and a link hash value; when the code execution module 12 executes the aspect enhancement code to generate a verification hash value corresponding to the modification operation upon receiving a modification operation to the database, it is specifically used for:
[0143] When a modification operation is received for a target data table in the database, the row hash value of the target row data that has been modified in the target data table is calculated by executing the aspect enhancement code;
[0144] And determine the link hash value of the target row data based on the row hash value of the target row data and the link hash value of the previous row data.
[0145] Optionally, the code execution module 12 is further configured to create a tamper-proof table corresponding to the target data table by executing the aspect enhancement code;
[0146] The row hash value, row identifier, and link hash value of the target row data are stored in the anti-tampering table.
[0147] Optionally, when the data signature module 13 executes the call to a trusted third party's cryptographic service to sign the target data corresponding to the modification operation using the verification hash value through the cryptographic service, it is specifically used for:
[0148] The trusted third party's cryptographic service is asynchronously invoked according to a preset data signature period;
[0149] A signature calculation is performed based on the signature key generated by the cryptographic service and the link hash value of the target row data to obtain the hash operation message authentication code of the target row data.
[0150] Optionally, the data signature module 13 is also used to derive the signature key based on the database access password and the confidential private key of the trusted third party.
[0151] Optionally, the data signature module 13 is also used to store the hash operation message authentication code of the target row data into an anti-tampering table.
[0152] Optionally, when the data verification module 14 verifies the database data based on the hash operation message authentication code obtained from the verification hash value and the data signature to determine whether the database has been tampered with, it is specifically used for:
[0153] The target data table is polled according to a preset data verification cycle to obtain the row data to be verified, including the target row data.
[0154] Calculate the row hash value and link hash value of the row data to be verified, and compare the row hash value and link hash value of the row data to be verified with the row hash value and link hash value of the corresponding row in the anti-tampering table respectively;
[0155] If all comparisons are consistent, the hash operation message authentication code obtained from the data signature is used to verify the data of the row to be verified.
[0156] If any comparison is inconsistent, it is determined that the data of the row to be verified has been tampered with.
[0157] Optionally, when the data verification module 14 calculates the row hash value and link hash value of the row data to be verified, and compares the row hash value and link hash value of the row data to be verified with the row hash value and link hash value of the corresponding row in the anti-tampering table, it is specifically used for:
[0158] Calculate the row hash value of the row data to be verified, and compare the row hash value of the row data to be verified with the row hash value of the corresponding row in the anti-tampering table;
[0159] If the comparison matches, the link hash value of the row data to be verified is calculated, and the link hash value of the row data to be verified is compared with the link hash value of the corresponding row in the anti-tampering table.
[0160] Optionally, when the data verification module 14 performs further verification on the data to be verified using the hash operation message authentication code obtained from the data signature, it is specifically used for:
[0161] The chain hash value of the row data to be verified is used to calculate the hash operation message authentication code of the row data to be verified through the cryptographic service of a trusted third party;
[0162] The hash message authentication code of the row data to be verified is compared with the hash message authentication code of the corresponding row in the anti-tampering table;
[0163] If the comparison is inconsistent, it is determined that the data of the row to be verified has been tampered with.
[0164] Optionally, before executing the aspect enhancement code injected at the preset pointcut location in the database, the code execution module 12 is also used for:
[0165] Upon receiving a verification command for the database, configuration data is sent to the aspect enhancement code to determine the target data table that needs to be verified for data integrity based on the configuration data; wherein, the configuration data includes the target data table;
[0166] It also allows configuring trusted third-party cryptographic service interface information, data signature cycles, and data verification cycles through the configuration channel.
[0167] Optionally, the database integrity verification device 1 also includes a database management module, specifically used for:
[0168] If it is determined that the database has been tampered with, an alarm will be issued or the tampered database will be replaced with a backup database.
[0169] The above-described apparatus embodiments correspond to the method embodiments, and detailed descriptions can be found in the description of the method embodiments section, which will not be repeated here. The apparatus embodiments are derived based on the corresponding method embodiments and have the same technical effects as the corresponding method embodiments; detailed descriptions can be found in the corresponding method embodiments.
[0170] Please see Figure 6 This is a schematic diagram of the architecture of another database integrity verification system provided in the embodiments of this specification. Figure 6 As shown, the database integrity verification system includes an aspect engine 61, a database 62, and a trusted third party 63. The aspect engine 61 injects aspect enhancement code into preset point locations in the database according to a pointcut list. The database 62 executes the aspect enhancement code to perform periodic signing and verification when it receives modification operations on the database. The trusted third party 63 provides cryptographic services to the database 62, enabling the database 62 to call the cryptographic services for periodic signing and verification.
[0171] Optionally, the aspect engine 61 includes an aspect injection module 601, which is used to maintain a pointcut list, manage aspect enhancement code, and control configuration data. Maintaining the pointcut list includes instrumenting callback functions in the database kernel for enabling, inserting, and updating anti-tampering tables, recording pointcut positions. Managing aspect enhancement code includes, but is not limited to, writing and maintaining aspect enhancement code to implement related database integrity verification functions, such as calculating verification hash values, calculating hash operation message authentication codes, and timed verification. Control configuration data refers to configuration data distributed to the aspect enhancement code through a control configuration interface, such as configuring anti-tampering tables (i.e., which tables need to have integrity protection enabled), trusted third-party cryptographic service interface information, and timed signature and verification cycles.
[0172] The aspect injection module 601 can inject aspect enhancement code into the target methods of the database according to the position requirements of the pointcut list. For example, when a user performs insert or update operations on a specified data table, at the pointcut where these operations are completed, the aspect enhancement code automatically calculates the row hash value of the inserted or updated row data, and stores the row hash value along with the row identifier in an anti-tampering table. At the same time, it calculates and stores the link hash value of the row data, forming a chain structure.
[0173] Database 62 includes a scheduled task aspect module 602, which is used to start a scheduled signature task and asynchronously call the cryptographic service of a trusted third party 63 according to a preset data signature period, so as to use the cryptographic service to sign the target data corresponding to the modification operation. It is also used to start a scheduled verification task and verify the database data according to a preset data verification period based on the data signature result, so as to determine whether the database 62 has been tampered with.
[0174] For example, the scheduled task aspect module 602 starts a scheduled signature task, which asynchronously calls the cryptographic service provided by the trusted third party 63 at regular intervals to perform HMAC signature on the latest unsigned data row in the anti-tampering table, and fills the signature value (Hash value) back into the corresponding data row.
[0175] The scheduled task aspect module 602 initiates a scheduled verification task. This task calculates the rowhash of each row in the original data table and compares it with the records in the anti-tampering table to check for inconsistencies. Simultaneously, it calculates the linkhash of each row in the original data table, checks the consistency between the linkhash of each row and the records in the anti-tampering table, and further verifies the hash values to ensure the data has not been tampered with.
[0176] The trusted third party 63 includes a cryptographic service module 603. This module provides a signature key, performs signature calculations based on it to obtain the data signature result (signature value), and feeds the result back to the scheduled task aspect module 602. The scheduled task aspect module 602 then performs data signing and verification on the database data based on the signature result. Additionally, the cryptographic service module 603 provides a private key for calculating the signature key. This private key remains within the third-party organization; all cryptographic operations based on it are performed internally, such as calculating the HMAC value. The trusted certificate in the cryptographic service module 603 verifies the identity of the trusted third party, ensuring its legitimacy.
[0177] The entire process utilizes the HMAC symmetric key method to improve performance. The signing key is derived from the database access password and a trusted third party's private key, ensuring high trustworthiness and security. Furthermore, the tamper-proof table design using chained hash association enhances system security, especially in distributed scenarios, increasing the difficulty of tamper detection.
[0178] By separating data signing and verification logic into the aspect engine 61 and the trusted third party 63, the burden on the database 62 itself is reduced, and system security is improved. The trusted third party 63 provides professional cryptographic services, ensuring the security of the signing process. Aspect-oriented programming allows data signing and verification logic unrelated to core business logic to be developed and maintained independently of business logic, improving system scalability and maintainability. Moreover, aspect-enhanced code can be updated and optimized without affecting existing business logic, reducing system coupling.
[0179] This specification also provides an embodiment of a computer storage medium that can store multiple instructions adapted to be loaded and executed by a processor as described above. Figure 2 and Figure 3 The method described in the illustrated embodiment can be found in the following document for a detailed execution process. Figure 2 and Figure 3 The specific details of the illustrated embodiments will not be elaborated here.
[0180] This specification also provides a computer program product that stores at least one instruction, said at least one instruction being loaded and executed by the processor as described above. Figure 2 and Figure 3 The method described in the illustrated embodiment can be found in the following document for a detailed execution process. Figure 2 and Figure 3 The specific details of the illustrated embodiments will not be elaborated here.
[0181] The embodiments in this specification also provide Figure 7 The diagram shows the structure of the electronic device. Figure 7 At the hardware level, the electronic device includes a processor, internal bus, network interface, memory, and non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into memory and then runs it to implement the aforementioned voice activity detection method.
[0182] Of course, in addition to software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of hardware and software. In other words, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0183] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program and "integrate" a digital system onto a PLD themselves, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should understand that by simply performing some logic programming on the method flow using one of these hardware description languages and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.
[0184] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0185] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.
[0186] For ease of description, the above devices are described in terms of function, divided into various units. Of course, in implementing this specification, the functions of each unit can be implemented in one or more software and / or hardware components.
[0187] Those skilled in the art will understand that embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this specification may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0188] This specification is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this specification. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations 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, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0189] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0190] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0191] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0192] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0193] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0194] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0195] Those skilled in the art will understand that the embodiments of this specification can be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this specification may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0196] This specification can be described in the general context of computer-executable instructions that are executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This specification can also be practiced in distributed computing environments, where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0197] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0198] The above description is merely an embodiment of this specification and is not intended to limit this specification. Various modifications and variations can be made to this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims of this specification.
Claims
1. A database integrity verification method, the method comprising: Inject aspect enhancement code at the preset point locations in the database; When a modification operation is received for the database, the aspect enhancement code is executed to generate a verification hash value corresponding to the modification operation; Invoke the cryptographic service of a trusted third party, and use the cryptographic service to sign the target data corresponding to the modification operation with the verification hash value; The database data is verified based on the hash operation message authentication code obtained from the verification hash value and data signature to determine whether the database has been tampered with.
2. The database integrity verification method according to claim 1, wherein the database includes at least one data table, and the verification hash value includes a row hash value and a link hash value; When a modification operation is received for the database, the aspect enhancement code is executed to generate a verification hash value corresponding to the modification operation, including: When a modification operation is received for a target data table in the database, the row hash value of the target row data that has been modified in the target data table is calculated by executing the aspect enhancement code; And determine the link hash value of the target row data based on the row hash value of the target row data and the link hash value of the previous row data.
3. The database integrity verification method according to claim 2, further comprising: A tamper-proof table corresponding to the target data table is created by executing the aspect enhancement code. The row hash value, row identifier, and link hash value of the target row data are stored in the anti-tampering table.
4. The database integrity verification method according to claim 2, wherein calling a trusted third-party cryptographic service to sign the target data corresponding to the modification operation using the verification hash value through the cryptographic service includes: The trusted third party's cryptographic service is asynchronously invoked according to a preset data signature period; A signature calculation is performed based on the signature key generated by the cryptographic service and the link hash value of the target row data to obtain the hash operation message authentication code of the target row data.
5. The database integrity verification method according to claim 4, further comprising: The signature key is derived from the database access password and the private key of the trusted third party.
6. The database integrity verification method according to claim 4, further comprising: The hash operation message authentication code of the target row data is stored in the anti-tampering table.
7. The database integrity verification method according to claim 2, wherein verifying the database data based on the hash operation message authentication code obtained from the verification hash value and the data signature to determine whether the database has been tampered with includes: The target data table is polled according to a preset data verification cycle to obtain the row data to be verified, including the target row data. Calculate the row hash value and link hash value of the row data to be verified, and compare the row hash value and link hash value of the row data to be verified with the row hash value and link hash value of the corresponding row in the anti-tampering table respectively; If all comparisons are consistent, the hash operation message authentication code obtained from the data signature is used to verify the data of the row to be verified. If any comparison is inconsistent, it is determined that the data of the row to be verified has been tampered with.
8. The database integrity verification method according to claim 7, wherein calculating the row hash value and link hash value of the row data to be verified, and comparing the row hash value and link hash value of the row data to be verified with the row hash value and link hash value of the corresponding row in the anti-tampering table, includes: Calculate the row hash value of the row data to be verified, and compare the row hash value of the row data to be verified with the row hash value of the corresponding row in the anti-tampering table; If the comparison matches, the link hash value of the row data to be verified is calculated, and the link hash value of the row data to be verified is compared with the link hash value of the corresponding row in the anti-tampering table.
9. The database integrity verification method according to claim 7, wherein the step of further verifying the row data to be verified using the hash operation message authentication code obtained by data signature includes: The chain hash value of the row data to be verified is used to calculate the hash operation message authentication code of the row data to be verified through the cryptographic service of a trusted third party; The hash message authentication code of the row data to be verified is compared with the hash message authentication code of the corresponding row in the anti-tampering table; If the comparison is inconsistent, it is determined that the data of the row to be verified has been tampered with.
10. The database integrity verification method according to claim 1, before injecting aspect enhancement code at the preset point location of the database, the method further includes: Upon receiving a verification command for the database, configuration data is sent to the aspect enhancement code to determine the target data table that needs to be verified for data integrity based on the configuration data; wherein, the configuration data includes the target data table; It also allows configuring trusted third-party cryptographic service interface information, data signature cycles, and data verification cycles through the configuration channel.
11. The database integrity verification method according to claim 1, further comprising: If it is determined that the database has been tampered with, an alarm will be issued or the tampered database will be replaced with a backup database.
12. A database integrity verification device, the device comprising: The code injection module is used to inject aspect enhancement code at preset pointcut locations in the database; The code execution module is used to execute the aspect enhancement code when a modification operation is received for the database, so as to generate a verification hash value corresponding to the modification operation; The data signature module is used to call the cryptographic service of a trusted third party to sign the target data corresponding to the modification operation by using the cryptographic service to verify the hash value. The data verification module is used to verify the database data using the verification hash value and the hash operation message authentication code obtained from the data signature, in order to determine whether the database has been tampered with.
13. A database integrity verification system, the system comprising: An aspect engine is used to inject aspect enhancement code at preset point location positions in the database based on a list of point points. The database is used to execute the aspect enhancement code for timed signing and timed verification when a modification operation is received for the database. A trusted third party is used to provide cryptographic services to the database, enabling the database to invoke the cryptographic services for periodic signing and periodic verification.
14. The database integrity verification system according to claim 13, wherein the aspect engine includes an aspect injection module, the aspect injection module being used to maintain the pointcut list, manage the aspect enhancement code, and control configuration data.
15. The database integrity verification system according to claim 13, wherein the database includes a scheduled task aspect module, the scheduled task aspect module being used to start a scheduled signature task and asynchronously call the cryptographic service of the trusted third party according to a preset data signature period, so as to use the cryptographic service to perform data signature on the target data corresponding to the modification operation, and to start a scheduled verification task and verify the database data according to the data signature result and a preset data verification period to determine whether the database has been tampered with.
16. The database integrity verification system according to claim 15, wherein the trusted third party includes a cryptographic service module, the cryptographic service module being used to provide a signature key, perform signature calculation based on the signature key to obtain a data signature result, and feed the data signature result back to the scheduled task aspect module, so that the database data can be signed and verified by the scheduled task aspect module based on the data signature result.
17. A storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method according to any one of claims 1-11.
18. An electronic device comprising: A processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to execute the steps of the method as claimed in any one of claims 1-11.
19. A computer program product having at least one instruction stored thereon, wherein the at least one instruction, when executed by a processor, implements the steps of the method according to any one of claims 1-11.
Citation Information
Patent Citations
Data verification method and device, storage medium and electronic equipment
CN115357762A
Data verification method and device, equipment and medium
CN117556476A