Private data protection method and device, electronic equipment and computer program product
By analyzing and encrypting the database operation statements, and using the Guoxin algorithm to encrypt and store customer data, the security issues of customer data during storage, transmission and use are solved, and efficient privacy data protection and application performance under large data volumes are achieved.
Patent Information
- Application Number
- CN202411435568.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2025-02-25
AI Technical Summary
During the marketing process, the lack of effective security protection measures in the storage, transmission and use of customer data, resulting in an increase in the risk of customer privacy leakage, and traditional data analysis and retrieval methods cannot effectively protect customer privacy.
By intercepting the operation statements of the database, parsing and determining the fields to be encrypted, the values of these fields are encrypted using the National Secret SM2 and SM3 algorithms, ciphertext is generated, and the ciphertext is written into the target data table. At the same time, it supports fuzzy query and scope retrieval, and authentication matching with external third-party systems.
It realizes encrypted storage of customer privacy data, ensures the security of data during transmission and use, supports efficient query and retrieval under large data volumes, and meets the dual requirements of customer privacy protection and data application performance.
Smart Images

Figure CN119513908A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information security technology, and in particular to a privacy data protection method, device, electronic device, and computer program product. Background Art
[0002] In the marketing process, a large amount of customer data needs to be processed and stored, including basic information, purchase records, browsing behavior, etc. This data contains important sensitive information of customers, such as name, address, phone number, etc. If customer information is leaked, it will have a negative impact on customers. During data transmission, transmission message encryption is used to protect customer privacy, but a large amount of customer information stored in the database exists in plain text. There is no security protection measure other than the system password, which is not conducive to customer privacy protection.
[0003] In the traditional way, when in-depth analysis and mining of customer data is needed, a large amount of data sharing is involved, which is not conducive to customer privacy protection. In addition, after customer information is protected, the original customer information retrieval and statistics methods will not be able to achieve accurate insight matching due to changes in data formats, and the value of customer data will not be accurately and fully utilized. Summary of the invention
[0004] The embodiments of the present application provide a privacy data protection method, device, electronic device, and computer program product to improve the security of customer privacy data storage, transmission, and use.
[0005] The present application embodiment adopts the following technical solutions:
[0006] In a first aspect, an embodiment of the present application provides a privacy data protection method, the privacy data protection method comprising:
[0007] Intercepting and parsing the operation statement of the database to obtain the parsing result of the operation statement, wherein the operation statement is a statement for performing an operation change on the data in the database;
[0008] Acquire data parameter configuration information, and determine the field to be encrypted according to the parsing result of the operation statement and the data parameter configuration information;
[0009] Encrypting the field value corresponding to the field to be encrypted using the encryption policy corresponding to the field to be encrypted to obtain a ciphertext of the field value;
[0010] Write the ciphertext of the field value into the target data table.
[0011] Optionally, the parsing result of the operation statement includes a parsed field, and determining the field to be encrypted according to the parsing result of the operation statement and the data parameter configuration information includes:
[0012] Determine whether the parsed field exists in the data parameter configuration information;
[0013] In a case where the parsed field exists in the data parameter configuration information, it is determined that the parsed field is a field to be encrypted.
[0014] Optionally, the parsing result of the operation statement also includes a complete field value plaintext corresponding to the parsed field, and the encrypting the field value corresponding to the field to be encrypted by using the encryption policy corresponding to the field to be encrypted to obtain the field value ciphertext includes:
[0015] The complete field value plaintext is encrypted using the national secret SM2 encryption algorithm to obtain the complete field value ciphertext;
[0016] The step of writing the ciphertext of the field value into the target data table comprises:
[0017] The complete field value ciphertext replaces the corresponding complete field value plaintext stored in the original data table.
[0018] Optionally, the encrypting the field value corresponding to the field to be encrypted by using the encryption policy corresponding to the field to be encrypted to obtain the field value ciphertext includes:
[0019] Determine whether the field to be encrypted needs to support fuzzy query and range search;
[0020] In the case where the field to be encrypted needs to support fuzzy query and range search, a complete field value plaintext corresponding to the field to be encrypted is segmented to obtain multiple segmented field value plaintexts;
[0021] Use the national secret SM2 encryption algorithm to encrypt the plaintexts of multiple word segmentation field values respectively to obtain the ciphertexts of multiple word segmentation field values;
[0022] The step of writing the ciphertext of the field value into the target data table comprises:
[0023] A mapping relationship between the parsed fields and the corresponding data tables and multiple ciphertexts of word segmentation field values is constructed and stored in a word segmentation registration table.
[0024] Optionally, the encrypting the field value corresponding to the field to be encrypted by using the encryption policy corresponding to the field to be encrypted to obtain the field value ciphertext includes:
[0025] Determine whether the to-be-encrypted field is a field that needs to be authenticated and matched with an external third-party system;
[0026] In the case where the field to be encrypted is a field that needs to be authenticated and matched with an external third-party system, obtaining an authentication field set;
[0027] According to the type of the operation statement, the field value plaintext corresponding to the authentication field in the authentication field set is encrypted using the national secret SM3 encryption algorithm to obtain the authentication field value digest;
[0028] The step of writing the ciphertext of the field value into the target data table comprises:
[0029] Constructing a mapping relationship between the authentication field value summary and the corresponding data table and the field value ciphertext of the data table;
[0030] The authentication field value summary is encrypted using the national secret SM2 encryption algorithm, and the mapping relationship between the encrypted authentication field value summary and the corresponding data table and the field value ciphertext of the data table is stored in the verification information table.
[0031] Optionally, the privacy data protection method further includes:
[0032] Receiving a query statement from a database and parsing it to obtain a parsing result of the query statement, wherein the parsing result of the query statement includes a query field and a corresponding field value;
[0033] In the case where the query field exists in the data parameter configuration information, encrypting the field value corresponding to the query field to obtain a ciphertext of the query field value;
[0034] According to the ciphertext of the query field value, a query is performed in the target data table using the query strategy corresponding to the query field to obtain a data query result.
[0035] Optionally, querying in a target data table according to the query field value ciphertext using a query strategy corresponding to the query field to obtain a data query result includes:
[0036] If the query field does not need to support fuzzy query and range search, and does not need to be authenticated and matched with an external third-party system, the ciphertext of the query field value is queried in the original data table;
[0037] If the query field needs to support fuzzy query and range search, the query statement is rewritten, and a query is performed in the word segmentation data table according to the rewritten query statement and the ciphertext of the query field value;
[0038] If the query field needs to be authenticated and matched with an external third-party system, a query is performed in the verification data table according to the ciphertext of the query field value.
[0039] In a second aspect, an embodiment of the present application further provides a privacy data protection device, the privacy data protection device comprising:
[0040] An interception unit, used to intercept and parse an operation statement of the database to obtain a parsing result of the operation statement, wherein the operation statement is a statement for performing an operation change on data in the database;
[0041] A determination unit, configured to obtain data parameter configuration information, and determine a field to be encrypted according to a parsing result of the operation statement and the data parameter configuration information;
[0042] A first encryption unit is used to encrypt a field value corresponding to the field to be encrypted by using an encryption policy corresponding to the field to be encrypted to obtain a ciphertext of the field value;
[0043] The storage unit is used to write the ciphertext of the field value into the target data table.
[0044] In a third aspect, an embodiment of the present application further provides an electronic device, including:
[0045] Processor; and
[0046] A memory arranged to store computer executable instructions, which, when executed, cause the processor to perform any of the aforementioned privacy data protection methods.
[0047] In a fourth aspect, an embodiment of the present application further provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements any of the aforementioned privacy data protection methods.
[0048] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects: the privacy data protection method of the embodiments of the present application first intercepts the operation statement of the database and parses it to obtain the parsing result of the operation statement, which is a statement for changing the data in the database; then obtains the data parameter configuration information, and determines the field to be encrypted according to the parsing result of the operation statement and the data parameter configuration information; then uses the encryption strategy corresponding to the field to be encrypted to encrypt the field value corresponding to the field to be encrypted, and obtains the ciphertext of the field value; finally, writes the ciphertext of the field value into the target data table. The privacy data protection method of the embodiments of the present application solves the security issues of customer information in the storage, transmission, and use process in marketing scenarios, realizes the encrypted storage of various customer privacy data through simple configuration, does not rely on data decryption in the subsequent query and retrieval process, and the retrieval process also retrieves and compares in ciphertext, which ensures data security while meeting the performance requirements of applications with large data volumes. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0050] Figure 1 A flowchart of a privacy data protection method in an embodiment of the present application;
[0051] Figure 2 This is a schematic diagram of a privacy data protection process in an embodiment of the present application;
[0052] Figure 3 This is a schematic diagram of the structure of a privacy data protection device in an embodiment of the present application;
[0053] Figure 4 It is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0055] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0056] In order to facilitate the understanding of the embodiments of the present application, the main technical terms involved in the present application are first introduced:
[0057] 1) National Encryption SM3 Algorithm: National Encryption SM3 Algorithm is a digest algorithm that can convert data of any length into a hash value of fixed length. It is collision-resistant and irreversible, and can be used for data integrity verification and digital signatures, etc.
[0058] 2) National SM2 Algorithm: National SM2 Algorithm is an elliptic curve public key cryptographic algorithm, which was released by the State Cryptography Administration on December 17, 2010. It includes SM2-1 elliptic curve digital signature algorithm, SM2-2 elliptic curve key exchange protocol and SM2-3 elliptic curve public key encryption algorithm, which are used to implement digital signature key negotiation and data encryption functions respectively. This algorithm has high security, flexibility and adaptability, and is an encryption algorithm independently innovated by my country.
[0059] 3) Privacy computing: refers to a collection of technologies that implement data analysis and computing while protecting the data from external disclosure, so as to achieve the goal of making the data "available but invisible". It is a computing theory and method for protecting the entire life cycle of private information, which realizes the transformation and release of data value while fully protecting data and privacy security.
[0060] Based on this, the present application embodiment provides a privacy data protection method, such as Figure 1 As shown, a flowchart of a privacy data protection method in an embodiment of the present application is provided, and the privacy data protection method at least includes the following steps S110 to S140:
[0061] Step S110, intercepting and parsing the operation statement of the database to obtain the parsing result of the operation statement, wherein the operation statement is a statement for performing an operation change on the data in the database.
[0062] When processing the customer's private data, it is necessary to first intercept the user's operation statements on the database. The operation statements intercepted here are mainly SQL statements that can cause data changes, such as modifying or adding data in the database. The SQL statements are parsed to parse out the fields contained in the statements and the corresponding field values.
[0063] Step S120, obtaining data parameter configuration information, and determining the field to be encrypted according to the parsing result of the operation statement and the data parameter configuration information.
[0064] Before processing the customer's private data, the embodiment of the present application will also configure the data field parameters in the database, mainly configuring the table in the database where the customer information that needs to be protected for privacy is distributed and the corresponding table fields, and can also configure whether the encrypted field needs to support fuzzy and range retrieval. In addition, the customer information fields and order in each table that are uniquely authenticated and matched with the external third-party system can also be configured. Of course, the specific configuration parameters can be flexibly set by those skilled in the art according to actual needs, and no specific restrictions are made here.
[0065] Based on the above configuration, the field information parsed in the previous steps is searched and matched in the data parameter configuration information to determine whether the field in the current operation statement involves customer privacy, that is, whether it is a field that needs to be encrypted. If so, the parsed field is used as a field to be encrypted for subsequent processing. If not, no subsequent processing is performed.
[0066] Step S130: encrypt the field value corresponding to the field to be encrypted using the encryption policy corresponding to the field to be encrypted to obtain a ciphertext of the field value.
[0067] For the field to be encrypted, it is necessary to determine the encryption strategy of the field to be encrypted based on the pre-configured data field parameters. The encryption strategy here may include the encryption algorithm and encryption processing method adopted, etc. The encryption strategy corresponding to the field to be encrypted is used to encrypt the field value corresponding to the field to be encrypted, thereby obtaining the field value ciphertext.
[0068] Step S140, writing the ciphertext of the field value into the target data table.
[0069] The ciphertext of the field values obtained in the above steps is stored in the corresponding target data table according to the actual application requirements for subsequent query and retrieval.
[0070] The privacy data protection method of the embodiment of the present application solves the security issues in the storage, transmission and use of customer information in marketing scenarios. It realizes the encrypted storage of various customer privacy data through simple configuration. In the subsequent query and retrieval process, it does not rely on data decryption. The retrieval process also searches and compares in ciphertext, which ensures data security while meeting the performance requirements of applications with large data volumes.
[0071] In some embodiments of the present application, the parsing result of the operation statement includes parsed fields, and determining the fields to be encrypted based on the parsing result of the operation statement and the data parameter configuration information includes: determining whether the parsed fields exist in the data parameter configuration information; and if the parsed fields exist in the data parameter configuration information, determining that the parsed fields are the fields to be encrypted.
[0072] As mentioned above, the embodiment of the present application can pre-configure the data fields related to customer privacy, and then search and match the fields parsed in the operation statement in the configured fields. If there is a hit, the parsed field is the field that needs to be encrypted. If there is no hit, no encryption is performed and normal storage can be performed.
[0073] In some embodiments of the present application, the parsing result of the operation statement also includes the complete field value plaintext corresponding to the parsed field, and the encrypting the field value corresponding to the field to be encrypted using the encryption policy corresponding to the field to be encrypted to obtain the field value ciphertext includes: encrypting the complete field value plaintext using the national secret SM2 encryption algorithm to obtain the complete field value ciphertext; writing the field value ciphertext into the target data table includes: replacing the corresponding complete field value plaintext stored in the original data table with the complete field value ciphertext.
[0074] When encrypting the complete field value plaintext corresponding to the encrypted field, the embodiment of the present application can use the public key of the national secret SM2 encryption algorithm to encrypt the complete field value plaintext, thereby obtaining the complete field value ciphertext, and replace the field value plaintext stored in the corresponding original data table with the complete field value ciphertext, so that the field data related to customer privacy stored in the data table are all in ciphertext form.
[0075] In some embodiments of the present application, the encryption strategy corresponding to the field to be encrypted is used to encrypt the field value corresponding to the field to be encrypted to obtain the field value ciphertext, including: determining whether the field to be encrypted needs to support fuzzy query and range retrieval; when the field to be encrypted needs to support fuzzy query and range retrieval, the complete field value plaintext corresponding to the field to be encrypted is processed by word segmentation to obtain multiple word segmentation field value plaintexts; the multiple word segmentation field value plaintexts are encrypted separately by using the national secret SM2 encryption algorithm to obtain multiple word segmentation field value ciphertexts; the field value ciphertext is written into the target data table, including: constructing a mapping relationship between the parsed field and the data table to which it belongs and the corresponding multiple word segmentation field value ciphertexts and storing them in the word segmentation registration table.
[0076] In some application scenarios, there may be a need for fuzzy query and range retrieval. Therefore, when configuring the data parameter information in the aforementioned embodiment, the fields that need to support fuzzy query and range retrieval can be configured. For example, field A and field B are configured to support fuzzy query and range retrieval. If the fields parsed in the current operation statement include field A, it means that the field is a field that needs to be encrypted and is also a field that supports fuzzy query and range retrieval.
[0077] For such fields, the embodiment of the present application further performs full word segmentation on the complete field value plaintext corresponding to the field to obtain a word segmentation ring group plaintext composed of multiple word segmentation field value plaintexts, and then constructs a mapping relationship between the word segmentation ring group plaintext and the corresponding data table name, field name and complete field value plaintext, and saves the mapping relationship in memory. The specific word segmentation method can be flexibly set by those skilled in the art according to actual needs, and is not specifically limited here.
[0078] When encrypting, based on the mapping relationship stored in the above memory, use the public key of the national secret SM2 encryption algorithm to encrypt each word segmentation element in the word segmentation ring group, and then store the mapping relationship between the table name, field name and the encrypted ciphertext of each word segmentation element in the word segmentation registration table. The word segmentation registration table can be regarded as an intermediate link table established outside the original data table in the fuzzy query and range retrieval scenarios. The mapping relationship between the word segmentation registration table and the original data table can be established through the table name and field value.
[0079] In some embodiments of the present application, the encryption policy corresponding to the field to be encrypted is used to encrypt the field value corresponding to the field to be encrypted to obtain the field value ciphertext, including: determining whether the field to be encrypted is a field that needs to be authenticated and matched with an external third-party system; in the case that the field to be encrypted is a field that needs to be authenticated and matched with an external third-party system, obtaining an authentication field set; according to the type of operation statement, the field value plaintext corresponding to the authentication field in the authentication field set is encrypted using the national secret SM3 encryption algorithm to obtain an authentication field value summary; the writing of the field value ciphertext into the target data table includes: constructing a mapping relationship between the authentication field value summary and the data table to which it belongs and the field value ciphertext of the data table; encrypting the authentication field value summary using the national secret SM2 encryption algorithm, and storing the mapping relationship between the encrypted authentication field value summary and the data table to which it belongs and the field value ciphertext of the data table in the verification information table.
[0080] In some application scenarios, some fields of data tables may also need to support authentication matching with external third-party systems. Therefore, when configuring data parameter information in the aforementioned embodiment, the fields that need to support authentication matching with external third-party systems can be configured. For example, field C needs to support authentication matching with external third-party systems. If the fields parsed in the current operation statement include field C, it means that the field is a field that needs to be encrypted and is also a field that needs to support authentication matching with external third-party systems. Of course, it can also be a field that needs to support fuzzy query and range retrieval in the above embodiment.
[0081] For fields that need to support authentication matching with external third-party systems, the pre-configured authentication field set can be read out, and then different encryption methods can be used for the plaintext of the field value corresponding to the authentication field set according to the type of operation statement. For example, if it is an insert statement, the plaintext of the field value corresponding to the authentication field set is directly obtained from the insert statement and encrypted using the national secret SM3 encryption algorithm to form an authentication field value summary; if it is an update statement, first query all the record sets involved, and then extract the data information plaintext corresponding to the authentication field set from the update statement and record, and encrypt it using the national secret SM3 encryption algorithm to form an authentication field value summary. Finally, a comparison relationship between the authentication field value summary and the ciphertext of the primary key field value of the data table and table is formed, and then the summary is encrypted using the national secret SM2 encryption algorithm and stored in the verification information table for subsequent verification with the external third-party system.
[0082] The embodiment of the present application adopts the SM3 algorithm to generate a hash value of the customer's key information. When it is necessary to subsequently match and confirm the customer information with a third-party system, the hash value calculated using the configured key information is directly used to perform authentication matching with the third-party system. There is no need to decrypt the ciphertext from the storage table and then generate the hash value each time.
[0083] Based on the above embodiments, by configuring parameters in advance, the key information configured in advance by the customer is encrypted and stored using the national secret SM2 algorithm and the national secret SM3 algorithm, ensuring that only the encrypted information is stored in the database. In the subsequent query and retrieval stage of customer information, only the data management personnel who know the symmetric private key can restore and query the data. The data in the database will not be restored to plain text by maintenance personnel with other permissions, thereby protecting the security of the customer's privacy data storage.
[0084] In some embodiments of the present application, the privacy data protection method also includes: receiving a query statement from a database and parsing it to obtain a parsing result of the query statement, wherein the parsing result of the query statement includes a query field and a corresponding field value; when the query field exists in the data parameter configuration information, encrypting the field value corresponding to the query field to obtain a ciphertext of the query field value; based on the ciphertext of the query field value, using the query strategy corresponding to the query field to query in the target data table to obtain a data query result.
[0085] In the data query stage, the query statement of the database can be received first and then parsed to parse the queried fields and the corresponding field values, and then determine whether the parsed fields are fields in the data parameter configuration information. If they are fields in the data parameter configuration information, then due to the processing of the aforementioned embodiments, the data fields involving customer privacy are stored in the data table in ciphertext form. Therefore, in order to meet the matching requirements of the query retrieval stage, the field values involving customer privacy in the query statement can also be encrypted in the same encryption method to obtain the ciphertext of the query field value, and then subsequent matching can be performed.
[0086] Based on the needs of the actual query scenario, different query matching strategies can be adopted, such as whether fuzzy query and range search need to be supported, and whether data for authentication matching with external third-party systems needs to be queried. Based on the ciphertext of the query field value, the corresponding query strategy is adopted to perform query matching in the target data table to obtain the final data query result.
[0087] In some embodiments of the present application, the query is performed in the target data table according to the query field value ciphertext and the query strategy corresponding to the query field to obtain the data query result, including: if the query field does not need to support fuzzy query and range retrieval, and does not need to be authenticated and matched with an external third-party system, the query field value ciphertext is queried in the original data table; if the query field needs to support fuzzy query and range retrieval, the query statement is rewritten, and the query is performed in the word segmentation data table according to the rewritten query statement and the query field value ciphertext; if the query field needs to be authenticated and matched with an external third-party system, the query is performed in the verification data table according to the query field value ciphertext.
[0088] As mentioned above, when making a specific query, you can first determine whether the parsed field is a field that needs to be encrypted in the data parameter configuration information. If so, you can perform a secondary analysis on the query conditions to further determine whether the field needs to support fuzzy query and range search. For example, if a fuzzy query statement containing "%" exists in the statement, it means that fuzzy query and range search are supported. In addition, you can also determine whether the field needs to match the external third-party system authentication.
[0089] If the currently parsed query field belongs to the field in the data parameter configuration information, but does not need to support fuzzy query and range search, nor does it need to match with external third-party system authentication, then the query strategy can be to directly use the query field value ciphertext corresponding to the query field to search and match in the original data table to determine whether there is a matching data record.
[0090] If the current query field needs to support fuzzy query and range search, the query statement will be rewritten, and the original data table will be associated with the word segmentation registration table. The query will be changed from querying the original field to searching for matching word segmentation field ciphertexts in the word segmentation registration table.
[0091] If the current query field needs to be checked for consistency with external data, you can first query the data range that needs to be checked, and then retrieve the summary information set that can be used for external verification in the verification information table based on the ciphertext of the primary key field value within the range, and return these sets to the user for external detailed information verification.
[0092] In order to facilitate the understanding of the above embodiments, Figure 2As shown, a schematic diagram of a privacy data protection process in an embodiment of the present application is provided. Data parameter configuration is the initialization stage of the privacy data protection process, which mainly configures the database table and corresponding table fields of the customer information distribution that needs to be protected for privacy, and configures whether the encrypted field supports fuzzy and range retrieval. In addition, in the data configuration stage, the customer information fields and order in each table that are uniquely authenticated and matched with the external third-party system can also be configured.
[0093] After the data field parameter configuration is completed, the data encryption processing phase begins. This phase mainly intercepts the update and insert operation statements of the database, and parses out the fields configured in the data parameter configuration information and the corresponding field value plaintext. If the parsed field needs to support fuzzy query and range search, it will enter the word segmentation processing phase, perform full word segmentation on the field value plaintext corresponding to this field, form a mapping relationship with the table name and field name and the word segmentation field value plaintext, and save the mapping relationship in memory.
[0094] After the word segmentation process is completed or no word segmentation process is required, the data encryption process begins. The data encryption process is divided into the following steps:
[0095] 1) The fields and field plaintext values in the data parameter configuration parsed in the previous steps are encrypted using the national encryption SM2 algorithm public key, and the encrypted results replace the original field value plaintext and are stored in the fields of the corresponding database table.
[0096] 2) For information that needs to support fuzzy retrieval, read the mapping relationship stored in the memory, use the national encryption SM2 algorithm to encrypt each word segmentation element, and then register the mapping relationship between the table name, field name and the ciphertext of the word segmentation field value into the word segmentation registration table.
[0097] 3) Retrieve configuration information and determine whether the table needs to be matched and checked with an external third-party system. If a match is required, read out the pre-configured authentication field set. If it is an insert statement, directly obtain the plain text corresponding to the authentication field set from the insert statement and encrypt it using SM3 to form a summary. If it is an update statement, determine whether the updated field is in the authentication field set, first query all the record sets involved, and then extract the data information plain text corresponding to the authentication field set from the update statement and record, and encrypt it using SM3 to form a summary. Finally, form a comparison relationship between the authentication field value summary and the data table and the table's primary key field value ciphertext, and then use the national secret SM2 encryption algorithm to encrypt the summary and store it in the verification information table for subsequent verification with an external third-party system.
[0098] In the data query stage, after receiving the query statement from the front end, first check whether the fields involved in the query conditions are the fields that need to be encrypted in the data parameter configuration information. If so, SM2 encrypt the query field value, and then perform a secondary analysis on the query conditions to determine whether fuzzy query and range search are possible. If so, rewrite the query statement, associate the original data table with the word segmentation registration table, and change from querying the original field to searching for matching word segmentation field ciphertext in the word segmentation registration table. If the analysis finds that there is no fuzzy query statement, the query statement will not be rewritten.
[0099] If the current query field needs to be checked for consistency with external data, you can first query the data range that needs to be checked, and then retrieve the summary information set that can be used for external verification in the verification information table based on the ciphertext of the primary key field value within the range, and return these sets to the user for external detailed information verification.
[0100] In summary, the key points of the privacy data protection method of this application are as follows:
[0101] 1) In the mode of adopting national secret encryption, data fuzzy query and accurate query as well as data detail verification are realized without relying on data decryption;
[0102] 2) Implement fuzzy retrieval scheme under fuzzy encryption through word segmentation;
[0103] 3) Adaptive rewriting capability of SQL statements based on configuration;
[0104] 4) Capability to intercept and judge SQL statements based on configuration.
[0105] The privacy data protection method of this application has achieved at least the following technical effects:
[0106] This application is easy to operate and can realize the national secret encryption storage of various customer information data through simple configuration. In the process of encrypted data query and retrieval, it does not rely on data decryption. The data is stored in the database in an encrypted manner, and the retrieval process is retrieved and compared in ciphertext, which ensures data security while meeting the performance requirements of applications with large data volumes.
[0107] In addition, this application can adapt to changes in customer protected information by real-time interception of application SQL statements and the judgment, analysis and rewriting of SQL statements. It only requires simple configuration to meet the changed requirements, without the need for secondary development at the application level, and effectively supports customer privacy protection needs in various situations.
[0108] The present application embodiment also provides a privacy data protection device 300, such as Figure 3As shown, a schematic diagram of the structure of a privacy data protection device in an embodiment of the present application is provided, and the privacy data protection device includes: an interception unit 310, a determination unit 320, a first encryption unit 330 and a storage unit 340, wherein:
[0109] The interception unit 310 is used to intercept and parse the operation statement of the database to obtain the parsing result of the operation statement, wherein the operation statement is a statement for performing an operation change on the data in the database;
[0110] A determination unit 320, configured to obtain data parameter configuration information, and determine a field to be encrypted according to the parsing result of the operation statement and the data parameter configuration information;
[0111] A first encryption unit 330 is used to encrypt the field value corresponding to the field to be encrypted by using the encryption policy corresponding to the field to be encrypted to obtain a ciphertext of the field value;
[0112] The storage unit 340 is used to write the encrypted field value into the target data table.
[0113] In some embodiments of the present application, the parsing result of the operation statement includes parsed fields, and the determination unit 320 is specifically used to: determine whether the parsed fields exist in the data parameter configuration information; if the parsed fields exist in the data parameter configuration information, determine that the parsed fields are fields to be encrypted.
[0114] In some embodiments of the present application, the parsing result of the operation statement also includes the complete field value plaintext corresponding to the parsed field, and the first encryption unit 330 is specifically used to: encrypt the complete field value plaintext using the national secret SM2 encryption algorithm to obtain the complete field value ciphertext; the storage unit 340 is specifically used to: replace the corresponding complete field value plaintext stored in the original data table with the complete field value ciphertext.
[0115] In some embodiments of the present application, the first encryption unit 330 is specifically used to: determine whether the field to be encrypted needs to support fuzzy query and range retrieval; when the field to be encrypted needs to support fuzzy query and range retrieval, perform word segmentation on the complete field value plaintext corresponding to the field to be encrypted to obtain multiple word segmentation field value plaintexts; use the national secret SM2 encryption algorithm to encrypt the multiple word segmentation field value plaintexts respectively to obtain multiple word segmentation field value ciphertexts; the storage unit 340 is specifically used to: construct a mapping relationship between the parsed field and the corresponding data table and the corresponding multiple word segmentation field value ciphertexts and store them in the word segmentation registration table.
[0116] In some embodiments of the present application, the first encryption unit 330 is specifically used to: determine whether the field to be encrypted is a field that needs to be authenticated and matched with an external third-party system; if the field to be encrypted is a field that needs to be authenticated and matched with an external third-party system, obtain an authentication field set; according to the type of operation statement, use the national secret SM3 encryption algorithm to encrypt the field value plaintext corresponding to the authentication field in the authentication field set to obtain an authentication field value summary; the storage unit 340 is specifically used to: construct a mapping relationship between the authentication field value summary and the data table to which it belongs and the field value ciphertext of the data table; use the national secret SM2 encryption algorithm to encrypt the authentication field value summary, and store the mapping relationship between the encrypted authentication field value summary and the data table to which it belongs and the field value ciphertext of the data table in the verification information table.
[0117] In some embodiments of the present application, the privacy data protection device 300 also includes: a receiving unit, which is used to receive a query statement from a database and parse it to obtain a parsing result of the query statement, wherein the parsing result of the query statement includes a query field and a corresponding field value; a second encryption unit, which is used to encrypt the field value corresponding to the query field when the query field exists in the data parameter configuration information to obtain a ciphertext of the query field value; and a query unit, which is used to query in a target data table according to the ciphertext of the query field value and using a query strategy corresponding to the query field to obtain a data query result.
[0118] In some embodiments of the present application, the query unit is specifically used for: if the query field does not need to support fuzzy query and range search, and does not need to be authenticated and matched with an external third-party system, then the query field value ciphertext is queried in the original data table; if the query field needs to support fuzzy query and range search, then the query statement is rewritten, and the query is performed in the word segmentation data table according to the rewritten query statement and the query field value ciphertext; if the query field needs to be authenticated and matched with an external third-party system, then the query field value ciphertext is queried in the verification data table.
[0119] It can be understood that the above-mentioned privacy data protection device can implement each step of the privacy data protection method provided in the above-mentioned embodiment. The relevant explanations about the privacy data protection method are applicable to the privacy data protection device and will not be repeated here.
[0120] Figure 4 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 4At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0121] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0122] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0123] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a privacy data protection device at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0124] Intercepting and parsing the operation statement of the database to obtain the parsing result of the operation statement, wherein the operation statement is a statement for performing an operation change on the data in the database;
[0125] Acquire data parameter configuration information, and determine the field to be encrypted according to the parsing result of the operation statement and the data parameter configuration information;
[0126] Encrypting the field value corresponding to the field to be encrypted using the encryption policy corresponding to the field to be encrypted to obtain a ciphertext of the field value;
[0127] Write the ciphertext of the field value into the target data table.
[0128] The above application Figure 1The method performed by the privacy data protection device disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or instructions in software form. The above processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in a decoding processor. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0129] The present application also provides a computer program product, including a computer program or an instruction, which is implemented when the computer program or the instruction is executed by a processor. Figure 1 The privacy data protection method in the illustrated embodiment is specifically used to perform:
[0130] Intercepting and parsing the operation statement of the database to obtain the parsing result of the operation statement, wherein the operation statement is a statement for performing an operation change on the data in the database;
[0131] Acquire data parameter configuration information, and determine the field to be encrypted according to the parsing result of the operation statement and the data parameter configuration information;
[0132] Encrypting the field value corresponding to the field to be encrypted using the encryption policy corresponding to the field to be encrypted to obtain a ciphertext of the field value;
[0133] Write the ciphertext of the field value into the target data table.
[0134] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0135] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0136] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0137] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0138] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0139] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0140] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0141] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0142] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0143] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A privacy data protection method, characterized in that: The privacy data protection method comprises: Intercepting and parsing the operation statement of the database to obtain the parsing result of the operation statement, wherein the operation statement is a statement for performing an operation change on the data in the database; Acquire data parameter configuration information, and determine the field to be encrypted according to the parsing result of the operation statement and the data parameter configuration information; Encrypting the field value corresponding to the field to be encrypted using the encryption policy corresponding to the field to be encrypted to obtain a ciphertext of the field value; Write the ciphertext of the field value into the target data table.
2. The privacy data protection method according to claim 1, characterized in that: The parsing result of the operation statement includes the parsed fields, and the determining the to-be-encrypted fields according to the parsing result of the operation statement and the data parameter configuration information includes: Determine whether the parsed field exists in the data parameter configuration information; In a case where the parsed field exists in the data parameter configuration information, it is determined that the parsed field is a field to be encrypted.
3. The privacy data protection method according to claim 2, characterized in that: The parsing result of the operation statement also includes the complete field value plaintext corresponding to the parsed field, and the field value corresponding to the field to be encrypted is encrypted using the encryption policy corresponding to the field to be encrypted to obtain the field value ciphertext including: The complete field value plaintext is encrypted using the national secret SM2 encryption algorithm to obtain the complete field value ciphertext; The step of writing the ciphertext of the field value into the target data table comprises: The complete field value ciphertext replaces the corresponding complete field value plaintext stored in the original data table.
4. The privacy data protection method according to claim 3, characterized in that: The step of encrypting the field value corresponding to the field to be encrypted by using the encryption policy corresponding to the field to be encrypted to obtain the ciphertext of the field value comprises: Determine whether the field to be encrypted needs to support fuzzy query and range search; In the case where the field to be encrypted needs to support fuzzy query and range search, a complete field value plaintext corresponding to the field to be encrypted is segmented to obtain multiple segmented field value plaintexts; Use the national secret SM2 encryption algorithm to encrypt the plaintexts of multiple word segmentation field values respectively to obtain the ciphertexts of multiple word segmentation field values; The step of writing the ciphertext of the field value into the target data table comprises: A mapping relationship between the parsed fields and the corresponding data tables and multiple ciphertexts of word segmentation field values is constructed and stored in a word segmentation registration table.
5. The privacy data protection method according to claim 3, characterized in that: The step of encrypting the field value corresponding to the field to be encrypted by using the encryption policy corresponding to the field to be encrypted to obtain the ciphertext of the field value comprises: Determine whether the to-be-encrypted field is a field that needs to be authenticated and matched with an external third-party system; In the case where the field to be encrypted is a field that needs to be authenticated and matched with an external third-party system, obtaining an authentication field set; According to the type of the operation statement, the field value plaintext corresponding to the authentication field in the authentication field set is encrypted using the national secret SM3 encryption algorithm to obtain the authentication field value digest; The step of writing the ciphertext of the field value into the target data table comprises: Constructing a mapping relationship between the authentication field value summary and the corresponding data table and the field value ciphertext of the data table; The authentication field value summary is encrypted using the national secret SM2 encryption algorithm, and the mapping relationship between the encrypted authentication field value summary and the corresponding data table and the field value ciphertext of the data table is stored in the verification information table.
6. The privacy data protection method according to claim 1, characterized in that: The privacy data protection method further includes: Receiving a query statement from a database and parsing it to obtain a parsing result of the query statement, wherein the parsing result of the query statement includes a query field and a corresponding field value; In the case where the query field exists in the data parameter configuration information, encrypting the field value corresponding to the query field to obtain a ciphertext of the query field value; According to the ciphertext of the query field value, a query is performed in the target data table using the query strategy corresponding to the query field to obtain a data query result.
7. The privacy data protection method according to claim 6, characterized in that: The query strategy corresponding to the query field is used to query the target data table according to the ciphertext of the query field value to obtain the data query result, which includes: If the query field does not need to support fuzzy query and range search, and does not need to be authenticated and matched with an external third-party system, the ciphertext of the query field value is queried in the original data table; If the query field needs to support fuzzy query and range search, the query statement is rewritten, and a query is performed in the word segmentation data table according to the rewritten query statement and the ciphertext of the query field value; If the query field needs to be authenticated and matched with an external third-party system, a query is performed in the verification data table according to the ciphertext of the query field value.
8. A privacy data protection device, characterized in that: The privacy data protection device comprises: An interception unit, used to intercept and parse an operation statement of the database to obtain a parsing result of the operation statement, wherein the operation statement is a statement for performing an operation change on data in the database; A determination unit, configured to obtain data parameter configuration information, and determine a field to be encrypted according to a parsing result of the operation statement and the data parameter configuration information; A first encryption unit is used to encrypt a field value corresponding to the field to be encrypted by using an encryption policy corresponding to the field to be encrypted to obtain a ciphertext of the field value; The storage unit is used to write the ciphertext of the field value into the target data table.
9. An electronic device, comprising: processor; as well as A memory arranged to store computer executable instructions, wherein when the executable instructions are executed, the processor executes the privacy data protection method according to any one of claims 1 to 7.
10. A computer program product, comprising a computer program or instructions, wherein when the computer program or instructions are executed by a processor, the privacy data protection method according to any one of claims 1 to 7 is implemented.