WO2022156588A1 - Data management method, device, and system - Google Patents

Data management method, device, and system Download PDF

Info

Publication number
WO2022156588A1
WO2022156588A1 PCT/CN2022/071757 CN2022071757W WO2022156588A1 WO 2022156588 A1 WO2022156588 A1 WO 2022156588A1 CN 2022071757 W CN2022071757 W CN 2022071757W WO 2022156588 A1 WO2022156588 A1 WO 2022156588A1
Authority
WO
WIPO (PCT)
Prior art keywords
ciphertext
data
plaintext
index value
space
Prior art date
Application number
PCT/CN2022/071757
Other languages
French (fr)
Chinese (zh)
Inventor
刘佳阳
郭亮
朱金伟
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2022156588A1 publication Critical patent/WO2022156588A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • G06F21/6227Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database where protection concerns the structure of data, e.g. records, types, queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/70Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer
    • G06F21/78Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure storage of data

Definitions

  • the present application relates to the technical field of databases, and in particular, to a method, device and system for data management.
  • the solution of fully encrypted database means that user data is encrypted by the user key on the client side, and then the encrypted ciphertext data is stored in the database. Because only the client side has the user key, it can be guaranteed to be stored in the database. Security of ciphertext data in Chinese.
  • the encryption scheme of user data usually adopts symmetric encryption.
  • Symmetric encryption cannot guarantee the sequential operation based on sequentially encrypted data.
  • the database will provide the data with order preservation requirements.
  • a new data column is added to store the data with the order-preserving requirement, which will lead to the expansion of the data column used for storing the data with the order-preserving requirement, which reduces the scalability of the database.
  • Embodiments of the present application provide a data management method, device, and system, which are used to reduce the space occupied by the expansion of a table for storing ciphertext data, and improve the scalability of stored data in a cloud device.
  • Embodiments of the present application also provide corresponding apparatuses, systems, computer-readable storage media, computer program products, and the like.
  • a first aspect of the present application provides a data management method, including: acquiring a first statement, where the first statement includes plaintext data; determining a ciphertext index value according to information of the plaintext data; sending a second statement, the second statement to a cloud device Including the ciphertext index value, the ciphertext index value is used by the cloud device to establish the correspondence between the ciphertext index value and the information of the storage location of the ciphertext data in the index structure, or to query the ciphertext data from the index structure.
  • the information of the storage location, the ciphertext data is the encrypted data of the plaintext data, and the information of the storage location indicates the storage location of the ciphertext data corresponding to the plaintext data.
  • the first statement is a first statement based on sequential operations.
  • the solution provided in the first aspect above can be applied to a database end-to-cloud scenario, and can also be applied to a non-database end-to-cloud scenario.
  • the client side can be a client, and the client can be hardware (such as a terminal device) or software (such as an application (APP)), and the cloud side can be a cloud device, and the cloud device can be a physical machine or a physical machine. It can be a virtual machine (VM) or a container (container).
  • the plaintext data on the terminal side can be encrypted by the user key to obtain the ciphertext data, and then the ciphertext data is sent to the cloud side for storage.
  • Operations such as insert (insert), update (update), query (select/query), and delete (delete) can be performed between devices and clouds for ciphertext data.
  • Many of the plaintext data on the terminal side are based on sequential records, such as employee information lists, student information lists, and other data, which are all recorded based on sequential records. These sequential recorded data also need to be sorted in order after being encrypted by the user key. These data can also be called data with sequential requirements.
  • the encryption method for these order-required data can be order-preserving encryption (OPE), order-revealing encryption (ORE), or other order-based encryption methods.
  • OEPE order-preserving encryption
  • ORE order-revealing encryption
  • statements for operations on these sequence-related data may be referred to as statements based on sequence operations.
  • Input conditions based on sequential operations can include comparison operators, range queries, ordering (ORDER BY), minimum (minimum, MIN), maximum (maximum, MAX), and sorting (SORT), etc.
  • both the first statement and the second statement may be structured query language (structured query language, SQL) statements.
  • the first statement is typically a statement generated based on user input. For example: a statement generated by a query condition input by a user, or a statement generated by an insert instruction, an update instruction, or a delete instruction input by the user.
  • the operation indicated by the second statement is the same as the operation indicated by the first statement.
  • plaintext data may also be described as "plaintext of data”
  • ciphertext data may also be described as "ciphertext of data”.
  • the ciphertext index value refers to an index value that has a pointing relationship with the ciphertext data.
  • the index structure is a structure established by the cloud device to store the correspondence between the ciphertext index value and the information of the storage location of the ciphertext data, and the index structure may be a tree structure or other types of structures.
  • the information on the storage location of the ciphertext data may include an address of the storage location or an identification of the ciphertext data in the stored list.
  • the cloud device will establish a correspondence between the ciphertext index value and the information of the storage location of the ciphertext data in the index structure. For a query operation, an update operation or a deletion operation, the cloud device will query the information of the storage location of the ciphertext data from the index structure, and then can query the ciphertext data according to the information of the storage location.
  • the client can generate a ciphertext index value for plaintext data based on sequential operations, and then the cloud device can store the ciphertext index value in an index structure to establish a storage location for the ciphertext index value and the ciphertext data
  • the cloud device can store the ciphertext index value in an index structure to establish a storage location for the ciphertext index value and the ciphertext data
  • the corresponding ciphertext data can be queried according to the corresponding relationship in the index structure, and then the corresponding operations on the ciphertext data can be performed.
  • the ciphertext index value is used instead of the field in the data column as the key value in the conventional ordered index to realize the search for ciphertext data, and the ciphertext stored in the table can be searched without adding data table fields.
  • the data is queried based on the order, thereby reducing the space occupied by the expansion of the table used to store the ciphertext data, and improving the scalability of the stored data in the cloud device. That is to say, the solution of the present application has the advantages of not changing the interaction mode, not increasing the number of extra interactions, maintaining the efficiency of conventional queries, not adding data table fields, not changing the conventional index function, and not adding additional SQL statements to change the query mode.
  • the function based on sequential operation is implemented.
  • the information of the plaintext data includes the value of the plaintext data, the type of the plaintext data, and the value range of the plaintext data.
  • the types of plaintext data may include integer (int), floating point (float), string (string), and character (char), and the integer type can also be subdivided into int1 , int2, int4 and int8, etc.
  • floating-point types can also be subdivided into floating-point types with different granularities
  • string types can also be subdivided into long strings and short strings
  • character types can also be subdivided into readable characters and full characters, etc.
  • the value range of the plaintext data is related to the type of the plaintext data. For example, if the type of the plaintext data is int4, the value range of the plaintext data can be [-2 31 , 2 31 ].
  • the ciphertext index value determined by the value of the plaintext data, the type of the plaintext data and the value range of the plaintext data not only ensures the security of the ciphertext, but also improves the obtaining efficiency of the ciphertext index value.
  • the above step determining the ciphertext index value according to the information of the plaintext data, including: normalizing the value of the plaintext data, the type of the plaintext data and the value range of the plaintext data process to obtain the plaintext value, plaintext space and ciphertext space; determine the ciphertext index value according to the plaintext value, plaintext space and ciphertext space.
  • the normalization process may be to determine the normalization parameter of the plaintext data according to the type of the plaintext data and the value range of the plaintext data; according to the normalization parameter, the value of the plaintext data is normalized processing to obtain the plaintext value, plaintext space and ciphertext space.
  • the plaintext value is the normalized plaintext value
  • the plaintext space is also the normalized plaintext space.
  • the normalization process can be performed using different processing methods for different types, such as translation or shift for integer types. Normalization processing methods such as truncation and compression are used for string types, and normalization processing methods such as truncation and translation are used for floating point types.
  • the ciphertext space is obtained by enlarging the plaintext space according to the expansion coefficient.
  • normalization parameters are added for different types of plaintext data and different normalization processing methods are adopted, so that the ciphertext index value generation algorithm of this application can be adapted to all data types without input range limitation.
  • the above steps determining the ciphertext index value according to the plaintext value, the plaintext space and the ciphertext space, including: sampling in the sampling interval of the ciphertext space to obtain sampling points, The sampling interval corresponds to the midpoint of the plaintext space; according to the midpoint and the plaintext value, the plaintext space and the ciphertext space are reduced to obtain a reduced plaintext space and a reduced ciphertext space.
  • the reduced plaintext space is bounded by the midpoint and contains The plaintext value
  • the reduced ciphertext space is bounded by the sampling point; the above steps of sampling and reducing the plaintext space and the ciphertext space are repeated until the upper boundary and the lower boundary of the reduced plaintext space coincide, and the upper boundary coincides with the lower boundary.
  • the corresponding sampling point of the reduced ciphertext space is the ciphertext index value.
  • the plaintext space is a numerical range, including upper and lower boundaries.
  • the plaintext space is expressed as [a1, a2]
  • the ciphertext space is obtained by enlarging the plaintext space according to the expansion coefficient.
  • the ratio can be 1.3 times, 1.5 times or other multiples.
  • the ciphertext space can also be as large as the plaintext space.
  • the ciphertext space can be expressed as [b1,b2].
  • the plaintext space corresponds to the ciphertext space.
  • the midpoint of the plaintext space refers to the midpoint (mid) determined by the upper and lower boundaries of the plaintext space, that is, half of the sum of the upper and lower boundaries of the plaintext space is The midpoint of this plaintext space.
  • the midpoint of [a1, a2] is (a1+a2)/2. Because the ciphertext space is larger than the plaintext space, the midpoint of the plaintext space corresponds to an interval of the ciphertext space, and the client can perform deterministic sampling in this sampling interval, or it can be understood as pseudo-random sampling, that is, according to the user The key is sampled, and the sampling point (y) is obtained in the sampling interval.
  • determining the reduced plaintext space and the reduced ciphertext space may include the case where the plaintext value is greater than the midpoint, or may include the case where the plaintext value is smaller than the midpoint, if m >mid, the reduced plaintext space is the next number from the midpoint to the lower boundary of the original plaintext space, which can be expressed as [mid+1, a2], and the reduced ciphertext space is the next number from the sampling point From the beginning to the lower boundary of the ciphertext space, it can be expressed as [y+1,b2].
  • the reduced plaintext space is from the upper boundary of the plaintext space to the midpoint, which can be expressed as [a1,mid]
  • the reduced ciphertext space is from the upper boundary of the ciphertext space to the sampling point, which can be Represented as [b1,y].
  • the reduced plaintext space corresponds to
  • the sampling point of the ciphertext space is the ciphertext index value.
  • obtaining the ciphertext index value in a recursive manner can reduce the probability of leaking the ciphertext index value and improve the security of the ciphertext index value.
  • the above steps sampling in a sampling interval of the ciphertext space to obtain sampling points, including: performing modulo calculation on the size of the sampling interval by using an unpredictable pseudo-random number, to obtain the modulo value; determine the corresponding sampling point from the sampling interval according to the modulo value.
  • sampling is performed by taking a modulo value, which can improve the sampling efficiency, thereby improving the calculation efficiency of the ciphertext index value.
  • the sampling of the reduced ciphertext space is non-deterministic sampling.
  • the last sampling of the ciphertext space adopts non-deterministic sampling to determine the ciphertext index value, which can resist inference attacks.
  • the first statement indicates an insert operation or an update operation
  • the method further includes: performing symmetric encryption processing on the plaintext data to obtain ciphertext data of the plaintext data
  • the second statement further includes: Or indicate the ciphertext data, and the ciphertext data is stored in the corresponding storage location by the cloud device.
  • the client when the first statement instructs to perform an insert operation or an update operation, the client will also send the ciphertext data corresponding to the plaintext data to the cloud device for storage, and the second statement may directly include the ciphertext data.
  • the ciphertext data may also include a link to the storage location of the ciphertext data, and the link indicates the storage location of the ciphertext data.
  • the method when the first statement is used to perform a query operation, the method further includes: scrambling the second statement; receiving the query result returned by the cloud device, and descrambling the query result .
  • scrambling the second statement before sending the second statement can reduce the probability of query leakage. If the client performs scramble, after the cloud device returns the query result, the client decrypts the symmetric ciphertext. The decrypted query result may have some false positive results, but no false negative results. Then, the decrypted result will be filtered and checked, and then the final result will be output.
  • the method further includes: sending an index creation statement to the cloud device, where the index creation statement indicates the specified column of the specified table of the first statement; receiving the cloud device The existing data on the specified column returned by the device; determine the ciphertext index value of the existing data; send the ciphertext index value of the existing data to the cloud device.
  • the ciphertext index value of the existing data can be determined by sampling the above method, and the ciphertext index value is inserted into the index structure, so that the stock data can be adapted The data management process for this application.
  • a second aspect of the present application provides a data management method, comprising: receiving a second statement from a client, where the second statement includes a ciphertext index value determined by the client according to information of plaintext data in response to the first statement, the first The statement includes plaintext data; in response to the second statement, establish a correspondence between the ciphertext index value and the information of the storage location of the ciphertext data in the index structure according to the ciphertext index value, or query the ciphertext data from the index structure
  • the information of the storage location of the ciphertext data is the encrypted data corresponding to the plaintext data, and the information of the storage location indicates the storage location of the ciphertext data.
  • the solution provided in the second aspect is applied to a cloud device corresponding to the client of the first aspect, and the cloud device may be a physical machine or a virtual machine or a container.
  • the cloud device may be a physical machine or a virtual machine or a container.
  • the cloud device can store the ciphertext index value determined by the client in the index structure, establish a correspondence between the ciphertext index value and the information of the storage location of the ciphertext data, and query the ciphertext data when it needs to be queried.
  • the ciphertext data corresponding to the text index value is retrieved, the corresponding ciphertext data can be queried according to the corresponding relationship in the index structure, and then corresponding operations on the ciphertext data can be performed.
  • the ciphertext index value is used instead of the field in the data column as the key value in the conventional ordered index to realize the search for ciphertext data, and the ciphertext stored in the table can be searched without adding data table fields.
  • the data is queried based on the order, thereby reducing the space occupied by the expansion of the table used to store the ciphertext data, and improving the scalability of the stored data in the cloud device. That is to say, the solution of the present application has the advantages of not changing the interaction mode, not increasing the number of extra interactions, maintaining the efficiency of conventional queries, not adding data table fields, not changing the conventional index function, and not adding additional SQL statements to change the query mode.
  • the function based on sequential operation is implemented.
  • the second statement indicates an insert operation
  • the method further includes: determining ciphertext data corresponding to the plaintext data according to the second statement; storing the ciphertext data in a The corresponding storage location, where the storage location is the location indicated by the storage location information in the corresponding relationship.
  • the cloud device when the second statement sent by the client indicates an insert operation, the cloud device will first store the ciphertext data in a corresponding storage location, and the storage location may be a table for storing ciphertext data One or more rows of a certain column, and then the cloud device establishes the corresponding relationship between the ciphertext index value and the information of the storage location of the ciphertext data in the index structure. In this way, when querying the ciphertext data in the future, The ciphertext data can be queried from the table for storing the ciphertext data through the corresponding relationship in the index structure, so that the ciphertext data can be quickly searched in the normal query mode.
  • the second statement indicates a query operation
  • the method further includes: querying the ciphertext data according to the information of the storage location ; Return ciphertext data to the client.
  • the cloud device when the second statement sent by the client indicates a query operation, the cloud device will query the index structure according to the ciphertext index value in the second statement, and use the ciphertext already established in the index structure to query.
  • the corresponding relationship between the index value and the information of the storage location query the information of the storage location of the ciphertext data, and then query the ciphertext data in the table according to the information of the storage location, and then return the ciphertext data to the client. text data.
  • the fast search for ciphertext data can be achieved in the manner of maintaining the conventional query.
  • the second statement instructs to update the index value
  • the second statement further includes the original ciphertext index value of the plaintext data
  • the method further includes: querying the original ciphertext index value according to the original ciphertext index value The correspondence between the ciphertext index and the information of the storage location; the correspondence between the original ciphertext index value in the index structure and the information of the storage location is updated according to the ciphertext index value.
  • the second statement instructs to update the ciphertext index value
  • the second statement will include the old ciphertext index value and the new ciphertext index value of the plaintext data.
  • the text index value finds the correspondence between the established old ciphertext index value and the information of the storage location of the ciphertext data in the index structure, and then replaces the old ciphertext index value in the corresponding relationship with the new ciphertext index value.
  • the ciphertext index value in this way, enhances the flexibility of managing the correspondence between the ciphertext index value and the information of the storage location of the ciphertext data.
  • the second statement indicates to update the ciphertext data
  • the second statement further includes or indicates the ciphertext data of the plaintext data
  • the ciphertext index value of the plaintext data before the update the The method further includes: querying the correspondence between the ciphertext index value of the plaintext data before the update and the information of the storage location according to the ciphertext index value of the plaintext data before the update; updating the plaintext before the update according to the ciphertext index value of the plaintext data
  • the correspondence between the ciphertext index value of the data and the information of the storage location; the ciphertext data of the storage location is updated according to the ciphertext data of the plaintext data.
  • the ciphertext index value and the ciphertext index value before the update are sent to the cloud device, so that the cloud device can find the corresponding relationship in the index structure according to the ciphertext index value before the update, and replace the corresponding relationship with the new ciphertext index value
  • the ciphertext index value before the update is used in the corresponding storage location to update the old ciphertext data with the new ciphertext data according to the information of the storage location in the corresponding relationship.
  • the update solution provided in this possible implementation manner can realize flexible management of the ciphertext data and the ciphertext index value in the cloud device.
  • the second statement indicates to delete the index value
  • the method further includes: deleting the ciphertext index value from the correspondence between the ciphertext index value of the index structure and the information of the storage location .
  • the client terminal will send a second statement indicating deletion of the ciphertext index value to the cloud device.
  • the text index value finds a corresponding relationship in the index structure, and then deletes the ciphertext index value in the corresponding relationship, or deletes the corresponding relationship.
  • the second statement indicates to delete the ciphertext data
  • the method further includes: deleting the ciphertext data in the storage location according to the information of the storage location, and deleting the ciphertext index from the index structure Correspondence between the value and the information of the storage location of the ciphertext data.
  • the client terminal will send a second statement indicating deletion of the ciphertext data to the cloud device, and the cloud device will index the ciphertext data according to the second statement.
  • the corresponding corresponding relationship is found in the index structure, and then the ciphertext data is deleted from the corresponding position according to the information of the storage location in the corresponding relationship, and the corresponding relationship is deleted from the index structure.
  • the method further includes: receiving a statement of creating an index; querying a specified column of a specified table of the second statement according to the statement of creating an index; when there is existing data in the specified column, reporting to the client
  • the terminal sends the existing data; receives the ciphertext index value of the existing data; establishes the correspondence between the ciphertext index value of the existing data and the information of the storage location of the existing data in the index structure.
  • the ciphertext index value of the existing data can be determined by sampling the above method, and the ciphertext index value is inserted into the index structure, so that the stock data can be adapted The data management process for this application.
  • a client for executing the method in the first aspect or any possible implementation manner of the first aspect.
  • the apparatus includes modules or units for executing the method in the first aspect or any possible implementation manner of the first aspect, such as: an acquiring unit, a processing unit, a sending unit, and a receiving unit.
  • a cloud device for executing the method in the second aspect or any possible implementation manner of the second aspect.
  • the apparatus includes modules or units for executing the method in the second aspect or any possible implementation manner of the second aspect, such as a receiving unit, a processing unit, and a sending unit.
  • a fifth aspect of the present application provides a client.
  • the client may include at least one processor, memory and a communication interface.
  • the processor is coupled with the memory and the communication interface.
  • the memory is used to store instructions
  • the processor is used to execute the instructions
  • the communication interface is used to communicate with other network elements under the control of the processor.
  • the instructions when executed by the processor, cause the processor to perform the method of the first aspect or any possible implementation of the first aspect.
  • a cloud device may include at least one processor, memory, and a communication interface.
  • the processor is coupled with the memory and the communication interface.
  • the memory is used to store instructions
  • the processor is used to execute the instructions
  • the communication interface is used to communicate with other network elements under the control of the processor.
  • the instructions when executed by the processor, cause the processor to perform the method of the second aspect or any possible implementation of the second aspect.
  • a seventh aspect of the present application provides a computer-readable storage medium, where a program is stored in the computer-readable storage medium, and the program causes a processor to execute the first aspect and any one of the various implementation manners thereof.
  • a computer-readable storage medium where a program is stored in the computer-readable storage medium, and the program causes a processor to execute the second aspect and any one of the various implementation manners thereof.
  • a computer program product includes computer-executable instructions, and the computer-executable instructions are stored in a computer-readable storage medium; at least one processor of the device can be read from the computer-readable storage medium.
  • the computer executes instructions, and at least one processor executes the computer execute instructions to cause the device to implement the first aspect or a method provided by any possible implementation manner of the first aspect.
  • a tenth aspect provides a computer program product comprising computer-executable instructions stored in a computer-readable storage medium; at least one processor of the device can read the computer from the computer-readable storage medium Executing the instructions, at least one processor executes the computer-executable instructions to cause the device to implement the second aspect or a method provided by any possible implementation manner of the second aspect.
  • An eleventh aspect of the present application provides a chip system, where the chip system includes a processor for supporting a client to implement the functions involved in the first aspect or any possible implementation manner of the first aspect.
  • the chip system may further include a memory for storing necessary program instructions and data of the client.
  • the chip system may be composed of chips, or may include chips and other discrete devices.
  • a twelfth aspect of the present application provides a chip system, where the chip system includes a processor for supporting a cloud device to implement the functions involved in the second aspect or any possible implementation manner of the second aspect.
  • the chip system may further include a memory for storing necessary program instructions and data of the cloud device.
  • the chip system may be composed of chips, or may include chips and other discrete devices.
  • a nineteenth aspect of the present application provides a data management system.
  • the data management includes a client and a cloud device, the client is used to execute the functions involved in the first aspect or any possible implementation manner of the first aspect, and the cloud device is used to execute the second aspect or the second aspect The functions involved in any of the possible implementations.
  • the client, cloud device, computer storage medium, computer program product or chip system provided above are all used to execute the corresponding data management method provided above. Therefore, the beneficial effects that can be achieved can be referred to. The beneficial effects in the corresponding methods provided above will not be repeated here.
  • FIG. 1 is a schematic structural diagram of a data management system provided by an embodiment of the present application.
  • 2A is a schematic diagram of a stand-alone database system
  • 2B is a schematic diagram of a cluster database system using a shared disk architecture
  • 2C is a schematic diagram of a cluster database system using a shared-nothing architecture
  • FIG. 3 is a schematic diagram of an embodiment of a data management method provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of another embodiment of the data management method provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of another embodiment of the data management method provided by the embodiment of the present application.
  • FIG. 6 is a schematic diagram of another embodiment of the data management method provided by an embodiment of the present application.
  • FIG. 7 is a schematic diagram of another embodiment of the data management method provided by an embodiment of the present application.
  • FIG. 8 is a schematic diagram of another embodiment of a data management method provided by an embodiment of the present application.
  • FIG. 9 is a schematic diagram of another embodiment of the data management method provided by an embodiment of the present application.
  • FIG. 10 is a schematic diagram of another embodiment of the data management method provided by the embodiment of the present application.
  • FIG. 11 is a schematic structural diagram of a client provided by an embodiment of the present application.
  • FIG. 12 is a schematic structural diagram of a cloud device provided by an embodiment of the present application.
  • FIG. 13 is a schematic structural diagram of a client provided by an embodiment of the present application.
  • FIG. 14 is a schematic structural diagram of a cloud device provided by an embodiment of the present application.
  • Embodiments of the present application provide a data management method, device, and system, which are used to reduce the space occupied by the expansion of a table for storing ciphertext data, and improve the scalability of stored data in a cloud device.
  • Embodiments of the present application also provide corresponding apparatuses, systems, computer-readable storage media, computer program products, and the like. Each of them will be described in detail below.
  • the user data of the client is usually stored in the cloud device.
  • these user data are usually stored in cloud devices in the form of ciphertext data.
  • the cloud device can manage the stored ciphertext data.
  • the system formed by the client and the cloud device related to the embodiment of the present application is called a data management system, and the data management system can be understood with reference to FIG. 1 .
  • the data management system can include clients and cloud devices. There can be one or more clients and one or more cloud devices. Different cloud devices can manage data on different clients, such as : Cloud device 1 can manage data on clients in region 1, and cloud device 2 can manage data on clients in region 2. Different cloud devices may also manage different types of user data, for example, cloud device 1 manages data of type A generated by the client, and cloud device 2 manages data of type B generated by the client.
  • the client may be hardware (eg, a terminal device) or software (eg, an application (application, APP)).
  • software eg, an application (application, APP)
  • the terminal device (also referred to as user equipment (UE)) is a device with wireless transceiver functions that can be deployed on land, including indoor or outdoor, handheld or vehicle-mounted; Can be deployed on water (such as ships, etc.); can also be deployed in the air (such as aircraft, balloons and satellites, etc.).
  • the terminal may be a mobile phone (mobile phone), a tablet computer (pad), a computer with a wireless transceiver function, a virtual reality (VR) terminal, an augmented reality (AR) terminal, or a terminal in an industrial control (industrial control).
  • VR virtual reality
  • AR augmented reality
  • Wireless terminal wireless terminal in self driving, wireless terminal in remote medical, wireless terminal in smart grid, wireless terminal in transportation safety, smart city Wireless terminals in (smart city), wireless terminals in smart homes (smart home), wireless terminals in the Internet of Things (IoT), etc.
  • Cloud devices can be physical machines or virtual machines (VMs) or containers.
  • the above-mentioned cloud device can be a device carrying a database management system (database management system, DBMS) in a database system (database system), and the method provided in the embodiment of the present application can be implemented as a part of the database management system, or as an independent component .
  • the methods provided by the embodiments of the present application can be applied to a single-machine database system or a cluster database system.
  • a database system generally consists of the following three parts: (1) Database (DB), which refers to a collection of organized and sharable data stored in a computer for a long time.
  • DB Database
  • the data in the database is organized, described and stored according to a certain mathematical model, with less redundancy, high data independence and easy expansion, and can be shared by various users.
  • Hardware including data storage required to store data, such as memory and/or disk.
  • Software including DBMS, DBMS is the core software of the database system, is used to scientifically organize and store data, and efficiently acquire and maintain data.
  • the database engine is the core component of DBMS.
  • FIG. 2A is a schematic diagram of a stand-alone database system, including a database management system and a data storage (data storage), the database management system is used to provide services such as database query and modification, and the database management system stores data in the data storage.
  • the database management system and data storage are usually located on a single server, such as a symmetric multi-processor (SMP) server.
  • the SMP server includes multiple processors, all of which share resources such as bus, memory, and I/O systems.
  • the functions of the database management system may be implemented by one or more processors executing in-memory programs.
  • FIG. 2B is a schematic diagram of a cluster database system using a shared-storage architecture, including multiple nodes (nodes 1-N in FIG. 2B ), each node is deployed with a database management system, which provides database queries for users respectively and modification services, multiple database management systems store shared data in the shared data storage, and perform read and write operations on the data in the data storage through the switch.
  • Shared data storage can be a shared disk array.
  • Nodes in a clustered database system can be physical machines, such as database servers, or virtual machines (virtual machines, VMs) or containers (containers) running on abstract hardware resources.
  • the database management system deployed in the node is a DBMS instance (instance), and the DBMS may be a process or a thread.
  • the switch is a storage area network (storage area network, SAN) switch, an Ethernet switch, a fiber optic switch or other physical switching devices.
  • the switch is a virtual switch.
  • FIG. 2C is a schematic diagram of a cluster database system using a shared-nothing architecture
  • each node has its own exclusive hardware resources (such as data storage), an operating system and a database, and the nodes communicate through a network.
  • data will be allocated to each node according to the database model and application characteristics, and the query task will be divided into several parts, which will be executed in parallel on all nodes, and calculated in cooperation with each other, providing database services as a whole, and all communication functions are in It is implemented on a high-bandwidth network interconnection system.
  • the nodes can be either physical machines or virtual machines.
  • the data storage (data storage) of the database system includes but is not limited to solid state drives (SSD), disk arrays or other types of non-transitory computer-readable media.
  • SSD solid state drives
  • the database is not shown in FIGS. 2A-2C, it should be understood that the database is stored in the data storage.
  • a database system may include fewer or more components than those shown in FIGS. 2A-2C, or components that are different from those shown in FIGS. 2A-2C.
  • FIG. 2C only shows components more related to the implementations disclosed in the embodiments of the present application.
  • a clustered database system may include any number of nodes.
  • the database management system functions of each node may be implemented by an appropriate combination of software, hardware and/or firmware running on each node, respectively.
  • the above database systems in FIGS. 2A to 2C all include nodes, and the structures of the nodes are described below with reference to the accompanying drawings.
  • the node may include at least one processor, a non-transitory computer-readable medium storing executable code, and a database management system.
  • the executable code when executed by the at least one processor, is configured to implement the components and functions of the database management system.
  • a non-transitory computer-readable medium may include one or more non-volatile memories including, by way of example, semiconductor memory devices such as erasable programmable read only memory (EPROM), Electrically erasable programmable read only memory (EEPROM) and flash memory (flash memory); magnetic disks, such as internal hard disks or removable disks, magneto optical disks, As well as CD-ROM and DVD-ROM.
  • a non-transitory computer-readable medium can also include any device configured as main memory.
  • the at least one processor may include any type of general purpose computing circuit or special purpose logic circuit, such as a field-programmable gate array (FPGA) or an application specific integrated circuit (ASIC).
  • At least one processor 104 may also be one or more processors, such as a CPU, coupled to one or more semiconductor substrates.
  • SQL structured query language
  • SQL can refer to various types of data-related languages, including, for example, data definition languages and data manipulation languages, where the scope of SQL can include data insertion, query, update and delete, schema creation and modification, and data access control.
  • SQL may include descriptions related to various language elements, including clauses, expressions, predicates, and query statements, which are also often referred to simply as "query”.
  • clauses can refer to various components of statements and queries, and in some cases, clauses can be considered optional.
  • expressions may be configured to produce scalar values and/or tables that include columns and/or rows of data.
  • predicates can be configured to specify conditions for adjusting the effects of statements and queries.
  • a query statement is a request to view, access and/or manipulate data stored in a database.
  • a database management system can receive queries in SQL format (called SQL queries) from clients.
  • the SQL query may also be referred to as an SQL statement.
  • the database management system generates query results corresponding to the query by accessing relevant data from the database and manipulating the relevant data, and returning the query results to the database client.
  • a database is a collection of data organized, described and stored according to a certain mathematical model.
  • a database can include one or more database structures or formats, such as row storage and column storage.
  • the above cloud device can be applied to a database scenario or a non-database scenario. Regardless of whether the cloud device is applied to a database scenario, the data management method provided by the embodiment of the present application can be applied.
  • the data management method provided by the embodiments of the present application will be introduced below with reference to the accompanying drawings.
  • FIG. 3 A schematic diagram of an embodiment of a data management method is shown in FIG. 3 .
  • An embodiment of the data management method provided by the embodiment of the present application includes:
  • the client obtains a first statement, where the first statement includes plaintext data.
  • the first statement may be a first statement based on sequential operations.
  • Plaintext data can also be described as "the plaintext of the data”. Many plaintext data are based on sequential records, such as employee information lists, student information lists and other data, which are all recorded based on sequential records. These sequential records also need to be arranged in order after being encrypted by the user key. Data can also be referred to as data with sequential requirements.
  • the table is based on sequential records and can be understood by referring to Table 1 below.
  • the plaintext data may be any column in Table 1, or may be information of a certain row or certain rows in a certain column.
  • the encryption method for these order-required data can be order-preserving encryption (OPE), order-revealing encryption (ORE), or other order-based encryption methods.
  • OPE order-preserving encryption
  • ORE order-revealing encryption
  • statements for operations on these sequence-related data may be referred to as statements based on sequence operations.
  • Input conditions based on sequential operations can include comparison operators, range queries, sorting (ORDER BY), minimum (minimum, MIN), maximum (maximum, MAX), and sorting (SORT), etc.
  • the first statement may be a structured query language (SQL) statement.
  • the first statement is typically a statement generated based on user input. For example: a statement generated by a query condition input by a user, or a statement generated by an insert instruction, an update instruction or a delete instruction input by the user.
  • the client determines the ciphertext index value according to the information of the plaintext data.
  • the ciphertext index value refers to an index value that has a pointing relationship with the ciphertext data.
  • the client sends a second sentence to the cloud device, where the second sentence includes a ciphertext index value. Accordingly, the cloud device receives the second sentence.
  • the second statement may also be an SQL statement.
  • the operation indicated by the second statement is the same as the operation indicated by the first statement.
  • the cloud device establishes a correspondence between the ciphertext index value and the information of the storage location of the ciphertext data in the index structure according to the ciphertext index value, or queries the index structure for the information of the ciphertext data.
  • the information of the storage location, the ciphertext data is the encrypted data corresponding to the plaintext data, and the information of the storage location indicates the storage location of the ciphertext data.
  • the ciphertext data is encrypted data corresponding to the plaintext data, and the storage location information indicates the storage location of the ciphertext data.
  • the index structure is a structure established by the cloud device to store the correspondence between the ciphertext index value and the information of the storage location of the ciphertext data.
  • the index structure can be a tree structure, such as a B-tree, or other type of structure.
  • the information on the storage location of the ciphertext data may include an address of the storage location or an identification of the ciphertext data in the stored list. If the operation indicated by the second statement is an insert operation, the cloud device will establish a correspondence between the ciphertext index value and the information of the storage location of the ciphertext data in the index structure. For a query operation, an update operation or a deletion operation, the cloud device will query the information of the storage location of the ciphertext data from the index structure, and then can query the ciphertext data according to the information of the storage location.
  • the client can generate a ciphertext index value for plaintext data based on sequential operations, and then the cloud device can store the ciphertext index value in an index structure to establish a relationship between the ciphertext index value and the ciphertext data.
  • the corresponding relationship between the information of the storage location when the ciphertext data corresponding to the ciphertext index value needs to be queried, the corresponding ciphertext data can be queried according to the corresponding relationship in the index structure, and then the corresponding ciphertext data can be executed. operate.
  • the ciphertext index value is used instead of the field in the data column as the key value in the conventional ordered index to realize the search for ciphertext data without adding data table fields, and the ciphertext data stored in the table can be searched Sequence-based queries are performed, thereby reducing the space occupied by the expansion of tables used to store ciphertext data, and improving the scalability of stored data in cloud devices. That is to say, the solution of the present application has the advantages of not changing the interaction mode, not increasing the number of extra interactions, maintaining the efficiency of conventional queries, not adding data table fields, not changing the conventional index function, and not adding additional SQL statements to change the query mode.
  • the function based on sequential operation is implemented.
  • the information of the plaintext data involved in the foregoing step 102 may include the value of the plaintext data, the type of the plaintext data, and the value range of the plaintext data.
  • the value range of the plaintext data may include the size of the plaintext data or the lower boundary of the plaintext data.
  • the value of the plaintext data, the type of the plaintext data, and the value range of the plaintext data can be normalized to obtain the plaintext value, the plaintext space and the ciphertext space; Text space, determine the ciphertext index value.
  • the plaintext value is the normalized plaintext value
  • the plaintext space is also the normalized plaintext space.
  • the above process of determining the ciphertext index value according to the plaintext value, the plaintext space and the ciphertext space can be performed by a binary recursion method, and the process can include: sampling in a sampling interval of the ciphertext space to obtain sampling points, sampling intervals Corresponds to the midpoint of the plaintext space; according to the midpoint and the plaintext value, the plaintext space and the ciphertext space are reduced to obtain the reduced plaintext space and the reduced ciphertext space, and the reduced plaintext space is bounded by the midpoint and contains the plaintext value , the reduced ciphertext space is bounded by the sampling point; the above steps of sampling and reducing the plaintext space and the ciphertext space are repeated until the upper and lower boundaries of the reduced plaintext space coincide, and the corresponding The sampling point of the reduced ciphertext space is the ciphertext index value.
  • the process of determining the ciphertext index value can be understood by referring to FIG. 4 .
  • the process of determining the ciphertext index value may include:
  • the client parses the first statement, and determines the value of the plaintext data, the data type of the plaintext data, and the value range of the plaintext data.
  • the value range of the plaintext data may be determined according to the data type of the plaintext data, or may be a preconfigured default range, or may be a range dynamically input by the user.
  • the types of plaintext data can include integer (int), floating-point (float), string (string), and character (char). Moreover, integers can also be subdivided into int4 and int8, etc. It can be subdivided into floating-point types with different granularities, string types can also be subdivided into long strings and short strings, and character types can also be subdivided into readable characters and full characters.
  • the value range of the plaintext data is related to the type of the plaintext data. For example, if the type of the plaintext data is int4, the value range of the plaintext data can be [-2 31 , 2 31 ].
  • the client determines the normalization parameter of the plaintext data according to the type of the plaintext data and the value range of the plaintext data.
  • the client performs normalization processing on the value of the plaintext data according to the normalization parameter, so as to obtain the plaintext value, the plaintext space and the ciphertext space.
  • the process of normalization processing can be different processing methods for different types, such as: normalization processing methods such as translation or shift for integer types, and normalization processing methods such as truncation and compression for string types. For floating-point types, normalization methods such as truncation and translation are used.
  • Integer (int1, int2, int4, int8): Negative numbers need to be translated into non-negative numbers according to the normalization parameters.
  • the BN library in the openssl open source library can be uniformly used before encryption (the BIGNUM library is used for those beyond the range of int8 after conversion), which makes the actual application data range of this application unlimited.
  • Character type (text, varchar(n), char, char(n), varchar2(n), bytea): first note n is the size of the valid character space of the current type + 1, and the full valid character space such as bytea is 256.
  • the long string intercepts the high-order fixed-length string according to the normalization parameter, and the low-order complement of the short string is 0, and then converts the string to an n-ary number, and then transfers it to the BN structure.
  • Floating-point number types float4, float8, double precision:
  • the normalized structure is a concatenated significand of the exponent bit, and negative numbers and negative exponents are supported. Note that the current type maximum exponent is emax, and the exponent is exp.
  • the exponent bit is corrected to emax-exp for negative numbers, and 3*emax+exp for positive numbers.
  • the significant digits (decimal) of negative numbers are corrected digit-by-digit to 9-native significant digits. In the case of different precisions, if the number of significant digits is insufficient, the low digits of the significant digits should be filled with 0 according to the normalization parameter and then cascaded. If the significant digits are too long, the low digits should be truncated.
  • the normalized plaintext value can be uniformly multiplied by the same ratio (for example, 8) to limit the existence of two ciphertexts that differ by less than the multiplication ratio.
  • the multiplication ratio refers to the normalization ratio. The scale by which the normalized plaintext value is multiplied.
  • the plaintext space is determined by the type of plaintext data and the upper and lower boundaries of the plaintext data determined by the normalization parameter.
  • the size of the ciphertext space can generally be a fixed multiple of the bit length of the size of the plaintext space (such as 1.3 times, 1.5 times, of course, other multiples, which are not limited in this application), and exceed a certain lower limit (for example, limit).
  • the bit length of the ciphertext space is at least 10 bits longer than the plaintext), and the lower bound of the ciphertext space can be 1.
  • the ciphertext space is obtained by enlarging the plaintext space according to the expansion coefficient.
  • normalization parameters are added for different types of plaintext data and different normalization processing methods are adopted, so that the ciphertext index value generation algorithm of this application can be adapted to all data types without input range limitation.
  • the plaintext space is a range of values, including upper and lower boundaries.
  • the plaintext space is expressed as [a1, a2]
  • the ciphertext space is obtained by enlarging the plaintext space according to the expansion coefficient.
  • the ciphertext space can be expressed as [ b1,b2].
  • the client performs sampling in the sampling interval of the ciphertext space to obtain sampling points, and the sampling interval corresponds to the midpoint of the plaintext space.
  • the plaintext space corresponds to the ciphertext space.
  • the midpoint of the plaintext space refers to the midpoint (mid) determined by the upper and lower boundaries of the plaintext space, that is, half of the sum of the upper and lower boundaries of the plaintext space is The midpoint of this plaintext space. For example: the midpoint of [a1, a2] is (a1+a2)/2. Because the ciphertext space is larger than the plaintext space, the midpoint of the plaintext space corresponds to a sampling interval of the ciphertext space.
  • the client can perform deterministic sampling in this sampling interval, or it can be understood as pseudo-random sampling, that is, according to The user key is sampled, and the sampling point (y) is obtained in the sampling interval.
  • K sam is a parameter added before sampling. For example, the value can be 0.9. Adding this K sam parameter can increase the smoothness of the actual ciphertext distribution.
  • key is a secure random number or user key.
  • the client reduces the plaintext space and the ciphertext space according to the midpoint and the plaintext value, so as to obtain a reduced plaintext space and a reduced ciphertext space.
  • the reduced plaintext space is bounded by the midpoint and contains the plaintext value, and the reduced ciphertext space is bounded by the sampling point.
  • determining the reduced plaintext space and the reduced ciphertext space may include the case where the plaintext value is greater than the midpoint, or may include the case where the plaintext value is smaller than the midpoint.
  • the comparison relationship and the corresponding result can be expressed as: if m>mid, the reduced plaintext space is [mid+1, a2], and the reduced ciphertext space is [y+1, b2]; if m ⁇ mid, then The reduced plaintext space is [a1,mid], and the reduced ciphertext space is [b1,y].
  • the reduced plaintext space starts from the next number from the midpoint to the lower boundary of the original plaintext space, which can be expressed as [mid+1, a2], and the reduced ciphertext space is From the next number of the sampling point to the lower boundary of the ciphertext space, it can be expressed as [y+1,b2].
  • the reduced plaintext space is from the upper boundary of the plaintext space to the midpoint, which can be expressed as [a1,mid]
  • the reduced ciphertext space is from the upper boundary of the ciphertext space to the sampling point, which can be Represented as [b1,y].
  • the client performs multiple recursion, the upper and lower boundaries of the reduced plaintext space are equal, and the output sampling point is the ciphertext index value.
  • obtaining the ciphertext index value in a recursive manner can reduce the probability of leakage of the ciphertext index value and improve the security of the ciphertext index value.
  • sampling in the sampling interval corresponding to the midpoint of the plaintext space to obtain the sampling point may include: performing a modulo calculation on the size of the sampling interval by using an unpredictable pseudo-random number to obtain a modulo value; The corresponding sampling point is determined from the sampling interval according to the modulo value.
  • sampling is performed by taking the modulo value, which can improve the sampling efficiency, thereby improving the calculation efficiency of the ciphertext index value.
  • the sampling of the reduced ciphertext space is non-deterministic sampling.
  • This last sampling of the ciphertext space uses non-deterministic sampling to determine the ciphertext index value, which can resist inference attacks.
  • the client may further scramble the second statement, which can reduce the probability of query leakage. If the client performs scramble, after the cloud device returns the query result, the client decrypts the symmetric ciphertext. The decrypted query result may have some false positive results, but no false negative results. Then, the decrypted result will be filtered and checked, and then the final result will be output.
  • the above-mentioned first statement and second statement may indicate various operations such as insert, query, update, and delete.
  • operations such as insert, query, update, and delete.
  • the data management processes of the client and the cloud device are somewhat different.
  • the statement and the second statement indicating an insert operation, a query operation, an update operation, and a delete operation introduce the data management process provided by the embodiments of the present application.
  • the first statement and the second statement indicate an insert operation.
  • another embodiment of the data management method provided by the embodiment of the present application may include:
  • the client side symmetrically encrypts the plaintext data in the first sentence to obtain ciphertext data.
  • the client determines the ciphertext index value according to the information of the plaintext data.
  • This step can be understood by referring to the previous process of determining the ciphertext index value, and details are not repeated here.
  • the client adds the ciphertext data and the ciphertext index value to the second statement.
  • a link to the storage location of the ciphertext data can be added to the second sentence, so that the cloud device can obtain the ciphertext data through the link of the storage location.
  • the client sends the second sentence to the cloud device.
  • the cloud device receives the second sentence.
  • the cloud device parses the second sentence, and stores the ciphertext data in a corresponding storage location.
  • the second statement may carry the identifier of the table where the ciphertext data is to be stored, and the identifier of the column in the table.
  • the cloud device can find the corresponding table according to the table identifier, then insert the data carried by the second statement into the corresponding column, and store the ciphertext data in the column indicated by the column identifier.
  • the cloud device establishes a correspondence between the ciphertext index value and the information of the storage location where the ciphertext data is located in the index structure.
  • the corresponding relationship is a key-value (key-value, KV) relationship, wherein the ciphertext index value is the key, and the information of the storage location is the value.
  • the cloud device returns an execution message to the client.
  • the ciphertext index value can be inserted into the index structure, so that the ciphertext data can be quickly searched when the ciphertext data query is performed.
  • the first statement and the second statement indicate a query operation.
  • another embodiment of the data management method provided by the embodiment of the present application may include:
  • the client determines the ciphertext index value according to the information of the plaintext data in the first sentence.
  • This step can be understood by referring to the previous process of determining the ciphertext index value, and details are not repeated here.
  • the client adds the ciphertext index value to the second statement.
  • the client sends a second sentence to the cloud device.
  • the cloud device receives the second sentence.
  • the cloud device parses the second sentence, and searches for the KV relationship of the ciphertext index value from the index structure according to the ciphertext index value.
  • the cloud device queries the ciphertext data from the corresponding storage location according to the storage location information in the KV relationship of the ciphertext index value.
  • the cloud device returns a query result to the client, where the query result includes ciphertext data.
  • ciphertext data can be quickly searched through the ciphertext index value and the KV relationship.
  • the first statement and the second statement indicate the operation of updating the index value.
  • another embodiment of the data management method provided by the embodiment of the present application may include:
  • the client determines the ciphertext index value according to the information of the plaintext data in the first sentence.
  • the ciphertext index value is a new ciphertext index value.
  • the client adds the ciphertext index value of the plaintext data and the original ciphertext index value of the plaintext data to the second statement.
  • the client sends a second sentence to the cloud device.
  • the cloud device receives the second sentence.
  • the second sentence includes the original ciphertext index value and the new ciphertext index value of the plaintext data.
  • the cloud device searches the index structure for the KV relationship including the original ciphertext index value according to the original ciphertext index value.
  • the cloud device replaces the original ciphertext index value in the KV relationship according to the new ciphertext index value.
  • the cloud device returns the execution result to the client.
  • the execution result may be a response to an index value update.
  • the solution provided by the embodiment of the present application enhances the flexibility of the management of the correspondence between the ciphertext index value and the information of the storage location of the ciphertext data.
  • the first statement and the second statement indicate the operation of updating the ciphertext data.
  • another embodiment of the data management method provided by this embodiment of the present application may include:
  • the client determines the ciphertext index value according to the information of the plaintext data in the first sentence.
  • the plaintext data is the updated plaintext data
  • the ciphertext index value is a new ciphertext index value
  • the client performs symmetric encryption on the plaintext data to generate ciphertext data.
  • the ciphertext data is the ciphertext data corresponding to the plaintext data updated by the client.
  • the client adds the ciphertext data corresponding to the updated plaintext data, the new ciphertext index value and the ciphertext index value of the plaintext data before the update to the second sentence.
  • the client sends the second sentence to the cloud device.
  • the cloud device receives the second sentence.
  • the second sentence includes the ciphertext data corresponding to the updated plaintext data, as well as the new ciphertext index value and the ciphertext index value of the plaintext data before the update.
  • the cloud device searches the index structure for the KV relationship including the ciphertext index value of the plaintext data before the update according to the ciphertext index value of the plaintext data before the update.
  • the cloud device replaces the ciphertext data at the corresponding location with the ciphertext data corresponding to the updated plaintext data according to the storage location information in the KV relationship.
  • the cloud device replaces the ciphertext index value of the plaintext data before the update in the KV relationship according to the new ciphertext index value.
  • the cloud device returns the execution result to the client.
  • the execution result may be a response of updating the ciphertext data.
  • the solutions provided by the embodiments of the present application can realize flexible management of ciphertext data and ciphertext index values in the cloud device.
  • the first statement and the second statement indicate the operation of deleting the index value or the operation of deleting the ciphertext data.
  • another embodiment of the data management method provided by the embodiment of the present application may include:
  • the client determines the ciphertext index value according to the information of the plaintext data in the first sentence.
  • the client adds the ciphertext index value to the second statement.
  • the client sends a second sentence to the cloud device.
  • the cloud device receives the second sentence.
  • the cloud device searches for the corresponding KV relationship from the index structure according to the ciphertext index value in the second sentence.
  • the cloud device deletes the ciphertext index value from the KV relationship, or deletes the ciphertext data according to the information of the storage location in the KV relationship, and deletes the KV relationship.
  • the cloud device returns the execution result to the client.
  • the execution result may be a successful deletion response.
  • another embodiment of the data management method provided by this embodiment of the present application may include:
  • the client sends an index creation statement to the cloud device.
  • the cloud device receives the create index statement.
  • Create index statement (create index).
  • the CREATE INDEX statement indicates the specified column of the specified table of the first statement.
  • the create statement will contain the identifier of the specified table (table ID) and the identifier of the specified column (column ID).
  • the cloud device queries the specified column of the specified table of the second statement according to the index creation statement.
  • the cloud device sends the existing data to the client.
  • the client receives the existing data on the specified column returned by the cloud device.
  • the client determines the ciphertext index value of the existing data.
  • the client sends the ciphertext index value of the existing data to the cloud device.
  • the cloud device receives the ciphertext index value of the existing data sent by the client.
  • the ciphertext index value of the existing data may be sent through an update statement.
  • the cloud device establishes a correspondence between the ciphertext index value of the existing data and the information of the storage location of the existing data in the index structure.
  • the existing data in the cloud device can be adapted to the above-mentioned data management process. This process can be performed before the above insert, query, update and delete operations.
  • a Gauss order preserving encryption (GSOPE) algorithm is configured in the client, and the GSOPE algorithm is higher in computational efficiency than the existing BCLO algorithm or the Lewi-Wu algorithm. , and a set of experimental data is taken as an example for comparison and description.
  • GOPE Gauss order preserving encryption
  • GSOPE BCLO Lewi-Wu (blocks of 10) INT4 88 3000+ 300 INT8 360 7000+ 527 FLOAT8 343 not support not support 0-1 string[25] 99 not support 223 CHAR[15] (readable characters) 515 not support 900+ CHAR[15] (full character) 728 not support 1200+
  • Lewi-Wu is a trapdoor block evolution algorithm used by the CLWW algorithm to reduce ciphertext leakage.
  • the GSOPE algorithm provided in the embodiment of the present application supports all data types of plaintext data, and there is no limitation on the data range objectively, and the range is controllable subjectively.
  • an embodiment of the client terminal 90 provided by this embodiment of the present application includes:
  • the obtaining unit 901 is configured to obtain a first sentence, where the first sentence includes plaintext data.
  • the processing unit 902 is configured to determine the ciphertext index value according to the information of the plaintext data acquired by the acquiring unit 901 .
  • the sending unit 903 is configured to send a second statement to the cloud device, where the second statement includes the ciphertext index value determined by the processing unit 902, and the ciphertext index value is used by the cloud device to establish the ciphertext index value and the ciphertext data in the index structure
  • the corresponding relationship between the information of the storage location of the ciphertext data, or query the information of the storage location of the ciphertext data from the index structure, the ciphertext data is the encrypted data corresponding to the plaintext data, and the information of the storage location indicates the storage location of the ciphertext data.
  • the client can generate a ciphertext index value for plaintext data based on sequential operations, and then the cloud device can store the ciphertext index value in an index structure to establish a relationship between the ciphertext index value and the ciphertext data.
  • the corresponding relationship between the information of the storage location when the ciphertext data corresponding to the ciphertext index value needs to be queried, the corresponding ciphertext data can be queried according to the corresponding relationship in the index structure, and then the corresponding ciphertext data can be executed. operate.
  • the ciphertext index value is used instead of the field in the data column as the key value in the conventional ordered index to realize the search for ciphertext data, and the ciphertext stored in the table can be searched without adding a data table field.
  • the data is queried based on the order, thereby reducing the space occupied by the expansion of the table used to store the ciphertext data, and improving the scalability of the stored data in the cloud device. That is to say, the solution of the present application has the advantages of not changing the interaction mode, not increasing the number of extra interactions, maintaining the efficiency of conventional queries, not adding data table fields, not changing the conventional index function, and not adding additional SQL statements to change the query mode.
  • the function based on sequential operation is implemented.
  • the information of the plaintext data includes the value of the plaintext data, the type of the plaintext data, and the value range of the plaintext data.
  • the processing unit 902 is configured to perform normalization processing on the value of the plaintext data, the type of the plaintext data and the value range of the plaintext data to obtain the plaintext value, the plaintext space and the ciphertext space; space and ciphertext space, determine the ciphertext index value.
  • the processing unit 902 is configured to perform sampling in the sampling interval of the ciphertext space to obtain a sampling point, and the sampling interval corresponds to the midpoint of the plaintext space; according to the midpoint and the plaintext value, reduce the plaintext space and the ciphertext space, In order to obtain the reduced plaintext space and the reduced ciphertext space, the reduced plaintext space is bounded by the midpoint and contains the plaintext value, and the reduced ciphertext space is bounded by the sampling point; repeat the above sampling and reduced plaintext space and ciphertext Space steps until the upper boundary of the reduced plaintext space and the lower boundary coincide, and the sampling point of the reduced ciphertext space corresponding to the coincidence of the upper boundary and the lower boundary is the ciphertext index value.
  • the processing unit 902 is configured to perform modulo calculation on the size of the sampling interval by using an unpredictable pseudo-random number to obtain a modulo value; and determine a corresponding sampling point from the sampling interval according to the modulo value.
  • the sampling of the reduced ciphertext space is non-deterministic sampling.
  • the processing unit 902 is also used for the first statement to indicate an insert operation or an update operation, and symmetric encryption processing is performed on the plaintext data to obtain the ciphertext data of the plaintext data; the second statement also includes the ciphertext data, the ciphertext data. Stored in the corresponding storage location by the cloud device.
  • processing unit 902 is further configured for the first statement to indicate a query operation, and to scramble the second statement.
  • the receiving unit 904 is configured to receive the query result returned by the cloud device.
  • the processing unit 902 is further configured to descramble the query result.
  • the sending unit 903 is further configured to send a create index statement to the cloud device, where the create index statement indicates the specified column of the specified table of the first statement.
  • the receiving unit 904 is configured to receive the existing data on the specified column returned by the cloud device.
  • the processing unit 902 is further configured to determine the ciphertext index value of the existing data.
  • the sending unit 903 is also used to send the ciphertext index value of the existing data to the cloud device.
  • an embodiment of the cloud device 100 provided by this embodiment of the present application includes:
  • the receiving unit 1001 is configured to receive a second sentence from a client, where the second sentence includes a ciphertext index value determined by the client according to information of plaintext data in response to the first sentence, and the first sentence includes plaintext data.
  • the processing unit 1002 is configured to, in response to the second statement received by the receiving unit 1001, establish a correspondence between the ciphertext index value and the information of the storage location of the ciphertext data in the index structure according to the ciphertext index value, or, from the index In the structure, the information of the storage location of the ciphertext data is queried, the ciphertext data is the encrypted data corresponding to the plaintext data, and the information of the storage location indicates the storage location of the ciphertext data.
  • the cloud device may store the ciphertext index value determined by the client in the index structure, and establish a correspondence between the ciphertext index value and the information of the storage location of the ciphertext data.
  • the ciphertext index value is used instead of the field in the data column as the key value in the conventional ordered index to realize the search for ciphertext data, and the ciphertext stored in the table can be searched without adding data table fields.
  • the data is queried based on the order, thereby reducing the space occupied by the expansion of the table used to store the ciphertext data, and improving the scalability of the stored data in the cloud device. That is to say, the solution of the present application has the advantages of not changing the interaction mode, not increasing the number of extra interactions, maintaining the efficiency of conventional queries, not adding data table fields, not changing the conventional index function, and not adding additional SQL statements to change the query mode.
  • the function based on sequential operation is implemented.
  • the processing unit 1002 is further configured to, if the second statement indicates an insert operation, before establishing the corresponding relationship, determine the ciphertext data corresponding to the plaintext data according to the second statement; store the ciphertext data in a corresponding storage location, and store the The position is the position indicated by the information of the storage position in the corresponding relationship.
  • the processing unit 1002 is further configured to query the ciphertext data according to the information of the storage location after querying the information of the storage location of the ciphertext data from the index structure if the second statement indicates a query operation.
  • the sending unit 1003 is configured to return ciphertext data to the client.
  • the processing unit 1002 is further configured to query the original ciphertext index and store the original ciphertext index according to the original ciphertext index value if the second statement indicates to update the index value, and the second statement also includes the original ciphertext index value of the plaintext data. Correspondence between the information of the location; update the correspondence between the original ciphertext index value in the index structure and the information of the storage location according to the ciphertext index value.
  • the processing unit 1002 is further configured to, if the second statement indicates to update the ciphertext data, the second statement also includes or indicates the ciphertext data of the plaintext data, and the ciphertext index value of the plaintext data before the update, according to The ciphertext index value of the plaintext data before the update is to query the correspondence between the ciphertext index value of the plaintext data before the update and the information of the storage location; update the ciphertext index of the plaintext data before the update according to the ciphertext index value of the plaintext data Correspondence between the value and the information of the storage location; update the ciphertext data of the storage location according to the ciphertext data of the plaintext data.
  • the processing unit 1002 is further configured to delete the ciphertext index value from the correspondence between the ciphertext index value of the index structure and the information of the storage location if the second statement indicates to delete the index value.
  • the processing unit 1002 is further configured to delete the ciphertext data in the storage location according to the information of the storage location if the second statement indicates to delete the ciphertext data, and delete the difference between the ciphertext index value and the ciphertext data from the index structure. The correspondence between the information of the storage location.
  • the receiving unit 1001 is further configured to receive an index creation statement.
  • the processing unit 1002 is further configured to query the specified column of the specified table of the second statement according to the index creation statement.
  • the sending unit 1003 is configured to send the existing data to the client when existing data exists in the specified column.
  • the receiving unit 1001 is further configured to receive the ciphertext index value of the existing data.
  • the processing unit 1002 is further configured to establish a correspondence between the ciphertext index value of the existing data and the information of the storage location of the existing data in the index structure.
  • FIG. 13 is a block diagram showing a partial structure of a mobile phone provided by an embodiment of the present application.
  • the mobile phone includes: a radio frequency (: Radio Frequency,: RF) circuit 810, a memory 820, an input unit 830, a display unit 840, a sensor 850, an audio circuit 860, a wireless fidelity (WiFi) module 870, a processing 880, and the power supply 890 and other components.
  • the RF circuit 810 can be used for receiving and sending signals during sending and receiving of information or during a call. In particular, after receiving the downlink information of the base station, it is processed by the processor 880; in addition, the designed uplink data is sent to the base station.
  • the RF circuit 810 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like.
  • LNA Low Noise Amplifier
  • the memory 820 can be used to store software programs and modules, and the processor 880 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 820 .
  • the memory 820 may mainly include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; According to the data created by the mobile phone (such as audio data, phone book, etc.) and so on.
  • memory 820 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
  • the input unit 830 can be used to receive information input by the user, such as a user password, and generate key signal input related to user settings and function control of the mobile phone.
  • the input unit 830 may include a touch panel 831 and other input devices 832 .
  • the touch panel 831 also referred to as a touch screen, can collect the user's touch operations on or near it (such as the user's finger, stylus, etc., any suitable object or attachment on or near the touch panel 831). operation), and drive the corresponding connection device according to the preset program.
  • the touch panel 831 may include two parts, a touch detection device and a touch controller.
  • the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the touch controller.
  • the touch panel 831 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • the input unit 830 may further include other input devices 832 .
  • other input devices 832 may include, but are not limited to, one or more of physical keyboards, function keys (such as volume control keys, switch keys, etc.), trackballs, mice, joysticks, and the like.
  • the display unit 840 may be used to display the interface content of the APP.
  • the display unit 840 may include a display panel 841.
  • a liquid crystal display (English full name: Liquid Crystal Display, English abbreviation: LCD), an organic light-emitting diode (English full name: Organic Light-Emitting Diode, English abbreviation: OLED), etc.
  • the display panel 841 is configured in the form.
  • the touch panel 831 can cover the display panel 841, and when the touch panel 831 detects a touch operation on or near it, it transmits it to the processor 880 to determine the type of the touch event, and then the processor 880 determines the type of the touch event according to the touch event. Type provides corresponding visual output on display panel 841 .
  • the touch panel 831 and the display panel 841 are used as two independent components to realize the input and input functions of the mobile phone, in some embodiments, the touch panel 831 and the display panel 841 can be integrated to form Realize the input and output functions of the mobile phone.
  • the cell phone may also include at least one sensor 850, such as a light sensor, a motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 841 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 841 and/or when the mobile phone is moved to the ear. or backlight.
  • the accelerometer sensor can detect the magnitude of acceleration in all directions (usually three axes), and can detect the magnitude and direction of gravity when it is stationary. games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc. Repeat.
  • the audio circuit 860, the speaker 861, and the microphone 862 can provide an audio interface between the user and the mobile phone.
  • the audio circuit 860 can transmit the received audio data converted electrical signals to the speaker 861, and the speaker 861 converts them into sound signals for output; on the other hand, the microphone 862 converts the collected sound signals into electrical signals, and the audio circuit 860 converts the collected sound signals into electrical signals. After receiving, it is converted into audio data, and then the audio data is output to the processor 880 for processing, and then sent to, for example, another mobile phone through the RF circuit 810, or the audio data is output to the memory 820 for further processing.
  • WiFi is a short-distance wireless transmission technology.
  • the mobile phone can help users to send and receive emails, browse web pages, and access streaming media through the WiFi module 870. It provides users with wireless broadband Internet access.
  • FIG. 13 shows the WiFi module 870, it can be understood that it is not a necessary component of the mobile phone, and can be completely omitted as required within the scope of not changing the essence of the invention.
  • the processor 880 is the control center of the mobile phone, using various interfaces and lines to connect various parts of the entire mobile phone, by running or executing the software programs and/or modules stored in the memory 820, and calling the data stored in the memory 820.
  • the processor 880 may include one or more processing units; preferably, the processor 880 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc. , the modem processor mainly deals with wireless communication. It can be understood that, the above-mentioned modulation and demodulation processor may not be integrated into the processor 880.
  • the mobile phone also includes a power supply 890 (such as a battery) for supplying power to various components.
  • a power supply 890 (such as a battery) for supplying power to various components.
  • the power supply can be logically connected to the processor 880 through a power management system, so as to manage charging, discharging, and power consumption management functions through the power management system.
  • the mobile phone may also include a camera, a Bluetooth module, and the like, which will not be repeated here.
  • the processor 880 also has the function of data management of the client described above.
  • FIG. 14 is a schematic diagram of a possible logical structure of the cloud device involved in the above-mentioned embodiment provided by the embodiment of the present application.
  • the cloud device 110 includes: a processor 1101 , a communication interface 1102 , a memory 1103 and a bus 1104 .
  • the processor 1101 , the communication interface 1102 , and the memory 1103 are connected to each other through a bus 1104 .
  • the processor 1101 is configured to control and manage the actions of the cloud device 110.
  • the processor 1101 is configured to perform the verification process of the token by the cloud device in FIG. 3 to FIG. 10, and/or Additional procedures for the techniques described herein.
  • the communication interface 1102 is used to support the cloud device 110 to communicate, for example, the communication interface 1102 can perform the steps of sending and receiving data in the above method embodiments.
  • the memory 1103 is used to store program codes and data of the cloud device 110 .
  • the processor 1101 may be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array, or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute the various exemplary logical blocks, modules and circuits described in connection with this disclosure.
  • a processor may also be a combination that performs computing functions, such as a combination comprising one or more microprocessors, a combination of a digital signal processor and a microprocessor, and the like.
  • the bus 1104 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (Extended Industry Standard Architecture, EISA) bus or the like. The bus can be divided into address bus, data bus, control bus and so on. For ease of presentation, only one thick line is shown in FIG. 14, but it does not mean that there is only one bus or one type of bus.
  • PCI Peripheral Component Interconnect
  • EISA Extended Industry Standard Architecture
  • a computer-readable storage medium is also provided, where computer-executable instructions are stored in the computer-readable storage medium, and when at least one processor of a device executes the computer-executable instructions, the device executes the above diagram 3 to FIG. 10 describe the data management method in some embodiments.
  • a computer program product in another embodiment, includes computer-executable instructions, and the computer-executable instructions are stored in a computer-readable storage medium; at least one processor of the device can be obtained from a computer-readable storage medium. Reading the storage medium reads the computer-executable instructions, and at least one processor executes the computer-executable instructions to cause the device to perform the data management methods described in the above-mentioned partial embodiments of FIG. 3 to FIG. 10 .
  • a chip system is further provided, where the chip system includes a processor, and is configured to support a client to implement the data management methods described in the above-mentioned partial embodiments of FIG. 3 to FIG. 10 .
  • the system-on-chip may also include memory for storing necessary program instructions and data.
  • the chip system may be composed of chips, or may include chips and other discrete devices.
  • a chip system in another embodiment of the present application, includes a processor, and is configured to support a cloud device to implement the data management methods described in the above-mentioned partial embodiments of FIG. 3 to FIG. 10 .
  • the chip system may further include a memory for storing necessary program instructions and data.
  • the chip system may be composed of chips, or may include chips and other discrete devices.
  • Units described as separate components may or may not be physically separated, and components shown as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional unit in each embodiment of the embodiments of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the functions, if implemented in the form of software functional units and sold as stand-alone products or based, may be stored in a computer-readable storage medium.
  • the technical solutions of the embodiments of the present application can be embodied in the form of software products in essence, or the parts that make contributions to the prior art or the parts of the technical solutions, and the computer software products are stored in a storage medium , including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in the embodiments of the present application.
  • the aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program codes .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Bioethics (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Storage Device Security (AREA)

Abstract

Disclosed is a data management method. The method comprises: a client can determine a ciphertext index value according to information on plaintext data, and send the ciphertext index value to a cloud device; the cloud device can establish, in an index structure (such as a B-tree), a correspondence between the ciphertext index value and information on a storage location of ciphertext data corresponding to the plaintext data, or search an index structure for a storage location of ciphertext data according to the ciphertext index value, so as to implement an operation on the ciphertext data. In the present application, a ciphertext index value is used to replace a field in a data column to serve as a key value in a conventional ordered index, so as to implement searching of ciphertext data, and order-based query can be performed on ciphertext data stored in a table without adding any data table field, thereby reducing space occupied by a full table used for storing the ciphertext data and improving the expandability for stored data in a cloud device.

Description

一种数据管理的方法、设备及系统Method, device and system for data management
本申请要求于2021年01月25日提交中国专利局、申请号为202110098939.6、发明名称为“一种数据管理的方法、设备及系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on January 25, 2021 with the application number 202110098939.6 and the invention title "A method, device and system for data management", the entire contents of which are incorporated by reference in in this application.
技术领域technical field
本申请涉及数据库技术领域,具体涉及一种数据管理的方法、设备及系统。The present application relates to the technical field of databases, and in particular, to a method, device and system for data management.
背景技术Background technique
传统数据库可以通过使用权限来保证数据库的安全,但依赖权限来管理数据库可能会存在内部管理人员篡改数据的问题。再者由于开放式的环境和网络边界的模糊化,用户数据在整个业务流程中更充分的暴露给攻击者,无论是传输、存储、运维还是运行过程中,都有可能遭受来自攻击者的攻击。Traditional databases can use permissions to ensure the security of the database, but relying on permissions to manage the database may have the problem of internal managers tampering with data. In addition, due to the open environment and the fuzzification of network boundaries, user data is more fully exposed to attackers throughout the business process. Whether it is in the process of transmission, storage, operation and maintenance, or operation, it may suffer from attackers. attack.
对于云数据库场景,在保障用户数据安全方面,提出了全密态数据库的解决方案。全密态数据库的解决方案指的是用户数据在客户端采用用户密钥加密,然后将加密后的密文数据存储到数据库中,因为只有客户端才有用户密钥,所以可以保证存储在数据库中密文数据的安全性。For cloud database scenarios, in terms of ensuring user data security, a solution for fully encrypted database is proposed. The solution of fully encrypted database means that user data is encrypted by the user key on the client side, and then the encrypted ciphertext data is stored in the database. Because only the client side has the user key, it can be guaranteed to be stored in the database. Security of ciphertext data in Chinese.
目前用户数据的加密方案通常是采用对称加密,对称加密无法保证基于顺序加密数据的顺序操作,当客户端有保序需求的数据需要存储到数据库时,数据库就会为该有保序需求的数据新增数据列,用于存储该有保序需求的数据,这样会导致用于存储有保序需求的数据的数据列膨胀,降低了数据库的可扩展性。At present, the encryption scheme of user data usually adopts symmetric encryption. Symmetric encryption cannot guarantee the sequential operation based on sequentially encrypted data. When the client needs to store the data with order preservation requirements in the database, the database will provide the data with order preservation requirements. A new data column is added to store the data with the order-preserving requirement, which will lead to the expansion of the data column used for storing the data with the order-preserving requirement, which reduces the scalability of the database.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供一种数据管理的方法、设备及系统,用于减少因用于存储密文数据的表格膨胀而占用的空间,提高了云设备中对存储数据的扩展性。本申请实施例还提供了相应的装置、系统、计算机可读存储介质以及计算机程序产品等。Embodiments of the present application provide a data management method, device, and system, which are used to reduce the space occupied by the expansion of a table for storing ciphertext data, and improve the scalability of stored data in a cloud device. Embodiments of the present application also provide corresponding apparatuses, systems, computer-readable storage media, computer program products, and the like.
本申请第一方面提供一种数据管理的方法,包括:获取第一语句,第一语句包括明文数据;根据明文数据的信息,确定密文索引值;向云设备发送第二语句,第二语句包括密文索引值,密文索引值被云设备用于在索引结构中建立密文索引值与密文数据的存储位置的信息之间的对应关系,或者,从索引结构中查询密文数据的存储位置的信息,密文数据为明文数据的加密数据,存储位置的信息指示明文数据对应的密文数据的存储位置。A first aspect of the present application provides a data management method, including: acquiring a first statement, where the first statement includes plaintext data; determining a ciphertext index value according to information of the plaintext data; sending a second statement, the second statement to a cloud device Including the ciphertext index value, the ciphertext index value is used by the cloud device to establish the correspondence between the ciphertext index value and the information of the storage location of the ciphertext data in the index structure, or to query the ciphertext data from the index structure. The information of the storage location, the ciphertext data is the encrypted data of the plaintext data, and the information of the storage location indicates the storage location of the ciphertext data corresponding to the plaintext data.
在一种可能的实现方式中,该第一语句是基于顺序操作的第一语句。In a possible implementation manner, the first statement is a first statement based on sequential operations.
上述第一方面所提供的方案可以应用于数据库的端对云的场景,也可以应用于非数据库的端对云的场景。端侧可以是客户端,该客户端可以是硬件(如:终端设备),也可以是软件(如:应用(application,APP)),云侧可以是云设备,该云设备可以是物理机也可以是虚拟机(virtual machine,VM)或容器(container)。端侧的明文数据可以通过用户密钥加密得到密文数据,然后将密文数据发送到云侧存储。端云之间针对密文数据可以执行插入(insert)、更新(update)、查询(select/query)和删除(delete)等操作。端侧的明文数据很多是基于顺序记录的数据,如:员工信息列表、学生信息列表等数据,都是基于顺序记录的,这些基于顺序记录的数据在经过用户密钥加密后也需要按顺序排布, 这些数据也可以称为有顺序需求的数据。针对这些有顺序需求的数据的加密方式可以是保序加密(order preserving encryption,OPE),也可以是揭序加密(order revealing encryption,ORE),还可以是其他基于顺序的加密方式。本申请中,针对这些与顺序相关的数据的操作的语句可以称为基于顺序操作的语句。基于顺序操作的输入条件可以包括比较运算符、范围查询、排序(ORDER BY)、最小值(minimum,MIN)、最大值(maximum,MAX)和分类(SORT)等。The solution provided in the first aspect above can be applied to a database end-to-cloud scenario, and can also be applied to a non-database end-to-cloud scenario. The client side can be a client, and the client can be hardware (such as a terminal device) or software (such as an application (APP)), and the cloud side can be a cloud device, and the cloud device can be a physical machine or a physical machine. It can be a virtual machine (VM) or a container (container). The plaintext data on the terminal side can be encrypted by the user key to obtain the ciphertext data, and then the ciphertext data is sent to the cloud side for storage. Operations such as insert (insert), update (update), query (select/query), and delete (delete) can be performed between devices and clouds for ciphertext data. Many of the plaintext data on the terminal side are based on sequential records, such as employee information lists, student information lists, and other data, which are all recorded based on sequential records. These sequential recorded data also need to be sorted in order after being encrypted by the user key. These data can also be called data with sequential requirements. The encryption method for these order-required data can be order-preserving encryption (OPE), order-revealing encryption (ORE), or other order-based encryption methods. In the present application, statements for operations on these sequence-related data may be referred to as statements based on sequence operations. Input conditions based on sequential operations can include comparison operators, range queries, ordering (ORDER BY), minimum (minimum, MIN), maximum (maximum, MAX), and sorting (SORT), etc.
上述第一方面中,第一语句和第二语句都可以是结构化查询语言(structured query language,SQL)语句。第一语句通常为基于用户输入生成的语句。如:通过用户输入的查询条件生成的语句,或者通过用户输入的插入指令、更新指令或删除指令生成的语句。第二语句所指示的操作与第一语句所指示的操作是相同的。In the above first aspect, both the first statement and the second statement may be structured query language (structured query language, SQL) statements. The first statement is typically a statement generated based on user input. For example: a statement generated by a query condition input by a user, or a statement generated by an insert instruction, an update instruction, or a delete instruction input by the user. The operation indicated by the second statement is the same as the operation indicated by the first statement.
本申请中,明文数据也可以描述为“数据的明文”,密文数据也可以描述为“数据的密文”。密文索引值指的是与密文数据有指向关系的索引值。索引结构是云设备建立的用于存储密文索引值和密文数据的存储位置的信息之间的对应关系的结构,该索引结构可以是树型结构,也可以是其他类型的结构。密文数据的存储位置的信息可以包括该存储位置的地址或者密文数据在所存储的列表中的标识。若该第二语句所指示的操作为插入操作,则云设备会在索引结构中建立密文索引值与密文数据的存储位置的信息之间的对应关系,若该第二语句所指示的操作为查询操作、更新操作或删除操作,则云设备会从索引结构中查询密文数据的存储位置的信息,进而可以根据该存储位置的信息查询密文数据。In this application, plaintext data may also be described as "plaintext of data", and ciphertext data may also be described as "ciphertext of data". The ciphertext index value refers to an index value that has a pointing relationship with the ciphertext data. The index structure is a structure established by the cloud device to store the correspondence between the ciphertext index value and the information of the storage location of the ciphertext data, and the index structure may be a tree structure or other types of structures. The information on the storage location of the ciphertext data may include an address of the storage location or an identification of the ciphertext data in the stored list. If the operation indicated by the second statement is an insert operation, the cloud device will establish a correspondence between the ciphertext index value and the information of the storage location of the ciphertext data in the index structure. For a query operation, an update operation or a deletion operation, the cloud device will query the information of the storage location of the ciphertext data from the index structure, and then can query the ciphertext data according to the information of the storage location.
该第一方面中,客户端可以为基于顺序操作的明文数据生成密文索引值,进而云设备可以将该密文索引值存入索引结构中,建立密文索引值与密文数据的存储位置的信息之间的对应关系,在需要查询该密文索引值对应的密文数据时,可以根据索引结构中的对应关系查询到相应的密文数据,进而执行对该密文数据的相应操作。由此可见,本申请中,以密文索引值代替数据列中的字段作为常规有序索引中的键值实现对密文数据的查找,无需增加数据表字段就可以对表格中存储的密文数据进行基于顺序的查询,从而减少了因用于存储密文数据的表格膨胀而占用的空间,提高了云设备中对存储数据的可扩展性。也就是说,本申请的方案,在不改变交互模式,不增加额外交互次数,保持常规查询效率、不增加数据表字段,不改变常规索引功能,不添加额外SQL语句改变查询模式的优势下,实现了基于顺序操作的功能。In the first aspect, the client can generate a ciphertext index value for plaintext data based on sequential operations, and then the cloud device can store the ciphertext index value in an index structure to establish a storage location for the ciphertext index value and the ciphertext data When the ciphertext data corresponding to the ciphertext index value needs to be queried, the corresponding ciphertext data can be queried according to the corresponding relationship in the index structure, and then the corresponding operations on the ciphertext data can be performed. It can be seen that in this application, the ciphertext index value is used instead of the field in the data column as the key value in the conventional ordered index to realize the search for ciphertext data, and the ciphertext stored in the table can be searched without adding data table fields. The data is queried based on the order, thereby reducing the space occupied by the expansion of the table used to store the ciphertext data, and improving the scalability of the stored data in the cloud device. That is to say, the solution of the present application has the advantages of not changing the interaction mode, not increasing the number of extra interactions, maintaining the efficiency of conventional queries, not adding data table fields, not changing the conventional index function, and not adding additional SQL statements to change the query mode. The function based on sequential operation is implemented.
在第一方面的一种可能的实现方式中,明文数据的信息包括明文数据的值、明文数据的类型以及明文数据的取值范围。In a possible implementation manner of the first aspect, the information of the plaintext data includes the value of the plaintext data, the type of the plaintext data, and the value range of the plaintext data.
该种可能的实现方式中,明文数据的类型可以包括整型(int)、浮点型(float)、字符串型(string)、字符型(char),而且,整型还可以细分为int1、int2、int4和int8等,浮点型也可以细分为不同粒度的浮点型,字符串型也可以细分为长字符串和短字符串,字符型也可以细分为可读字符和全字符等。明文数据的取值范围与明文数据的类型相关,例如:若明文数据的类型为int4,则该明文数据的取值范围可以为[-2 31,2 31]。该种可能的实现方式中,通过明文数据的值、明文数据的类型以及明文数据的取值范围确定的密文索引值在保证密文安全性的同时,提高了密文索引值的获得效率。 In this possible implementation manner, the types of plaintext data may include integer (int), floating point (float), string (string), and character (char), and the integer type can also be subdivided into int1 , int2, int4 and int8, etc., floating-point types can also be subdivided into floating-point types with different granularities, string types can also be subdivided into long strings and short strings, and character types can also be subdivided into readable characters and full characters, etc. The value range of the plaintext data is related to the type of the plaintext data. For example, if the type of the plaintext data is int4, the value range of the plaintext data can be [-2 31 , 2 31 ]. In this possible implementation manner, the ciphertext index value determined by the value of the plaintext data, the type of the plaintext data and the value range of the plaintext data not only ensures the security of the ciphertext, but also improves the obtaining efficiency of the ciphertext index value.
在第一方面的一种可能的实现方式中,上述步骤:根据明文数据的信息,确定密文索引值,包括:对明文数据的值、明文数据的类型以及明文数据的取值范围进行归一化处理,以得到明文值、明文空间和密文空间;根据明文值、明文空间和密文空间,确定密文索引值。In a possible implementation manner of the first aspect, the above step: determining the ciphertext index value according to the information of the plaintext data, including: normalizing the value of the plaintext data, the type of the plaintext data and the value range of the plaintext data process to obtain the plaintext value, plaintext space and ciphertext space; determine the ciphertext index value according to the plaintext value, plaintext space and ciphertext space.
该种可能的实现方式中,归一化过程可以是根据明文数据的类型,以及明文数据的取值范围确定明文数据的归一化参数;根据归一化参数,对明文数据的值进行归一化处理,以得到明文值、明文空间和密文空间。该明文值为归一化的明文值,明文空间也为归一化的明文空间,归一化处理的过程可以是针对不同的类型采用不同的处理方式,如:针对整型采用平移或移位的归一化处理方式,针对字符串型采用截断、压缩等归一化处理方式,针对浮点型采用截断、平移等归一化处理方式。本申请中,密文空间是按照膨胀系数对明文空间进行放大得到的。本申请中,针对不同的明文数据的类型加入归一化参数并采用不同的归一化处理方式,使得本申请的密文索引值生成算法适配全数据类型,无输入范围限制。In this possible implementation manner, the normalization process may be to determine the normalization parameter of the plaintext data according to the type of the plaintext data and the value range of the plaintext data; according to the normalization parameter, the value of the plaintext data is normalized processing to obtain the plaintext value, plaintext space and ciphertext space. The plaintext value is the normalized plaintext value, and the plaintext space is also the normalized plaintext space. The normalization process can be performed using different processing methods for different types, such as translation or shift for integer types. Normalization processing methods such as truncation and compression are used for string types, and normalization processing methods such as truncation and translation are used for floating point types. In this application, the ciphertext space is obtained by enlarging the plaintext space according to the expansion coefficient. In this application, normalization parameters are added for different types of plaintext data and different normalization processing methods are adopted, so that the ciphertext index value generation algorithm of this application can be adapted to all data types without input range limitation.
在第一方面的一种可能的实现方式中,上述步骤:根据明文值、明文空间和密文空间,确定密文索引值,包括:在密文空间的采样区间进行采样,以得到采样点,采样区间与明文空间的中点对应;根据中点与明文值,缩小明文空间和密文空间,以得到缩小的明文空间和缩小的密文空间,缩小的明文空间以中点为边界,且包含明文值,缩小的密文空间以采样点为边界;重复执行上述采样和缩小明文空间和密文空间的步骤,直到缩小的明文空间的上边界与下边界重合,上边界与下边界重合时所对应的缩小的密文空间的采样点为密文索引值。In a possible implementation manner of the first aspect, the above steps: determining the ciphertext index value according to the plaintext value, the plaintext space and the ciphertext space, including: sampling in the sampling interval of the ciphertext space to obtain sampling points, The sampling interval corresponds to the midpoint of the plaintext space; according to the midpoint and the plaintext value, the plaintext space and the ciphertext space are reduced to obtain a reduced plaintext space and a reduced ciphertext space. The reduced plaintext space is bounded by the midpoint and contains The plaintext value, the reduced ciphertext space is bounded by the sampling point; the above steps of sampling and reducing the plaintext space and the ciphertext space are repeated until the upper boundary and the lower boundary of the reduced plaintext space coincide, and the upper boundary coincides with the lower boundary. The corresponding sampling point of the reduced ciphertext space is the ciphertext index value.
该种可能的实现方式中,明文空间是一个数值范围,包括上边界和下边界,如该明文空间表示为[a1,a2],密文空间是按照膨胀系数对明文空间进行放大得到的,放大比例可以为1.3倍、1.5倍或其他倍数,当然,密文空间也可以与明文空间等大。例如:密文空间可以表示为[b1,b2]。明文空间与密文空间是对应的,明文空间的中点指的是通过明文空间的上边界和下边界确定的中点(mid),也就是明文空间上边界和下边界的和的一半即为该明文空间的中点。例如:[a1,a2]的中点即为(a1+a2)/2。因为密文空间比明文空间大,所以,明文空间的中点会对应密文空间的一个区间,客户端可以在该采样区间进行确定性采样,也可以理解为是伪随机采样,也就是按照用户密钥进行采样,在该采样区间得到采样点(y)。根据中点(mid)与明文值(m)的大小关系,确定缩小的明文空间和缩小的密文空间可以包括明文值大于中点的情况,也可以包括明文值小于中点的情况,若m>mid,则缩小的明文空间为从中点的下一个数开始到原来的明文空间的下边界,即可以表示为[mid+1,a2],缩小的密文空间为从采样点的下一个数开始到密文空间的下边界,即可以表示为[y+1,b2]。若m≤mid,则缩小的明文空间为从明文空间的上边界到中点,即可以表示为[a1,mid],缩小的密文空间为从密文空间的上边界到采样点,即可以表示为[b1,y]。通过多次递归后,缩小的明文空间的上边界和下边界相等,会与明文值和中点相等,即可以表示为a1=a2=mid=m,这时,该缩小的明文空间所对应的密文空间的采样点为密文索引值。本申请中,通过递归的方式得到密文索引值,可以降低密文索引值泄露的机率,提高密文 索引值的安全性。In this possible implementation, the plaintext space is a numerical range, including upper and lower boundaries. For example, the plaintext space is expressed as [a1, a2], and the ciphertext space is obtained by enlarging the plaintext space according to the expansion coefficient. The ratio can be 1.3 times, 1.5 times or other multiples. Of course, the ciphertext space can also be as large as the plaintext space. For example: the ciphertext space can be expressed as [b1,b2]. The plaintext space corresponds to the ciphertext space. The midpoint of the plaintext space refers to the midpoint (mid) determined by the upper and lower boundaries of the plaintext space, that is, half of the sum of the upper and lower boundaries of the plaintext space is The midpoint of this plaintext space. For example: the midpoint of [a1, a2] is (a1+a2)/2. Because the ciphertext space is larger than the plaintext space, the midpoint of the plaintext space corresponds to an interval of the ciphertext space, and the client can perform deterministic sampling in this sampling interval, or it can be understood as pseudo-random sampling, that is, according to the user The key is sampled, and the sampling point (y) is obtained in the sampling interval. According to the size relationship between the midpoint (mid) and the plaintext value (m), determining the reduced plaintext space and the reduced ciphertext space may include the case where the plaintext value is greater than the midpoint, or may include the case where the plaintext value is smaller than the midpoint, if m >mid, the reduced plaintext space is the next number from the midpoint to the lower boundary of the original plaintext space, which can be expressed as [mid+1, a2], and the reduced ciphertext space is the next number from the sampling point From the beginning to the lower boundary of the ciphertext space, it can be expressed as [y+1,b2]. If m≤mid, the reduced plaintext space is from the upper boundary of the plaintext space to the midpoint, which can be expressed as [a1,mid], and the reduced ciphertext space is from the upper boundary of the ciphertext space to the sampling point, which can be Represented as [b1,y]. After repeated recursion, the upper and lower boundaries of the reduced plaintext space are equal to the plaintext value and the midpoint, which can be expressed as a1=a2=mid=m. At this time, the reduced plaintext space corresponds to The sampling point of the ciphertext space is the ciphertext index value. In this application, obtaining the ciphertext index value in a recursive manner can reduce the probability of leaking the ciphertext index value and improve the security of the ciphertext index value.
在第一方面的一种可能的实现方式中,上述步骤:在密文空间的采样区间进行采样,以得到采样点,包括:通过不可预测的伪随机数对采样区间的大小进行取模计算,以得到取模值;根据取模值从采样区间确定对应的采样点。In a possible implementation manner of the first aspect, the above steps: sampling in a sampling interval of the ciphertext space to obtain sampling points, including: performing modulo calculation on the size of the sampling interval by using an unpredictable pseudo-random number, to obtain the modulo value; determine the corresponding sampling point from the sampling interval according to the modulo value.
该种可能的实现方式中,在采样过程中,通过取模值的方式进行采样,可以提升采样效率,从而提高密文索引值的计算效率。In this possible implementation manner, in the sampling process, sampling is performed by taking a modulo value, which can improve the sampling efficiency, thereby improving the calculation efficiency of the ciphertext index value.
在第一方面的一种可能的实现方式中,上边界与下边界重合时,对缩小的密文空间的采样为非确定性采样。In a possible implementation manner of the first aspect, when the upper boundary and the lower boundary coincide, the sampling of the reduced ciphertext space is non-deterministic sampling.
该种可能的实现方式中,最后一次对密文空间的采样采用非确定性采样确定密文索引值,可以抵抗推理攻击。In this possible implementation manner, the last sampling of the ciphertext space adopts non-deterministic sampling to determine the ciphertext index value, which can resist inference attacks.
在第一方面的一种可能的实现方式中,第一语句指示插入操作或更新操作,该方法还包括:对明文数据采用对称加密处理,以得到明文数据的密文数据;第二语句还包括或指示密文数据,密文数据被云设备存储到相应的存储位置。In a possible implementation manner of the first aspect, the first statement indicates an insert operation or an update operation, and the method further includes: performing symmetric encryption processing on the plaintext data to obtain ciphertext data of the plaintext data; the second statement further includes: Or indicate the ciphertext data, and the ciphertext data is stored in the corresponding storage location by the cloud device.
该种可能的实现方式中,当第一语句指示执行插入操作或更新操作时,客户端还会将该明文数据对应的密文数据发送到云设备进行存储,第二语句中可以直接包括该密文数据,也可以包括该密文数据的存储位置的链接,通过该链接指示该密文数据的存储位置。In this possible implementation manner, when the first statement instructs to perform an insert operation or an update operation, the client will also send the ciphertext data corresponding to the plaintext data to the cloud device for storage, and the second statement may directly include the ciphertext data. The ciphertext data may also include a link to the storage location of the ciphertext data, and the link indicates the storage location of the ciphertext data.
在第一方面的一种可能的实现方式中,第一语句用于执行查询操作时,方法还包括:对第二语句进行加扰;接收云设备返回的查询结果,并对查询结果进行解扰。In a possible implementation manner of the first aspect, when the first statement is used to perform a query operation, the method further includes: scrambling the second statement; receiving the query result returned by the cloud device, and descrambling the query result .
该种可能的实现方式中,在发送第二语句前对该第二语句进行加扰,可以降低查询泄露的机率。若客户端进行了加扰,在云设备返回查询结果后,客户端会解密对称密文。解密后的查询结果可能会出现部分假阳性结果,不会出现假阴性结果,然后会对解密结果进行过滤检验,然后输出最终结果。In this possible implementation manner, scrambling the second statement before sending the second statement can reduce the probability of query leakage. If the client performs scramble, after the cloud device returns the query result, the client decrypts the symmetric ciphertext. The decrypted query result may have some false positive results, but no false negative results. Then, the decrypted result will be filtered and checked, and then the final result will be output.
在第一方面的一种可能的实现方式中,上述步骤获取第一语句之后,该方法还包括:向云设备发送创建索引语句,创建索引语句指示第一语句的指定表的指定列;接收云设备返回的指定列上的已有数据;确定已有数据的密文索引值;向云设备发送已有数据的密文索引值。In a possible implementation manner of the first aspect, after the above steps obtain the first statement, the method further includes: sending an index creation statement to the cloud device, where the index creation statement indicates the specified column of the specified table of the first statement; receiving the cloud device The existing data on the specified column returned by the device; determine the ciphertext index value of the existing data; send the ciphertext index value of the existing data to the cloud device.
该种可能的实现方式中,针对云设备中的存量数据,可以采样上述方式确定已有数据的密文索引值,并将该密文索引值插入到索引结构中,从而使得存量数据可以适配本申请的数据管理过程。In this possible implementation manner, for the stock data in the cloud device, the ciphertext index value of the existing data can be determined by sampling the above method, and the ciphertext index value is inserted into the index structure, so that the stock data can be adapted The data management process for this application.
本申请第二方面提供一种数据管理的方法,包括:接收来源于客户端的第二语句,第二语句包括客户端响应于第一语句,根据明文数据的信息确定的密文索引值,第一语句包括明文数据;响应于第二语句,根据密文索引值在索引结构中建立密文索引值与密文数据的存储位置的信息之间的对应关系,或者,从索引结构中查询密文数据的存储位置的信息,密文数据为明文数据对应的加密数据,存储位置的信息指示密文数据的存储位置。A second aspect of the present application provides a data management method, comprising: receiving a second statement from a client, where the second statement includes a ciphertext index value determined by the client according to information of plaintext data in response to the first statement, the first The statement includes plaintext data; in response to the second statement, establish a correspondence between the ciphertext index value and the information of the storage location of the ciphertext data in the index structure according to the ciphertext index value, or query the ciphertext data from the index structure The information of the storage location of the ciphertext data is the encrypted data corresponding to the plaintext data, and the information of the storage location indicates the storage location of the ciphertext data.
该第二方面所提供的方案应用于与上述第一方面的客户端对应的云设备,该云设备可以是物理机也可以是虚拟机或容器。该第二方面中所涉及到的与第一方面相同的特征可以参阅第一方面的介绍进行理解。The solution provided in the second aspect is applied to a cloud device corresponding to the client of the first aspect, and the cloud device may be a physical machine or a virtual machine or a container. The features of the second aspect that are the same as those of the first aspect can be understood with reference to the introduction of the first aspect.
该第二方面中,云设备可以将该客户端确定的密文索引值存入索引结构中,建立密文索引值与密文数据的存储位置的信息之间的对应关系,在需要查询该密文索引值对应的密文数据时,可以根据索引结构中的对应关系查询到相应的密文数据,进而执行对该密文数据的相应操作。由此可见,本申请中,以密文索引值代替数据列中的字段作为常规有序索引中的键值实现对密文数据的查找,无需增加数据表字段就可以对表格中存储的密文数据进行基于顺序的查询,从而减少了因用于存储密文数据的表格膨胀而占用的空间,提高了云设备中对存储数据的可扩展性。也就是说,本申请的方案,在不改变交互模式,不增加额外交互次数,保持常规查询效率、不增加数据表字段,不改变常规索引功能,不添加额外SQL语句改变查询模式的优势下,实现了基于顺序操作的功能。In the second aspect, the cloud device can store the ciphertext index value determined by the client in the index structure, establish a correspondence between the ciphertext index value and the information of the storage location of the ciphertext data, and query the ciphertext data when it needs to be queried. When the ciphertext data corresponding to the text index value is retrieved, the corresponding ciphertext data can be queried according to the corresponding relationship in the index structure, and then corresponding operations on the ciphertext data can be performed. It can be seen that in this application, the ciphertext index value is used instead of the field in the data column as the key value in the conventional ordered index to realize the search for ciphertext data, and the ciphertext stored in the table can be searched without adding data table fields. The data is queried based on the order, thereby reducing the space occupied by the expansion of the table used to store the ciphertext data, and improving the scalability of the stored data in the cloud device. That is to say, the solution of the present application has the advantages of not changing the interaction mode, not increasing the number of extra interactions, maintaining the efficiency of conventional queries, not adding data table fields, not changing the conventional index function, and not adding additional SQL statements to change the query mode. The function based on sequential operation is implemented.
在第二方面的一种可能的实现方式中,第二语句指示插入操作,在建立对应关系之前,该方法还包括:根据第二语句确定明文数据对应的密文数据;将密文数据存储到相应的存储位置,存储位置为对应关系中存储位置的信息所指示的位置。In a possible implementation manner of the second aspect, the second statement indicates an insert operation, and before establishing the corresponding relationship, the method further includes: determining ciphertext data corresponding to the plaintext data according to the second statement; storing the ciphertext data in a The corresponding storage location, where the storage location is the location indicated by the storage location information in the corresponding relationship.
该种可能的实现方式中,当客户端发送来的第二语句指示插入操作时,云设备会先将密文数据存储到相应的存储位置,该存储位置可以是用于存储密文数据的表格的某一列的一行或多行,然后云设备在索引结构中再建立该密文索引值与该密文数据的存储位置的信息之间的对应关系,这样,后续要查询该密文数据时,就可以通过索引结构中的该对应关系,从用于存储密文数据的表格中查询到该密文数据,这样,在保持常规查询的方式下,就可以实现对密文数据的快速查找。In this possible implementation manner, when the second statement sent by the client indicates an insert operation, the cloud device will first store the ciphertext data in a corresponding storage location, and the storage location may be a table for storing ciphertext data One or more rows of a certain column, and then the cloud device establishes the corresponding relationship between the ciphertext index value and the information of the storage location of the ciphertext data in the index structure. In this way, when querying the ciphertext data in the future, The ciphertext data can be queried from the table for storing the ciphertext data through the corresponding relationship in the index structure, so that the ciphertext data can be quickly searched in the normal query mode.
在第二方面的一种可能的实现方式中,第二语句指示查询操作,从索引结构中查询密文数据的存储位置的信息之后,该方法还包括:根据存储位置的信息,查询密文数据;向客户端返回密文数据。In a possible implementation manner of the second aspect, the second statement indicates a query operation, and after querying the information of the storage location of the ciphertext data from the index structure, the method further includes: querying the ciphertext data according to the information of the storage location ; Return ciphertext data to the client.
该种可能的实现方式中,当客户端发送来的第二语句指示查询操作时,云设备会根据第二语句中的密文索引值到索引结构中查询,通过索引结构中已建立的密文索引值与存储位置的信息之间的对应关系,查询出该密文数据的存储位置的信息,然后再根据该存储位置的信息在表格中查询出该密文数据,再向客户端返回该密文数据。这样,在保持常规查询的方式下,就可以实现对密文数据的快速查找。In this possible implementation, when the second statement sent by the client indicates a query operation, the cloud device will query the index structure according to the ciphertext index value in the second statement, and use the ciphertext already established in the index structure to query. The corresponding relationship between the index value and the information of the storage location, query the information of the storage location of the ciphertext data, and then query the ciphertext data in the table according to the information of the storage location, and then return the ciphertext data to the client. text data. In this way, the fast search for ciphertext data can be achieved in the manner of maintaining the conventional query.
在第二方面的一种可能的实现方式中,第二语句指示更新索引值,第二语句还包括明文数据原来的密文索引值,该方法还包括:根据原来的密文索引值查询原来的密文索引和存储位置的信息之间的对应关系;根据密文索引值更新索引结构中的原来的密文索引值与存储位置的信息之间的对应关系。In a possible implementation manner of the second aspect, the second statement instructs to update the index value, the second statement further includes the original ciphertext index value of the plaintext data, and the method further includes: querying the original ciphertext index value according to the original ciphertext index value The correspondence between the ciphertext index and the information of the storage location; the correspondence between the original ciphertext index value in the index structure and the information of the storage location is updated according to the ciphertext index value.
该种可能的实现方式中,若第二语句指示更新密文索引值,则会在第二语句中包含明文数据的旧的密文索引值和新的密文索引值,云设备根据旧的密文索引值在索引结构中查找到已建立的旧的密文索引值与密文数据的存储位置的信息之间的对应关系,然后再用新的密文索引值替换该对应关系中的旧的密文索引值,这样,增强了密文索引值与密文数据的存储位置的信息之间对应关系管理的灵活性。In this possible implementation manner, if the second statement instructs to update the ciphertext index value, the second statement will include the old ciphertext index value and the new ciphertext index value of the plaintext data. The text index value finds the correspondence between the established old ciphertext index value and the information of the storage location of the ciphertext data in the index structure, and then replaces the old ciphertext index value in the corresponding relationship with the new ciphertext index value. The ciphertext index value, in this way, enhances the flexibility of managing the correspondence between the ciphertext index value and the information of the storage location of the ciphertext data.
在第二方面的一种可能的实现方式中,第二语句指示更新密文数据,第二语句中还包括或指示明文数据的密文数据,以及更新前的明文数据的密文索引值,该方法还包括:根 据更新前的明文数据的密文索引值查询更新前的明文数据的密文索引值与存储位置的信息之间的对应关系;根据明文数据的密文索引值更新更新前的明文数据的密文索引值与存储位置的信息之间的对应关系;根据明文数据的密文数据更新存储位置的密文数据。In a possible implementation manner of the second aspect, the second statement indicates to update the ciphertext data, the second statement further includes or indicates the ciphertext data of the plaintext data, and the ciphertext index value of the plaintext data before the update, the The method further includes: querying the correspondence between the ciphertext index value of the plaintext data before the update and the information of the storage location according to the ciphertext index value of the plaintext data before the update; updating the plaintext before the update according to the ciphertext index value of the plaintext data The correspondence between the ciphertext index value of the data and the information of the storage location; the ciphertext data of the storage location is updated according to the ciphertext data of the plaintext data.
该种可能的实现方式中,若用户更新了明文数据,则会根据该更新的明文数据再生成对应的密文索引值和新的密文数据,客户端可以将该新的密文数据、新的密文索引值和更新前的密文索引值发送给云设备,这样,云设备就可以根据更新前的密文索引值在索引结构中查找对应关系,用新的密文索引值替换对应关系中更新前的密文索引值,然后再根据该对应关系中的存储位置的信息,在相应的存储位置用于新的密文数据更新旧的密文数据。该种可能的实现方式中提供的更新方案,可以实现了对云设备中密文数据和密文索引值的灵活管理。In this possible implementation, if the user updates the plaintext data, the corresponding ciphertext index value and new ciphertext data will be regenerated according to the updated plaintext data, and the client can use the new ciphertext data, new ciphertext data, The ciphertext index value and the ciphertext index value before the update are sent to the cloud device, so that the cloud device can find the corresponding relationship in the index structure according to the ciphertext index value before the update, and replace the corresponding relationship with the new ciphertext index value The ciphertext index value before the update is used in the corresponding storage location to update the old ciphertext data with the new ciphertext data according to the information of the storage location in the corresponding relationship. The update solution provided in this possible implementation manner can realize flexible management of the ciphertext data and the ciphertext index value in the cloud device.
在第二方面的一种可能的实现方式中,第二语句指示删除索引值,该方法还包括:从索引结构的密文索引值与存储位置的信息之间的对应关系中删除密文索引值。In a possible implementation manner of the second aspect, the second statement indicates to delete the index value, and the method further includes: deleting the ciphertext index value from the correspondence between the ciphertext index value of the index structure and the information of the storage location .
该种可能的实现方式中,若用户要删除某个明文数据的密文索引值,则客户端会向云设备发送指示删除密文索引值的第二语句,云设备根据第二语句中的密文索引值在索引结构中查找到相应的对应关系,然后删除该对应关系中的密文索引值,或者,删除该对应关系。In this possible implementation, if the user wants to delete the ciphertext index value of a certain plaintext data, the client terminal will send a second statement indicating deletion of the ciphertext index value to the cloud device. The text index value finds a corresponding relationship in the index structure, and then deletes the ciphertext index value in the corresponding relationship, or deletes the corresponding relationship.
在第二方面的一种可能的实现方式中,第二语句指示删除密文数据,该方法还包括:根据存储位置的信息,删除存储位置的密文数据,并从索引结构中删除密文索引值与密文数据的存储位置的信息之间的对应关系。In a possible implementation manner of the second aspect, the second statement indicates to delete the ciphertext data, and the method further includes: deleting the ciphertext data in the storage location according to the information of the storage location, and deleting the ciphertext index from the index structure Correspondence between the value and the information of the storage location of the ciphertext data.
该种可能的实现方式中,若用户要删除某个明文数据的密文数据,则客户端会向云设备发送指示删除密文数据的第二语句,云设备根据第二语句中的密文索引值在索引结构中查找到相应的对应关系,然后根据该对应关系中的存储位置的信息到相应位置删除该密文数据,并从索引结构中删除该对应关系。In this possible implementation, if the user wants to delete the ciphertext data of a certain plaintext data, the client terminal will send a second statement indicating deletion of the ciphertext data to the cloud device, and the cloud device will index the ciphertext data according to the second statement. The corresponding corresponding relationship is found in the index structure, and then the ciphertext data is deleted from the corresponding position according to the information of the storage location in the corresponding relationship, and the corresponding relationship is deleted from the index structure.
在第二方面的一种可能的实现方式中,该方法还包括:接收创建索引语句;根据创建索引语句查询第二语句的指定表的指定列;当指定列上存在已有数据时,向客户端发送已有数据;接收已有数据的密文索引值;在索引结构中建立已有数据的密文索引值与已有数据的存储位置的信息之间的对应关系。In a possible implementation manner of the second aspect, the method further includes: receiving a statement of creating an index; querying a specified column of a specified table of the second statement according to the statement of creating an index; when there is existing data in the specified column, reporting to the client The terminal sends the existing data; receives the ciphertext index value of the existing data; establishes the correspondence between the ciphertext index value of the existing data and the information of the storage location of the existing data in the index structure.
该种可能的实现方式中,针对云设备中的存量数据,可以采样上述方式确定已有数据的密文索引值,并将该密文索引值插入到索引结构中,从而使得存量数据可以适配本申请的数据管理过程。In this possible implementation manner, for the stock data in the cloud device, the ciphertext index value of the existing data can be determined by sampling the above method, and the ciphertext index value is inserted into the index structure, so that the stock data can be adapted The data management process for this application.
本申请第三方面,提供了一种客户端,用于执行上述第一方面或第一方面的任意可能的实现方式中的方法。具体地,该装置包括用于执行上述第一方面或第一方面的任意可能的实现方式中的方法的模块或单元,如:获取单元、处理单元、发送单元和接收单元。In a third aspect of the present application, a client is provided for executing the method in the first aspect or any possible implementation manner of the first aspect. Specifically, the apparatus includes modules or units for executing the method in the first aspect or any possible implementation manner of the first aspect, such as: an acquiring unit, a processing unit, a sending unit, and a receiving unit.
本申请第四方面,提供了一种云设备,用于执行上述第二方面或第二方面的任意可能的实现方式中的方法。具体地,该装置包括用于执行上述第二方面或第二方面的任意可能的实现方式中的方法的模块或单元,如:接收单元、处理单元和发送单元。In a fourth aspect of the present application, a cloud device is provided for executing the method in the second aspect or any possible implementation manner of the second aspect. Specifically, the apparatus includes modules or units for executing the method in the second aspect or any possible implementation manner of the second aspect, such as a receiving unit, a processing unit, and a sending unit.
本申请第五方面,提供了一种客户端。该客户端可以包括至少一个处理器、存储器和 通信接口。处理器与存储器和通信接口耦合。存储器用于存储指令,处理器用于执行该指令,通信接口用于在处理器的控制下与其他网元进行通信。该指令在被处理器执行时,使处理器执行第一方面或第一方面的任意可能的实现方式中的方法。A fifth aspect of the present application provides a client. The client may include at least one processor, memory and a communication interface. The processor is coupled with the memory and the communication interface. The memory is used to store instructions, the processor is used to execute the instructions, and the communication interface is used to communicate with other network elements under the control of the processor. The instructions, when executed by the processor, cause the processor to perform the method of the first aspect or any possible implementation of the first aspect.
本申请第六方面,提供了一种云设备。该云设备可以包括至少一个处理器、存储器和通信接口。处理器与存储器和通信接口耦合。存储器用于存储指令,处理器用于执行该指令,通信接口用于在处理器的控制下与其他网元进行通信。该指令在被处理器执行时,使处理器执行第二方面或第二方面的任意可能的实现方式中的方法。In a sixth aspect of the present application, a cloud device is provided. The cloud device may include at least one processor, memory, and a communication interface. The processor is coupled with the memory and the communication interface. The memory is used to store instructions, the processor is used to execute the instructions, and the communication interface is used to communicate with other network elements under the control of the processor. The instructions, when executed by the processor, cause the processor to perform the method of the second aspect or any possible implementation of the second aspect.
本申请第七方面,提供了一种计算机可读存储介质,该计算机可读存储介质存储有程序,该程序使得处理器执行上述第一方面,及其各种实现方式中的任一种方法。A seventh aspect of the present application provides a computer-readable storage medium, where a program is stored in the computer-readable storage medium, and the program causes a processor to execute the first aspect and any one of the various implementation manners thereof.
本申请第八方面,提供了一种计算机可读存储介质,该计算机可读存储介质存储有程序,该程序使得处理器执行上述第二方面,及其各种实现方式中的任一种方法。In an eighth aspect of the present application, a computer-readable storage medium is provided, where a program is stored in the computer-readable storage medium, and the program causes a processor to execute the second aspect and any one of the various implementation manners thereof.
本申请第九方面,提供一种计算机程序产品,该计算机程序产品包括计算机执行指令,该计算机执行指令存储在计算机可读存储介质中;设备的至少一个处理器可以从计算机可读存储介质读取该计算机执行指令,至少一个处理器执行该计算机执行指令使得设备实施上述第一方面或者第一方面的任一种可能的实现方式所提供的一种方法。In a ninth aspect of the present application, a computer program product is provided, the computer program product includes computer-executable instructions, and the computer-executable instructions are stored in a computer-readable storage medium; at least one processor of the device can be read from the computer-readable storage medium. The computer executes instructions, and at least one processor executes the computer execute instructions to cause the device to implement the first aspect or a method provided by any possible implementation manner of the first aspect.
第十方面,提供一种计算机程序产品,该计算机程序产品包括计算机执行指令,该计算机执行指令存储在计算机可读存储介质中;设备的至少一个处理器可以从计算机可读存储介质读取该计算机执行指令,至少一个处理器执行该计算机执行指令使得设备实施上述第二方面或者第二方面的任一种可能的实现方式所提供的一种方法。A tenth aspect provides a computer program product comprising computer-executable instructions stored in a computer-readable storage medium; at least one processor of the device can read the computer from the computer-readable storage medium Executing the instructions, at least one processor executes the computer-executable instructions to cause the device to implement the second aspect or a method provided by any possible implementation manner of the second aspect.
本申请第十一方面提供了一种芯片系统,该芯片系统包括处理器,用于支持客户端实现上述第一方面或第一方面任意一种可能的实现方式中所涉及的功能。在一种可能的设计中,芯片系统还可以包括存储器,存储器用于保存客户端必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件。An eleventh aspect of the present application provides a chip system, where the chip system includes a processor for supporting a client to implement the functions involved in the first aspect or any possible implementation manner of the first aspect. In a possible design, the chip system may further include a memory for storing necessary program instructions and data of the client. The chip system may be composed of chips, or may include chips and other discrete devices.
本申请第十二方面提供了一种芯片系统,该芯片系统包括处理器,用于支持云设备实现上述第二方面或第二方面任意一种可能的实现方式中所涉及的功能。在一种可能的设计中,芯片系统还可以包括存储器,存储器用于保存云设备必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件。A twelfth aspect of the present application provides a chip system, where the chip system includes a processor for supporting a cloud device to implement the functions involved in the second aspect or any possible implementation manner of the second aspect. In a possible design, the chip system may further include a memory for storing necessary program instructions and data of the cloud device. The chip system may be composed of chips, or may include chips and other discrete devices.
本申请第十九方面,提供了一种数据管理系统。该数据管理包括客户端和云设备,该客户端用于执行上述第一方面或第一方面任意一种可能的实现方式中所涉及的功能,云设备用于执行上述第二方面或第二方面任意一种可能的实现方式中所涉及的功能。A nineteenth aspect of the present application provides a data management system. The data management includes a client and a cloud device, the client is used to execute the functions involved in the first aspect or any possible implementation manner of the first aspect, and the cloud device is used to execute the second aspect or the second aspect The functions involved in any of the possible implementations.
可以理解地,上述提供的客户端、云设备、计算机存储介质、计算机程序产品或者芯片系统均用于执行上文所提供的对应的数据管理的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。It can be understood that the client, cloud device, computer storage medium, computer program product or chip system provided above are all used to execute the corresponding data management method provided above. Therefore, the beneficial effects that can be achieved can be referred to. The beneficial effects in the corresponding methods provided above will not be repeated here.
附图说明Description of drawings
图1是本申请实施例提供的数据管理系统的一架构示意图;1 is a schematic structural diagram of a data management system provided by an embodiment of the present application;
图2A是单机数据库系统示意图;2A is a schematic diagram of a stand-alone database system;
图2B是采用共享磁盘架构的集群数据库系统示意图;2B is a schematic diagram of a cluster database system using a shared disk architecture;
图2C是采用无共享架构的集群数据库系统示意图;2C is a schematic diagram of a cluster database system using a shared-nothing architecture;
图3是本申请实施例提供的数据管理的方法的一实施例示意图;3 is a schematic diagram of an embodiment of a data management method provided by an embodiment of the present application;
图4是本申请实施例提供的数据管理的方法的另一实施例示意图;FIG. 4 is a schematic diagram of another embodiment of the data management method provided by an embodiment of the present application;
图5是本申请实施例提供的数据管理的方法的另一实施例示意图;FIG. 5 is a schematic diagram of another embodiment of the data management method provided by the embodiment of the present application;
图6是本申请实施例提供的数据管理的方法的另一实施例示意图;FIG. 6 is a schematic diagram of another embodiment of the data management method provided by an embodiment of the present application;
图7是本申请实施例提供的数据管理的方法的另一实施例示意图;FIG. 7 is a schematic diagram of another embodiment of the data management method provided by an embodiment of the present application;
图8是本申请实施例提供的数据管理的方法的另一实施例示意图;FIG. 8 is a schematic diagram of another embodiment of a data management method provided by an embodiment of the present application;
图9是本申请实施例提供的数据管理的方法的另一实施例示意图;FIG. 9 is a schematic diagram of another embodiment of the data management method provided by an embodiment of the present application;
图10是本申请实施例提供的数据管理的方法的另一实施例示意图;FIG. 10 is a schematic diagram of another embodiment of the data management method provided by the embodiment of the present application;
图11是本申请实施例提供的客户端的一结构示意图;FIG. 11 is a schematic structural diagram of a client provided by an embodiment of the present application;
图12是本申请实施例提供的云设备的一结构示意图;12 is a schematic structural diagram of a cloud device provided by an embodiment of the present application;
图13是本申请实施例提供的客户端的一结构示意图;FIG. 13 is a schematic structural diagram of a client provided by an embodiment of the present application;
图14是本申请实施例提供的云设备的一结构示意图。FIG. 14 is a schematic structural diagram of a cloud device provided by an embodiment of the present application.
具体实施方式Detailed ways
下面结合附图,对本申请的实施例进行描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。本领域普通技术人员可知,随着技术发展和新场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。The embodiments of the present application will be described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Those of ordinary skill in the art know that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样根据的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second" and the like in the description and claims of the present application and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It is to be understood that the data so relied upon can be interchanged under appropriate circumstances so that the embodiments described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having" and any variations thereof, are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those expressly listed Rather, those steps or units may include other steps or units not expressly listed or inherent to these processes, methods, products or devices.
本申请实施例提供一种数据管理的方法、设备及系统,用于减少因用于存储密文数据的表格膨胀而占用的空间,提高了云设备中对存储数据的扩展性。本申请实施例还提供了相应的装置、系统、计算机可读存储介质以及计算机程序产品等。以下分别进行详细说明。Embodiments of the present application provide a data management method, device, and system, which are used to reduce the space occupied by the expansion of a table for storing ciphertext data, and improve the scalability of stored data in a cloud device. Embodiments of the present application also provide corresponding apparatuses, systems, computer-readable storage media, computer program products, and the like. Each of them will be described in detail below.
因为客户端的存储空间有限,所以客户端的用户数据通常都存储在云设备中。为了用户数据的安全性,这些用户数据通常都以密文数据的形式存储在云设备中。云设备可以对所存储的密文数据进行管理。与本申请实施例相关的客户端和云设备所形成的系统称为数据管理系统,该数据管理系统可以参阅图1进行理解。Because the storage space of the client is limited, the user data of the client is usually stored in the cloud device. For the security of user data, these user data are usually stored in cloud devices in the form of ciphertext data. The cloud device can manage the stored ciphertext data. The system formed by the client and the cloud device related to the embodiment of the present application is called a data management system, and the data management system can be understood with reference to FIG. 1 .
如图1所示,数据管理系统可以包括客户端和云设备,客户端可以有一个或多个,云设备也可以有一个或多个,不同的云设备可以管理不同客户端上的数据,如:云设备1可以管理地区1的客户端上的数据,云设备2可以管理地区2的客户端上的数据。也可以是不同的云设备管理不同类型的用户数据,如:云设备1管理客户端产生的A类型的数据,云设备2管理客户端产生的B类型的数据。As shown in Figure 1, the data management system can include clients and cloud devices. There can be one or more clients and one or more cloud devices. Different cloud devices can manage data on different clients, such as : Cloud device 1 can manage data on clients in region 1, and cloud device 2 can manage data on clients in region 2. Different cloud devices may also manage different types of user data, for example, cloud device 1 manages data of type A generated by the client, and cloud device 2 manages data of type B generated by the client.
该客户端可以是硬件(如:终端设备),也可以是软件(如:应用(application,APP))。The client may be hardware (eg, a terminal device) or software (eg, an application (application, APP)).
若客户端是终端设备,该终端设备(也可以称为用户设备(user equipment,UE))是一种具有无线收发功能的设备,可以部署在陆地上,包括室内或室外、手持或车载;也可以部署在水面上(如轮船等);还可以部署在空中(例如飞机、气球和卫星上等)。终端可以是手机(mobile phone)、平板电脑(pad)、带无线收发功能的电脑、虚拟现实(virtual reality,VR)终端、增强现实(augmented reality,AR)终端、工业控制(industrial control)中的无线终端、无人驾驶(self driving)中的无线终端、远程医疗(remote medical)中的无线终端、智能电网(smart grid)中的无线终端、运输安全(transportation safety)中的无线终端、智慧城市(smart city)中的无线终端、智慧家庭(smart home)中的无线终端、以物联网(internet of things,IoT)中的无线终端等。If the client is a terminal device, the terminal device (also referred to as user equipment (UE)) is a device with wireless transceiver functions that can be deployed on land, including indoor or outdoor, handheld or vehicle-mounted; Can be deployed on water (such as ships, etc.); can also be deployed in the air (such as aircraft, balloons and satellites, etc.). The terminal may be a mobile phone (mobile phone), a tablet computer (pad), a computer with a wireless transceiver function, a virtual reality (VR) terminal, an augmented reality (AR) terminal, or a terminal in an industrial control (industrial control). Wireless terminal, wireless terminal in self driving, wireless terminal in remote medical, wireless terminal in smart grid, wireless terminal in transportation safety, smart city Wireless terminals in (smart city), wireless terminals in smart homes (smart home), wireless terminals in the Internet of Things (IoT), etc.
云设备可以是物理机也可以是虚拟机(virtual machine,VM)或容器(container)。上述云设备可以是承载数据库系统(database system)中数据库管理系统(database management system,DBMS)的设备,本申请实施例提供的方法、可以实现为数据库管理系统的一部分,或者实现为一个独立的组件。本申请实施例提供的方法可以应用于单机数据库系统或者集群数据库系统。数据库系统(database system)一般由以下三部分组成:(1)数据库(database,DB),指长期存储在计算机内的,有组织,可共享的数据的集合。数据库中的数据按一定的数学模型组织、描述和存储,具有较小的冗余,较高的数据独立性和易扩展性,并可为各种用户共享。(2)硬件,包括存储数据所需的数据存储器,例如内存和/或磁盘。(3)软件,包括DBMS,DBMS是数据库系统的核心软件,是用于科学地组织和存储数据,以及高效获取和维护数据的系统软件,数据库引擎是DBMS的核心组件。Cloud devices can be physical machines or virtual machines (VMs) or containers. The above-mentioned cloud device can be a device carrying a database management system (database management system, DBMS) in a database system (database system), and the method provided in the embodiment of the present application can be implemented as a part of the database management system, or as an independent component . The methods provided by the embodiments of the present application can be applied to a single-machine database system or a cluster database system. A database system generally consists of the following three parts: (1) Database (DB), which refers to a collection of organized and sharable data stored in a computer for a long time. The data in the database is organized, described and stored according to a certain mathematical model, with less redundancy, high data independence and easy expansion, and can be shared by various users. (2) Hardware, including data storage required to store data, such as memory and/or disk. (3) Software, including DBMS, DBMS is the core software of the database system, is used to scientifically organize and store data, and efficiently acquire and maintain data. The database engine is the core component of DBMS.
具体地,图2A为单机数据库系统示意图,包括一个数据库管理系统和数据存储器(data storage),该数据库管理系统用于提供数据库的查询和修改等服务,该数据库管理系统将数据存储到数据存储器中。在单机数据库系统中,数据库管理系统和数据存储器通常位于单一服务器上,比如一台对称多处理(symmetric multi-processor,SMP)服务器。该SMP服务器包括多个处理器,所有的处理器共享资源,如总线,内存和I/O系统等。数据库管理系统的功能可由一个或多个处理器执行内存中的程序来实现。Specifically, FIG. 2A is a schematic diagram of a stand-alone database system, including a database management system and a data storage (data storage), the database management system is used to provide services such as database query and modification, and the database management system stores data in the data storage. . In stand-alone database systems, the database management system and data storage are usually located on a single server, such as a symmetric multi-processor (SMP) server. The SMP server includes multiple processors, all of which share resources such as bus, memory, and I/O systems. The functions of the database management system may be implemented by one or more processors executing in-memory programs.
图2B为采用共享磁盘(shared-storage)架构的集群数据库系统示意图,包括多个节点(如图2B中的节点1-N),每个节点部署有数据库管理系统,分别为用户提供数据库的查询和修改等服务,多个数据库管理系统存储有共享的数据在共享数据存储器中,并且通过交换机对数据存储器中的数据执行读写操作。共享数据存储器可以为共享磁盘阵列。集群数据库系统中的节点可以为物理机,比如数据库服务器,也可以为运行在抽象硬件资源上的虚拟机(virtual machine,VM)或容器(container)。当节点为虚拟机或容器时,节点中部署的数据库管理系统为DBMS实例(instance),该DBMS可以是进程或线程。若节点为物理机,则交换机为存储区网络(storage area network,SAN)交换机、以太网交换机,光纤交换机或其它物理交换设备。若节点为虚拟机或容器,则交换机为虚拟交换机。FIG. 2B is a schematic diagram of a cluster database system using a shared-storage architecture, including multiple nodes (nodes 1-N in FIG. 2B ), each node is deployed with a database management system, which provides database queries for users respectively and modification services, multiple database management systems store shared data in the shared data storage, and perform read and write operations on the data in the data storage through the switch. Shared data storage can be a shared disk array. Nodes in a clustered database system can be physical machines, such as database servers, or virtual machines (virtual machines, VMs) or containers (containers) running on abstract hardware resources. When the node is a virtual machine or a container, the database management system deployed in the node is a DBMS instance (instance), and the DBMS may be a process or a thread. If the node is a physical machine, the switch is a storage area network (storage area network, SAN) switch, an Ethernet switch, a fiber optic switch or other physical switching devices. If the node is a virtual machine or container, the switch is a virtual switch.
图2C为采用无共享(shared-nothing)架构的集群数据库系统示意图,每个节点具有各自独享的硬件资源(如数据存储器)、操作系统和数据库,节点之间通过网络来通信。该体系下,数据将根据数据库模型和应用特点被分配到各个节点上,查询任务将被分割成若 干部分,在所有节点上并行执行,彼此协同计算,作为整体提供数据库服务,所有通信功能都在一个高宽带网络互联体系上实现。如同图2B所描述的shared-storage架构的集群数据库系统一样,这里的节点既可以是物理机,也可以是虚拟机。2C is a schematic diagram of a cluster database system using a shared-nothing architecture, each node has its own exclusive hardware resources (such as data storage), an operating system and a database, and the nodes communicate through a network. Under this system, data will be allocated to each node according to the database model and application characteristics, and the query task will be divided into several parts, which will be executed in parallel on all nodes, and calculated in cooperation with each other, providing database services as a whole, and all communication functions are in It is implemented on a high-bandwidth network interconnection system. Like the cluster database system of the shared-storage architecture described in FIG. 2B , the nodes here can be either physical machines or virtual machines.
在本申请所有实施例中,数据库系统的数据存储器(data storage)包括但不限于固态硬盘(solid state drives,SSD)、磁盘阵列或其他类型的非瞬态计算机可读介质。图2A-图2C中虽未示出数据库,应理解,数据库存储在数据存储器中。所属领域的技术人员可以理解一个数据库系统可能包括比图2A-图2C中所示的部件更少或更多的组件,或者包括与图2A-图2C中所示组件不同的组件,图2A-图2C仅仅示出了与本申请实施例所公开的实现方式更加相关的组件。例如,虽然图2B和图2C中已经描述了4个节点,但所属领域的技术人员可理解成一个集群数据库系统可包含任何数量的节点。各节点的数据库管理系统功能可分别由运行在各节点上的软件、硬件和/或固件的适当组合来实现。In all the embodiments of the present application, the data storage (data storage) of the database system includes but is not limited to solid state drives (SSD), disk arrays or other types of non-transitory computer-readable media. Although the database is not shown in FIGS. 2A-2C, it should be understood that the database is stored in the data storage. Those skilled in the art will appreciate that a database system may include fewer or more components than those shown in FIGS. 2A-2C, or components that are different from those shown in FIGS. 2A-2C. FIG. 2C only shows components more related to the implementations disclosed in the embodiments of the present application. For example, although 4 nodes have been described in FIGS. 2B and 2C, those skilled in the art will understand that a clustered database system may include any number of nodes. The database management system functions of each node may be implemented by an appropriate combination of software, hardware and/or firmware running on each node, respectively.
上述图2A至图2C的数据库系统都包括节点,下面结合附图对节点的结构进行介绍。该节点可以包括:至少一个处理器、存储可执行代码的非瞬态计算机可读介质(non-transitory computer-readable medium)和数据库管理系统。可执行代码在被至少一个处理器执行时被配置为实现数据库管理系统的组件和功能。非瞬态计算机可读介质可以包括一个或多个非易失性存储器,作为示例,非易失性存储器包括半导体存储器设备,例如可擦可编程只读存储器(erasable programmable read only memory,EPROM),电可擦只读存储器(electrically erasable programmable read only memory,EEPROM)和闪存(flash memory);磁盘,例如内部硬盘(internal hard disk)或可移动磁盘(removable disk),磁光盘(magneto optical disk),以及CD ROM和DVD-ROM。此外,非瞬态计算机可读介质还可以包括被配置为主存储器(main memory)的任何设备。至少一个处理器可以包括任何类型的通用计算电路或专用逻辑电路,例如:现场可编程门阵列(field-programmable gate array,FPGA)或专用集成电路(application specific integrated circuit,ASIC)。至少一个处理器104也可以是耦合到一个或多个半导体基板的一个或多个处理器,例如CPU。The above database systems in FIGS. 2A to 2C all include nodes, and the structures of the nodes are described below with reference to the accompanying drawings. The node may include at least one processor, a non-transitory computer-readable medium storing executable code, and a database management system. The executable code, when executed by the at least one processor, is configured to implement the components and functions of the database management system. A non-transitory computer-readable medium may include one or more non-volatile memories including, by way of example, semiconductor memory devices such as erasable programmable read only memory (EPROM), Electrically erasable programmable read only memory (EEPROM) and flash memory (flash memory); magnetic disks, such as internal hard disks or removable disks, magneto optical disks, As well as CD-ROM and DVD-ROM. In addition, a non-transitory computer-readable medium can also include any device configured as main memory. The at least one processor may include any type of general purpose computing circuit or special purpose logic circuit, such as a field-programmable gate array (FPGA) or an application specific integrated circuit (ASIC). At least one processor 104 may also be one or more processors, such as a CPU, coupled to one or more semiconductor substrates.
数据库管理系统支持结构化查询语言(structured query language,SQL)。通常,SQL是指专门用于管理关系型数据库中保存的数据的专用编程语言。SQL可以指代各种类型的数据相关语言,包括例如数据定义语言和数据操纵语言,其中SQL的范围可以包括数据插入,查询,更新和删除,模式创建和修改以及数据访问控制。此外,在一些示例中,SQL可以包括与各种语言元素相关的描述,包括子句(clause),表达式(expression),谓词(predicate)和查询语句(Query statement),查询语句通常也简称为“查询(query)”。例如,子句可以指语句和查询的各种组成部分,并且在一些情况下,子句可以被认为是可选的。此外,表达式可以被配置为产生包括数据列和/或行的标量值(scalar value)和/或表。另外,谓词可经配置以指定条件,以用于调节语句和查询的效果。Database management systems support structured query language (SQL). In general, SQL refers to a special-purpose programming language designed to manage data held in relational databases. SQL can refer to various types of data-related languages, including, for example, data definition languages and data manipulation languages, where the scope of SQL can include data insertion, query, update and delete, schema creation and modification, and data access control. Additionally, in some examples, SQL may include descriptions related to various language elements, including clauses, expressions, predicates, and query statements, which are also often referred to simply as "query". For example, clauses can refer to various components of statements and queries, and in some cases, clauses can be considered optional. Additionally, expressions may be configured to produce scalar values and/or tables that include columns and/or rows of data. Additionally, predicates can be configured to specify conditions for adjusting the effects of statements and queries.
查询语句是请求查看,访问和/或操纵存储在数据库中的数据。数据库管理系统可以从客户端接收SQL格式的查询(称为SQL查询)。该SQL查询也可以称为SQL语句。通常,数据库管理系统通过从数据库访问相关数据并操纵相关数据以生成查询所对应的查询结果,并将 查询结果返回到数据库客户端。数据库是按一定的数学模型组织、描述和存储的数据集合,数据库可以包括一个或多个数据库结构或格式,例如行存储和列存储。A query statement is a request to view, access and/or manipulate data stored in a database. A database management system can receive queries in SQL format (called SQL queries) from clients. The SQL query may also be referred to as an SQL statement. Generally, the database management system generates query results corresponding to the query by accessing relevant data from the database and manipulating the relevant data, and returning the query results to the database client. A database is a collection of data organized, described and stored according to a certain mathematical model. A database can include one or more database structures or formats, such as row storage and column storage.
上述云设备可以应用于数据库的场景,也可以应用于非数据库的场景,无论该云设备是否应用于数据库的场景,都可以适用本申请实施例所提供的数据管理的方法。下面结合附图对本申请实施例提供的数据管理的方法进行介绍。The above cloud device can be applied to a database scenario or a non-database scenario. Regardless of whether the cloud device is applied to a database scenario, the data management method provided by the embodiment of the present application can be applied. The data management method provided by the embodiments of the present application will be introduced below with reference to the accompanying drawings.
如图3所示的数据管理的方法的一实施例示意图。本申请实施例提供的数据管理的方法的一实施例包括:A schematic diagram of an embodiment of a data management method is shown in FIG. 3 . An embodiment of the data management method provided by the embodiment of the present application includes:
101、客户端获取第一语句,该第一语句包括明文数据。101. The client obtains a first statement, where the first statement includes plaintext data.
该第一语句可以是基于顺序操作的第一语句。The first statement may be a first statement based on sequential operations.
明文数据也可以描述为“数据的明文”。明文数据很多是基于顺序记录的数据,如:员工信息列表、学生信息列表等数据,都是基于顺序记录的,这些基于顺序记录的数据在经过用户密钥加密后也需要按顺序排布,这些数据也可以称为有顺序需求的数据。Plaintext data can also be described as "the plaintext of the data". Many plaintext data are based on sequential records, such as employee information lists, student information lists and other data, which are all recorded based on sequential records. These sequential records also need to be arranged in order after being encrypted by the user key. Data can also be referred to as data with sequential requirements.
是基于顺序记录的表格中可以参阅如下表1进行理解。The table is based on sequential records and can be understood by referring to Table 1 below.
表1:员工信息表Table 1: Employee Information Form
标识logo 姓名Name 年龄age 部门department
00010001 赵一Zhao Yi 24twenty four 品管quality control
00020002 李二Li Er 2626 生产Production
00030003 张三Zhang San 2828 工程project
……... ……... ……... ……...
明文数据可以是表1中的任意一列,也可以是某一列中某一行或某几行的信息。The plaintext data may be any column in Table 1, or may be information of a certain row or certain rows in a certain column.
针对这些有顺序需求的数据的加密方式可以是保序加密(order preserving encryption,OPE),也可以是揭序加密(order revealing encryption,ORE),还可以是其他基于顺序的加密方式。本申请中,针对这些与顺序相关的数据的操作的语句可以称为基于顺序操作的语句。基于顺序操作的输入条件可以包括比较运算符、范围查询、排序(ORDER BY)、最小值(minimum,MIN)、最大值(maximum,MAX)和分类(SORT)等。The encryption method for these order-required data can be order-preserving encryption (OPE), order-revealing encryption (ORE), or other order-based encryption methods. In the present application, statements for operations on these sequence-related data may be referred to as statements based on sequence operations. Input conditions based on sequential operations can include comparison operators, range queries, sorting (ORDER BY), minimum (minimum, MIN), maximum (maximum, MAX), and sorting (SORT), etc.
第一语句可以是结构化查询语言(structured query language,SQL)语句。第一语句通常为基于用户输入生成的语句。如:通过用户输入的查询条件生成的语句,或者通过用户输入的插入指令、更新指令或删除指令生成的语句。The first statement may be a structured query language (SQL) statement. The first statement is typically a statement generated based on user input. For example: a statement generated by a query condition input by a user, or a statement generated by an insert instruction, an update instruction or a delete instruction input by the user.
102、客户端根据明文数据的信息,确定密文索引值。102. The client determines the ciphertext index value according to the information of the plaintext data.
密文索引值指的是与密文数据有指向关系的索引值。The ciphertext index value refers to an index value that has a pointing relationship with the ciphertext data.
103、客户端向云设备发送第二语句,第二语句包括密文索引值。相应地,云设备接收第二语句。103. The client sends a second sentence to the cloud device, where the second sentence includes a ciphertext index value. Accordingly, the cloud device receives the second sentence.
第二语句也可以是SQL语句。第二语句所指示的操作与第一语句所指示的操作是相同的。The second statement may also be an SQL statement. The operation indicated by the second statement is the same as the operation indicated by the first statement.
104、云设备响应于第二语句,根据密文索引值在索引结构中建立密文索引值与密文数据的存储位置的信息之间的对应关系,或者,从索引结构中查询密文数据的存储位置的信息,密文数据为明文数据对应的加密数据,存储位置的信息指示密文数据的存储位置。104. In response to the second statement, the cloud device establishes a correspondence between the ciphertext index value and the information of the storage location of the ciphertext data in the index structure according to the ciphertext index value, or queries the index structure for the information of the ciphertext data. The information of the storage location, the ciphertext data is the encrypted data corresponding to the plaintext data, and the information of the storage location indicates the storage location of the ciphertext data.
密文数据为明文数据对应的加密数据,存储位置的信息指示密文数据的存储位置。The ciphertext data is encrypted data corresponding to the plaintext data, and the storage location information indicates the storage location of the ciphertext data.
索引结构是云设备建立的用于存储密文索引值和密文数据的存储位置的信息之间的对应关系的结构,该索引结构可以是树型结构,如:B-tree,也可以是其他类型的结构。密文数据的存储位置的信息可以包括该存储位置的地址或者密文数据在所存储的列表中的标识。若该第二语句所指示的操作为插入操作,则云设备会在索引结构中建立密文索引值与密文数据的存储位置的信息之间的对应关系,若该第二语句所指示的操作为查询操作、更新操作或删除操作,则云设备会从索引结构中查询密文数据的存储位置的信息,进而可以根据该存储位置的信息查询密文数据。The index structure is a structure established by the cloud device to store the correspondence between the ciphertext index value and the information of the storage location of the ciphertext data. The index structure can be a tree structure, such as a B-tree, or other type of structure. The information on the storage location of the ciphertext data may include an address of the storage location or an identification of the ciphertext data in the stored list. If the operation indicated by the second statement is an insert operation, the cloud device will establish a correspondence between the ciphertext index value and the information of the storage location of the ciphertext data in the index structure. For a query operation, an update operation or a deletion operation, the cloud device will query the information of the storage location of the ciphertext data from the index structure, and then can query the ciphertext data according to the information of the storage location.
本申请实施例提供的方案,客户端可以为基于顺序操作的明文数据生成密文索引值,进而云设备可以将该密文索引值存入索引结构中,建立密文索引值与密文数据的存储位置的信息之间的对应关系,在需要查询该密文索引值对应的密文数据时,可以根据索引结构中的对应关系查询到相应的密文数据,进而执行对该密文数据的相应操作。由此可见,本申请中,以密文索引值代替数据列中的字段作为常规有序索引中的键值实现对密文数据的查找无需增加数据表字段就可以对表格中存储的密文数据进行基于顺序的查询,从而减少了因用于存储密文数据的表格膨胀而占用的空间,提高了云设备中对存储数据的可扩展性。也就是说,本申请的方案,在不改变交互模式,不增加额外交互次数,保持常规查询效率、不增加数据表字段,不改变常规索引功能,不添加额外SQL语句改变查询模式的优势下,实现了基于顺序操作的功能。In the solution provided by this embodiment of the present application, the client can generate a ciphertext index value for plaintext data based on sequential operations, and then the cloud device can store the ciphertext index value in an index structure to establish a relationship between the ciphertext index value and the ciphertext data. The corresponding relationship between the information of the storage location, when the ciphertext data corresponding to the ciphertext index value needs to be queried, the corresponding ciphertext data can be queried according to the corresponding relationship in the index structure, and then the corresponding ciphertext data can be executed. operate. It can be seen that in this application, the ciphertext index value is used instead of the field in the data column as the key value in the conventional ordered index to realize the search for ciphertext data without adding data table fields, and the ciphertext data stored in the table can be searched Sequence-based queries are performed, thereby reducing the space occupied by the expansion of tables used to store ciphertext data, and improving the scalability of stored data in cloud devices. That is to say, the solution of the present application has the advantages of not changing the interaction mode, not increasing the number of extra interactions, maintaining the efficiency of conventional queries, not adding data table fields, not changing the conventional index function, and not adding additional SQL statements to change the query mode. The function based on sequential operation is implemented.
可选地,上述步骤102中所涉及的明文数据的信息可以包括明文数据的值、明文数据的类型以及明文数据的取值范围。该明文数据的取值范围可以包括明文数据的规模或者明文数据的下边界。Optionally, the information of the plaintext data involved in the foregoing step 102 may include the value of the plaintext data, the type of the plaintext data, and the value range of the plaintext data. The value range of the plaintext data may include the size of the plaintext data or the lower boundary of the plaintext data.
本申请实施例可以通过:对明文数据的值、明文数据的类型以及明文数据的取值范围进行归一化处理,以得到明文值、明文空间和密文空间;根据明文值、明文空间和密文空间,确定密文索引值。In the embodiment of the present application, the value of the plaintext data, the type of the plaintext data, and the value range of the plaintext data can be normalized to obtain the plaintext value, the plaintext space and the ciphertext space; Text space, determine the ciphertext index value.
该明文值为归一化的明文值,明文空间也为归一化的明文空间。The plaintext value is the normalized plaintext value, and the plaintext space is also the normalized plaintext space.
其中,上述根据明文值、明文空间和密文空间,确定密文索引值的过程可以采用二分递归法进行,该过程可以包括:在密文空间的采样区间进行采样,以得到采样点,采样区间与明文空间的中点对应;根据中点与明文值,缩小明文空间和密文空间,以得到缩小的明文空间和缩小的密文空间,缩小的明文空间以中点为边界,且包含明文值,缩小的密文空间以采样点为边界;重复执行上述采样和缩小明文空间和密文空间的步骤,直到缩小的明文空间的上边界与下边界重合,上边界与下边界重合时所对应的缩小的密文空间的采样点为密文索引值。Wherein, the above process of determining the ciphertext index value according to the plaintext value, the plaintext space and the ciphertext space can be performed by a binary recursion method, and the process can include: sampling in a sampling interval of the ciphertext space to obtain sampling points, sampling intervals Corresponds to the midpoint of the plaintext space; according to the midpoint and the plaintext value, the plaintext space and the ciphertext space are reduced to obtain the reduced plaintext space and the reduced ciphertext space, and the reduced plaintext space is bounded by the midpoint and contains the plaintext value , the reduced ciphertext space is bounded by the sampling point; the above steps of sampling and reducing the plaintext space and the ciphertext space are repeated until the upper and lower boundaries of the reduced plaintext space coincide, and the corresponding The sampling point of the reduced ciphertext space is the ciphertext index value.
上述确定密文索引值的过程可以参阅图4进行理解。如图4所示,该确定密文索引值的过程可以包括:The above process of determining the ciphertext index value can be understood by referring to FIG. 4 . As shown in Figure 4, the process of determining the ciphertext index value may include:
201、客户端解析第一语句,确定明文数据的值、明文数据的数据类型和明文数据的取值范围。201. The client parses the first statement, and determines the value of the plaintext data, the data type of the plaintext data, and the value range of the plaintext data.
该明文数据的取值范围可以是依据明文数据的数据类型确定的,也可以是预先配置的默认范围,也可以是用户动态输入的范围。The value range of the plaintext data may be determined according to the data type of the plaintext data, or may be a preconfigured default range, or may be a range dynamically input by the user.
明文数据的类型可以包括整型(int)、浮点型(float)、字符串型(string)、字符型(char),而且,整型还可以细分为int4和int8等,浮点型也可以细分为不同粒度的浮点型,字符串型也可以细分为长字符串和短字符串,字符型也可以细分为可读字符和全字符等。明文数据的取值范围与明文数据的类型相关,例如:若明文数据的类型为int4,则该明文数据的取值范围可以为[-2 31,2 31]。 The types of plaintext data can include integer (int), floating-point (float), string (string), and character (char). Moreover, integers can also be subdivided into int4 and int8, etc. It can be subdivided into floating-point types with different granularities, string types can also be subdivided into long strings and short strings, and character types can also be subdivided into readable characters and full characters. The value range of the plaintext data is related to the type of the plaintext data. For example, if the type of the plaintext data is int4, the value range of the plaintext data can be [-2 31 , 2 31 ].
202、客户端根据明文数据的类型,以及明文数据的取值范围确定明文数据的归一化参数。202. The client determines the normalization parameter of the plaintext data according to the type of the plaintext data and the value range of the plaintext data.
203、客户端根据归一化参数,对明文数据的值进行归一化处理,以得到明文值、明文空间和密文空间。203. The client performs normalization processing on the value of the plaintext data according to the normalization parameter, so as to obtain the plaintext value, the plaintext space and the ciphertext space.
归一化处理的过程可以是针对不同的类型采用不同的处理方式,如:针对整型采用平移或移位的归一化处理方式,针对字符串型采用截断、压缩等归一化处理方式,针对浮点型采用截断、平移等归一化处理方式。The process of normalization processing can be different processing methods for different types, such as: normalization processing methods such as translation or shift for integer types, and normalization processing methods such as truncation and compression for string types. For floating-point types, normalization methods such as truncation and translation are used.
如:整型(int1、int2、int4、int8):需将负数按归一化参数平移为非负数。int8加密后超限情形可在加密前统一采用openssl开源库中的BN库(转换后超出int8范围的均采用BIGNUM库),这可使本申请的实际应用数据范围无限制。For example: Integer (int1, int2, int4, int8): Negative numbers need to be translated into non-negative numbers according to the normalization parameters. In the case of exceeding the limit after int8 encryption, the BN library in the openssl open source library can be uniformly used before encryption (the BIGNUM library is used for those beyond the range of int8 after conversion), which makes the actual application data range of this application unlimited.
字符类型(text、varchar(n)、char、char(n)、varchar2(n)、bytea):先记n为当前类型有效字符空间大小+1,全有效字符空间如bytea则为256。长字符串按归一化参数截取高位固定长度的字符串,将短字符串低位补码为0,然后将字符串转化为n进制数,再转至BN结构。Character type (text, varchar(n), char, char(n), varchar2(n), bytea): first note n is the size of the valid character space of the current type + 1, and the full valid character space such as bytea is 256. The long string intercepts the high-order fixed-length string according to the normalization parameter, and the low-order complement of the short string is 0, and then converts the string to an n-ary number, and then transfers it to the BN structure.
浮点数类型(float4、float8、double precision):归一化构造为指数位级联有效数字,支持负数与负指数。记当前类型最大指数为emax,指数exp。负数的指数位修正为emax-exp,正数为3*emax+exp。负数的有效数字(十进制)逐位修正为9-本位有效数字。精度不同情形若有效数字位数不足要按归一化参数在有效数字低位补0后再级联,若有效数字过长要截断低位。Floating-point number types (float4, float8, double precision): The normalized structure is a concatenated significand of the exponent bit, and negative numbers and negative exponents are supported. Note that the current type maximum exponent is emax, and the exponent is exp. The exponent bit is corrected to emax-exp for negative numbers, and 3*emax+exp for positive numbers. The significant digits (decimal) of negative numbers are corrected digit-by-digit to 9-native significant digits. In the case of different precisions, if the number of significant digits is insufficient, the low digits of the significant digits should be filled with 0 according to the normalization parameter and then cascaded. If the significant digits are too long, the low digits should be truncated.
为减少出现连续密文的弱密钥情形,归一化明文值可统一数乘同一比例(例如8),以限制不存在两个相差小于数乘比例的密文,数乘比例指的是归一化明文值所乘的比例。In order to reduce the case of weak keys with continuous ciphertext, the normalized plaintext value can be uniformly multiplied by the same ratio (for example, 8) to limit the existence of two ciphertexts that differ by less than the multiplication ratio. The multiplication ratio refers to the normalization ratio. The scale by which the normalized plaintext value is multiplied.
明文空间由明文数据的类型及归一化参数确定的明文数据的上边界和下边界决定。密文空间大小一般可取明文空间大小比特长度的固定倍数(比如取1.3倍、1.5倍,当然,也可以是其他倍数,对此,本申请中不做限定),且超过一定的下限(例如限制密文空间比特长度至少比明文长10比特),密文空间下界可以为1。The plaintext space is determined by the type of plaintext data and the upper and lower boundaries of the plaintext data determined by the normalization parameter. The size of the ciphertext space can generally be a fixed multiple of the bit length of the size of the plaintext space (such as 1.3 times, 1.5 times, of course, other multiples, which are not limited in this application), and exceed a certain lower limit (for example, limit The bit length of the ciphertext space is at least 10 bits longer than the plaintext), and the lower bound of the ciphertext space can be 1.
本申请中,密文空间是按照膨胀系数对明文空间进行放大得到的。本申请中,针对不同的明文数据的类型加入归一化参数并采用不同的归一化处理方式,使得本申请的密文索引值生成算法适配全数据类型,无输入范围限制。In this application, the ciphertext space is obtained by enlarging the plaintext space according to the expansion coefficient. In this application, normalization parameters are added for different types of plaintext data and different normalization processing methods are adopted, so that the ciphertext index value generation algorithm of this application can be adapted to all data types without input range limitation.
明文空间是一个数值范围,包括上边界和下边界,如该明文空间表示为[a1,a2],密文空间是按照膨胀系数对明文空间进行放大得到的,例如:密文空间可以表示为[b1,b2]。The plaintext space is a range of values, including upper and lower boundaries. For example, the plaintext space is expressed as [a1, a2], and the ciphertext space is obtained by enlarging the plaintext space according to the expansion coefficient. For example, the ciphertext space can be expressed as [ b1,b2].
204、客户端在密文空间的采样区间进行采样,以得到采样点,采样区间与明文空间的中点对应。204. The client performs sampling in the sampling interval of the ciphertext space to obtain sampling points, and the sampling interval corresponds to the midpoint of the plaintext space.
明文空间与密文空间是对应的,明文空间的中点指的是通过明文空间的上边界和下边界确定的中点(mid),也就是明文空间上边界和下边界的和的一半即为该明文空间的中点。例如:[a1,a2]的中点即为(a1+a2)/2。因为密文空间比明文空间大,所以,明文空间的中点会对应密文空间的一个采样区间,客户端可以在该采样区间进行确定性采样,也可以理解为是伪随机采样,也就是按照用户密钥进行采样,在该采样区间得到采样点(y)。The plaintext space corresponds to the ciphertext space. The midpoint of the plaintext space refers to the midpoint (mid) determined by the upper and lower boundaries of the plaintext space, that is, half of the sum of the upper and lower boundaries of the plaintext space is The midpoint of this plaintext space. For example: the midpoint of [a1, a2] is (a1+a2)/2. Because the ciphertext space is larger than the plaintext space, the midpoint of the plaintext space corresponds to a sampling interval of the ciphertext space. The client can perform deterministic sampling in this sampling interval, or it can be understood as pseudo-random sampling, that is, according to The user key is sampled, and the sampling point (y) is obtained in the sampling interval.
该采样点y的关系式可以表示为:y=unisample([b1+mid-a1,b2-a2+mid]*K sam,coin),其中,coin=SHA256(mid‖key),其中,SHA256表示安全散列函数,K sam为采样前加入的参数,例如:取值可以取0.9,加入该K sam参数可以增加实际密文分布的平滑度。key为安全随机数或用户密钥。 The relational expression of the sampling point y can be expressed as: y=unisample([b1+mid-a1,b2-a2+mid]*K sam ,coin), where coin=SHA256(mid‖key), where SHA256 represents For the secure hash function, K sam is a parameter added before sampling. For example, the value can be 0.9. Adding this K sam parameter can increase the smoothness of the actual ciphertext distribution. key is a secure random number or user key.
205、客户端根据中点与明文值,缩小明文空间和密文空间,以得到缩小的明文空间和缩小的密文空间。205. The client reduces the plaintext space and the ciphertext space according to the midpoint and the plaintext value, so as to obtain a reduced plaintext space and a reduced ciphertext space.
缩小的明文空间以中点为边界,且包含明文值,缩小的密文空间以采样点为边界。The reduced plaintext space is bounded by the midpoint and contains the plaintext value, and the reduced ciphertext space is bounded by the sampling point.
重复执行上述采样和缩小明文空间和密文空间的步骤,直到缩小的明文空间的上边界与下边界重合,上边界与下边界重合时所对应的缩小的密文空间的采样点为密文索引值。Repeat the above steps of sampling and reducing the plaintext space and the ciphertext space until the upper boundary of the reduced plaintext space and the lower boundary coincide, and the sampling point of the reduced ciphertext space corresponding to the coincidence of the upper boundary and the lower boundary is the ciphertext index. value.
根据中点(mid)与明文值(m)的大小关系,确定缩小的明文空间和缩小的密文空间可以包括明文值大于中点的情况,也可以包括明文值小于中点的情况。该比较关系与对应的结果可以表示为:若m>mid,则缩小的明文空间为[mid+1,a2],缩小的密文空间为[y+1,b2];若m≤mid,则缩小的明文空间为[a1,mid],缩小的密文空间为[b1,y]。According to the size relationship between the midpoint (mid) and the plaintext value (m), determining the reduced plaintext space and the reduced ciphertext space may include the case where the plaintext value is greater than the midpoint, or may include the case where the plaintext value is smaller than the midpoint. The comparison relationship and the corresponding result can be expressed as: if m>mid, the reduced plaintext space is [mid+1, a2], and the reduced ciphertext space is [y+1, b2]; if m≤mid, then The reduced plaintext space is [a1,mid], and the reduced ciphertext space is [b1,y].
也可以描述为:若m>mid,则缩小的明文空间为从中点的下一个数开始到原来的明文空间的下边界,即可以表示为[mid+1,a2],缩小的密文空间为从采样点的下一个数开始到密文空间的下边界,即可以表示为[y+1,b2]。若m≤mid,则缩小的明文空间为从明文空间的上边界到中点,即可以表示为[a1,mid],缩小的密文空间为从密文空间的上边界到采样点,即可以表示为[b1,y]。It can also be described as: if m>mid, the reduced plaintext space starts from the next number from the midpoint to the lower boundary of the original plaintext space, which can be expressed as [mid+1, a2], and the reduced ciphertext space is From the next number of the sampling point to the lower boundary of the ciphertext space, it can be expressed as [y+1,b2]. If m≤mid, the reduced plaintext space is from the upper boundary of the plaintext space to the midpoint, which can be expressed as [a1,mid], and the reduced ciphertext space is from the upper boundary of the ciphertext space to the sampling point, which can be Represented as [b1,y].
206、客户端通过多次递归,缩小的明文空间的上边界和下边界相等,输出的采样点为密文索引值。206. The client performs multiple recursion, the upper and lower boundaries of the reduced plaintext space are equal, and the output sampling point is the ciphertext index value.
缩小的明文空间的上边界和下边界相等,也会与明文值和中点相等,即可以表示为a1=a2=mid=m,这时,该缩小的明文空间所对应的密文空间的采样点为密文索引值。也就是当a1=a2=mid=m时输出的y为密文索引值。本申请中,通过递归的方式得到密文索引值,可以降低密文索引值泄露的机率,提高密文索引值的安全性。The upper and lower boundaries of the reduced plaintext space are equal, and they are also equal to the plaintext value and the midpoint, that is, it can be expressed as a1=a2=mid=m. At this time, the sampling of the ciphertext space corresponding to the reduced plaintext space The dot is the ciphertext index value. That is, when a1=a2=mid=m, the output y is the ciphertext index value. In the present application, obtaining the ciphertext index value in a recursive manner can reduce the probability of leakage of the ciphertext index value and improve the security of the ciphertext index value.
本申请实施例中,在明文空间的中点对应的采样区间进行采样,以得到采样点,可以包括:通过不可预测的伪随机数对采样区间的大小进行取模计算,以得到取模值;根据取模值从采样区间确定对应的采样点。这种在采样过程中,通过取模值的方式进行采样,可以提升采样效率,从而提高密文索引值的计算效率。In the embodiment of the present application, sampling in the sampling interval corresponding to the midpoint of the plaintext space to obtain the sampling point may include: performing a modulo calculation on the size of the sampling interval by using an unpredictable pseudo-random number to obtain a modulo value; The corresponding sampling point is determined from the sampling interval according to the modulo value. In the sampling process, sampling is performed by taking the modulo value, which can improve the sampling efficiency, thereby improving the calculation efficiency of the ciphertext index value.
本申请实施例中,上边界与下边界重合时,对缩小的密文空间的采样为非确定性采样。这种最后一次对密文空间的采样采用非确定性采样确定密文索引值,可以抵抗推理攻击。In this embodiment of the present application, when the upper boundary and the lower boundary coincide, the sampling of the reduced ciphertext space is non-deterministic sampling. This last sampling of the ciphertext space uses non-deterministic sampling to determine the ciphertext index value, which can resist inference attacks.
可选地,客户端在发送第二语句之前,还可以对该第二语句进行加扰,可以降低查询泄露的机率。若客户端进行了加扰,在云设备返回查询结果后,客户端会解密对称密文。 解密后的查询结果可能会出现部分假阳性结果,不会出现假阴性结果,然后会对解密结果进行过滤检验,然后输出最终结果。Optionally, before sending the second statement, the client may further scramble the second statement, which can reduce the probability of query leakage. If the client performs scramble, after the cloud device returns the query result, the client decrypts the symmetric ciphertext. The decrypted query result may have some false positive results, but no false negative results. Then, the decrypted result will be filtered and checked, and then the final result will be output.
本申请实施例中,上述第一语句和第二语句可以指示插入、查询、更新和删除等多种操作,针对不同操作,客户端和云设备的数据管理过程有一些不同,下面分别从第一语句和第二语句指示插入操作、查询操作、更新操作和删除操作介绍本申请实施例提供的数据管理过程。In the embodiment of the present application, the above-mentioned first statement and second statement may indicate various operations such as insert, query, update, and delete. For different operations, the data management processes of the client and the cloud device are somewhat different. The statement and the second statement indicating an insert operation, a query operation, an update operation, and a delete operation introduce the data management process provided by the embodiments of the present application.
1、第一语句和第二语句指示插入操作。1. The first statement and the second statement indicate an insert operation.
如图5所示,本申请实施例提供的数据管理的方法的另一实施例可以包括:As shown in FIG. 5 , another embodiment of the data management method provided by the embodiment of the present application may include:
301、客户端将第一语句中明文数据对称加密,以得到密文数据。301. The client side symmetrically encrypts the plaintext data in the first sentence to obtain ciphertext data.
302、客户端根据明文数据的信息,确定密文索引值。302. The client determines the ciphertext index value according to the information of the plaintext data.
该步骤可以参阅前面确定密文索引值的过程进行理解,此处不再重复赘述。This step can be understood by referring to the previous process of determining the ciphertext index value, and details are not repeated here.
303、客户端将密文数据和密文索引值添加到第二语句中。303. The client adds the ciphertext data and the ciphertext index value to the second statement.
若密文数据存储到其他设备上,可以将密文数据的存储位置的链接添加到该第二语句中,这样,云设备可以通过该存储位置的链接获取到该密文数据。If the ciphertext data is stored on another device, a link to the storage location of the ciphertext data can be added to the second sentence, so that the cloud device can obtain the ciphertext data through the link of the storage location.
304、客户端向云设备发送第二语句。对应地,云设备接收第二语句。304. The client sends the second sentence to the cloud device. Correspondingly, the cloud device receives the second sentence.
305、云设备解析第二语句,将密文数据存储到相应的存储位置。305. The cloud device parses the second sentence, and stores the ciphertext data in a corresponding storage location.
该第二语句中可以携带密文数据所要存储的表格标识,在表格中的列标识。这样,云设备就可以根据表格标识查找到相应的表格,然后将第二语句携带的数据插入到相应列中,将该密文数据存储到列标识所指示的列中。The second statement may carry the identifier of the table where the ciphertext data is to be stored, and the identifier of the column in the table. In this way, the cloud device can find the corresponding table according to the table identifier, then insert the data carried by the second statement into the corresponding column, and store the ciphertext data in the column indicated by the column identifier.
306、云设备在索引结构中建立密文索引值与密文数据所在的存储位置的信息之间的对应关系。306. The cloud device establishes a correspondence between the ciphertext index value and the information of the storage location where the ciphertext data is located in the index structure.
该对应关系为键值(key-value,KV)关系,其中,密文索引值为key,存储位置的信息为value。The corresponding relationship is a key-value (key-value, KV) relationship, wherein the ciphertext index value is the key, and the information of the storage location is the value.
307、云设备向客户端返回执行消息。307. The cloud device returns an execution message to the client.
如:插入成功的响应消息。Such as: inserting a successful response message.
本申请实施例提供的方案,可以将密文索引值插入到索引结构中,从而在执行密文数据的查询时可以实现密文数据的快速查找。In the solution provided by the embodiment of the present application, the ciphertext index value can be inserted into the index structure, so that the ciphertext data can be quickly searched when the ciphertext data query is performed.
2、第一语句和第二语句指示查询操作。2. The first statement and the second statement indicate a query operation.
如图6所示,本申请实施例提供的数据管理的方法的另一实施例可以包括:As shown in FIG. 6 , another embodiment of the data management method provided by the embodiment of the present application may include:
401、客户端根据第一语句中明文数据的信息,确定密文索引值。401. The client determines the ciphertext index value according to the information of the plaintext data in the first sentence.
该步骤可以参阅前面确定密文索引值的过程进行理解,此处不再重复赘述。This step can be understood by referring to the previous process of determining the ciphertext index value, and details are not repeated here.
402、客户端将密文索引值添加到第二语句中。402. The client adds the ciphertext index value to the second statement.
403、客户端向云设备发送第二语句。对应地,云设备接收第二语句。403. The client sends a second sentence to the cloud device. Correspondingly, the cloud device receives the second sentence.
404、云设备解析第二语句,根据密文索引值从索引结构中查找该密文索引值的KV关系。404. The cloud device parses the second sentence, and searches for the KV relationship of the ciphertext index value from the index structure according to the ciphertext index value.
405、云设备根据该密文索引值的KV关系中的存储位置的信息,从相应的存储位置查询密文数据。405. The cloud device queries the ciphertext data from the corresponding storage location according to the storage location information in the KV relationship of the ciphertext index value.
406、云设备向客户端返回查询结果,该查询结果包括密文数据。406. The cloud device returns a query result to the client, where the query result includes ciphertext data.
本申请实施例提供的方案,可以通过密文索引值和KV关系快速查找到密文数据。With the solution provided by the embodiment of the present application, ciphertext data can be quickly searched through the ciphertext index value and the KV relationship.
3、第一语句和第二语句指示更新索引值的操作。3. The first statement and the second statement indicate the operation of updating the index value.
如图7所示,本申请实施例提供的数据管理的方法的另一实施例可以包括:As shown in FIG. 7 , another embodiment of the data management method provided by the embodiment of the present application may include:
501、客户端根据第一语句中明文数据的信息,确定密文索引值。501. The client determines the ciphertext index value according to the information of the plaintext data in the first sentence.
该密文索引值为新的密文索引值。The ciphertext index value is a new ciphertext index value.
502、客户端将该明文数据的密文索引值和该明文数据原来的密文索引值添加到第二语句中。502. The client adds the ciphertext index value of the plaintext data and the original ciphertext index value of the plaintext data to the second statement.
503、客户端向云设备发送第二语句。对应地,云设备接收第二语句。503. The client sends a second sentence to the cloud device. Correspondingly, the cloud device receives the second sentence.
第二语句中包括该明文数据原来的密文索引值和新的密文索引值。The second sentence includes the original ciphertext index value and the new ciphertext index value of the plaintext data.
504、云设备根据原来的密文索引值,从索引结构中查找包含原来的密文索引值的KV关系。504. The cloud device searches the index structure for the KV relationship including the original ciphertext index value according to the original ciphertext index value.
505、云设备根据新的密文索引值替换KV关系中的原来的密文索引值。505. The cloud device replaces the original ciphertext index value in the KV relationship according to the new ciphertext index value.
506、云设备向客户端返回执行结果。506. The cloud device returns the execution result to the client.
该执行结果可以为索引值更新的响应。The execution result may be a response to an index value update.
本申请实施例提供的方案,增强了密文索引值与密文数据的存储位置的信息之间对应关系管理的灵活性。The solution provided by the embodiment of the present application enhances the flexibility of the management of the correspondence between the ciphertext index value and the information of the storage location of the ciphertext data.
4、第一语句和第二语句指示更新密文数据的操作。4. The first statement and the second statement indicate the operation of updating the ciphertext data.
如图8所示,本申请实施例提供的数据管理的方法的另一实施例可以包括:As shown in FIG. 8 , another embodiment of the data management method provided by this embodiment of the present application may include:
601、客户端根据第一语句中明文数据的信息,确定密文索引值。601. The client determines the ciphertext index value according to the information of the plaintext data in the first sentence.
该明文数据为已更新的明文数据,该密文索引值为新的密文索引值。The plaintext data is the updated plaintext data, and the ciphertext index value is a new ciphertext index value.
602、客户端对明文数据进行对称加密,生成密文数据。602. The client performs symmetric encryption on the plaintext data to generate ciphertext data.
该密文数据为客户端更新后的明文数据对应的密文数据。The ciphertext data is the ciphertext data corresponding to the plaintext data updated by the client.
603、客户端将已更新的明文数据对应的密文数据,以及新的密文索引值和更新前的明文数据的密文索引值添加到第二语句中。603. The client adds the ciphertext data corresponding to the updated plaintext data, the new ciphertext index value and the ciphertext index value of the plaintext data before the update to the second sentence.
604、客户端向云设备发送第二语句。对应地,云设备接收第二语句。604. The client sends the second sentence to the cloud device. Correspondingly, the cloud device receives the second sentence.
第二语句中包括已更新的明文数据对应的密文数据,以及新的密文索引值和更新前的明文数据的密文索引值。The second sentence includes the ciphertext data corresponding to the updated plaintext data, as well as the new ciphertext index value and the ciphertext index value of the plaintext data before the update.
605、云设备根据更新前的明文数据的密文索引值,从索引结构中查找包含更新前的明文数据的密文索引值的KV关系。605. The cloud device searches the index structure for the KV relationship including the ciphertext index value of the plaintext data before the update according to the ciphertext index value of the plaintext data before the update.
606、云设备根据KV关系中存储位置的信息,将相应位置的密文数据替换为已更新的明文数据对应的密文数据。606. The cloud device replaces the ciphertext data at the corresponding location with the ciphertext data corresponding to the updated plaintext data according to the storage location information in the KV relationship.
607、云设备根据新的密文索引值替换KV关系中的更新前的明文数据的密文索引值。607. The cloud device replaces the ciphertext index value of the plaintext data before the update in the KV relationship according to the new ciphertext index value.
608、云设备向客户端返回执行结果。608. The cloud device returns the execution result to the client.
该执行结果可以为密文数据更新的响应。The execution result may be a response of updating the ciphertext data.
本申请实施例提供的方案,可以实现了对云设备中密文数据和密文索引值的灵活管理。The solutions provided by the embodiments of the present application can realize flexible management of ciphertext data and ciphertext index values in the cloud device.
5、第一语句和第二语句指示删除索引值的操作或删除密文数据的操作。5. The first statement and the second statement indicate the operation of deleting the index value or the operation of deleting the ciphertext data.
如图9所示,本申请实施例提供的数据管理的方法的另一实施例可以包括:As shown in FIG. 9 , another embodiment of the data management method provided by the embodiment of the present application may include:
701、客户端根据第一语句中明文数据的信息,确定密文索引值。701. The client determines the ciphertext index value according to the information of the plaintext data in the first sentence.
702、客户端将密文索引值添加到第二语句中。702. The client adds the ciphertext index value to the second statement.
703、客户端向云设备发送第二语句。对应地,云设备接收第二语句。703. The client sends a second sentence to the cloud device. Correspondingly, the cloud device receives the second sentence.
704、云设备根据第二语句中的密文索引值,从索引结构中查找对应的KV关系。704. The cloud device searches for the corresponding KV relationship from the index structure according to the ciphertext index value in the second sentence.
705、云设备从KV关系中删除密文索引值,或者,根据KV关系中的存储位置的信息,删除密文数据,并删除该KV关系。705. The cloud device deletes the ciphertext index value from the KV relationship, or deletes the ciphertext data according to the information of the storage location in the KV relationship, and deletes the KV relationship.
706、云设备向客户端返回执行结果。706. The cloud device returns the execution result to the client.
该执行结果可以为删除成功的响应。The execution result may be a successful deletion response.
以上描述了客户端和云设备在数据管理过程中设计到插入、查询、更新和删除等操作时的执行过程,实际上,云设备中可能有一些存量数据还没有密文索引值,针对这些存量数据,本申请实施例也提供了相应的管理过程,下面结合图10进行理解。The above describes the execution process of inserting, querying, updating, and deleting operations designed by the client and cloud device in the data management process. Data, the embodiment of the present application also provides a corresponding management process, which will be understood below with reference to FIG. 10 .
如图10所示,本申请实施例提供的数据管理的方法的另一实施例可以包括:As shown in FIG. 10 , another embodiment of the data management method provided by this embodiment of the present application may include:
801、客户端向云设备发送创建索引语句。对应地,云设备接收创建索引语句。801. The client sends an index creation statement to the cloud device. Correspondingly, the cloud device receives the create index statement.
创建索引语句(create index)。创建索引语句指示第一语句的指定表的指定列。该创建语句中会包含指定表的标识(table ID),指定列的标识(column ID)。Create index statement (create index). The CREATE INDEX statement indicates the specified column of the specified table of the first statement. The create statement will contain the identifier of the specified table (table ID) and the identifier of the specified column (column ID).
802、云设备根据创建索引语句查询第二语句的指定表的指定列。802. The cloud device queries the specified column of the specified table of the second statement according to the index creation statement.
803、当指定列上存在已有数据时,云设备向客户端发送已有数据。对应地,客户端接收云设备返回的指定列上的已有数据。803. When existing data exists in the specified column, the cloud device sends the existing data to the client. Correspondingly, the client receives the existing data on the specified column returned by the cloud device.
804、客户端确定已有数据的密文索引值。804. The client determines the ciphertext index value of the existing data.
805、客户端向云设备发送已有数据的密文索引值。对应地,云设备接收客户端发送的已有数据的密文索引值。805. The client sends the ciphertext index value of the existing data to the cloud device. Correspondingly, the cloud device receives the ciphertext index value of the existing data sent by the client.
该已有数据的密文索引值可以是通过更新语句发送的。The ciphertext index value of the existing data may be sent through an update statement.
806、云设备在索引结构中建立已有数据的密文索引值与已有数据的存储位置的信息之间的对应关系。806. The cloud device establishes a correspondence between the ciphertext index value of the existing data and the information of the storage location of the existing data in the index structure.
本申请实施例中,可以使云设备中的存量数据适配上述数据管理过程。该过程可以在上述插入、查询、更新和删除操作之前执行。In this embodiment of the present application, the existing data in the cloud device can be adapted to the above-mentioned data management process. This process can be performed before the above insert, query, update and delete operations.
本申请实施例提供的数据管理的方法在客户端中配置有高斯保序加密(Gauss order preserving encryption,GSOPE)算法,该GSOPE算法在计算效率上比现有的BCLO算法或者Lewi-Wu算法都高,下面以一组实验数据为例进行比较说明。In the data management method provided by the embodiments of the present application, a Gauss order preserving encryption (GSOPE) algorithm is configured in the client, and the GSOPE algorithm is higher in computational efficiency than the existing BCLO algorithm or the Lewi-Wu algorithm. , and a set of experimental data is taken as an example for comparison and description.
表2:实验数据(单位:微秒)Table 2: Experimental data (unit: microseconds)
   GSOPEGSOPE BCLOBCLO Lewi-Wu(分块为10)Lewi-Wu (blocks of 10)
INT4INT4 8888 3000+3000+ 300300
INT8INT8 360360 7000+7000+ 527527
FLOAT8FLOAT8 343343 不支持not support 不支持not support
0-1字符串[25]0-1 string[25] 9999 不支持not support 223223
CHAR[15](可读字符)CHAR[15] (readable characters) 515515 不支持not support 900+900+
CHAR[15](全字符)CHAR[15] (full character) 728728 不支持not support 1200+1200+
表2中,Lewi-Wu为CLWW算法减少密文泄露的一种有陷门分块演进算法。In Table 2, Lewi-Wu is a trapdoor block evolution algorithm used by the CLWW algorithm to reduce ciphertext leakage.
从表2中的数据比对结果可以看出,针对INT4的明文数据,采用本申请提供GSOPE算法只需要88微秒,而采用BCLO算法,需要3000多微秒,采用Lewi-Wu算法,也需要300微秒,而针对float型,BCLO算法和Lewi-Wu算法都不支持float的计算,BCLO算法也不支持字符串型和CHAR型的计算,Lewi-Wu算法虽然支持字符串型和CHAR型的计算,但计算效率上都远低于本申请提供的GSOPE算法。From the data comparison results in Table 2, it can be seen that for the plaintext data of INT4, using the GSOPE algorithm provided by this application only takes 88 microseconds, while using the BCLO algorithm requires more than 3000 microseconds, and using the Lewi-Wu algorithm also requires 300 microseconds, and for the float type, the BCLO algorithm and the Lewi-Wu algorithm do not support the calculation of the float, and the BCLO algorithm does not support the calculation of the string type and CHAR type. Although the Lewi-Wu algorithm supports the string type and CHAR type. However, the computational efficiency is far lower than the GSOPE algorithm provided in this application.
由此可见,本申请实施例提供的GSOPE算法支持明文数据全数据类型,且客观上无数据范围限制,主观上范围可控。It can be seen from this that the GSOPE algorithm provided in the embodiment of the present application supports all data types of plaintext data, and there is no limitation on the data range objectively, and the range is controllable subjectively.
以上介绍了客户端和云设备配合完成本申请实施例的数据管理的方法,下面结合附图介绍本申请实施例提供的客户端和云设备。The above describes the method for the client and the cloud device to cooperate to complete the data management according to the embodiments of the present application. The following describes the client and the cloud device provided by the embodiments of the present application with reference to the accompanying drawings.
如图11所示,本申请实施例提供的客户端90的一实施例包括:As shown in FIG. 11 , an embodiment of the client terminal 90 provided by this embodiment of the present application includes:
获取单元901,用于获取第一语句,第一语句包括明文数据。The obtaining unit 901 is configured to obtain a first sentence, where the first sentence includes plaintext data.
处理单元902,用于根据获取单元901获取的明文数据的信息,确定密文索引值。The processing unit 902 is configured to determine the ciphertext index value according to the information of the plaintext data acquired by the acquiring unit 901 .
发送单元903,用于向云设备发送第二语句,第二语句包括处理单元902确定的密文索引值,密文索引值被云设备用于在索引结构中建立密文索引值与密文数据的存储位置的信息之间的对应关系,或者,从索引结构中查询密文数据的存储位置的信息,密文数据为明文数据对应的加密数据,存储位置的信息指示密文数据的存储位置。The sending unit 903 is configured to send a second statement to the cloud device, where the second statement includes the ciphertext index value determined by the processing unit 902, and the ciphertext index value is used by the cloud device to establish the ciphertext index value and the ciphertext data in the index structure The corresponding relationship between the information of the storage location of the ciphertext data, or query the information of the storage location of the ciphertext data from the index structure, the ciphertext data is the encrypted data corresponding to the plaintext data, and the information of the storage location indicates the storage location of the ciphertext data.
本申请实施例提供的方案,客户端可以为基于顺序操作的明文数据生成密文索引值,进而云设备可以将该密文索引值存入索引结构中,建立密文索引值与密文数据的存储位置的信息之间的对应关系,在需要查询该密文索引值对应的密文数据时,可以根据索引结构中的对应关系查询到相应的密文数据,进而执行对该密文数据的相应操作。由此可见,本申请中,以密文索引值代替数据列中的字段作为常规有序索引中的键值实现对密文数据的查找,无需增加数据表字段就可以对表格中存储的密文数据进行基于顺序的查询,从而减少了因用于存储密文数据的表格膨胀而占用的空间,提高了云设备中对存储数据的可扩展性。也就是说,本申请的方案,在不改变交互模式,不增加额外交互次数,保持常规查询效率、不增加数据表字段,不改变常规索引功能,不添加额外SQL语句改变查询模式的优势下,实现了基于顺序操作的功能。In the solution provided by this embodiment of the present application, the client can generate a ciphertext index value for plaintext data based on sequential operations, and then the cloud device can store the ciphertext index value in an index structure to establish a relationship between the ciphertext index value and the ciphertext data. The corresponding relationship between the information of the storage location, when the ciphertext data corresponding to the ciphertext index value needs to be queried, the corresponding ciphertext data can be queried according to the corresponding relationship in the index structure, and then the corresponding ciphertext data can be executed. operate. It can be seen that in this application, the ciphertext index value is used instead of the field in the data column as the key value in the conventional ordered index to realize the search for ciphertext data, and the ciphertext stored in the table can be searched without adding a data table field. The data is queried based on the order, thereby reducing the space occupied by the expansion of the table used to store the ciphertext data, and improving the scalability of the stored data in the cloud device. That is to say, the solution of the present application has the advantages of not changing the interaction mode, not increasing the number of extra interactions, maintaining the efficiency of conventional queries, not adding data table fields, not changing the conventional index function, and not adding additional SQL statements to change the query mode. The function based on sequential operation is implemented.
可选地,明文数据的信息包括明文数据的值、明文数据的类型以及明文数据的取值范围。Optionally, the information of the plaintext data includes the value of the plaintext data, the type of the plaintext data, and the value range of the plaintext data.
可选地,处理单元902,用于对明文数据的值、明文数据的类型以及明文数据的取值范围进行归一化处理,以得到明文值、明文空间和密文空间;根据明文值、明文空间和密文空间,确定密文索引值。Optionally, the processing unit 902 is configured to perform normalization processing on the value of the plaintext data, the type of the plaintext data and the value range of the plaintext data to obtain the plaintext value, the plaintext space and the ciphertext space; space and ciphertext space, determine the ciphertext index value.
可选地,处理单元902,用于在密文空间的采样区间进行采样,以得到采样点,采样区间与明文空间的中点对应;根据中点与明文值,缩小明文空间和密文空间,以得到缩小的明文空间和缩小的密文空间,缩小的明文空间以中点为边界,且包含明文值,缩小的密文空间以采样点为边界;重复执行上述采样和缩小明文空间和密文空间的步骤,直到缩小的明文空间的上边界与下边界重合,上边界与下边界重合时所对应的缩小的密文空间的采样点为密文索引值。Optionally, the processing unit 902 is configured to perform sampling in the sampling interval of the ciphertext space to obtain a sampling point, and the sampling interval corresponds to the midpoint of the plaintext space; according to the midpoint and the plaintext value, reduce the plaintext space and the ciphertext space, In order to obtain the reduced plaintext space and the reduced ciphertext space, the reduced plaintext space is bounded by the midpoint and contains the plaintext value, and the reduced ciphertext space is bounded by the sampling point; repeat the above sampling and reduced plaintext space and ciphertext Space steps until the upper boundary of the reduced plaintext space and the lower boundary coincide, and the sampling point of the reduced ciphertext space corresponding to the coincidence of the upper boundary and the lower boundary is the ciphertext index value.
可选地,处理单元902,用于通过不可预测的伪随机数对采样区间的大小进行取模计算,以得到取模值;根据取模值从采样区间确定对应的采样点。Optionally, the processing unit 902 is configured to perform modulo calculation on the size of the sampling interval by using an unpredictable pseudo-random number to obtain a modulo value; and determine a corresponding sampling point from the sampling interval according to the modulo value.
可选地,上边界与下边界重合时,对缩小的密文空间的采样为非确定性采样。Optionally, when the upper boundary and the lower boundary coincide, the sampling of the reduced ciphertext space is non-deterministic sampling.
可选地,处理单元902,还用于第一语句指示插入操作或更新操作,对明文数据采用对称加密处理,以得到明文数据的密文数据;第二语句还包括密文数据,密文数据被云设备存储到相应的存储位置。Optionally, the processing unit 902 is also used for the first statement to indicate an insert operation or an update operation, and symmetric encryption processing is performed on the plaintext data to obtain the ciphertext data of the plaintext data; the second statement also includes the ciphertext data, the ciphertext data. Stored in the corresponding storage location by the cloud device.
可选地,处理单元902,还用于第一语句指示查询操作,对第二语句进行加扰。Optionally, the processing unit 902 is further configured for the first statement to indicate a query operation, and to scramble the second statement.
接收单元904,用于接收云设备返回的查询结果。The receiving unit 904 is configured to receive the query result returned by the cloud device.
处理单元902,还用于对查询结果进行解扰。The processing unit 902 is further configured to descramble the query result.
可选地,发送单元903,还用于向云设备发送创建索引语句,创建索引语句指示第一语句的指定表的指定列。Optionally, the sending unit 903 is further configured to send a create index statement to the cloud device, where the create index statement indicates the specified column of the specified table of the first statement.
接收单元904,用于接收云设备返回的指定列上的已有数据。The receiving unit 904 is configured to receive the existing data on the specified column returned by the cloud device.
处理单元902,还用于确定已有数据的密文索引值。The processing unit 902 is further configured to determine the ciphertext index value of the existing data.
发送单元903,还用向云设备发送已有数据的密文索引值。The sending unit 903 is also used to send the ciphertext index value of the existing data to the cloud device.
如图12所示,本申请实施例提供的云设备100的一实施例包括:As shown in FIG. 12 , an embodiment of the cloud device 100 provided by this embodiment of the present application includes:
接收单元1001,用于接收来源于客户端的第二语句,第二语句包括客户端响应于第一语句,根据明文数据的信息确定的密文索引值,第一语句包括明文数据。The receiving unit 1001 is configured to receive a second sentence from a client, where the second sentence includes a ciphertext index value determined by the client according to information of plaintext data in response to the first sentence, and the first sentence includes plaintext data.
处理单元1002,用于响应于接收单元1001接收的第二语句,根据密文索引值在索引结构中建立密文索引值与密文数据的存储位置的信息之间的对应关系,或者,从索引结构中查询密文数据的存储位置的信息,密文数据为明文数据对应的加密数据,存储位置的信息指示密文数据的存储位置。The processing unit 1002 is configured to, in response to the second statement received by the receiving unit 1001, establish a correspondence between the ciphertext index value and the information of the storage location of the ciphertext data in the index structure according to the ciphertext index value, or, from the index In the structure, the information of the storage location of the ciphertext data is queried, the ciphertext data is the encrypted data corresponding to the plaintext data, and the information of the storage location indicates the storage location of the ciphertext data.
本申请实施例中,云设备可以将该客户端确定的密文索引值存入索引结构中,建立密文索引值与密文数据的存储位置的信息之间的对应关系,在需要查询该密文索引值对应的密文数据时,可以根据索引结构中的对应关系查询到相应的密文数据,进而执行对该密文数据的相应操作。由此可见,本申请中,以密文索引值代替数据列中的字段作为常规有序索引中的键值实现对密文数据的查找,无需增加数据表字段就可以对表格中存储的密文数据进行基于顺序的查询,从而减少了因用于存储密文数据的表格膨胀而占用的空间,提高了云设备中对存储数据的可扩展性。也就是说,本申请的方案,在不改变交互模式,不增加额外交互次数,保持常规查询效率、不增加数据表字段,不改变常规索引功能,不添加额外SQL语句改变查询模式的优势下,实现了基于顺序操作的功能。In this embodiment of the present application, the cloud device may store the ciphertext index value determined by the client in the index structure, and establish a correspondence between the ciphertext index value and the information of the storage location of the ciphertext data. When the ciphertext data corresponding to the text index value is retrieved, the corresponding ciphertext data can be queried according to the corresponding relationship in the index structure, and then corresponding operations on the ciphertext data can be performed. It can be seen that in this application, the ciphertext index value is used instead of the field in the data column as the key value in the conventional ordered index to realize the search for ciphertext data, and the ciphertext stored in the table can be searched without adding data table fields. The data is queried based on the order, thereby reducing the space occupied by the expansion of the table used to store the ciphertext data, and improving the scalability of the stored data in the cloud device. That is to say, the solution of the present application has the advantages of not changing the interaction mode, not increasing the number of extra interactions, maintaining the efficiency of conventional queries, not adding data table fields, not changing the conventional index function, and not adding additional SQL statements to change the query mode. The function based on sequential operation is implemented.
可选地,处理单元1002,还用于若第二语句指示插入操作,在建立对应关系之前,根据第二语句确定明文数据对应的密文数据;将密文数据存储到相应的存储位置,存储位置为对应关系中存储位置的信息所指示的位置。Optionally, the processing unit 1002 is further configured to, if the second statement indicates an insert operation, before establishing the corresponding relationship, determine the ciphertext data corresponding to the plaintext data according to the second statement; store the ciphertext data in a corresponding storage location, and store the The position is the position indicated by the information of the storage position in the corresponding relationship.
可选地,处理单元1002,还用于若第二语句指示查询操作,从索引结构中查询密文数据的存储位置的信息之后,根据存储位置的信息,查询密文数据。Optionally, the processing unit 1002 is further configured to query the ciphertext data according to the information of the storage location after querying the information of the storage location of the ciphertext data from the index structure if the second statement indicates a query operation.
发送单元1003,用于向客户端返回密文数据。The sending unit 1003 is configured to return ciphertext data to the client.
可选地,处理单元1002,还用于若第二语句指示更新索引值,第二语句还包括明文数 据原来的密文索引值,则根据原来的密文索引值查询原来的密文索引和存储位置的信息之间的对应关系;根据密文索引值更新索引结构中的原来的密文索引值与存储位置的信息之间的对应关系。Optionally, the processing unit 1002 is further configured to query the original ciphertext index and store the original ciphertext index according to the original ciphertext index value if the second statement indicates to update the index value, and the second statement also includes the original ciphertext index value of the plaintext data. Correspondence between the information of the location; update the correspondence between the original ciphertext index value in the index structure and the information of the storage location according to the ciphertext index value.
可选地,处理单元1002,还用于若第二语句指示更新密文数据,第二语句中还包括或指示明文数据的密文数据,以及更新前的明文数据的密文索引值,则根据更新前的明文数据的密文索引值查询更新前的明文数据的密文索引值与存储位置的信息之间的对应关系;根据明文数据的密文索引值更新更新前的明文数据的密文索引值与存储位置的信息之间的对应关系;根据明文数据的密文数据更新存储位置的密文数据。Optionally, the processing unit 1002 is further configured to, if the second statement indicates to update the ciphertext data, the second statement also includes or indicates the ciphertext data of the plaintext data, and the ciphertext index value of the plaintext data before the update, according to The ciphertext index value of the plaintext data before the update is to query the correspondence between the ciphertext index value of the plaintext data before the update and the information of the storage location; update the ciphertext index of the plaintext data before the update according to the ciphertext index value of the plaintext data Correspondence between the value and the information of the storage location; update the ciphertext data of the storage location according to the ciphertext data of the plaintext data.
可选地,处理单元1002,还用于若第二语句指示删除索引值,从索引结构的密文索引值与存储位置的信息之间的对应关系中删除密文索引值。Optionally, the processing unit 1002 is further configured to delete the ciphertext index value from the correspondence between the ciphertext index value of the index structure and the information of the storage location if the second statement indicates to delete the index value.
可选地,处理单元1002,还用于若第二语句指示删除密文数据,根据存储位置的信息,删除存储位置的密文数据,并从索引结构中删除密文索引值与密文数据的存储位置的信息之间的对应关系。Optionally, the processing unit 1002 is further configured to delete the ciphertext data in the storage location according to the information of the storage location if the second statement indicates to delete the ciphertext data, and delete the difference between the ciphertext index value and the ciphertext data from the index structure. The correspondence between the information of the storage location.
可选地,接收单元1001,还用于接收创建索引语句。Optionally, the receiving unit 1001 is further configured to receive an index creation statement.
处理单元1002,还用于根据创建索引语句查询第二语句的指定表的指定列。The processing unit 1002 is further configured to query the specified column of the specified table of the second statement according to the index creation statement.
发送单元1003,用于当指定列上存在已有数据时,向客户端发送已有数据。The sending unit 1003 is configured to send the existing data to the client when existing data exists in the specified column.
接收单元1001,还用于接收已有数据的密文索引值。The receiving unit 1001 is further configured to receive the ciphertext index value of the existing data.
处理单元1002,还用于在索引结构中建立已有数据的密文索引值与已有数据的存储位置的信息之间的对应关系。The processing unit 1002 is further configured to establish a correspondence between the ciphertext index value of the existing data and the information of the storage location of the existing data in the index structure.
以上所描述的客户端和云设备的功能可以参阅前述图1至图10部分的相应描述进行理解,此处不再重复赘述。The functions of the client and the cloud device described above can be understood by referring to the corresponding descriptions in the foregoing parts of FIG. 1 to FIG. 10 , which will not be repeated here.
图13示出的是与本申请实施例提供的客户端是手机的部分结构的框图。参考图13,手机包括:射频(:Radio Frequency,:RF)电路810、存储器820、输入单元830、显示单元840、传感器850、音频电路860、无线保真(wireless fidelity,WiFi)模块870、处理器880、以及电源890等部件。本领域技术人员可以理解,图13中示出的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。FIG. 13 is a block diagram showing a partial structure of a mobile phone provided by an embodiment of the present application. 13 , the mobile phone includes: a radio frequency (: Radio Frequency,: RF) circuit 810, a memory 820, an input unit 830, a display unit 840, a sensor 850, an audio circuit 860, a wireless fidelity (WiFi) module 870, a processing 880, and the power supply 890 and other components. Those skilled in the art can understand that the structure of the mobile phone shown in FIG. 13 does not constitute a limitation on the mobile phone, and may include more or less components than shown, or combine some components, or arrange different components.
下面结合图13对手机的各个构成部件进行具体的介绍:The following is a detailed introduction to each component of the mobile phone with reference to Figure 13:
RF电路810可用于收发信息或通话过程中,信号的接收和发送,特别地,将基站的下行信息接收后,给处理器880处理;另外,将设计上行的数据发送给基站。通常,RF电路810包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low Noise Amplifier,LNA)、双工器等。The RF circuit 810 can be used for receiving and sending signals during sending and receiving of information or during a call. In particular, after receiving the downlink information of the base station, it is processed by the processor 880; in addition, the designed uplink data is sent to the base station. Typically, the RF circuit 810 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like.
存储器820可用于存储软件程序以及模块,处理器880通过运行存储在存储器820的软件程序以及模块,从而执行手机的各种功能应用以及数据处理。存储器820可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据手机的根据所创建的数据(比如音频数据、电话本等)等。此外,存储器820可以包括高速随机存取存储器,还可以 包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory 820 can be used to store software programs and modules, and the processor 880 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 820 . The memory 820 may mainly include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; According to the data created by the mobile phone (such as audio data, phone book, etc.) and so on. Additionally, memory 820 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
输入单元830可用于接收用户输入的信息:如用户口令,以及产生与手机的用户设置以及功能控制有关的键信号输入。具体地,输入单元830可包括触控面板831以及其他输入设备832。触控面板831,也称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户根据手指、触笔等任何适合的物体或附件在触控面板831上或在触控面板831附近的操作),并根据预先设定的程式驱动相应的连接装置。可选的,触控面板831可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器880,并能接收处理器880发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板831。除了触控面板831,输入单元830还可以包括其他输入设备832。具体地,其他输入设备832可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。The input unit 830 can be used to receive information input by the user, such as a user password, and generate key signal input related to user settings and function control of the mobile phone. Specifically, the input unit 830 may include a touch panel 831 and other input devices 832 . The touch panel 831, also referred to as a touch screen, can collect the user's touch operations on or near it (such as the user's finger, stylus, etc., any suitable object or attachment on or near the touch panel 831). operation), and drive the corresponding connection device according to the preset program. Optionally, the touch panel 831 may include two parts, a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the touch controller. To the processor 880, and can receive the command sent by the processor 880 and execute it. In addition, the touch panel 831 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. Besides the touch panel 831 , the input unit 830 may further include other input devices 832 . Specifically, other input devices 832 may include, but are not limited to, one or more of physical keyboards, function keys (such as volume control keys, switch keys, etc.), trackballs, mice, joysticks, and the like.
显示单元840可用于显示APP的界面内容。显示单元840可包括显示面板841,可选的,可以采用液晶显示器(英文全称:Liquid Crystal Display,英文缩写:LCD)、有机发光二极管(英文全称:Organic Light-Emitting Diode,英文缩写:OLED)等形式来配置显示面板841。进一步的,触控面板831可覆盖显示面板841,当触控面板831检测到在其上或附近的触摸操作后,传送给处理器880以确定触摸事件的类型,随后处理器880根据触摸事件的类型在显示面板841上提供相应的视觉输出。虽然在图13中,触控面板831与显示面板841是作为两个独立的部件来实现手机的输入和输入功能,但是在某些实施例中,可以将触控面板831与显示面板841集成而实现手机的输入和输出功能。The display unit 840 may be used to display the interface content of the APP. The display unit 840 may include a display panel 841. Optionally, a liquid crystal display (English full name: Liquid Crystal Display, English abbreviation: LCD), an organic light-emitting diode (English full name: Organic Light-Emitting Diode, English abbreviation: OLED), etc. The display panel 841 is configured in the form. Further, the touch panel 831 can cover the display panel 841, and when the touch panel 831 detects a touch operation on or near it, it transmits it to the processor 880 to determine the type of the touch event, and then the processor 880 determines the type of the touch event according to the touch event. Type provides corresponding visual output on display panel 841 . Although in FIG. 13, the touch panel 831 and the display panel 841 are used as two independent components to realize the input and input functions of the mobile phone, in some embodiments, the touch panel 831 and the display panel 841 can be integrated to form Realize the input and output functions of the mobile phone.
手机还可包括至少一种传感器850,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板841的亮度,接近传感器可在手机移动到耳边时,关闭显示面板841和/或背光。作为运动传感器的一种,加速计传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于手机还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。The cell phone may also include at least one sensor 850, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 841 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 841 and/or when the mobile phone is moved to the ear. or backlight. As a kind of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (usually three axes), and can detect the magnitude and direction of gravity when it is stationary. games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc. Repeat.
音频电路860、扬声器861,传声器862可提供用户与手机之间的音频接口。音频电路860可将接收到的音频数据转换后的电信号,传输到扬声器861,由扬声器861转换为声音信号输出;另一方面,传声器862将收集的声音信号转换为电信号,由音频电路860接收后转换为音频数据,再将音频数据输出处理器880处理后,经RF电路810以发送给比如另一手机,或者将音频数据输出至存储器820以便进一步处理。The audio circuit 860, the speaker 861, and the microphone 862 can provide an audio interface between the user and the mobile phone. The audio circuit 860 can transmit the received audio data converted electrical signals to the speaker 861, and the speaker 861 converts them into sound signals for output; on the other hand, the microphone 862 converts the collected sound signals into electrical signals, and the audio circuit 860 converts the collected sound signals into electrical signals. After receiving, it is converted into audio data, and then the audio data is output to the processor 880 for processing, and then sent to, for example, another mobile phone through the RF circuit 810, or the audio data is output to the memory 820 for further processing.
WiFi属于短距离无线传输技术,手机通过WiFi模块870可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图13示出了WiFi 模块870,但是可以理解的是,其并不属于手机的必须构成,完全可以根据需要在不改变发明的本质的范围内而省略。WiFi is a short-distance wireless transmission technology. The mobile phone can help users to send and receive emails, browse web pages, and access streaming media through the WiFi module 870. It provides users with wireless broadband Internet access. Although FIG. 13 shows the WiFi module 870, it can be understood that it is not a necessary component of the mobile phone, and can be completely omitted as required within the scope of not changing the essence of the invention.
处理器880是手机的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器820内的软件程序和/或模块,以及调用存储在存储器820内的数据,执行手机的各种功能和处理数据,从而对手机进行整体监控。可选的,处理器880可包括一个或多个处理单元;优选的,处理器880可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器880中。The processor 880 is the control center of the mobile phone, using various interfaces and lines to connect various parts of the entire mobile phone, by running or executing the software programs and/or modules stored in the memory 820, and calling the data stored in the memory 820. Various functions of the mobile phone and processing data, so as to monitor the mobile phone as a whole. Optionally, the processor 880 may include one or more processing units; preferably, the processor 880 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc. , the modem processor mainly deals with wireless communication. It can be understood that, the above-mentioned modulation and demodulation processor may not be integrated into the processor 880.
手机还包括给各个部件供电的电源890(比如电池),优选的,电源可以通过电源管理系统与处理器880逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。The mobile phone also includes a power supply 890 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 880 through a power management system, so as to manage charging, discharging, and power consumption management functions through the power management system.
尽管未示出,手机还可以包括摄像头、蓝牙模块等,在此不再赘述。Although not shown, the mobile phone may also include a camera, a Bluetooth module, and the like, which will not be repeated here.
在本申请实施例中,处理器880还具有上述所描述客户端的数据管理的功能。In this embodiment of the present application, the processor 880 also has the function of data management of the client described above.
图14所示,为本申请的实施例提供的上述实施例中所涉及的云设备的一种可能的逻辑结构示意图。云设备110包括:处理器1101、通信接口1102、存储器1103以及总线1104。处理器1101、通信接口1102以及存储器1103通过总线1104相互连接。在本申请的实施例中,处理器1101用于对云设备110的动作进行控制管理,例如,处理器1101用于执行图3至图10中云设备对令牌的校验过程,和/或用于本文所描述的技术的其他过程。通信接口1102用于支持云设备110进行通信,例如:通信接口1102可以执行上述方法实施例中数据的发送和接收的步骤。存储器1103,用于存储云设备110的程序代码和数据。FIG. 14 is a schematic diagram of a possible logical structure of the cloud device involved in the above-mentioned embodiment provided by the embodiment of the present application. The cloud device 110 includes: a processor 1101 , a communication interface 1102 , a memory 1103 and a bus 1104 . The processor 1101 , the communication interface 1102 , and the memory 1103 are connected to each other through a bus 1104 . In this embodiment of the present application, the processor 1101 is configured to control and manage the actions of the cloud device 110. For example, the processor 1101 is configured to perform the verification process of the token by the cloud device in FIG. 3 to FIG. 10, and/or Additional procedures for the techniques described herein. The communication interface 1102 is used to support the cloud device 110 to communicate, for example, the communication interface 1102 can perform the steps of sending and receiving data in the above method embodiments. The memory 1103 is used to store program codes and data of the cloud device 110 .
其中,处理器1101可以是中央处理器单元,通用处理器,数字信号处理器,专用集成电路,现场可编程门阵列或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。其可以实现或执行结合本申请公开内容所描述的各种示例性的逻辑方框,模块和电路。处理器也可以是实现计算功能的组合,例如包含一个或多个微处理器组合,数字信号处理器和微处理器的组合等等。总线1104可以是外设部件互连标准(Peripheral Component Interconnect,PCI)总线或扩展工业标准结构(Extended Industry Standard Architecture,EISA)总线等。总线可以分为地址总线、数据总线、控制总线等。为便于表示,图14中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The processor 1101 may be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array, or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute the various exemplary logical blocks, modules and circuits described in connection with this disclosure. A processor may also be a combination that performs computing functions, such as a combination comprising one or more microprocessors, a combination of a digital signal processor and a microprocessor, and the like. The bus 1104 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (Extended Industry Standard Architecture, EISA) bus or the like. The bus can be divided into address bus, data bus, control bus and so on. For ease of presentation, only one thick line is shown in FIG. 14, but it does not mean that there is only one bus or one type of bus.
在本申请的另一实施例中,还提供一种计算机可读存储介质,计算机可读存储介质中存储有计算机执行指令,当设备的至少一个处理器执行该计算机执行指令时,设备执行上述图3至图10部分实施例所描述的数据管理的方法。In another embodiment of the present application, a computer-readable storage medium is also provided, where computer-executable instructions are stored in the computer-readable storage medium, and when at least one processor of a device executes the computer-executable instructions, the device executes the above diagram 3 to FIG. 10 describe the data management method in some embodiments.
在本申请的另一实施例中,还提供一种计算机程序产品,该计算机程序产品包括计算机执行指令,该计算机执行指令存储在计算机可读存储介质中;设备的至少一个处理器可以从计算机可读存储介质读取该计算机执行指令,至少一个处理器执行该计算机执行指令使得设备执行上述图3至图10部分实施例所描述的数据管理的方法。In another embodiment of the present application, a computer program product is also provided, the computer program product includes computer-executable instructions, and the computer-executable instructions are stored in a computer-readable storage medium; at least one processor of the device can be obtained from a computer-readable storage medium. Reading the storage medium reads the computer-executable instructions, and at least one processor executes the computer-executable instructions to cause the device to perform the data management methods described in the above-mentioned partial embodiments of FIG. 3 to FIG. 10 .
在本申请的另一实施例中,还提供一种芯片系统,该芯片系统包括处理器,用于支持客户端实现上述图3至图10部分实施例所描述的数据管理的方法。在一种可能的设计中,芯 片系统还可以包括存储器,存储器用于存储必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件。In another embodiment of the present application, a chip system is further provided, where the chip system includes a processor, and is configured to support a client to implement the data management methods described in the above-mentioned partial embodiments of FIG. 3 to FIG. 10 . In one possible design, the system-on-chip may also include memory for storing necessary program instructions and data. The chip system may be composed of chips, or may include chips and other discrete devices.
在本申请的另一实施例中,还提供一种芯片系统,该芯片系统包括处理器,用于支持云设备实现上述图3至图10部分实施例所描述的数据管理的方法。在一种可能的设计中,芯片系统还可以包括存储器,存储器用于存储必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件。In another embodiment of the present application, a chip system is further provided, the chip system includes a processor, and is configured to support a cloud device to implement the data management methods described in the above-mentioned partial embodiments of FIG. 3 to FIG. 10 . In one possible design, the chip system may further include a memory for storing necessary program instructions and data. The chip system may be composed of chips, or may include chips and other discrete devices.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来根据不同方法来实现所描述的功能,但是这种实现不应认为超出本申请实施例的范围。Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. A skilled person can implement the described functions according to different methods for each specific application, but such implementation should not be considered beyond the scope of the embodiments of the present application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described systems, devices and units may refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here.
在本申请实施例所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided by the embodiments of the present application, it should be understood that the disclosed systems, devices and methods may be implemented in other manners. For example, the apparatus embodiments described above are only illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods, for example, multiple units or components may be combined or integrated. to another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。Units described as separate components may or may not be physically separated, and components shown as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
另外,在本申请实施例各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the embodiments of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
功能如果以软件功能单元的形式实现并作为独立的产品销售或根据时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请实施例各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The functions, if implemented in the form of software functional units and sold as stand-alone products or based, may be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application can be embodied in the form of software products in essence, or the parts that make contributions to the prior art or the parts of the technical solutions, and the computer software products are stored in a storage medium , including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in the embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program codes .
以上,仅为本申请实施例的具体实施方式,但本申请实施例的保护范围并不局限于此。The above are only specific implementations of the embodiments of the present application, but the protection scope of the embodiments of the present application is not limited thereto.

