Database integrity verification method, device and system, medium and equipment
By injecting the section enhancement code at the preset point-of-cut point position of the database, generating verification hash values, and using trusted third-party password services for data signature and verification, the problems of database data integrity and security guarantee are solved, and database integrity verification with high security and flexible configuration is achieved.
Patent Information
- Application Number
- CN202411480125.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2044-10-22
AI Technical Summary
The existing technology is difficult to effectively protect the integrity and security of database data, especially when facing threats from external hacker attacks and internal malicious tampering.
Enhanced code by injecting the sectional enhancement code at the preset point-of-cut position of the database, generating verification hash values, and using trusted third-party password services for data signature and verification, ensuring the integrity and authenticity of the database data.
It realizes high security integrity verification of database data, enhances users' confidence in the database system, and does not need to modify database code, and adapts to multiple databases and flexible configurations.
Smart Images

Figure CN119670158A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a database integrity verification method, device, system, medium and equipment. Background Art
[0002] With the advent of the big data era, data has become an important asset for enterprises, and effective analysis and utilization of data has become crucial. However, as the value of data increases, databases face security threats such as attacks from external hackers and malicious tampering by internal personnel (such as database administrators), which will lead to a decrease in users' trust in database products and concerns that the integrity and security of data cannot be effectively guaranteed.
[0003] At present, there is an urgent need to provide a highly secure database integrity verification solution to protect the integrity of database data, thereby enhancing users' confidence in the database system. Summary of the invention
[0004] The embodiments of this specification provide a database integrity verification method, which verifies data integrity and authenticity by using a hash operation message authentication code symmetric key method, and further improves the credibility of the database by using a cryptographic service provided by a trusted third party, and uses aspect injection enhancement logic to implement data signing and verification without modifying the database code, supporting multiple databases and flexible configurations. The database integrity verification method includes:
[0005] Inject aspect enhancement code into the preset cut-point position of the database;
[0006] When a modification operation on the database is received, executing the aspect enhancement code to generate a verification hash value corresponding to the modification operation;
[0007] Calling a cryptographic service of a trusted third party, and using the cryptographic service to perform a data signature on the target data corresponding to the modification operation using the verification hash value;
[0008] The database data is verified based on the hash operation message authentication code obtained by the verification hash value and the data signature to determine whether the database has been tampered with.
[0009] Further, in some implementations, 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 receiving a modification operation on the database, executing the aspect enhancement code to generate a verification hash value corresponding to the modification operation includes:
[0011] When a modification operation for a target data table in the database is received, a row hash value of target row data modified in the target data table is calculated by executing the aspect enhancement code;
[0012] And determining the link hash value of the target row data according to 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 comprises:
[0014] Creating a tamper-proof table corresponding to the target data table by executing the section enhancement code;
[0015] The row hash value of the target row data, the row identifier of the target row data, and the link hash value of the target row data are stored in the tamper-proof table.
[0016] Further, in some implementations, the calling of a cryptographic service of a trusted third party and using the cryptographic service to digitally sign target data corresponding to the modification operation using the verification hash value includes:
[0017] Asynchronously calling the cryptographic service of the trusted third party according to a preset data signature cycle;
[0018] A signature calculation is performed according to the signature key generated by the cryptographic service and the linked hash value of the target row data to obtain a hash operation message authentication code of the target row data.
[0019] Furthermore, in some embodiments, the method further comprises:
[0020] The signing key is derived based on the database access password and the confidential private key of the trusted third party.
[0021] Furthermore, in some embodiments, the method further comprises:
[0022] The hash operation message authentication code of the target row data is stored in the tamper-proof table.
[0023] Further, in some implementations, the verifying the database data based on the hash operation message authentication code obtained by the verification hash value and the data signature to determine whether the database has been tampered with includes:
[0024] Poll the target data table 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 tamper-proof table;
[0026] If all the comparisons are consistent, the hash operation message authentication code obtained by the data signature is used to verify the row data to be verified;
[0027] If any comparison is inconsistent, it is determined that the row data to be verified has been tampered with.
[0028] Further, in some implementations, calculating the row hash value and the link hash value of the row data to be verified, and comparing the row hash value and the link hash value of the row data to be verified with the row hash value and the link hash value of the corresponding row in the tamper-proof table, respectively, 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 tamper-proof table;
[0030] If the comparison is consistent, 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 tamper-proof table.
[0031] Furthermore, in some implementations, the hash operation message authentication code obtained by using the data signature is further verified on the row data to be verified, including:
[0032] The linked hash value of the row data to be verified is calculated by a cryptographic service of a trusted third party to obtain a hash operation message authentication code of the row data to be verified;
[0033] Compare the hash operation message authentication code of the row data to be verified with the hash operation message authentication code of the corresponding row in the tamper-proof table;
[0034] If the comparison is inconsistent, it is determined that the row data to be verified has been tampered with.
[0035] Furthermore, in some implementations, before injecting the aspect enhancement code at the preset tangent point position of the database, the method further includes:
[0036] When receiving a verification instruction for the database, the configuration data is sent to the section enhancement code to determine the target data table that needs to be verified for data integrity according to the configuration data; wherein the configuration data includes the target data table;
[0037] And set the trusted third party's cryptographic service interface information, data signature cycle and data verification cycle through the configuration channel.
[0038] Furthermore, in some embodiments, the method further comprises:
[0039] If it is determined that the database has been tampered with, an alarm is issued or a backup database is used to replace the tampered database.
[0040] The embodiment of this specification also proposes a database integrity verification device, the device comprising:
[0041] The code injection module is used to inject aspect enhancement code at the preset cut-point position of the database;
[0042] A code execution module, configured to execute the aspect enhancement code upon receiving a modification operation on the database, so as to generate a verification hash value corresponding to the modification operation;
[0043] A data signature module, used to call a cryptographic service of a trusted third party, and use the cryptographic service to digitally sign the target data corresponding to the modification operation using the verification hash value;
[0044] The data verification module is used to verify the database data using the hash operation message authentication code obtained by verifying the hash value and the data signature to determine whether the database has been tampered with.
[0045] The embodiment of this specification also proposes a database integrity verification system, the system comprising:
[0046] Aspect engine, used to inject aspect enhancement code at preset point locations in the database according to the point list;
[0047] A database, configured to execute the section enhancement code for timing signature and timing verification when receiving a modification operation on the database;
[0048] A trusted third party is used to provide cryptographic services to the database, so that the database calls the cryptographic services for regular signing and regular verification.
[0049] Furthermore, in some embodiments, the aspect engine includes an aspect injection module, which is used to maintain the point cut 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 signature task and asynchronously call the cryptographic service of the trusted third party according to a preset data signature cycle to use the cryptographic service to data sign the target data corresponding to the modification operation, and to start a scheduled verification task and, based on the data signature result, verify the database data according to a preset data verification cycle to determine whether the database has been tampered with.
[0051] Furthermore, in some embodiments, the trusted third party includes a cryptographic service module, which is used to provide a signature key, perform signature calculation based on the signature key, obtain a data signature result, and feed the data signature result back to the scheduled task aspect module, so as to perform data signing and verification on the database data through the scheduled task aspect module based on the data signature result.
[0052] The embodiments of the present specification also provide a storage medium, wherein the storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and executing the steps of the above method.
[0053] An embodiment of the present specification also provides an electronic device, comprising: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the above method.
[0054] The embodiments of the present specification also provide a computer program product, wherein the computer program product stores at least one instruction, and the at least one instruction is suitable for being loaded by a processor and executing the above method steps.
[0055] In the embodiment of this specification, first, the aspect enhancement code is injected into the preset tangent point position of the database. Then, when a modification operation for the database is received, the aspect enhancement code is executed to generate a verification hash value corresponding to the modification operation. Further, the cryptographic service of a trusted third party is called, and the verification hash value is used to digitally sign the target data corresponding to the modification operation through the cryptographic service. Finally, the database data is verified based on the hash operation message authentication code obtained by 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 the data is modified, it can be ensured that the integrity of the data can still be verified after being modified, thereby improving the protection performance of database integrity; on the other hand, the data tamper-proof signature and verification adopts the 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 is provided by a trusted third party to ensure the security of the signing process; on the other hand, without modifying the original database code, the enhanced logic is dynamically injected through aspect injection, and the data signing and verification functions can be realized without modifying the database, thereby achieving the purpose of data integrity verification; importantly, the aspect injection method can adapt to different types of databases and support management and control configuration methods, making the database integrity verification process more flexible and changeable. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 A schematic diagram of the architecture of a database integrity verification system using an embodiment of this specification;
[0057] Figure 2 A flowchart of a database integrity verification method provided in an embodiment of this specification;
[0058] Figure 3 A flowchart of another database integrity verification method provided in an embodiment of this specification;
[0059] Figure 4 A schematic diagram of a tamper-proof table provided in an embodiment of this specification;
[0060] Figure 5 A schematic diagram of the structure of a database integrity verification device provided in an embodiment of this specification;
[0061] Figure 6 A schematic diagram of the principle of a database integrity verification system provided in an embodiment of this specification;
[0062] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0063] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.
[0064] Figure 1 A schematic diagram of the architecture of a database integrity verification system to which the embodiments of this specification can be applied is shown.
[0065] like Figure 1 As shown, the system architecture 100 may include one or more of terminal devices such as a smart phone 101, a portable computer 102, a desktop computer 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the terminal device and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc. The terminal device may be a variety of electronic devices with data management functions. For example, a user can query a database, modify database data, etc. through an electronic device. The server 105 can be used to process requests from the terminal device and perform functions such as signing and verifying database data.
[0066] It is understandable that the server 105 can host components such as databases, aspect engines, and trusted third-party cryptographic services. Among them, the database can be a relational database, such as MySQL (open source relational database), PostgreSQL (object-relational database), etc., or a non-relational database, such as MongoDB (an open source document database based on distributed file storage). The aspect engine can run on the server as a middleware, such as a service implemented based on the Spring AOP (aspect-oriented programming) framework, which is used to execute aspect logic at an appropriate time point. 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 through an API (Application Programming Interface), which is not limited in this specification embodiment.
[0067] For example, a user sends a database integrity check request to the server through a terminal device. The aspect engine on the server injects enhanced logic at the preset point of contact in the database. Then, the server calls a trusted third-party cryptographic service to sign the relevant data to ensure the integrity of the data and the reliability of the source. Finally, the server stores the signed data in the database and verifies the integrity of the data. It should be noted that the aspect logic is executed in the business logic layer, rather than directly acting on the database.
[0068] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. For example, the server 105 may be a server cluster composed of multiple servers.
[0069] See also Figure 2 , is a flowchart of a database integrity verification method provided in an embodiment of this specification. In an embodiment of this specification, the database integrity verification method is applied to a database integrity verification device or an electronic device equipped with a database integrity verification device. Figure 2 The process shown is described in detail, and the database integrity verification method may specifically include the following steps:
[0070] S202, injecting aspect enhancement code into a preset cut-point position of the database;
[0071] In one or more embodiments of the present specification, the preset tangent point position of the database refers to a position that is pre-defined in the database operation and is suitable for injecting additional logic. This position may correspond to an important operation point in the database, such as before or after data insertion, update or deletion operations, that is, the code or logic injected at the preset tangent point position will be activated. The aspect enhancement code refers to the specific logic injected at the preset tangent point position, which is used to implement the data integrity protection function, and may include but is not limited to data signing and data verification. For example, the data signature can be a data hash value generated before or after the data modification operation, and signed based on the data hash value using the HMAC (Hash-based Message Authentication Code) algorithm. Data verification can be to verify the integrity of the database data before or after the data modification operation to ensure that the database data has not been tampered with.
[0072] Optionally, injecting aspect enhancement code at the preset cut-point position of the database means dynamically inserting additional logic at a specific operation point of the database management system to implement functions such as data signing and verification. For example, the Spring AOP framework can be used to implement the injection of aspect logic, thereby separating the aspect logic from the business logic, making the original database code more modular and easier to maintain. For another example, if the database management system supports plug-ins or extension mechanisms, plug-ins or extension mechanisms can be used to implement the injection of aspect logic without modifying the original database code. You only need to install and configure the corresponding plug-in.
[0073] Of course, after injecting the aspect enhancement code at the preset cut-off point of the database, comprehensive testing and verification can be performed to ensure that the aspect enhancement code can be correctly executed at the preset cut-off point and will not interfere with the original database operation process.
[0074] In the embodiments of this specification, by inserting stubs (i.e., injecting aspect enhancement codes) at key operation points of the database and executing relevant logic for integrity protection, such as data signing and verification, through the insertion points, the integrity of the database data can be managed and protected more flexibly, while also facilitating the subsequent maintenance and upgrade of the database.
[0075] S204, when a modification operation on the database is received, executing the aspect enhancement code to generate a verification hash value corresponding to the modification operation;
[0076] The modification operation on the database may be inserting, updating or deleting a row of data, which is not limited in the embodiments of this specification. When a modification operation on the database is received, the aspect enhancement code corresponding to the modification operation is activated to start the preparation work before data signing and verification.
[0077] In one or more embodiments of the present specification, the verification hash value of the modified data row, such as rowhash, linkhash, etc., is calculated by executing the facet enhancement code. For example, a hash operation can be performed on the inserted or updated data row to obtain a verification hash value, so that the verification hash value can be used for subsequent data integrity verification. Among them, the verification hash value can be calculated using a secure hash algorithm such as SHA-256 (Secure Hash Algorithm 256) and MD5 (Message Digest Algorithm 5), ensuring that even small changes can produce significantly different hash values.
[0078] The embodiments of this specification ensure that each time the database data is modified, a verification hash value corresponding to the modification operation is generated, providing a basis for subsequent data integrity verification. Moreover, by generating a verification hash value corresponding to each modification operation each time the data is modified, it can be ensured that the integrity of the data can still be verified after being modified, thereby improving the protection performance of the database integrity.
[0079] In addition, it should be noted that when data integrity protection for database data is enabled through management and control configuration, the corresponding aspect enhancement code will synchronously create a corresponding tamper-proof table. When a modification operation is received for the database, the data of the tamper-proof table will be maintained through the aspect enhancement code at the preset cut-off point. Optionally, the verification hash value generated corresponding to the modification operation can be stored in the tamper-proof table and associated with the corresponding data record for subsequent data integrity verification. For example, the row hash value of the modified target row data, the row identifier of the target row data, and the link hash value of the target row data can all be stored in the tamper-proof table.
[0080] Of course, while storing the verification hash value, other metadata can also be saved, such as operation timestamp, operation type (insert, update or delete) and other information to facilitate subsequent data verification.
[0081] S206, calling a cryptographic service of a trusted third party, and using the cryptographic service to perform a data signature on the target data corresponding to the modification operation using the verification hash value;
[0082] In one or more embodiments of this specification, the aspect enhancement code calls the cryptographic service interface provided by the 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 a data signature on the target data corresponding to the modification operation. The target data may be an unsigned data row that is inserted or updated, which is not limited in the embodiments of this specification.
[0083] After receiving the request, the cryptographic service of the trusted third party can use a preset key such as a private key to sign the received verification hash value. Optionally, the HMAC algorithm can be used in combination with a shared key to calculate the signature value. For example, the signature value can be obtained by inputting the verification hash value corresponding to the target data into a hash function together with the shared key, wherein the shared key can be derived based on the preset key, which is not limited in the embodiments of this specification. It is understandable that the signature value will be used as proof of data integrity in subsequent data verification processes.
[0084] Then, the trusted third party returns the calculated signature value to the database to realize the data signature of the target data by associating the signature value with the verification hash value of the target data. It is understandable that the signature value of the target data corresponding to the modification operation can also be stored in the corresponding position in the tamper-proof table for subsequent data integrity verification.
[0085] The embodiments of this specification ensure that each time the database data is modified, a signature result corresponding to the modification operation is generated, thereby providing an effective verification method for the integrity of the data.
[0086] S208, verifying the database data based on the hash operation message authentication code obtained by verifying the hash value and the data signature to determine whether the database has been tampered with.
[0087] In one or more embodiments of the present 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 obtains 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 and linkhash is recalculated, and the verification hash value is used to compare with the verification hash value recorded in the tamper-proof table to confirm the integrity of the data row to be verified. And the signature value of the current data row to be verified is recalculated using the same HMAC algorithm and shared key, and the calculated HMAC value is compared with the signature value recorded in the tamper-proof table to further verify the consistency of the data signature.
[0088] For example, if the verification hash value of the current data to be verified matches the verification hash value in the tamper-proof table, and the calculated signature value also matches the signature value in the tamper-proof table, then the row of data is considered to have not been tampered with. If any value does not match, it means that the row of data may have been tampered with, and further inspection or corresponding alarm or maintenance measures need to be taken.
[0089] The data tamper-proof signature and verification in the embodiments of this specification adopt a symmetric key method of a hash operation message authentication code, which can not only further verify the integrity of the data, but also verify the authenticity of the data source. Moreover, the cryptographic service is provided by a trusted third party to ensure the security of the signing process. In addition, without modifying the original code of the database, the enhanced logic is dynamically injected through the aspect injection method, and the data signing and verification functions can be realized without modifying the database, thereby achieving the purpose of data integrity verification. Importantly, the aspect injection method can be adapted to different types of databases and supports management and control configuration methods, making the database integrity verification process more flexible and changeable.
[0090] See also Figure 3, provides a flow chart of another database integrity verification method for the embodiment of this specification. Among them, the database may include at least one data table. The database integrity verification method may specifically include the following steps:
[0091] S302, injecting aspect enhancement code into a preset cut-point position of the database;
[0092] The preset cut-off point position of the database can be when a user or application requests to enable the anti-tampering function of a data table, when a new data row is inserted into a protected table, or when an existing data row is updated. The embodiments of this specification do not limit this.
[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 for a target data table in the database is received, a row hash value of the target row data in the target data table that has been modified is calculated by executing the aspect enhancement code, and a link hash value of the target row data is determined according to the row hash value of the target row data and a link hash value of a previous row of data;
[0095] In one or more embodiments of this specification, the target data table is taken as the user data table shown in Table 1 as an example for description:
[0096] Table 1
[0097] id name account money 1 Bob Zfb1001 1000 2 Alice Zfb1001 2000 … … … … n-1 Jack Zfbn0n0 3000 n John Zfb 4000 … … … …
[0098] Each piece of user data in Table 1 contains the corresponding id (user ID), name (user name), account (user account) and money (amount).
[0099] If data integrity protection for the user data table is enabled through control configuration, the corresponding aspect enhancement code will simultaneously create an anti-tampering 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 100% mxmxm 1000n n nnnnn mnmnm nxnxn … … … …
[0102] The information contained in each user data in Table 2 includes the corresponding id (user ID), rowid (row ID), rowhash (row hash value), linkhash (link hash value) and hmac (hash operation message authentication code).
[0103] When the user inserts or updates the user data table shown in Table 1, the corresponding section enhancement code will maintain the data of the tamper-proof table shown in Table 2 at the preset section point where the insertion or update is completed, and perform data integrity verification.
[0104] For example, the target data row is the row data inserted or updated in the user data table. The row hash value of the target data row can be calculated by executing the facet enhancement code, which is:
[0105] rowhash n =hash(rowdata(column1 | column2 | ...)) (1)
[0106] Among them, rowhash n is the row hash value of the target data row, hash is a hash function, such as SHA-256, MD5, etc., rowdata(column1|column2|...) represents a row record consisting of multiple column data in the target data row, and "|" represents a concatenation operation, which can concatenate multiple column data into a string and serve as the input of the hash function.
[0107] The rowhash of the target data row n It is stored together with the rowid of the row in the tamper-proof table shown in Table 2. Then, the link hash value of the target data row is calculated, which is:
[0108] linkhash n = hash(rowhash n +linkhash n-1 ) (2)
[0109] Among them, linkhash n is the link hash value of the target data row. Hash is a hash function, such as SHA-256, MD5, etc. n is the row hash value of the target data row, linkhash n-1 The link hash value of the previous row of data.
[0110] refer to Figure 4 As shown in Figure 1, a schematic diagram of a tamper-proof table is given. Figure 4 It can be seen that the link hash value of each row of data depends on the link hash value of the previous row of data, thus forming a chain structure, which enhances the ability to detect data tampering. It is also 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 confidential private key of the trusted third party, which is very secure.
[0111] By seamlessly integrating the aspect enhancement code into the existing database architecture, data integrity protection can be achieved without modifying the database application itself, and the database system can transparently implement data integrity protection functions without affecting the original business logic.
[0112] S306, asynchronously calling the cryptographic service according to a preset data signature cycle, performing signature calculation according to the signature key generated by the cryptographic service and the linked hash value of the target row data, and obtaining a hash operation message authentication code of the target row data;
[0113] The data signature cycle can be defined in the configuration data, for example, the preset data signature cycle can be once a day or once a week, which is not limited in the embodiments of this specification. Accordingly, the asynchronous task can be triggered according to the data signature cycle. When the preset time point is reached, an asynchronous call is initiated to request the cryptographic service of a trusted third party to generate a new signature key.
[0114] Get the latest unsigned data row in the tamper-proof table shown in Table 2, that is, the target row data that has been modified but not signed, and the link hash value of the target row data can be used as the data to be signed for signing, that is, the link hash value of the target row data needs to be passed to a trusted third party for signing. Among them, the link hash value of the target row data is a hash value used to link the integrity of the previous and next row data, which is obtained by calculating the row hash value of the current row plus the link hash value of the previous row.
[0115] Exemplarily, the signing process may use the HMAC algorithm to perform signature calculation based on the signature key generated by the cryptographic service and the linked hash value of the target row data, as follows:
[0116] hmac=hmac_sha256(hmac_key, linkhash n ) (3)
[0117] Among them, hmac is the signature value of the target row data, hmac_sha256 means using SHA-256 as the HMAC implementation of the underlying hash function, hmac_key is the signature key, linkhash linkhash n The link hash value of the target data row.
[0118] Optionally, the signature key in formula (3) can be derived based on the database access password and the confidential private key of a trusted third party:
[0119] hmac_key=KDF(password+cakey) (4)
[0120] Among them, hmac_key is the signature key, password is the database access password, cakey is the confidential private key of the trusted third party, and KDF (Key Derivation Function) can be any secure key derivation function, such as HKDF (HMAC-based Extract-and-Expand, hash-based key derivation function), KBKDF (Key-Based Extract-and-Expand, digest-based key derivation function), PBKDF (Password-Based Key Derivation Function, password-based key derivation function), etc., which is not limited to the embodiments of this specification.
[0121] Then, the hash operation message authentication code of the target row data can be stored in the tamper-proof table shown in Table 2 to implement the signature of the target row data. In the embodiment of this specification, the entire data signing process is implemented by a symmetric key method, which has higher computational efficiency. Moreover, this step ensures that each row of data has a signature value based on the current row of data and the previous row of data, so as to verify the integrity of the data.
[0122] In the embodiments of this specification, by regularly signing the data rows stored in the tamper-proof table, it is ensured that even if the data is tampered, it can be detected. Moreover, the signing process is performed by a trusted third party to ensure the security of the signature, and by returning the signed hmac value to the tamper-proof table, it is convenient to verify whether the data maintains integrity during the subsequent data integrity check.
[0123] In addition, in order to ensure the security of data, a trusted third party is introduced in the embodiments of this specification to perform cryptographic calculations. Specifically, the trusted certificate is used to confirm the identity of the trusted third party and ensure its legitimacy. In addition, the trusted third party holds a confidential private key, which will not leave the third-party organization, and all cryptographic operations based on the private key are completed within the third-party organization, such as calculating the hmac value.
[0124] Through the authentication and services of a trusted third party, the protection of database data integrity can be enhanced, because the calculation of the hmac value involves the private key and the private key does not flow out of the third-party organization, reducing the risk of key leakage. At the same time, since the calculation of the hmac value is completed within the third-party organization, the security of the calculation is also improved, ensuring that only authenticated services can correctly generate and verify the hmac value, thereby improving the effectiveness of data tampering detection.
[0125] S308, polling the target data table according to a preset data verification cycle to obtain the row data to be verified including the target row data;
[0126] The data verification cycle can also be defined in the configuration data, for example, the preset data verification cycle can be once a day or once a week, which is not limited in the embodiments of this specification. When the preset data verification cycle is reached, a polling task will be started to access the target data table.
[0127] Optionally, query statements are executed to obtain the row data to be verified including the target row data, where the row data to be verified may include all rows or only the rows that have been recently modified, depending on the actual business logic and verification strategy. For example, the row data to be verified may be obtained starting from the first row of the target data table, and then proceeding sequentially until the last row.
[0128] This step can help ensure the consistency and integrity of the data in the database, and timely detect and respond to any data tampering attempts through regular data verification, which increases the difficulty of tampering. Moreover, by performing data verification in an automated manner, the need for manual intervention can be greatly reduced, and the efficiency and accuracy of data management can be improved.
[0129] S310, calculating the row hash value and the link hash value of the row data to be verified, and comparing the row hash value and the link hash value of the row data to be verified with the row hash value and the link hash value of the corresponding row in the tamper-proof table respectively;
[0130] Exemplarily, the row hash value of the row data to be verified can be calculated, and the row hash value of the row data to be verified can be compared with the row hash value of the corresponding row in the tamper-proof table. If the comparison is consistent, 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 can be compared with the link hash value of the corresponding row in the tamper-proof table.
[0131] For example, the rowhash calculation as shown in formula (1) is performed on the data of the row to be checked to obtain rowhash1, and the latest anti-tampering record row is obtained from the anti-tampering table, such as the rowid is the same and the id is the largest. Further, rowhash1 is compared with the rowhash value of the anti-tampering record row. If the comparison is consistent, continue. If the comparison is inconsistent, it means that the data of the row to be checked has been tampered with, and an error alarm can be issued.
[0132] When the comparison is consistent, the linkhash calculation is performed on the data of the verification row as shown in formula (2) to obtain linkhash1, and linkhash1 is compared with the linkhash value of the tamper-proof record row. If the comparison is consistent, continue. If the comparison is inconsistent, it means that the data of the verification row has been tampered with, and an error alarm can be issued.
[0133] S312, if all the comparisons are consistent, the row data to be verified is verified using the hash operation message authentication code obtained from the data signature; if any of the comparisons are inconsistent, it is determined that the row data to be verified has been tampered with.
[0134] Based on the comparison results of step S310, if all the comparisons are consistent, the linkhash value of the row data to be verified is used to calculate the hmac value through the cryptographic service of a trusted third party, that is, it is calculated according to formula (3) and formula (4), and the calculated value is compared with the hmac value of the tamper-proof record row. If the comparison is consistent, it indicates that the verification has passed and the row data to be verified has not been tampered with. If the comparison is inconsistent, it means that the row data to be verified has been tampered with, and an error alarm can be issued.
[0135] Similarly, each row of data to be verified in the target data table is verified. If all the verifications pass, it indicates that the target data table has not been tampered with. If the target data table is tampered with, an alarm is issued or the backup database is used to replace the tampered database.
[0136] It is understandable that before injecting the aspect enhancement code at the preset tangent point position of the database, if a verification instruction for the database is received, the configuration data can be 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. The configuration data includes the target data table, as well as the trusted third-party cryptographic service interface information such as API address, data signature cycle, and data verification cycle set through the configuration channel. The consistency and security of database data are ensured by dynamically deciding when and how to execute the data verification logic through configuration management.
[0137] See also Figure 5 , is a schematic diagram of the structure 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] The code injection module 11 is used to inject the aspect enhancement code at the preset point of the database;
[0139] A code execution module 12, configured to execute the aspect enhancement code upon receiving a modification operation on the database to generate a verification hash value corresponding to the modification operation;
[0140] A data signature module 13 is used to call a cryptographic service of a trusted third party and use the cryptographic service to digitally sign the target data corresponding to the modification operation using the verification hash value;
[0141] The data verification module 14 is used to verify the database data using the hash operation message authentication code obtained by verifying the hash value and the data signature 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 receives a modification operation for the database, it executes the aspect enhancement code to generate a verification hash value corresponding to the modification operation, specifically for:
[0143] When a modification operation for a target data table in the database is received, a row hash value of target row data modified in the target data table is calculated by executing the aspect enhancement code;
[0144] And determining the link hash value of the target row data according to 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 an anti-tampering table corresponding to the target data table by executing the section enhancement code;
[0146] The row hash value of the target row data, the row identifier of the target row data, and the link hash value of the target row data are stored in the tamper-proof table.
[0147] Optionally, when the data signature module 13 executes the call to the cryptographic service of the trusted third party and uses the cryptographic service to digitally sign the target data corresponding to the modification operation with the verification hash value, it is specifically used to:
[0148] Asynchronously calling the cryptographic service of the trusted third party according to a preset data signature cycle;
[0149] A signature calculation is performed according to the signature key generated by the cryptographic service and the linked hash value of the target row data to obtain a hash operation message authentication code of the target row data.
[0150] Optionally, the data signature module 13 is further configured to derive the signature key according to the database access password and the confidential private key of the trusted third party.
[0151] Optionally, the data signature module 13 is further configured 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 by executing the hash operation message authentication code obtained based on the verification hash value and the data signature to determine whether the database has been tampered with, it is specifically used to:
[0153] Poll the target data table 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 tamper-proof table;
[0155] If all the comparisons are consistent, the hash operation message authentication code obtained by the data signature is used to verify the row data to be verified;
[0156] If any comparison is inconsistent, it is determined that the row data to be verified has been tampered with.
[0157] Optionally, when the data verification module 14 calculates the row hash value and the link hash value of the row data to be verified, and compares the row hash value and the link hash value of the row data to be verified with the row hash value and the link hash value of the corresponding row in the tamper-proof table, it is specifically used to:
[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 tamper-proof table;
[0159] If the comparison is consistent, 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 tamper-proof table.
[0160] Optionally, when the data verification module 14 further verifies the to-be-verified row data by executing the hash operation message authentication code obtained by using the data signature, it is specifically used to:
[0161] The linked hash value of the row data to be verified is calculated by a cryptographic service of a trusted third party to obtain a hash operation message authentication code of the row data to be verified;
[0162] Compare the hash operation message authentication code of the row data to be verified with the hash operation message authentication code of the corresponding row in the tamper-proof table;
[0163] If the comparison is inconsistent, it is determined that the row data to be verified has been tampered with.
[0164] Optionally, before the code execution module 12 injects the aspect enhancement code at the preset cut-off point position of the database, it is further used to:
[0165] When receiving a verification instruction for the database, the configuration data is sent to the section enhancement code to determine the target data table that needs to be verified for data integrity according to the configuration data; wherein the configuration data includes the target data table;
[0166] And set the trusted third party's cryptographic service interface information, data signature cycle and data verification cycle through the configuration channel.
[0167] Optionally, the database integrity verification device 1 further includes a database management and control module, which is specifically used to:
[0168] If it is determined that the database has been tampered with, an alarm is issued or a backup database is used to replace the tampered database.
[0169] The above device embodiments correspond to the method embodiments. For specific descriptions, please refer to the description of the method embodiments, which will not be repeated here. The device embodiments are obtained based on the corresponding method embodiments and have the same technical effects as the corresponding method embodiments. For specific descriptions, please refer to the corresponding method embodiments.
[0170] See also Figure 6 , is a schematic diagram of the architecture of another database integrity verification system provided in the embodiment of this specification. Figure 6 As shown, the database integrity verification system includes a facet engine 61, a database 62, and a trusted third party 63. The facet engine 61 is used to inject the facet enhancement code at the preset facet point position of the database according to the facet point list, the database 62 is used to execute the facet enhancement code for timed signature and timed verification when receiving a modification operation for the database, and the trusted third party 63 is used to provide a cryptographic service to the database 62 so that the database 62 calls the cryptographic service for timed signature and timed verification.
[0171] Optionally, the aspect engine 61 includes an aspect injection module 601, which is used to maintain a point-of-cut list, manage aspect enhancement code, and manage configuration data. Among them, maintaining the point-of-cut list includes inserting and recording the point-of-cut location in the callback function of the database kernel for opening, inserting, and updating tamper-proof tables. 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 and verifying hash values, calculating hash operation message authentication codes, and timing verification. Management configuration data refers to configuration data sent to the aspect enhancement code through the management configuration channel, such as configuring tamper-proof tables (i.e., which tables need to enable integrity protection functions), trusted third-party cryptographic service interface information, timing signatures and verification cycles, etc.
[0172] The aspect injection module 601 can inject the aspect enhancement code into the target method of the database for code enhancement according to the position requirements of the point cut list. For example, when a user inserts or updates a specified data table, at the point cut 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 together with the row identifier in the tamper-proof table, and at the same time calculates and stores the link hash value of the row data to form a chain structure.
[0173] The 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 the trusted third party 63 according to a preset data signature cycle to use the cryptographic service to sign the target data corresponding to the modification operation, and to start a scheduled verification task and, based on the data signature result, verify the database data according to a preset data verification cycle to determine whether the database 62 has been tampered with.
[0174] For example, the scheduled task aspect module 602 starts a scheduled signature task, asynchronously calls the cryptographic service provided by the trusted third party 63, performs an HMAC signature on the latest unsigned data row in the tamper-proof table, and fills the signature value (Hash value) back into the corresponding data row.
[0175] The scheduled task section module 602 starts the scheduled verification task, calculates the rowhash of each row of the original data table, and compares it with the record in the anti-tampering table to check whether there is any inconsistency. At the same time, the linkhash of each row of the original data table is calculated, and the consistency between the linkhash of each row and the record in the anti-tampering table is checked, and the hash value is further verified to ensure that the data has not been tampered with.
[0176] The trusted third party 63 includes a cryptographic service module 603, which is used to provide a signature key, perform signature calculation based on the signature key, obtain a data signature result, i.e., a signature value, and feed the data signature result back to the scheduled task aspect module 602, so as to perform data signing and verification on the database data through the scheduled task aspect module 602 based on the data signature result. In addition, the cryptographic service module 603 also provides a confidential private key for calculating the signature key. Moreover, the confidential private key will not leave the third-party organization, and all cryptographic operations based on the private key are completed within the third-party organization, such as calculating the hmac value. The trusted certificate in the cryptographic service module 603 is used to confirm the identity of the trusted third party and ensure its legitimacy.
[0177] The entire process uses the HMAC symmetric key method to improve performance. The signature key is derived from the database access password and the confidential private key of a trusted third party, ensuring high credibility and security. In addition, the tamper-proof table design associated with chained hashes enhances the security of the system, especially in distributed scenarios, making tampering detection more difficult.
[0178] By separating the data signature and verification logic into the aspect engine 61 and the trusted third party 63, the burden on the database 62 itself is reduced and the security of the system is improved. The trusted third party 63 provides professional cryptographic services to ensure the security of the signature process. Aspect-oriented programming allows data signature and verification logic that is not related to the core business logic to be developed and maintained independently of the business logic, improving the scalability and maintainability of the system. Moreover, the aspect enhancement code can be updated and optimized without affecting the existing business logic, reducing the coupling of the system.
[0179] The present specification also provides a computer storage medium, which can store multiple instructions, and the instructions are suitable for being loaded and executed by a processor as described above. Figure 2 and Figure 3 The method of the embodiment shown in the figure can be specifically executed by referring to Figure 2 and Figure 3 The specific description of the illustrated embodiment will not be repeated here.
[0180] The present specification also provides a computer program product, which stores at least one instruction, and the at least one instruction is loaded and executed by the processor as described above. Figure 2 and Figure 3 The method of the embodiment shown in the figure can be specifically executed by referring to Figure 2 and Figure 3 The specific description of the illustrated embodiment will not be repeated here.
[0181] The embodiments of this specification also provide Figure 7 The structural diagram of the electronic device shown in FIG. Figure 7 At the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include hardware required for other services. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to implement the above-mentioned 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 software and hardware, etc., that is to say, the executor 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 hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, 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, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0184] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0185] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0186] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0187] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0188] This specification 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 this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, 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 device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0189] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0190] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions 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] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0193] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules 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 technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0194] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0195] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented 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 may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0197] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0198] The above description is only an embodiment of the present specification and is not intended to limit the present specification. For those skilled in the art, the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims of the present specification.
Claims
1. A database integrity verification method, the method comprising: Inject aspect enhancement code into the preset cut-point position of the database; When a modification operation on the database is received, executing the aspect enhancement code to generate a verification hash value corresponding to the modification operation; Calling a cryptographic service of a trusted third party, and using the cryptographic service to perform a data signature on the target data corresponding to the modification operation using the verification hash value; The database data is verified based on the hash operation message authentication code obtained by the verification hash value and the 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 receiving a modification operation on the database, executing the aspect enhancement code to generate a verification hash value corresponding to the modification operation includes: When a modification operation for a target data table in the database is received, a row hash value of target row data modified in the target data table is calculated by executing the aspect enhancement code; And determining the link hash value of the target row data according to 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: Creating a tamper-proof table corresponding to the target data table by executing the section enhancement code; The row hash value of the target row data, the row identifier of the target row data, and the link hash value of the target row data are stored in the tamper-proof table.
4. The database integrity verification method according to claim 2, wherein the calling of a cryptographic service of a trusted third party and the use of the cryptographic service to perform a data signature on the target data corresponding to the modification operation using the verification hash value comprises: Asynchronously calling the cryptographic service of the trusted third party according to a preset data signature cycle; A signature calculation is performed according to the signature key generated by the cryptographic service and the linked hash value of the target row data to obtain a hash operation message authentication code of the target row data.
5. The database integrity verification method according to claim 4, further comprising: The signing key is derived based on the database access password and the confidential 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 tamper-proof table.
7. The database integrity verification method according to claim 2, wherein the database data is verified based on the hash operation message authentication code obtained by the verification hash value and the data signature to determine whether the database has been tampered with, comprising: Poll the target data table 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 tamper-proof table respectively; If all the comparisons are consistent, the hash operation message authentication code obtained by the data signature is used to verify the row data to be verified; If any comparison is inconsistent, it is determined that the row data to be verified has been tampered with.
8. The database integrity verification method according to claim 7, wherein the calculating the row hash value and the link hash value of the row data to be verified, and comparing the row hash value and the link hash value of the row data to be verified with the row hash value and the link hash value of the corresponding row in the tamper-proof table, respectively, comprises: 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 tamper-proof table; If the comparison is consistent, 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 tamper-proof table.
9. The database integrity verification method according to claim 7, wherein the step of further verifying the row data to be verified by using the hash operation message authentication code obtained by the data signature comprises: The linked hash value of the row data to be verified is calculated by a cryptographic service of a trusted third party to obtain a hash operation message authentication code of the row data to be verified; Compare the hash operation message authentication code of the row data to be verified with the hash operation message authentication code of the corresponding row in the tamper-proof table; If the comparison is inconsistent, it is determined that the row data to be verified has been tampered with.
10. The database integrity verification method according to claim 1, before injecting the aspect enhancement code at the preset tangent point position of the database, the method further comprises: When receiving a verification instruction for the database, the configuration data is sent to the section enhancement code to determine the target data table that needs to be verified for data integrity according to the configuration data; wherein the configuration data includes the target data table; And set the trusted third party's cryptographic service interface information, data signature cycle and data verification cycle 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 is issued or a backup database is used to replace the tampered database.
12. A database integrity verification device, the device comprising: The code injection module is used to inject aspect enhancement code at the preset cut-point position of the database; A code execution module, configured to execute the aspect enhancement code upon receiving a modification operation on the database, so as to generate a verification hash value corresponding to the modification operation; A data signature module, used to call a cryptographic service of a trusted third party, and use the cryptographic service to digitally sign the target data corresponding to the modification operation using the verification hash value; The data verification module is used to verify the database data using the hash operation message authentication code obtained by verifying the hash value and the data signature to determine whether the database has been tampered with.
13. A database integrity verification system, the system comprising: Aspect engine, used to inject aspect enhancement code at preset point locations in the database according to the point list; A database, configured to execute the section enhancement code for timing signature and timing verification when receiving a modification operation on the database; A trusted third party is used to provide cryptographic services to the database, so that the database calls the cryptographic services for regular signing and regular verification.
14. According to the database integrity verification system of claim 13, the aspect engine includes an aspect injection module, and the aspect injection module is used to maintain the point cut list, manage the aspect enhancement code and control configuration data.
15. According to the database integrity verification system of claim 13, the database includes a scheduled task aspect module, the scheduled task aspect module is used to start a scheduled signature task, and asynchronously call the cryptographic service of the trusted third party according to a preset data signature cycle, so as to use the cryptographic service to data sign the target data corresponding to the modification operation, and to start a scheduled verification task, and based on the data signature result, verify the database data according to a preset data verification cycle to determine whether the database has been tampered with.
16. According to the database integrity verification system of claim 15, the trusted third party includes a cryptographic service module, which is used to provide a signature key, perform signature calculation based on the signature key, obtain a data signature result, and feed the data signature result back to the scheduled task aspect module, so as to perform data signing and verification on the database data based on the data signature result through the scheduled task aspect module.
17. A storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method according to any one of claims 1 to 11.
18. An electronic device, comprising: A processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the method as claimed in any one of claims 1 to 11.
19. A computer program product having at least one instruction stored thereon, wherein when the at least one instruction is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.
Citation Information
Patent Citations
Data verification method and device, storage medium and electronic equipment
CN115357762A
Data verification method and device, equipment and medium
CN117556476A
device for tamper-proof registration of measured values
DE202016105474U1
Securing and authenticating of a personal identity document
EP4307152A1
Apparatus and method for access certification by facial code chain encryption
KR102174548B1
Cited By
Method and device for realizing integrity protection of sensitive data of database
CN120449215A
A method and apparatus for implementing database sensitive data integrity protection
CN120449215B
Agricultural ecological member data security management method and system
CN120811719A
An agricultural ecological member data security management method and system
CN120811719B
Database integrity protection method and device, equipment and storage medium
CN121365430A