Database management system and method based on trusted execution environment and authenticated encryption
By introducing a trusted execution environment and authentication encryption mechanism into the SQLite database management system, the problems of data privacy leakage and tampering are solved, the secure transmission and storage of data are realized, the confidentiality and integrity of the system are improved, and multi-application sharing is supported. It is suitable for scenarios such as financial terminals, smart devices and IoT gateways.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-29
- Publication Date
- 2026-03-24
AI Technical Summary
Existing SQLite database management systems pose risks of privacy leaks and tampering during data processing, lack a unified security mechanism, have insecure key management, and insufficient data integrity verification.
A database management system based on a trusted execution environment and authentication encryption is adopted. The application host and SQLite database extension module are set in a trusted environment, while the database host is in an untrusted environment. The security of data transmission and storage is ensured by using the AES-128GCM mode authentication encryption algorithm and hash tree verification mechanism, and access isolation and permission control are implemented through a key mapping table.
It effectively prevents malicious access and data tampering, enhances data confidentiality and integrity, reduces storage overhead, improves computing efficiency, supports secure sharing among multiple applications, and balances system security and operational performance.
Smart Images

Figure CN121030751B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of database security, and particularly relates to a database management system and method based on a trusted execution environment and authentication encryption. BACKGROUND
[0002] SQLite is a lightweight, open-source relational database management system. Unlike most other SQL databases, SQLite does not have a separate server process. It provides high storage efficiency, fast query operation, acid transaction, and small memory requirement. A complete SQLite database is stored in a cross-platform disk file.
[0003] A database file is composed of one or more pages. All pages in the same database are of the same size. All data related to the database is stored in the page, including table records, indexes, and even available space in the database file (free list pages). Each page can be indexed by page number.
[0004] A trusted execution environment is an isolated environment running in parallel with the operating system, providing security for a resource-rich environment. It can guarantee that the loaded code and data are protected in terms of confidentiality and integrity. Tee provides security functions such as isolated execution, integrity of trusted applications, and confidentiality of its assets as an isolated execution environment. Various embedded hardware technologies aim to support TEE implementation, including AMD secure execution environment, ARM Trustzone, Intel Software Guard Extensions, and so on.
[0005] The existing SQLite security scheme has many defects. First, SQLite stores data in plaintext in local files, and any attacker who obtains file access rights can easily read or tamper with the data. Second, existing encryption extensions such as SQLCipher (SQLCipher is an open-source extension library developed based on SQLite, which enhances the security of SQLite through encryption functions. Although static data encryption is provided, the data still needs to be decrypted into memory when processing, which faces the risk of memory leakage. In addition, key management is highly dependent on the application, and there is a lack of unified security mechanism. Once the key is leaked, the data security is destroyed. At the same time, most schemes do not provide data integrity verification, and cannot prevent data tampering. SUMMARY
[0006] The present application provides a database management system and method based on a trusted execution environment and authentication encryption, aiming to solve the technical problem that the SQLite database management system in the prior art has a high risk of privacy leakage and tampering during data processing.
[0007] The application provides a database management system based on a trusted execution environment and authentication encryption, comprising:
[0008] An application program host, an SQLite database extension module, and a database host, the application program host and the SQLite database extension module being arranged in a trusted environment, and the database host being arranged in an untrusted environment;
[0009] The application program host is configured to establish a secure channel with the SQLite database extension module based on any one target application program of the application program host, and generate an encrypted file, and send the encrypted file to the SQLite database extension module;
[0010] The SQLite database extension module is configured to decrypt the encrypted file to obtain decrypted information, and execute a page query result based on the decrypted information;
[0011] The SQLite database extension module is further configured to parse the page query result to obtain a first page hash value, a label, and a first encrypted page corresponding to the page query result;
[0012] The database host is in communication connection with the SQLite database extension module, and is configured to read the first encrypted page based on the first page hash value;
[0013] The SQLite database extension module is further configured to decrypt the first encrypted page to obtain a first page;
[0014] The SQLite database extension module is further configured to execute a query statement on the first page based on the decrypted information to obtain a second page;
[0015] The SQLite database extension module is further configured to judge whether the second page and the first page are the same;
[0016] If the second page and the first page are not the same, the SQLite database extension module is configured to send update information to the database, and the database host is configured to update the first encrypted page to a second encrypted page based on the update information, and return the second encrypted page to the SQLite database extension module as an encrypted query result;
[0017] The SQLite database extension module is further configured to return the encrypted query result to the application program host after encryption;
[0018] The application program host is further configured to decrypt the encrypted query result, and verify the decrypted query result, and if the decrypted query result meets a preset condition, accept the decrypted query result.
[0019] Preferably, the application host is configured to obtain a data key preset by the target application, generate a symmetric key based on the data key, and verify integrity of the SQLite database extension module based on a remote authentication protocol;
[0020] If the SQLite database extension module is complete, a secure channel is established with the SQLite database extension module to share the symmetric key.
[0021] Preferably, the application host is further configured to encrypt the symmetric key and the unique identifier to obtain an encrypted identifier, and send the encrypted identifier to the SQLite database extension module, which is configured to complete binding with the application host based on the encrypted identifier.
[0022] The application host is further configured to obtain a target query statement, a random number, and an authentication tag, and encrypt the target query statement, the random number, and the authentication tag based on the symmetric key to obtain an encrypted file.
[0023] The application host is further configured to send the encrypted file to the SQLite database extension module. Preferably, the SQLite database extension module is configured to find the symmetric key in a key mapping according to the unique identifier carried by the application host, and decrypt the encrypted file based on the symmetric key to obtain decrypted information, wherein the decrypted information includes the target query statement and the random number.
[0024] The SQLite database extension module is further configured to execute a page query result based on the target query statement.
[0025] Preferably, the database host is configured to construct a hash tree, wherein each leaf node of the hash tree stores a leaf hash value of a page tag, and the hash tree is calculated by a child node hash level by level to obtain a root hash, which is sent to the SQLite database extension module for storage.
[0026] When the database host reads a first encrypted page based on a first page hash value, the database host provides the SQLite database extension module with encrypted data, a tag, a leaf hash value, and a verification path corresponding to the first encrypted page.
[0027] The SQLite database extension module calculates a function value of the first encrypted page based on the encrypted data, the tag, the leaf hash value, the verification path, and a chain hash calculation principle, and determines whether the function value is consistent with the root hash. If they are consistent, the tag corresponding to the first encrypted page is valid.
[0028] Preferably, the application program host and the SQLite database extension module adopt an authentication encryption algorithm in the AES-128 GCM mode;
[0029] When the SQLite database extension module stops running, the data of the SQLite database extension module is encrypted and stored based on the SGX sealing technology, and is loaded after being unsealed when restarted.
[0030] The application further provides a database management method based on a trusted execution environment and authentication encryption, comprising:
[0031] The application program host establishes a secure channel with the SQLite database extension module based on any one target application program of the application program host, and generates an encrypted file, and sends the encrypted file to the SQLite database extension module, wherein the application program host and the SQLite database extension module are arranged in a trusted environment.
[0032] The SQLite database extension module decrypts the encrypted file to obtain decryption information, and executes a page query result based on the decryption information.
[0033] The SQLite database extension module parses the page query result to obtain a first page hash value, a label and a first encrypted page corresponding to the page query result.
[0034] The database host is in communication connection with the SQLite database extension module, and is configured to read the first encrypted page based on the first page hash value, wherein the database host is arranged in an untrusted environment.
[0035] The SQLite database extension module decrypts the first encrypted page to obtain a first page, executes a query statement on the first page based on the decryption information to obtain a second page, and judges whether the second page is the same as the first page, and if the second page is not the same as the first page, sends update information to the database.
[0036] The database host updates the first encrypted page to a second encrypted page based on the update information, and returns the second encrypted page to the SQLite database extension module as an encrypted query result.
[0037] The SQLite database extension module returns the encrypted query result to the application program host.
[0038] The application program host decrypts the encrypted encrypted query result, and verifies the decrypted encrypted query result, and if the decrypted encrypted query result meets a preset condition, accepts the decrypted encrypted query result.
[0039] As preferred, the step of the application program host establishing a secure channel with the SQLite database extension module comprises:
[0040] The application program host is configured to obtain a data key preset by a target application program, generate a symmetric key based on the data key, and verify integrity of the SQLite database extension module based on a remote authentication protocol;
[0041] If the SQLite database extension module is complete, a secure channel is established with the SQLite database extension module to share the symmetric key.
[0042] As preferred, after the step of the application program host establishing a secure channel with the SQLite database extension module based on any one of the target application programs of the application program host, the application program host further comprises:
[0043] The application program host is further configured to encrypt the symmetric key and the unique identifier to obtain an encrypted identifier, and send the encrypted identifier to the SQLite database extension module (SQLite engine), which is configured to complete identity binding with the application program host based on the encrypted identifier.
[0044] The application program host is further configured to obtain a target query statement, a random number, and an authentication tag, and encrypt the target query statement, the random number, and the authentication tag based on the symmetric key to obtain an encrypted file.
[0045] The application program host is further configured to send the encrypted file to the SQLite database extension module.
[0046] As preferred, the step of the SQLite database extension module decrypting the encrypted file to obtain decryption information, and executing a page query result based on the decryption information comprises:
[0047] The SQLite database extension module is configured to find the symmetric key in a key mapping according to the unique identifier carried by the application program host, and decrypt the encrypted file based on the symmetric key to obtain decryption information, wherein the decryption information comprises the target query statement and the random number.
[0048] The SQLite database extension module is further configured to execute a page query result based on the target query statement.
[0049] The application has the advantages that: in the privacy protection aspect, the application runs in plaintext form in the protected SQLite database extension module (SQLiteEnclave) by means of the Intel SGX trusted execution environment and the AES-GCM authentication encryption mechanism, effectively prevents malicious access and data tampering, and greatly improves the confidentiality and integrity of data compared with the traditional scheme. In the computing efficiency aspect, the execution stage separation strategy makes the overhead of the initialization and destruction stages only once, the actual query time ratio is reduced, and the verification path length of the hash tree efficient verification mechanism is O (log(n)), the computing complexity is controllable, suitable for large-scale data processing, and the overall system running efficiency is improved. In the multi-application sharing aspect, an independent key is allocated to each target application program through the key mapping table, access isolation and permission control are realized, and the multi-application secure shared database engine is supported, which is incomparable with the traditional single-application designed SQLite. In the storage optimization aspect, the page label authentication protocol based on the hash tree is adopted, the authentication label hash value is stored in the untrusted environment, only the root hash is reserved in the trusted area, the storage overhead is reduced. At the same time, the key is persisted by means of the SGX sealing technology, and the security of the key storage is guaranteed.
[0050] In addition, the application is based on the mainstream SGX hardware platform deployment, highly compatible with the standard SQL syntax, while considering the system security, good running performance is ensured, the scene demand of the financial terminal, intelligent device, Internet of Things gateway and the like which are strict in data security and performance requirements can be better met, and the application has wide application prospect and high engineering practical value. BRIEF DESCRIPTION OF DRAWINGS
[0051] Figure 1 FIG. 1 is a system structure schematic diagram of an embodiment of the application.
[0052] Figure 2 FIG. 2 is a method flow schematic diagram of an embodiment of the application.
[0053] The implementation, functional features and advantages of the application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION
[0054] It should be understood that the specific embodiments described herein are only used to explain the application, and are not used to limit the application.
[0055] As shown in FIGS. Figure 1 , Figure 2 The application provides a database management system based on a trusted execution environment and authentication encryption, which comprises:
[0056] An application program host, an SQLite database extension module, and a database host, the application program host and the SQLite database extension module are arranged in a trusted environment, and the database host is arranged in an untrusted environment;
[0057] The application program host is configured to establish a secure channel with the SQLite database extension module based on any one target application program of the application program host, and generate an encrypted file, and send the encrypted file to the SQLite database extension module;
[0058] The SQLite database extension module is configured to decrypt the encrypted file to obtain decrypted information, and execute a page query result based on the decrypted information;
[0059] The SQLite database extension module is further configured to parse the page query result to obtain a first page hash value, a label, and a first encrypted page corresponding to the page query result;
[0060] The database host is in communication connection with the SQLite database extension module, and is configured to read the first encrypted page based on the first page hash value;
[0061] The SQLite database extension module is further configured to decrypt the first encrypted page to obtain a first page;
[0062] The SQLite database extension module is further configured to execute a query statement on the first page based on the decrypted information to obtain a second page;
[0063] The SQLite database extension module is further configured to judge whether the second page and the first page are the same;
[0064] If the second page and the first page are not the same, the SQLite database extension module is further configured to send update information to the database, and the database host is configured to update the first encrypted page to a second encrypted page based on the update information, and return the second encrypted page to the SQLite database extension module as an encrypted query result;
[0065] The SQLite database extension module is further configured to encrypt the encrypted query result and return the encrypted query result to the application program host;
[0066] The application program host is further configured to decrypt the encrypted query result, and verify the decrypted query result, and if the decrypted query result meets a preset condition, accept the decrypted query result.
[0067] As described above, the database management system architecture based on trusted execution environment and authentication encryption of the application is divided into three core parts, including application host, SQLite database extension module and database host, wherein the application host and the SQLite database extension module are set in a trusted environment, for example, a physically isolated application host or another Intel SGX enclave (SGX: It is a hardware-based security technology launched by Intel, which aims to provide a secure execution environment for applications to protect sensitive data and code from potential attacks, even if the operating system or other software layers are compromised, security can be ensured.
[0068] The application host is mainly responsible for key, encrypted SQL query statement request and decrypted query result; the SQLite database extension module (SQLite Enclave) is an extension of the SQLite database, which uses hardware-level security features to protect database operations. This means that even if the operating system or malicious software tries to access this data, they cannot easily read or modify the data stored in the SQLite Enclave. This is very useful for scenarios where sensitive data needs to be stored in an untrusted environment, such as in cloud services or Internet of Things devices.
[0069] The database host is set in an untrusted environment, and the database host is internally provided with a SQLite Store (SQLite storage) for storing encrypted database files (Ciphertext) and hash structures of Merkle trees, and a SQLite Agent (SQLite agent) is also provided, which acts as an agent for the application and database environment operating system in the system. As an agent to handle untrusted operations (such as system calls), it interacts with the SQLite database extension module (SQLite Enclave) through the OCALL (Out-of-Enclave Call) / ECALL (Enclave Call) mechanism.
[0070] The application is based on mainstream SGX hardware platform deployment, highly compatible with standard SQL syntax, can avoid privacy leakage and tampering in data processing, ensures good running performance while considering system security, can better meet the scene demand of financial terminals, intelligent devices, Internet of Things gateways and other scenes with strict requirements on data security and performance, has broad application prospect and high engineering practical value.
[0071] In one embodiment, the application program host is configured to obtain a data key preset by a target application program, generate a symmetric key based on the data key, and verify the integrity of the SQLite database extension module based on a remote authentication protocol;
[0072] If the SQLite database extension module is complete, a secure channel is established with the SQLite database extension module to share the symmetric key.
[0073] As described above, the application allocates independent keys for each target application program through a key mapping table, realizes access isolation and permission control, and supports multi-application secure shared database engine, which is incomparable to traditional single-application designed SQLite.
[0074] In one embodiment, the application program host is further configured to encrypt the symmetric key ki and the unique identifier IDi to obtain an encrypted identifier, and send the encrypted identifier to the SQLite database extension module (SQLite engine), which is configured to complete identity binding with the application program host based on the encrypted identifier;
[0075] The application program host is further configured to obtain a target query statement, a random number and an authentication tag, and encrypt the target query statement, the random number and the authentication tag based on the symmetric key to obtain an encrypted file;
[0076] The application program host is further configured to send the encrypted file to the SQLite database extension module.
[0077] In one embodiment, the SQLite database extension module is configured to find the symmetric key in the key mapping according to the unique identifier carried by the application program host, and decrypt the encrypted file based on the symmetric key to obtain decryption information, wherein the decryption information includes the target query statement and the random number;
[0078] The SQLite database extension module is further configured to execute page query results based on the target query statement.
[0079] In one embodiment, the database host is configured to build a hash tree, wherein each leaf node of the hash tree stores a leaf hash value of a page tag, and the hash tree is calculated by a child node hash level by level to obtain a root hash, and the root hash is sent to the SQLite database extension module for storage.
[0080] When the database host reads the first encrypted page based on the first page hash value, the database host provides the encrypted data corresponding to the first encrypted page, the tag, the leaf hash value and the verification path to the SQLite database extension module.
[0081] The SQLite database extension module calculates the function value of the first encrypted page based on the encrypted data, the tag, the leaf hash value, the verification path and the chain hash calculation principle, and determines whether the function value is consistent with the root hash. If they are consistent, the tag corresponding to the first encrypted page is valid.
[0082] As described above, the present application adopts a page tag authentication protocol based on a hash tree, stores the authentication tag hash value in an untrusted environment, and only retains the root hash in a trusted area, thereby reducing the storage overhead. At the same time, the key is persisted by means of the SGX sealing technology, thereby ensuring the security of the key storage. The execution phase separation strategy makes the initialization and destruction phase only need to be performed once, the actual query time ratio is reduced, and the verification path length of the hash tree efficient verification mechanism is O (log(n)), the calculation complexity is controllable, suitable for large-scale data processing, and the overall system operation efficiency is improved.
[0083] In one embodiment, the application program host and the SQLite database extension module adopt an authentication encryption algorithm of the AES-128GCM mode.
[0084] When the SQLite database extension module stops running, the data thereof is encrypted and stored based on the SGX sealing technology, and is loaded after being unsealed.
[0085] As described above, the present application uses the Intel SGX trusted execution environment and the AES-GCM authentication encryption mechanism, and the data processing is performed in the form of plaintext in the protected SQLite database extension module (SQLite Enclave) throughout the process, thereby effectively preventing malicious access and data tampering, and greatly improving the confidentiality and integrity of the data compared with the traditional scheme.
[0086] In order to facilitate better understanding of the system, the following examples are used to illustrate the overall process:
[0087] The system comprises a database host, a SQLite database extension module (SQLite Enclave) and an application program host, the database host is internally provided with a SQLite storage module, the SQLite database extension module (SQLite Enclave) is internally provided with a SQLite engine, the application program host is installed with any application program i, preset information of the application program i is a data key, a SQL statement (target query statement) is Sj, preset information of the SQLite database extension module is a password mapping table, indicated as , and an application program i tag mapping table, indicated as ;
[0088] 1. Initialization phase
[0089] Suppose that the application program i wants to use the system, he first generates a symmetric key ki according to the data key, and verifies the integrity of the SQLite Enclave through the SGX remote authentication protocol, and establishes a secure channel to share the symmetric key ki;
[0090] The application program i encrypts ki and a unique identifier IDi and sends them to the SQLite engine, and the SQLite engine stores them into the key map (in the computer field, it usually refers to a mapping relationship of associating the keys on the keyboard with specific functions, commands or operations. For example, in some software, users can customize key mapping to set a certain key to perform a specific task, such as mapping “Ctrl + S” to the operation of saving a file. To complete the binding of the key and the identity of the application program i.
[0091] 2. Execution phase
[0092] SQL request encryption and transmission: the application program i encrypts Sj and the generated random number Nj into an encrypted file using ki, and adds an authentication tag Tsj and IDi, in the form of: and sends them to the SQLite Enclave;
[0093] SQLite Enclave internal decryption and execution:
[0094] Page reading: the SQLite Enclave finds ki in the key map according to IDi, and decrypts the encrypted file Decrypting to obtain decrypted information (Sj and Nj), querying based on Sj in the decrypted information to obtain a query result of the page p; at this time, the page p is in an encrypted state, denoted as Eki(p), the first page hash value NOp and the label Tp, and the first encrypted page Eki(p) are obtained by parsing the page p, the SQLite storage module reads Eki(p) through NOp, the SQLite Enclave obtains Eki(p) and verifies the integrity of the label Tp in combination with the hash tree, and decrypts to obtain the page p;
[0095] Page update: Sj is executed on the page p to obtain a second page (query result Rj, page p', Tp'); if the page p' is not equal to the page p, NOp→Tp in the label mapping is updated to NOp'→Tp', and re-encryption is performed, Eki(p) is updated to Eki(p'), the hash tree is updated and the root hash value is synchronized.
[0096] 3. Result return
[0097] The SQLite Enclave returns the query result Rj and Nj in the second page after encryption to the application program i, and the application program i verifies the consistency of Nj to defend against a replay attack. Specifically, the SQLite Enclave sends to the application program i, the application program i decrypts to obtain Rj and Nj, and accepts Rj if Nj does not change.
[0098] When the system executes the above process, it further includes:
[0099] 4. Page label authentication protocol
[0100] Hash tree construction: each leaf node stores a hash value Φp=hash(<NOp,Tp>) of a page label, internal nodes are calculated through child node hashes level by level, and finally a root hash Φ(R) is stored in the SQLite Enclave.
[0101] Dynamic verification process: when reading a page, the non-trusted environment provides encrypted data Eki(p), a label Tp, a leaf hash Φp, and a verification path μp. The SQLite Enclave calculates a function value λ(Φp,μp) through a chain hash function, and if the function value λ(Φp,μp) result is consistent with Φ(R), the label is valid.
[0102] 5. Encryption and key management
[0103] Authenticated encryption algorithm: AES-128 GCM mode is adopted, ciphertext Cp and label Tp are generated during encryption, and the label is verified during decryption to ensure that the data has not been tampered with.
[0104] Key persistence: When the SQLite Enclave exits, the Key Map and root hash are encrypted and stored by SGX Seal technology, and are loaded by unsealing when restarting.
[0105] The system separates the execution phase: the overhead of initialization and destruction phase is only once, and the actual query time accounts for 24% of the system and 79% of the traditional encrypted SQLite. The hash tree of the system verifies efficiently: the verification path length is O(log(n)), the calculation complexity is controllable, and it is suitable for large-scale data.
[0106] The application ensures that the data processing process is always running in plaintext form in the protected enclave through the Intel SGX trusted execution environment, and provides confidentiality and integrity double security protection for the blockchain system by combining the AES-GCM authentication encryption mechanism, to prevent malicious access and data tampering.
[0107] The application adopts a page label authentication protocol based on a hash (Merkle) tree, stores the authentication label hash value in an untrusted environment, only retains the root hash in the trusted area, dynamically verifies the label by verifying the path when reading data, significantly reduces the storage overhead and improves the integrity verification efficiency.
[0108] The application realizes a multi-application shared database engine, which allocates independent keys for each application through a key mapping table (Key Map), realizes access isolation and permission control, is compatible with standard SQL syntax, and is deployed based on mainstream SGX hardware platforms, taking into account system security and running performance.
[0109] The application also provides a database management method based on a trusted execution environment and authentication encryption, comprising:
[0110] S1, the application program host establishes a secure channel with the SQLite database extension module based on any one target application program of itself, generates an encrypted file, and sends the encrypted file to the SQLite database extension module, wherein the application program host and the SQLite database extension module are arranged in a trusted environment;
[0111] S2, the SQLite database extension module decrypts the encrypted file to obtain decryption information, and executes a page query result based on the decryption information;
[0112] S3, the SQLite database extension module parses the page query result to obtain a first page hash value, a label and a first encrypted page corresponding to the page query result;
[0113] S4, the database host is in communication connection with the SQLite database extension module, and is configured to read the first encrypted page based on the first page hash value, wherein the database host is arranged in an untrusted environment;
[0114] S5, the SQLite database extension module decrypts the first encrypted page to obtain a first page, executes a query statement on the first page based on decryption information to obtain a query result and a second page, and judges whether the second page is the same as the first page. If the second page is not the same as the first page, the database is sent update information;
[0115] S6, the database host updates the first encrypted page to a second encrypted page based on the update information, and returns the second encrypted page to the SQLite database extension module as an encrypted query result;
[0116] S7, the SQLite database extension module returns the encrypted query result to the application program host;
[0117] S8, the application program host decrypts the encrypted encrypted query result, and verifies the decrypted encrypted query result. If the decrypted encrypted query result meets the preset condition, the decrypted encrypted query result is accepted.
[0118] In one embodiment, the application program host and the SQLite database extension module establish a secure channel, comprising:
[0119] The application program host is configured to obtain a data key preset by a target application program, generate a symmetric key based on the data key, and verify the integrity of the SQLite database extension module based on a remote authentication protocol;
[0120] If the SQLite database extension module is complete, a secure channel is established with the SQLite database extension module to share the symmetric key.
[0121] In one embodiment, after the application program host establishes a secure channel with the SQLite database extension module based on any one of the target application programs, the application program host further comprises:
[0122] The application program host is further configured to encrypt the symmetric key and the unique identifier to obtain an encrypted identifier, and send the encrypted identifier to the SQLite database extension module, and the SQLite database extension module is configured to complete the identity binding with the application program host based on the encrypted identifier;
[0123] The application program host is also configured to obtain a target query statement, a random number and an authentication tag, and encrypt the target query statement, the random number and the authentication tag based on a symmetric key to obtain an encrypted file;
[0124] The application program host is also configured to send the encrypted file to the SQLite database extension module.
[0125] In one embodiment, the SQLite database extension module decrypts the encrypted file to obtain decryption information, and executes the step of obtaining the page query result based on the decryption information, including:
[0126] The SQLite database extension module is configured to find the symmetric key in a key mapping according to a unique identification of the application program host, and decrypt the encrypted file based on the symmetric key to obtain decryption information, wherein the decryption information includes the target query statement and the random number.
[0127] The SQLite database extension module is also configured to execute the page query result based on the target query statement.
[0128] It should be noted that, in this document, the terms "comprising", "including", or any other variant thereof are intended to cover non-exclusive inclusions, so that a process, device, article or method including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such a process, device, article or method. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0129] The above description is only the preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation, or direct or indirect application in other related technical fields, is also included in the patent protection scope of the present application.
Claims
1. A database management system based on a trusted execution environment and authentication encryption, characterized in that, include: The application host, the SQLite database extension module, and the database host are located in a trusted environment, while the database host is located in an untrusted environment. The application host is used to establish a secure channel with the SQLite database extension module based on any of its target applications, generate an encrypted file, and send the encrypted file to the SQLite database extension module; The SQLite database extension module is used to decrypt the encrypted file, obtain decryption information, and execute page query results based on the decryption information; The SQLite database extension module is also used to parse the page query results to obtain the first page hash value, tag, and first encrypted page corresponding to the page query results; The database host is communicatively connected to the SQLite database extension module and is used to read the first encrypted page based on the hash value of the first page; The SQLite database extension module is also used to decrypt the first encrypted page to obtain the first page; It is also used to execute a query statement on the first page based on the decrypted information to obtain the second page; It is also used to determine whether the second page and the first page are the same; If the second page is different from the first page, an update message is sent to the database. The database host is used to update the first encrypted page to the second encrypted page based on the update message, and return the second encrypted page as an encrypted query result to the SQLite database extension module. The SQLite database extension module is also used to encrypt the encrypted query results and return them to the application host; The application host is also used to decrypt the encrypted query result and verify the decrypted encrypted query result. If the decrypted encrypted query result meets the preset conditions, the decrypted encrypted query result is accepted. The database host is used to construct a hash tree, wherein each leaf node of the hash tree stores the leaf hash value of the page tag, and the hash tree calculates the root hash level by level through the child node hashes, and sends the root hash to the SQLite database extension module for storage; When the database host reads the first encrypted page based on the hash value of the first page, the database host provides the SQLite database extension module with the encrypted data, tags, leaf hash values and verification path corresponding to the first encrypted page; The SQLite database extension module calculates the function value of the first encrypted page based on encrypted data, tags, leaf hash values, verification paths, and the chain hash calculation principle, and determines whether the function value is consistent with the root hash. If they are consistent, the tag corresponding to the first encrypted page is valid. The application host and the SQLite database extension module use the AES-128 GCM mode authentication encryption algorithm; When the SQLite database extension module stops running, it encrypts and stores its own data based on SGX sealing technology, and unencrypts and loads it upon restart.
2. The database management system based on trusted execution environment and authentication encryption according to claim 1, characterized in that, The application host is used to obtain the data key preset by the target application, generate a symmetric key based on the data key, and verify the integrity of the SQLite database extension module based on the remote authentication protocol; If the SQLite database extension module is complete, a secure channel is established with the SQLite database extension module to share the symmetric key.
3. The database management system based on trusted execution environment and authentication encryption according to claim 2, characterized in that, The application host is also used to encrypt the symmetric key and the unique identifier to obtain an encrypted identifier, and send the encrypted identifier to the SQLite database extension module. The SQLite database extension module is used to complete the identity binding with the application host based on the encrypted identifier. The application host is also used to obtain the target query statement, random number and authentication tag, and encrypt the target query statement, random number and authentication tag based on the symmetric key to obtain an encrypted file; The application host is also used to send the encrypted file to the SQLite database extension module.
4. The database management system based on trusted execution environment and authentication encryption according to claim 1, characterized in that, The SQLite database extension module is used to find the symmetric key in the key mapping based on the unique identifier of the application host, and to decrypt the encrypted file based on the symmetric key to obtain decryption information, wherein the decryption information includes the target query statement and a random number; The SQLite database extension module is also used to execute page query results based on the target query statement.
5. A database management method based on a trusted execution environment and authentication encryption, characterized in that, include: The application host establishes a secure channel with the SQLite database extension module based on any of its target applications, generates an encrypted file, and sends the encrypted file to the SQLite database extension module. The application host and the SQLite database extension module are set in a trusted environment. The SQLite database extension module decrypts the encrypted file to obtain decryption information, and executes page query results based on the decryption information; The SQLite database extension module parses the page query results to obtain the first page hash value, tag, and first encrypted page corresponding to the page query results; The database host is communicatively connected to the SQLite database extension module and is used to read the first encrypted page based on the hash value of the first page, wherein the database host is set in an untrusted environment; The SQLite database extension module decrypts the first encrypted page to obtain the first page, executes a query statement on the first page based on the decrypted information to obtain the second page, and determines whether the second page is the same as the first page. If the second page is not the same as the first page, it sends update information to the database. The database host updates the first encrypted page to the second encrypted page based on the update information, and returns the second encrypted page as the encrypted query result to the SQLite database extension module; The SQLite database extension module returns the encrypted query results to the application host; The application host decrypts the encrypted query result and verifies the decrypted encrypted query result. If the decrypted encrypted query result meets the preset conditions, the application host accepts the decrypted encrypted query result. The database host constructs a hash tree, wherein each leaf node of the hash tree stores the leaf hash value of the page tag, and the hash tree calculates the root hash level by level through the child node hashes, and sends the root hash to the SQLite database extension module for storage; When the database host reads the first encrypted page based on the hash value of the first page, the database host provides the SQLite database extension module with the encrypted data, tags, leaf hash values and verification path corresponding to the first encrypted page; The SQLite database extension module calculates the function value of the first encrypted page based on encrypted data, tags, leaf hash values, verification paths, and the chain hash calculation principle, and determines whether the function value is consistent with the root hash. If they are consistent, the tag corresponding to the first encrypted page is valid. The application host and the SQLite database extension module use the AES-128 GCM mode authentication encryption algorithm; When the SQLite database extension module stops running, it encrypts and stores its own data based on SGX sealing technology, and unencrypts and loads it upon restart.
6. A database management method based on a trusted execution environment and authentication encryption according to claim 5, characterized in that, The steps for establishing a secure channel between the application host and the SQLite database extension module include: The application host is used to obtain the data key preset by the target application, generate a symmetric key based on the data key, and verify the integrity of the SQLite database extension module based on the remote authentication protocol; If the SQLite database extension module is complete, a secure channel is established with the SQLite database extension module to share the symmetric key.
7. The database management method based on trusted execution environment and authentication encryption according to claim 6, characterized in that, After the step of establishing a secure channel between the application host and the SQLite database extension module based on any one of its target applications, the method further includes: The application host is also used to encrypt the symmetric key and the unique identifier to obtain an encrypted identifier, and send the encrypted identifier to the SQLite database extension module. The SQLite database extension module is used to complete the identity binding with the application host based on the encrypted identifier. The application host is also used to obtain the target query statement, random number and authentication tag, and encrypt the target query statement, random number and authentication tag based on the symmetric key to obtain an encrypted file; The application host is also used to send the encrypted file to the SQLite database extension module.
8. The database management method based on trusted execution environment and authentication encryption according to claim 5, characterized in that, The SQLite database extension module decrypts the encrypted file to obtain decryption information, and executes the page query results based on the decryption information, including: The SQLite database extension module is used to find the symmetric key in the key mapping based on the unique identifier of the application host, and to decrypt the encrypted file based on the symmetric key to obtain decryption information, wherein the decryption information includes the target query statement and a random number; The SQLite database extension module is also used to execute page query results based on the target query statement.
Citation Information
Patent Citations
Non-interactive public verifiable symmetric searchable encryption method with forward and backward security
CN118761085A
RFID bidirectional authentication method based on asymmetric key and HASH function
WO2014201585A1