Claims (28)

  1. 一种数据管理的方法,其特征在于,包括:A method for data management, comprising:
    获取第一语句,所述第一语句包括明文数据;obtaining a first statement, where the first statement includes plaintext data;
    根据所述明文数据的信息,确定密文索引值;According to the information of the plaintext data, determine the ciphertext index value;
    向云设备发送第二语句,所述第二语句包括所述密文索引值,所述密文索引值被所述云设备用在索引结构中建立所述密文索引值与密文数据的存储位置的信息之间的对应关系,或者,从索引结构中查询密文数据的存储位置的信息,所述密文数据为所述明文数据对应的加密数据,所述存储位置的信息指示所述密文数据的存储位置。Send a second statement to the cloud device, the second statement includes the ciphertext index value, and the ciphertext index value is used by the cloud device to establish storage of the ciphertext index value and ciphertext data in an index structure The corresponding relationship between the information of the location, or the information of the storage location of the ciphertext data is queried from the index structure, the ciphertext data is the encrypted data corresponding to the plaintext data, and the information of the storage location indicates the ciphertext data. The storage location of the text data.
  2. 根据权利要求1所述的方法,其特征在于,The method of claim 1, wherein:
    所述明文数据的信息包括所述明文数据的值、所述明文数据的类型以及所述明文数据的取值范围。The information of the plaintext data includes the value of the plaintext data, the type of the plaintext data, and the value range of the plaintext data.
  3. 根据权利要求2所述的方法,其特征在于,所述根据所述明文数据的信息,确定密文索引值,包括:The method according to claim 2, wherein the determining the ciphertext index value according to the information of the plaintext data comprises:
    对所述明文数据的值、所述明文数据的类型以及所述明文数据的取值范围进行归一化处理,以得到明文值、明文空间和密文空间;normalizing the value of the plaintext data, the type of the plaintext data and the value range of the plaintext data to obtain the plaintext value, the plaintext space and the ciphertext space;
    根据所述明文值、所述明文空间和密文空间,确定所述密文索引值。The ciphertext index value is determined according to the plaintext value, the plaintext space and the ciphertext space.
  4. 根据权利要求3所述的方法,其特征在于,所述根据所述明文值、所述明文空间和所述密文空间,确定所述密文索引值,包括:The method according to claim 3, wherein the determining the ciphertext index value according to the plaintext value, the plaintext space and the ciphertext space comprises:
    在所述密文空间的采样区间进行采样,以得到采样点,所述采样区间与所述明文空间的中点对应;Sampling is performed in the sampling interval of the ciphertext space to obtain a sampling point, and the sampling interval corresponds to the midpoint of the plaintext space;
    根据所述中点与所述明文值,缩小所述明文空间和密文空间,以得到缩小的明文空间和缩小的密文空间,所述缩小的明文空间以所述中点为边界,且包含所述明文值,所述缩小的密文空间以所述采样点为边界;According to the midpoint and the plaintext value, the plaintext space and the ciphertext space are reduced to obtain a reduced plaintext space and a reduced ciphertext space, and the reduced plaintext space is bounded by the midpoint and includes the plaintext value, the reduced ciphertext space is bounded by the sampling point;
    重复执行上述采样和缩小明文空间和密文空间的步骤,直到所述缩小的明文空间的上边界与下边界重合,所述上边界与下边界重合时所对应的缩小的密文空间的采样点为所述密文索引值。Repeat the above steps of sampling and reducing the plaintext space and the ciphertext space until the upper boundary of the reduced plaintext space and the lower boundary coincide, and the sampling point of the reduced ciphertext space corresponding to the coincidence of the upper boundary and the lower boundary is the ciphertext index value.
  5. 根据权利要求4所述的方法,其特征在于,所述在所述密文空间的采样区间进行采样,以得到采样点,包括:The method according to claim 4, wherein the sampling in the sampling interval of the ciphertext space to obtain sampling points comprises:
    通过不可预测的伪随机数对所述采样区间的大小进行取模计算,以得到取模值;Perform modulo calculation on the size of the sampling interval by using an unpredictable pseudo-random number to obtain a modulo value;
    根据所述取模值从所述采样区间确定对应的采样点。The corresponding sampling point is determined from the sampling interval according to the modulo value.
  6. 根据权利要求5所述的方法,其特征在于,所述上边界与下边界重合时,对所述缩小的密文空间的采样为非确定性采样。The method according to claim 5, wherein when the upper boundary and the lower boundary coincide, the sampling of the reduced ciphertext space is non-deterministic sampling.
  7. 根据权利要求1-6任一项所述的方法,其特征在于,所述第一语句指示插入操作或更新操作,所述方法还包括:The method according to any one of claims 1-6, wherein the first statement indicates an insert operation or an update operation, and the method further comprises:
    对所述明文数据采用对称加密处理,以得到所述明文数据的密文数据;Symmetric encryption processing is applied to the plaintext data to obtain ciphertext data of the plaintext data;
    所述第二语句还包括或指示所述密文数据,所述密文数据被所述云设备存储到相应的存储位置。The second sentence further includes or indicates the ciphertext data, and the ciphertext data is stored in a corresponding storage location by the cloud device.
  8. 根据权利要求1-6任一项所述的方法,其特征在于,所述第一语句指示查询操作,所述方法还包括:The method according to any one of claims 1-6, wherein the first statement indicates a query operation, and the method further comprises:
    对所述第二语句进行加扰;scrambling the second sentence;
    接收所述云设备返回的查询结果,并对所述查询结果进行解扰。The query result returned by the cloud device is received, and the query result is descrambled.
  9. 根据权利要求1-8任一项所述的方法,其特征在于,所述获取第一语句之后,所述方法还包括:The method according to any one of claims 1-8, wherein after acquiring the first statement, the method further comprises:
    向所述云设备发送创建索引语句,所述创建索引语句指示所述第一语句的指定表的指定列;sending an index creation statement to the cloud device, where the index creation statement indicates the specified column of the specified table of the first statement;
    接收所述云设备返回的所述指定列上的已有数据;receiving the existing data on the specified column returned by the cloud device;
    确定所述已有数据的密文索引值;determining the ciphertext index value of the existing data;
    向所述云设备发送所述已有数据的密文索引值。Send the ciphertext index value of the existing data to the cloud device.
  10. 一种数据管理的方法,其特征在于,包括:A method for data management, comprising:
    接收来源于客户端的第二语句,所述第二语句包括所述客户端响应于第一语句,根据明文数据的信息确定的密文索引值,所述第一语句包括所述明文数据;receiving a second statement from a client, where the second statement includes a ciphertext index value determined by the client in response to the first statement and according to information of plaintext data, and the first statement includes the plaintext data;
    响应于第二语句,根据所述密文索引值在索引结构中建立所述密文索引值与密文数据的存储位置的信息之间的对应关系,或者,从索引结构中查询密文数据的存储位置的信息,所述密文数据为所述明文数据对应的加密数据,所述存储位置的信息指示所述密文数据的存储位置。In response to the second statement, establish a correspondence between the ciphertext index value and the information of the storage location of the ciphertext data in the index structure according to the ciphertext index value, or query the index structure for the information of the ciphertext data. Storage location information, the ciphertext data is encrypted data corresponding to the plaintext data, and the storage location information indicates the storage location of the ciphertext data.
  11. 根据权利要求10所述的方法,其特征在于,所述第二语句指示插入操作,在建立所述对应关系之前,所述方法还包括:The method according to claim 10, wherein the second statement indicates an insert operation, and before establishing the corresponding relationship, the method further comprises:
    根据所述第二语句确定所述明文数据对应的密文数据;Determine the ciphertext data corresponding to the plaintext data according to the second statement;
    将所述密文数据存储到相应的存储位置,所述存储位置为所述对应关系中存储位置的信息所指示的位置。The ciphertext data is stored in a corresponding storage location, where the storage location is the location indicated by the storage location information in the corresponding relationship.
  12. 根据权利要求10所述的方法,其特征在于,所述第二语句指示查询操作,所述从索引结构中查询密文数据的存储位置的信息之后,所述方法还包括:The method according to claim 10, wherein the second statement indicates a query operation, and after querying the information of the storage location of the ciphertext data from the index structure, the method further comprises:
    根据存储位置的信息,查询所述密文数据;query the ciphertext data according to the information of the storage location;
    向所述客户端返回所述密文数据。Return the ciphertext data to the client.
  13. 根据权利要求10所述的方法,其特征在于,所述第二语句指示更新索引值,所述第二语句还包括所述明文数据原来的密文索引值,所述方法还包括:The method according to claim 10, wherein the second statement instructs to update the index value, the second statement further includes the original ciphertext index value of the plaintext data, and the method further comprises:
    根据所述原来的密文索引值查询所述原来的密文索引和存储位置的信息之间的对应关系;Query the correspondence between the original ciphertext index and the information of the storage location according to the original ciphertext index value;
    根据所述密文索引值更新所述索引结构中的原来的密文索引值与存储位置的信息之间的对应关系。The correspondence between the original ciphertext index value in the index structure and the information of the storage location is updated according to the ciphertext index value.
  14. 根据权利要求10所述的方法,其特征在于,所述第二语句指示更新密文数据,所述第二语句中还包括或指示所述明文数据的密文数据,以及更新前的明文数据的密文索引值,所述方法还包括:The method according to claim 10, wherein the second sentence indicates to update the ciphertext data, the second sentence further includes or indicates the ciphertext data of the plaintext data, and the ciphertext data of the plaintext data before the update. ciphertext index value, the method further includes:
    根据更新前的明文数据的密文索引值查询所述更新前的明文数据的密文索引值与存储 位置的信息之间的对应关系;Query the correspondence between the ciphertext index value of the plaintext data before the update and the information of the storage location according to the ciphertext index value of the plaintext data before the update;
    根据所述明文数据的密文索引值更新所述更新前的明文数据的密文索引值与存储位置的信息之间的对应关系;Update the correspondence between the ciphertext index value of the plaintext data before the update and the information of the storage location according to the ciphertext index value of the plaintext data;
    根据所述明文数据的密文数据更新所述存储位置的密文数据。The ciphertext data of the storage location is updated according to the ciphertext data of the plaintext data.
  15. 根据权利要求10所述的方法,其特征在于,所述第二语句指示删除索引值,所述方法还包括:The method of claim 10, wherein the second statement instructs to delete the index value, the method further comprising:
    从所述索引结构的所述密文索引值与存储位置的信息之间的对应关系中删除所述密文索引值。The ciphertext index value is deleted from the correspondence between the ciphertext index value of the index structure and the information of the storage location.
  16. 根据权利要求10所述的方法,其特征在于,所述第二语句指示删除密文数据,所述方法还包括:The method according to claim 10, wherein the second sentence indicates to delete the ciphertext data, and the method further comprises:
    根据所述存储位置的信息,删除所述存储位置的密文数据,并从所述索引结构中删除所述密文索引值与密文数据的存储位置的信息之间的对应关系。According to the information of the storage location, the ciphertext data of the storage location is deleted, and the correspondence between the ciphertext index value and the information of the storage location of the ciphertext data is deleted from the index structure.
  17. 根据权利要求10-16任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 10-16, wherein the method further comprises:
    接收创建索引语句;Receive the create index statement;
    根据所述创建索引语句查询所述第二语句的指定表的指定列;Query the specified column of the specified table of the second statement according to the index creation statement;
    当所述指定列上存在已有数据时,向客户端发送所述已有数据;When existing data exists on the specified column, send the existing data to the client;
    接收所述已有数据的密文索引值;receiving the ciphertext index value of the existing data;
    在所述索引结构中建立所述已有数据的密文索引值与所述已有数据的存储位置的信息之间的对应关系。The corresponding relationship between the ciphertext index value of the existing data and the information of the storage location of the existing data is established in the index structure.
  18. 一种客户端,其特征在于,包括:A client, characterized in that it includes:
    获取单元,用于获取第一语句,所述第一语句包括明文数据;an acquisition unit, configured to acquire a first statement, where the first statement includes plaintext data;
    处理单元,用于根据所述获取单元获取的明文数据的信息,确定密文索引值;a processing unit, configured to determine the ciphertext index value according to the information of the plaintext data acquired by the acquiring unit;
    发送单元,用于向云设备发送第二语句,所述第二语句包括所述处理单元确定的密文索引值,所述密文索引值被所述云设备用于在索引结构中建立所述密文索引值与密文数据的存储位置的信息之间的对应关系,或者,从索引结构中查询密文数据的存储位置的信息,所述密文数据为所述明文数据对应的加密数据,所述存储位置的信息指示所述密文数据的存储位置。a sending unit, configured to send a second statement to the cloud device, where the second statement includes a ciphertext index value determined by the processing unit, and the ciphertext index value is used by the cloud device to establish the ciphertext index in the index structure The correspondence between the ciphertext index value and the information of the storage location of the ciphertext data, or, query the information of the storage location of the ciphertext data from the index structure, and the ciphertext data is the encrypted data corresponding to the plaintext data, The information of the storage location indicates the storage location of the ciphertext data.
  19. 根据权利要求18所述的客户端,其特征在于,所述明文数据的信息包括所述明文数据的值、所述明文数据的类型以及所述明文数据的取值范围。The client according to claim 18, wherein the information of the plaintext data includes a value of the plaintext data, a type of the plaintext data, and a value range of the plaintext data.
  20. 根据权利要求19所述的客户端,其特征在于,The client according to claim 19, wherein,
    所述处理单元,用于对所述明文数据的值、所述明文数据的类型以及所述明文数据的取值范围进行归一化处理,以得到明文值、明文空间和密文空间;根据所述明文值、所述明文空间和密文空间,确定所述密文索引值。The processing unit is configured to perform normalization processing on the value of the plaintext data, the type of the plaintext data and the value range of the plaintext data to obtain the plaintext value, the plaintext space and the ciphertext space; The plaintext value, the plaintext space and the ciphertext space are described, and the ciphertext index value is determined.
  21. 根据权利要求20所述的客户端,其特征在于,The client according to claim 20, wherein,
    所述处理单元,用于在所述密文空间的采样区间进行采样,以得到采样点,所述采样区间与所述明文空间的中点对应;根据所述中点与所述明文值,缩小所述明文空间和密文空间,以得到缩小的明文空间和缩小的密文空间,所述缩小的明文空间以所述中点为边界, 且包含所述明文值,所述缩小的密文空间以所述采样点为边界;重复执行上述采样和缩小明文空间和密文空间的步骤,直到所述缩小的明文空间的上边界与下边界重合,所述上边界与下边界重合时所对应的缩小的密文空间的采样点为所述密文索引值。The processing unit is configured to perform sampling in a sampling interval of the ciphertext space to obtain a sampling point, and the sampling interval corresponds to a midpoint of the plaintext space; according to the midpoint and the plaintext value, reduce the the plaintext space and the ciphertext space to obtain a reduced plaintext space and a reduced ciphertext space, the reduced plaintext space is bounded by the midpoint and contains the plaintext value, and the reduced ciphertext space Take the sampling point as the boundary; repeat the above-mentioned steps of sampling and reducing the plaintext space and the ciphertext space, until the upper boundary and the lower boundary of the reduced plaintext space coincide, and the corresponding value when the upper boundary and the lower boundary coincide. The sampling point of the reduced ciphertext space is the ciphertext index value.
  22. 一种云设备,其特征在于,包括:A cloud device, comprising:
    接收单元,用于接收来源于客户端的第二语句,所述第二语句包括所述客户端响应于第一语句,根据明文数据的信息确定的密文索引值,所述第一语句包括所述明文数据;a receiving unit, configured to receive a second sentence from a client, where the second sentence includes a ciphertext index value determined by the client in response to the first sentence according to information of plaintext data, and the first sentence includes the plaintext data;
    处理单元,用于响应于所述接收单元接收的第二语句,根据所述密文索引值在索引结构中建立所述密文索引值与密文数据的存储位置的信息之间的对应关系,或者,从索引结构中查询密文数据的存储位置的信息,所述密文数据为所述明文数据对应的加密数据,所述存储位置的信息指示所述密文数据的存储位置。a processing unit, configured to, in response to the second statement received by the receiving unit, establish a correspondence between the ciphertext index value and the information of the storage location of the ciphertext data in the index structure according to the ciphertext index value, Alternatively, the information of the storage location of the ciphertext data is queried from the index structure, where the ciphertext data is encrypted data corresponding to the plaintext data, and the information of the storage location indicates the storage location of the ciphertext data.
  23. 根据权利要求22所述的云设备,其特征在于,所述云设备还包括发送单元,The cloud device according to claim 22, wherein the cloud device further comprises a sending unit,
    所述接收单元,还用于接收创建索引语句;The receiving unit is also used to receive the creation index statement;
    所述处理单元,还用于根据所述接收单元接收的创建索引语句查询所述第二语句的指定表的指定列;The processing unit is further configured to query the specified column of the specified table of the second statement according to the index creation statement received by the receiving unit;
    所述发送单元,还用于当所述指定列上存在已有数据时,向客户端发送所述已有数据;The sending unit is further configured to send the existing data to the client when existing data exists on the designated column;
    所述接收单元,还用于接收所述已有数据的密文索引值;The receiving unit is further configured to receive the ciphertext index value of the existing data;
    所述处理单元,还用于在所述索引结构中建立所述已有数据的密文索引值与所述已有数据的存储位置的信息之间的对应关系。The processing unit is further configured to establish a correspondence between the ciphertext index value of the existing data and the information of the storage location of the existing data in the index structure.
  24. 一种客户端,其特征在于,所述客户端包括至少一个处理器、存储器及存储在所述存储器上并可被所述至少一个处理器执行的指令,其特征在于,所述至少一个处理器执行所述指令,以实现权利要求1至9中任一项所述的方法的步骤。A client, characterized in that the client includes at least one processor, a memory, and instructions stored on the memory and executable by the at least one processor, characterized in that the at least one processor The instructions are executed to implement the steps of the method of any one of claims 1 to 9.
  25. 一种云设备,其特征在于,包括:所述云设备包括至少一个处理器、存储器及存储在所述存储器上并可被所述至少一个处理器执行的指令,其特征在于,所述至少一个处理器执行所述指令,以实现权利要求10至17中任一项所述的方法的步骤。A cloud device, comprising: the cloud device includes at least one processor, a memory, and instructions stored on the memory and executable by the at least one processor, wherein the at least one The instructions are executed by a processor to implement the steps of the method of any of claims 10 to 17.
  26. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现权利要求1至9中任一项所述的方法。A computer-readable storage medium on which a computer program is stored, characterized in that, when the program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
  27. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现权利要求10至17中任一项所述的方法。A computer-readable storage medium on which a computer program is stored, characterized in that, when the program is executed by a processor, the method of any one of claims 10 to 17 is implemented.
  28. 一种数据管理系统,其特征在于,包括:客户端和云设备,所述客户端用于执行上述权利要求1至9中任一项所述的方法,所述云设备用于执行上述权利要求10至17中任一项所述的方法。A data management system, comprising: a client and a cloud device, the client is configured to execute the method according to any one of the preceding claims 1 to 9, and the cloud device is configured to execute the preceding claims The method of any one of 10 to 17.
