A method for establishing an encrypted database and using fuzzy query
By converting database source data into three-dimensional graphics and encrypting feature data, it solves the fuzzy query problem in encrypted databases, realizes fuzzy query and security management of encrypted data, and supports data processing on big data and AI platforms.
Patent Information
- Application Number
- CN202411008582.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-26
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-07-26
AI Technical Summary
Existing encryption algorithms cannot perform fuzzy queries after encryption in the database, resulting in increased data management complexity and data leakage risks, affecting system performance and data security.
By converting source data into three-dimensional graphics, extracting feature data and encrypting it, generating feature encrypted data and directly encrypted data aggregation, it supports fuzzy queries in an encrypted state.
It realizes the fuzzy query capability of encrypted data, reduces the complexity of data management, enhances data security, supports characteristic data training of big data and AI platforms, and avoids the risk of data leakage.
Smart Images

Figure CN118550957B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data encryption and query, and in particular to a method for establishing an encrypted database and a fuzzy query method. Background Art
[0002] In the traditional database data encryption method, there are mainly three encryption methods: symmetric encryption algorithm, asymmetric encryption algorithm, and HASH algorithm. Among the symmetric encryption algorithms, there are mainly encryption algorithms such as DES, AES, and RC5. Among the asymmetric encryption algorithms, there are mainly encryption algorithms such as RSA, DSA, and Diffile-Hellman. Among the HASH algorithms, there are mainly encryption algorithms such as MD5, SHA-1, and SHA-2. In the process of encrypting database data through the above encryption algorithms, the encrypted data can only be decrypted or fully matched.
[0003] In business scenarios, data administrators often encounter situations where they need to perform fuzzy queries on specified encrypted data to find data during data processing and management operations on the management platform. If the data value has been encrypted by data encryption algorithms such as DES, SHA-2, and MD5, relevant fuzzy queries cannot be performed, which greatly increases the difficulty of overall data management and governance.
[0004] The commonly used methods in the industry are mainly based on encryption algorithms such as SM1, SM4, SM7, ZUC, DES, AES, RSA, and RC6. When data is encrypted using these algorithms, once the database data is encrypted, only full match queries can be performed, or fuzzy match queries can be performed after decryption. Fuzzy queries cannot be performed on the data in an encrypted state.
[0005] Existing encryption algorithms such as SM7, ZUC, DES, AES, and RSA cannot perform fuzzy queries after encrypting database data, which affects the user experience of data management. When querying encrypted data, the database administrator or the application user who needs to query needs to know the complete data or perform fuzzy queries after completely decrypting the encrypted data, which increases the operational complexity and management difficulty of data management. At the same time, the decryption operation of encrypted data may cause data leakage, the system IO (Input / Output) pressure is high, and the system performance and data security are affected.
[0006] Moreover, encrypted data cannot be used for data training: When a management or business platform introduces a big data platform or an AI (Artificial Intelligence) intelligent platform, the encrypted data in the database will affect the accuracy of data governance or AI training. The only way to perform relevant data training and processing on the big data platform or AI intelligent platform is to decrypt the encrypted data, which can easily lead to data leakage. Summary of the invention
[0007] In view of the above analysis, an embodiment of the present invention aims to provide a method for establishing and fuzzy querying an encrypted database, so as to solve the technical problems that the existing method cannot fuzzily query the encrypted data in the database and cannot perform data training.
[0008] The present invention provides a method for establishing an encrypted database and a fuzzy query method, comprising the following steps:
[0009] Acquire source data, and preprocess the source data to obtain a three-dimensional coordinate set W corresponding to the source data;
[0010] Encrypting each dimensional data element in the three-dimensional coordinate set W to form characteristic encrypted data K; encrypting the source data to obtain direct encrypted data V;
[0011] Aggregate the characteristic encrypted data K and the direct encrypted data V to generate complete encrypted data KEY and store it in the database;
[0012] The three-dimensional coordinate set of the query keyword is obtained and encrypted to generate query feature encrypted data K', and a fuzzy query is performed in the database.
[0013] Furthermore, each dimensional data element of the three-dimensional coordinate set W includes a distance value, an angle value, and an adjacent angle value; obtaining the three-dimensional coordinate set W corresponding to the source data includes:
[0014] Performing character segmentation on the source data;
[0015] The distance value and angle value of the two-dimensional coordinates corresponding to each character from the origin coordinate O, as well as the adjacent angle values with adjacent coordinate points are obtained; the origin coordinate O is generated based on a random number.
[0016] Furthermore, the encryption of each dimensional data element in the three-dimensional coordinate set W to form feature encrypted data K includes:
[0017] Connect the distance value and angle value in W, perform sha2 encryption, and obtain the sha2 hash value of the distance value and angle value;
[0018] Perform md5 hash encryption on the adjacent angle values in W to obtain the md5 hash values of the adjacent angle values;
[0019] Concatenate the sha2 hash value and the md5 hash value to obtain encrypted data ,as follows:
[0020] ;
[0021] Get encrypted data set , after random rearrangement, integration is performed to obtain the characteristic encrypted data K.
[0022] Furthermore, based on the two-dimensional vectorization of the characters obtained by segmentation in the source data, a two-dimensional coordinate point set A is obtained; the distance value and angle value of the two-dimensional coordinate corresponding to each character from the origin coordinate, as well as the adjacent angle value with the adjacent coordinate point are obtained, including:
[0023] Initialize the origin coordinates O and the common difference z;
[0024] Calculate the distance and angle from each coordinate point in the two-dimensional coordinate point set A to the origin coordinate O after subtracting the common difference z;
[0025] Calculate adjacent angle values between adjacent coordinate points in the two-dimensional coordinate point set A;
[0026] The distance value, angle value, and adjacent angle value of each two-dimensional coordinate point are combined to obtain a three-dimensional coordinate set W.
[0027] Furthermore, based on the two-dimensional vectorization of the characters obtained by segmentation in the source data, a two-dimensional coordinate point set A is obtained, including:
[0028] The source data is divided into a character array set, and the character array set is disassembled according to the character's area code or ASCII code to obtain the two-dimensional vector coordinates corresponding to each character .
[0029] Further, based on the initialization origin coordinates and the common difference z, calculate the two-dimensional coordinate point set A, each coordinate To origin Distance and angle values ,as follows:
[0030] ;
[0031] ;
[0032] Get the relationship set from the two-dimensional coordinate point set A to the origin coordinate O .
[0033] Furthermore, the adjacent coordinates of any two points in the two-dimensional coordinate point set A and Calculate the adjacent angle values, the last coordinate point and the first coordinate point calculate the adjacent angle values;
[0034] Calculate coordinate points Relative to the coordinate point The position of the coordinate system formed with the origin as the origin;
[0035] when When the position is in the first or third quadrant, calculate the coordinate point With coordinate points The adjacent angle values ε between them;
[0036] When the coordinate point When in the first quadrant, the calculation is as follows:
[0037] ;
[0038] ;
[0039] in, The coordinate points With coordinate points The distance and angle between the coordinate points When in the third quadrant, the last obtained Add 180 to the value;
[0040] when When the position is in the second or fourth quadrant, calculate the coordinate point With coordinate points The adjacent angle values ε between them;
[0041] When the coordinate point When in the second quadrant, the calculation is as follows:
[0042] ;
[0043] ;
[0044] When the coordinate point When in the fourth quadrant, the last acquired Add 180 to the value;
[0045] By calculating the adjacent angle values between all two adjacent points, we can obtain a set of adjacent angle values. .
[0046] Furthermore, the relationship set With the adjacent angle value set , integrate to obtain a set of three-dimensional feature vectors containing the characteristics of the source data .
[0047] Furthermore, the character array set is disassembled according to the character location code or ASCII code to obtain the two-dimensional vector coordinates corresponding to each character ,include:
[0048] If the character is a Chinese character, according to the GB2312 coding standard, the area code of each Chinese character is converted into a two-dimensional coordinate, the area code is the first-dimensional coordinate, and the bit code is the second-dimensional coordinate, to obtain the two-dimensional vector coordinate corresponding to the Chinese character;
[0049] Otherwise, if the character is an English character or Arabic numeral, according to the ASCII encoding, the ASCII code value is divided by 16 to obtain the first-dimensional coordinate; the ASCII code value modulo 16 is obtained to obtain the second-dimensional coordinate.
[0050] Furthermore, the three-dimensional coordinate set of the query keyword is obtained and encrypted to generate the query feature encrypted data K', including:
[0051] Get the query keyword and split it to form a character array set;
[0052] Decompose the character according to its area code or ASCII code to obtain a two-dimensional coordinate point set A';
[0053] Calculate the distance value l' and the angle value r' from each coordinate in the two-dimensional coordinate set A' to the origin coordinate O;
[0054] Calculate the adjacent angle values between adjacent coordinates in A' ;
[0055] The distance value l', the angle value r' and the adjacent angle value Combine to form a three-dimensional feature coordinate set W';
[0056] The three-dimensional feature coordinate set W' is encrypted to form query feature encrypted data K'.
[0057] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects:
[0058] 1. Convert the source data into three-dimensional graphics to extract data features, reduce the association between features and source data, and obtain data containing source data features at the same time. Encrypt the feature data to obtain encrypted data containing features, so that encrypted data can be fuzzy queried. At the same time, it avoids the risk of data leakage caused by the need to completely decrypt data in traditional data encryption methods for fuzzy queries, thereby enhancing data security.
[0059] 2. Support fuzzy query of encrypted data. The present invention allows fuzzy query in the encrypted state of data. By generating query feature encrypted data K' of the query keyword, effective retrieval of data can be achieved even when the data is encrypted, solving the problem that traditional encryption methods cannot perform fuzzy query;
[0060] 3. Optimize data management and governance. By establishing a three-dimensional coordinate set and generating feature encrypted data, the present invention reduces the complexity of data management, allowing data administrators to effectively manage data without decryption, thereby improving data governance efficiency;
[0061] 4. Protect the security of business application data. Under the premise of not leaking the source data, the present invention allows data query and effectively protects the confidentiality of business application data;
[0062] 5. Decoupling source data from features supports big data and AI feature data training applications. Encrypted data containing features is not content obtained from the source data itself, but feature points extracted by converting the source data into three-dimensional graphics and encrypting the feature points. While reducing the risk of data leakage, it also realizes that the encrypted data contains feature data. Therefore, the encrypted data containing feature points can be pushed to the big data platform or AI intelligent platform for data training, improving the security and intelligence level of data processing.
[0063] In the present invention, the above-mentioned technical solutions can also be combined with each other to achieve more preferred combination solutions. Other features and advantages of the present invention will be described in the subsequent description, and some advantages can become obvious from the description, or can be understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained through the contents particularly pointed out in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] The accompanying drawings are only used for the purpose of illustrating specific embodiments and are not to be considered as limiting the present invention. In the entire drawings, the same reference symbols represent the same components;
[0065] Figure 1 It is a flow chart of the establishment of an encrypted database and a fuzzy query method;
[0066] Figure 2 This is the architecture diagram of the encrypted data three-dimensional feature extraction and encryption algorithm;
[0067] Figure 3 This is a schematic diagram of the GB2312 area code. DETAILED DESCRIPTION
[0068] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.
[0069] The present invention proposes a data encryption method containing a feature vector, which converts the data to be encrypted into a three-dimensional graph relationship, extracts features from the three-dimensional graph, and forms feature encrypted data containing features after encrypting the features. At the same time, the source data is encrypted using an asymmetric encryption algorithm RSA, and after the encrypted data containing the features and the RSA-encrypted source data are aggregated, encrypted data that can be fuzzily queried is formed, which not only ensures the confidentiality of the data, but also solves the fuzzy query operation problems encountered by database administrators in daily data management or governance. At the same time, the feature encrypted data proposed by the present invention can also be provided to other big data or AI platforms for related data analysis, which can not only ensure that the data is not leaked, but also obtain feature data of the AI intelligent platform or big data platform that meets the relevant business system through feature training, and assist in business development.
[0070] The invention proposes a method for establishing an encrypted database and a fuzzy query method, which can well solve two problems in the prior art. The basic idea of the technical solution in the invention is to segment the source data, model the segmented data in a three-dimensional coordinate system, convert the segmented data into a three-dimensional graph, extract features from the three-dimensional graph, and encrypt the features to obtain encrypted data containing features, then perform RSA data encryption on the source data, and finally aggregate the two encrypted data to form new encrypted data.
[0071] A specific embodiment of the present invention discloses a method for establishing an encrypted database and a fuzzy query method, such as Figure 1 , Figure 2 As shown, including:
[0072] Step S1, acquiring source data, and preprocessing the source data to obtain a three-dimensional coordinate set W corresponding to the source data;
[0073] Step S2, encrypting each dimensional data element in the three-dimensional coordinate set W to form characteristic encrypted data K; encrypting the source data to obtain direct encrypted data V;
[0074] Step S3, aggregating the characteristic encrypted data K and the direct encrypted data V to generate complete encrypted data KEY and store it in a database;
[0075] Step S4, obtaining a three-dimensional coordinate set of the query keyword, encrypting it to generate query feature encrypted data K', and performing a fuzzy query in the database.
[0076] Step S1 includes steps S11-S12.
[0077] Step S11, obtaining source data.
[0078] Exemplarily, historical data is obtained from business systems (such as human resource management systems, customer relationship management systems, financial systems, e-commerce platforms), external data sources, IoT sensor data, web crawler data, manually entered data, or from existing databases through library-table docking; or data is obtained in real time.
[0079] Step S12: pre-process the source data to obtain a three-dimensional coordinate set W corresponding to the source data.
[0080] Based on the two-dimensional vectorization of the characters obtained by segmentation in the source data, a two-dimensional coordinate point set A is obtained; the distance value and angle value of the two-dimensional coordinate corresponding to each character from the origin coordinate, as well as the adjacent angle value with the adjacent coordinate point are obtained, including:
[0081] Initialize the origin coordinates O and the common difference z;
[0082] Calculate the distance and angle from each coordinate point in the two-dimensional coordinate point set A to the origin coordinate O after subtracting the common difference z;
[0083] Calculate adjacent angle values between adjacent coordinate points in the two-dimensional coordinate point set A;
[0084] The distance value, angle value, and adjacent angle value of each two-dimensional coordinate point are combined to obtain a three-dimensional coordinate set W.
[0085] In an optional implementation, step S12 specifically includes the following steps S121-S125.
[0086] Step S121, initializing the origin coordinate O and the common difference z.
[0087] In the present invention, the origin coordinate O and the common difference z are automatically and randomly generated by the algorithm during the initialization phase.
[0088] The origin coordinate O and the common difference z are generated based on random numbers and will not change after being generated.
[0089] Exemplarily, the method for generating the origin coordinate O is as follows:
[0090] Use a secure random number generator to generate two independent random numbers as the coordinate values of the x-axis and y-axis respectively;
[0091] Assume that the ranges of the x-axis and y-axis are and , then the generated origin coordinates O are as shown in formula (1):
[0092] ;
[0093] in, For in range A random number generated within For in range A random number generated within.
[0094] Exemplarily, the method for generating the common difference z is as follows:
[0095] Initialize with a secure random number generator to generate a random number within a predefined range;
[0096] Assume that the range of the common difference z is , then the generated common difference z is as shown in formula (2):
[0097] ;
[0098] Among them, z is in the range A random number generated.
[0099] The common difference z is used to establish an irregular coordinate system to reduce the possibility of exposing the origin of the coordinate system.
[0100] Step S122, obtaining a two-dimensional coordinate point set A based on two-dimensional vectorization of characters obtained by segmentation in source data, including:
[0101] The source data is divided into a character array set, and the character array set is disassembled according to the character's area code or ASCII code to obtain the two-dimensional vector coordinates corresponding to each character .
[0102] The two-dimensional vector coordinate set of all characters in the source data is expressed as shown in formula (3):
[0103] ;
[0104] Where n is the length of the data set.
[0105] The length of the data set, n, corresponds to the length of the source data. For a source data with a length of n, the length of its data set is also n.
[0106] Decompose the character array set according to the character's area code or ASCII code to obtain the two-dimensional vector coordinates corresponding to each character ,include:
[0107] If the character is a Chinese character, according to the GB2312 encoding standard, convert the area-position code of each Chinese character into two-dimensional coordinates, where the area code is the first-dimensional coordinate and the position code is the second-dimensional coordinate, to obtain the two-dimensional vector coordinates corresponding to the Chinese character;
[0108] Otherwise, if the character is an English character or an Arabic numeral, according to the ASCII encoding, divide the ASCII code value by 16 to obtain the first-dimensional coordinate; take the remainder of the ASCII code value divided by 16 to obtain the second-dimensional coordinate.
[0109] Exemplarily, the area-position code of the Chinese character is the area-position code corresponding to GB2312.
[0110] GB2312 is the encoding standard for Chinese characters. For English characters and Arabic numerals, GB2312 does not have corresponding area-position code encodings. ASCII codes are used to represent English characters and Arabic numerals, and GB2312 is compatible with ASCII encoding.
[0111] Each character (including Chinese characters, English characters, and Arabic numerals) in the source data is separately converted into a corresponding two-dimensional vector coordinate. Exemplarily, each character in the source data "Li Si is a teacher" will obtain a two-dimensional vector coordinate, forming a set containing multiple coordinates.
[0112] The characteristics of each character are processed separately and then used for feature extraction and encryption.
[0113] One data value represents one coordinate.
[0114] The coordinate system here is a plane coordinate system.
[0115] Split the source data "Li Si is a teacher" into a set of character arrays: ['Li', 'Si', 'is', 'a', 'teacher'].
[0116] As Figure 3 shown, 32 in the upper left corner represents the area code, in decimal representation, and "78" horizontally and vertically for the character "Li" represents the "position code", in decimal representation. The two-dimensional vector coordinates corresponding to the character "Li" .
[0117] And so on for other characters.
[0118] It can also be considered to subtract 0xA1 (here in hexadecimal, corresponding to 160 in binary) from both the area code and the position code at the same time. The effect of subtracting 0xA1 is to map the area-position code of GB2312 encoding to the range of 0 to 63, simplifying data calculation.
[0119] The ASCII code value conversion steps are applicable to English uppercase and lowercase letters and Arabic numerals.
[0120] Step S123: based on the initialization origin coordinates and the common difference z, calculate the two-dimensional coordinate point set A, each coordinate To origin Distance and angle values , as shown in formulas (4)-(5):
[0121] ;
[0122] ;
[0123] Get the relationship set from the two-dimensional coordinate point set A to the origin coordinate O .
[0124] After subtracting the common difference z from each coordinate in set A, the distance l and angle value r from the origin are obtained.
[0125] The purpose of subtracting the common difference z is to establish an irregular coordinate system and reduce the possibility of exposing the origin of the coordinate system.
[0126] Step S124: Calculate the adjacent angle values between adjacent coordinates in set A .
[0127] The adjacent coordinates of any two points in the two-dimensional coordinate point set A and Calculate the adjacent angle values, the last coordinate point and the first coordinate point calculate the adjacent angle values;
[0128] Calculate coordinate points Relative to the coordinate point The position of the coordinate system formed with the origin as the origin;
[0129] when When the position is in the first or third quadrant, calculate the coordinate point With coordinate points The adjacent angle values ε between them;
[0130] When the coordinate point When in the first quadrant, the calculation is as shown in formulas (6)-(7):
[0131] ;
[0132] ;
[0133] in, The coordinate points With coordinate points The distance and angle between the coordinate points When in the third quadrant, the last obtained Add 180 to the value;
[0134] when When the position is in the second or fourth quadrant, calculate the coordinate point With coordinate points The adjacent angle values between ;
[0135] When the coordinate point When in the second quadrant, the calculation is as shown in formulas (8)-(9):
[0136] ;
[0137] ;
[0138] When the coordinate point When in the fourth quadrant, the last acquired Add 180 to the value;
[0139] By calculating the adjacent angle values between all two adjacent points, we can obtain a set of adjacent angle values. .
[0140] Take out the adjacent coordinates of any two points in set A and , calculate the coordinate point Relative to the coordinate point The position of the coordinate system formed with the origin as the origin;
[0141] Whether two coordinates are adjacent coordinates is determined based on whether the source data after segmentation is adjacent data.
[0142] Among them, the coordinate point The coordinate system is formed with O as the origin. The directions of the x-axis and y-axis of the coordinate system are based on the initialization origin O, and are consistent with the directions of the x-axis and y-axis of the initialization coordinate system.
[0143] The adjacent angle values of the last coordinate point and the first coordinate point are calculated; therefore, the number of adjacent angle values corresponding to n coordinate points is still n.
[0144] Step S125: Distance l, angle value r, adjacent angle value Combine and obtain a three-dimensional coordinate set W.
[0145] The relationship set With the adjacent angle value set , integrate to obtain a set of three-dimensional feature vectors containing the characteristics of the source data .
[0146] Collection-based With Collection , integrate to obtain a set of three-dimensional feature vectors containing the characteristics of the source data .
[0147] Each dimensional data element of the three-dimensional coordinate set W includes a distance value, an angle value, and an adjacent angle value; obtaining the three-dimensional coordinate set W corresponding to the source data includes:
[0148] Performing character segmentation on the source data;
[0149] The distance value and angle value of the two-dimensional coordinates corresponding to each character from the origin coordinate O, as well as the adjacent angle values with adjacent coordinate points are obtained; the origin coordinate O is generated based on a random number.
[0150] Step S2 includes steps S21-S22.
[0151] Step S21: encrypt each dimensional data element in the three-dimensional coordinate set W to form feature encrypted data K.
[0152] The step of encrypting each dimensional data element in the three-dimensional coordinate set W to form feature encrypted data K includes:
[0153] Connect the distance value and angle value in W, perform sha2 encryption, and obtain the sha2 hash value of the distance value and angle value;
[0154] Perform md5 hash encryption on the adjacent angle values in W to obtain the md5 hash values of the adjacent angle values;
[0155] Concatenate the sha2 hash value and the md5 hash value to obtain encrypted data , as shown in formula (10):
[0156] ;
[0157] Get encrypted data set , after random rearrangement, integration is performed to obtain the characteristic encrypted data K.
[0158] Connect the data elements in set W , perform sha2 encryption to obtain the sha2 hash value of the distance value and the angle value;
[0159] calculate The md5 hash value of ; concatenate the sha2 hash value and the md5 hash value to get , . The encrypted data set obtained , after random rearrangement, integration is performed to obtain the characteristic encrypted data K.
[0160] Step S22: Encrypt the source data to obtain directly encrypted data V.
[0161] Exemplarily, the source data is encrypted by RSA to obtain directly encrypted data V.
[0162] In practice, other data encryption methods can also be selected according to business needs.
[0163] Step S3, specifically.
[0164] The characteristic encrypted data K and the direct encrypted data V are aggregated to generate complete encrypted data KEY and store them in the database.
[0165] The source data is encrypted using the RSA encryption algorithm to obtain encrypted data V; the encrypted data K and V are concatenated together.
[0166] Aggregate the encrypted data V and the characteristic encrypted data K to obtain the complete encrypted data KEY, which is finally stored in the database.
[0167] Exemplarily, the database supports all structured and unstructured databases.
[0168] Step S4, specifically.
[0169] The query feature encrypted data K' is generated based on the query keyword to perform fuzzy query in the database.
[0170] Obtain the three-dimensional coordinate set of the query keyword and encrypt it to generate the query feature encrypted data K', including:
[0171] Get the query keyword and split it to form a character array set;
[0172] Decompose the character according to its area code or ASCII code to obtain a two-dimensional coordinate point set A';
[0173] Calculate the distance value l' and the angle value r' from each coordinate in the two-dimensional coordinate set A' to the origin coordinate O;
[0174] Calculate the adjacent angle values between adjacent coordinates in A' ;
[0175] The distance value l', the angle value r' and the adjacent angle value Combine to form a three-dimensional feature coordinate set W';
[0176] The three-dimensional feature coordinate set W' is encrypted to form query feature encrypted data K'.
[0177] Exemplarily, the query keyword may be defined by the application user.
[0178] The result of the fuzzy query is empty or feature encrypted data.
[0179] The fuzzy query results obtained are encrypted feature data. If the business needs to obtain plaintext data, it is necessary to query the application user or database administrator permissions to determine whether reverse decryption can be performed.
[0180] In summary, the method for establishing an encrypted database and fuzzy query according to an embodiment of the present invention has the following beneficial effects:
[0181] 1. Convert the source data into three-dimensional graphics to extract data features, reduce the association between features and source data, and obtain data containing source data features at the same time. Encrypt the feature data to obtain encrypted data containing features, so that encrypted data can be fuzzy queried. At the same time, avoid the need to completely decrypt data for fuzzy queries in traditional data encryption methods, which leads to the risk of data leakage and enhances data security.
[0182] 2. Support fuzzy query of encrypted data. The present invention allows fuzzy query in the encrypted state of data. By generating query feature encrypted data K' of the query keyword, effective retrieval of data can be achieved even when the data is encrypted, solving the problem that traditional encryption methods cannot perform fuzzy query;
[0183] 3. Optimize data management and governance. By establishing a three-dimensional coordinate set and generating feature encrypted data, the present invention reduces the complexity of data management, allowing data administrators to effectively manage data without decryption, thereby improving the efficiency of data governance;
[0184] 4. Protect the security of business application data. Under the premise of not leaking the source data, the present invention allows data query and effectively protects the confidentiality of business application data;
[0185] 5. Decoupling source data from features supports big data and AI feature data training applications. Encrypted data containing features is not obtained from the source data itself, but is extracted by converting the source data into three-dimensional graphics and encrypting the feature points, which reduces the risk of data leakage and also realizes that encrypted data contains feature data. Therefore, encrypted data containing feature points can be pushed to the big data platform or AI intelligent platform for data training, improving the security and intelligence level of data processing.
[0186] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.
Claims
1. A method for establishing an encrypted database and a fuzzy query method, characterized in that: The steps include: Acquire source data, and preprocess the source data to obtain a three-dimensional coordinate set W corresponding to the source data; Encrypting each dimensional data element in the three-dimensional coordinate set W to form feature encrypted data K; Encrypting the source data to obtain directly encrypted data V; Aggregate the characteristic encrypted data K and the direct encrypted data V to generate complete encrypted data KEY and store it in the database; Obtain a three-dimensional coordinate set of the query keyword and encrypt it to generate query feature encrypted data K', and perform fuzzy query in the database; Each dimensional data element of the three-dimensional coordinate set W includes a distance value, an angle value and an adjacent angle value; Obtaining a three-dimensional coordinate set W corresponding to the source data includes: Performing character segmentation on the source data; Obtain the distance value and angle value of the two-dimensional coordinates corresponding to each character from the origin coordinate O, as well as the adjacent angle values of the adjacent coordinate points; the origin coordinate O is generated based on a random number; Based on the two-dimensional vectorization of the characters obtained by segmentation in the source data, a two-dimensional coordinate point set A is obtained; the distance value and angle value of the two-dimensional coordinate corresponding to each character from the origin coordinate, as well as the adjacent angle value with the adjacent coordinate point are obtained, including: Initialize the origin coordinates O and the common difference z; Calculate the distance and angle from each coordinate point in the two-dimensional coordinate point set A to the origin coordinate O after subtracting the common difference z; Calculate adjacent angle values between adjacent coordinate points in the two-dimensional coordinate point set A; Combine the distance value, angle value, and adjacent angle value of each two-dimensional coordinate point to obtain a three-dimensional coordinate set W; Based on the two-dimensional vectorization of the characters obtained from the segmentation of the source data, a two-dimensional coordinate point set A is obtained, including: The source data is divided into a character array set, and the character array set is disassembled according to the character's area code or ASCII code to obtain the two-dimensional vector coordinates corresponding to each character ; Based on the initialization origin coordinates and the common difference z, calculate the two-dimensional coordinate point set A, each coordinate To origin Distance and angle values ,as follows: ; ; Get the relationship set from the two-dimensional coordinate point set A to the origin coordinate O ; The adjacent coordinates of any two points in the two-dimensional coordinate point set A and Calculate the adjacent angle values, the last coordinate point and the first coordinate point calculate the adjacent angle values; Calculate coordinate points Relative to the coordinate point The position of the coordinate system formed with the origin as the origin; when When the position is in the first or third quadrant, calculate the coordinate point With coordinate points The adjacent angle values ε between them; When the coordinate point When in the first quadrant, the calculation is as follows: ; ; in, The coordinate points With coordinate points The distance and angle between the coordinate points When in the third quadrant, the last obtained Add 180 to the value; when When the position is in the second or fourth quadrant, calculate the coordinate point With coordinate points The adjacent angle values ε between them; When the coordinate point When in the second quadrant, the calculation is as follows: ; ; When the coordinate point When in the fourth quadrant, the last acquired Add 180 to the value; By calculating the adjacent angle values between all two adjacent points, we can obtain a set of adjacent angle values. ; The relationship set With the adjacent angle value set , integrate to obtain a set of three-dimensional feature vectors containing the characteristics of the source data 。 2. The method according to claim 1, characterized in that: Encrypting each dimensional data element in the three-dimensional coordinate set W to form feature encrypted data K, including: Connect the distance value and angle value in W, perform sha2 encryption, and obtain the sha2 hash value of the distance value and angle value; Perform md5 hash encryption on the adjacent angle values in W to obtain the md5 hash values of the adjacent angle values; Concatenate the sha2 hash value and the md5 hash value to obtain encrypted data ,as follows: ; Get encrypted data set , after random rearrangement, integration is performed to obtain the characteristic encrypted data K.
3. The method according to claim 1, characterized in that: Decompose the character array set according to the character's area code or ASCII code to obtain the two-dimensional vector coordinates corresponding to each character ,include: If the character is a Chinese character, according to the GB2312 coding standard, the area code of each Chinese character is converted into a two-dimensional coordinate, the area code is the first-dimensional coordinate, and the bit code is the second-dimensional coordinate, to obtain the two-dimensional vector coordinate corresponding to the Chinese character; Otherwise, if the character is an English character or Arabic numeral, according to the ASCII encoding, the ASCII code value is divided by 16 to obtain the first-dimensional coordinate; the ASCII code value modulo 16 is obtained to obtain the second-dimensional coordinate.
4. The method according to claim 1, characterized in that: Obtain the three-dimensional coordinate set of the query keyword and encrypt it to generate the query feature encrypted data K', including: Get the query keyword and split it to form a character array set; Decompose the character according to its area code or ASCII code to obtain a two-dimensional coordinate point set A'; Calculate the distance value l' and the angle value r' from each coordinate in the two-dimensional coordinate set A' to the origin coordinate O; Calculate the adjacent angle values between adjacent coordinates in A' ; The distance value l', the angle value r' and the adjacent angle value Combine to form a three-dimensional feature coordinate set W'; The three-dimensional feature coordinate set W' is encrypted to form query feature encrypted data K'.