PCT/CN2022/071757 2021-01-25 2022-01-13 Data management method, device, and system WO2022156588A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110098939.6A CN114792009A (en) 2021-01-25 2021-01-25 Data management method, equipment and system
CN202110098939.6 2021-01-25

Publications (1)

Publication Number Publication Date
WO2022156588A1 true WO2022156588A1 (en) 2022-07-28

Family

ID=82460552

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/071757 WO2022156588A1 (en) 2021-01-25 2022-01-13 Data management method, device, and system

Country Status (2)

Country Link
CN (1) CN114792009A (en)
WO (1) WO2022156588A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115880789B (en) * 2023-02-08 2023-06-30 中昊芯英(杭州)科技有限公司 Encryption-based face recognition method, related device and storage medium
CN115952563B (en) * 2023-03-10 2023-09-12 深圳市一秋医纺科技有限公司 Data security communication system based on Internet of Things

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104765848A (en) * 2015-04-17 2015-07-08 中国人民解放军空军航空大学 Symmetrical searchable encryption method for supporting result high-efficiency sequencing in hybrid cloud storage
CN107370725A (en) * 2017-06-21 2017-11-21 西安电子科技大学 The access method and system of general encrypting database under a kind of cloud environment
CN108628867A (en) * 2017-03-16 2018-10-09 北京科瑞云安信息技术有限公司 Multi-key word cipher text retrieval method towards cloud storage and system
CN112231752A (en) * 2020-10-20 2021-01-15 南开大学 Ciphertext insertion query deletion method without interactive frequency hiding

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104765848A (en) * 2015-04-17 2015-07-08 中国人民解放军空军航空大学 Symmetrical searchable encryption method for supporting result high-efficiency sequencing in hybrid cloud storage
CN108628867A (en) * 2017-03-16 2018-10-09 北京科瑞云安信息技术有限公司 Multi-key word cipher text retrieval method towards cloud storage and system
CN107370725A (en) * 2017-06-21 2017-11-21 西安电子科技大学 The access method and system of general encrypting database under a kind of cloud environment
CN112231752A (en) * 2020-10-20 2021-01-15 南开大学 Ciphertext insertion query deletion method without interactive frequency hiding

Also Published As

Publication number Publication date
CN114792009A (en) 2022-07-26

Similar Documents

Publication Publication Date Title
US10255454B2 (en) Controlling security in relational databases
CN111373390B (en) Storing unstructured data in a structured framework
WO2022156588A1 (en) Data management method, device, and system
US9069987B2 (en) Secure data access using SQL query rewrites
US8769302B2 (en) Encrypting data and characterization data that describes valid contents of a column
US20190286837A1 (en) Database encryption
US9323798B2 (en) Storing a key value to a deleted row based on key range density
WO2021017305A1 (en) Data query method and apparatus, electronic device, and computer readable storage medium
WO2020088681A1 (en) Management method for model files and terminal device
US10790862B2 (en) Cache index mapping
CN103365941A (en) Information processing method and information processing system
WO2019104140A1 (en) Efficiently querying databases while providing differential privacy
US20200042609A1 (en) Methods and systems for searching directory access groups
US11461551B1 (en) Secure word search
CN113434501A (en) Storage method and device of relational database table and readable storage medium
CN105930104B (en) Date storage method and device
US20210224242A1 (en) Systems and methods for indexing and searching data
Tinoco et al. {EnigMap}:{External-Memory} Oblivious Map for Secure Enclaves
CN110297842B (en) Data comparison method, device, terminal and storage medium
US11151110B2 (en) Identification of records for post-cloning tenant identifier translation
CN113127717A (en) Key retrieval method and system
US20150106884A1 (en) Memcached multi-tenancy offload
US20190057130A1 (en) Method, system, and apparatus for performing flow-based processing using stored procedure
KR101754580B1 (en) Method and apprapatus for supporting full text search in embedded environment and computer program stored on computer-readable medium
US20230418878A1 (en) Multi-model enrichment memory and catalog for better search recall with granular provenance and lineage

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22742067

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22742067

Country of ref document: EP

Kind code of ref document: A1