Desensitization SQL script generation method and device and electronic equipment
By automatically generating desensitized SQL scripts, using target metadata and desensitization rulesets, efficient desensitization of SQL scripts is achieved, solving the problems of inefficiency and high error rate caused by manual operations in the existing technology, and improving desensitization Sensitivity accuracy and efficiency.
Patent Information
- Application Number
- CN202411846742.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-01-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, the desensitization processing of SQL scripts relies on manual operations, resulting in low efficiency, long time consumption, high error rate and poor flexibility.
A desensitized SQL script generation method is proposed. By obtaining the target metadata and desensitized rule set, the target desensitized tag is generated, and the desensitized SQL statement is generated based on the tag, and the desensitized SQL script is finally generated, including byte substitution and row transformation. Multiple desensitization technologies such as mixing and columns.
It realizes automatic generation of desensitized SQL scripts, shortens desensitization time, improves desensitization efficiency and accuracy, and reduces the work burden of operations, maintenance and developers.
Smart Images

Figure CN119311720A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a method, device and electronic device for generating a desensitized SQL script. Background Art
[0002] At present, with the surge in the number of Internet users and the rapid expansion of business needs, desensitizing SQL scripts is becoming increasingly important.
[0003] In the related art, the desensitization processing of SQL scripts mostly relies on manual operations, which has the problems of low desensitization efficiency, long time consumption, high error rate and poor flexibility.
[0004] Therefore, a new technical solution is urgently needed to solve the above technical problems. Summary of the invention
[0005] A series of simplified concepts are introduced in the Summary of the Invention, which will be further described in detail in the Detailed Description of the Invention. The Summary of the Invention does not mean to attempt to define the key features and essential technical features of the claimed technical solution, nor does it mean to attempt to determine the scope of protection of the claimed technical solution.
[0006] In a first aspect, the present application proposes a method for generating a desensitized SQL script, comprising: Obtain target metadata and desensitization rule set; the desensitization rule set includes: desensitization fields and / or desensitization methods; Generate a target desensitization label corresponding to the target metadata according to the desensitization rule set, wherein the target desensitization label includes: a desensitization label and a desensitization-free label; Generate the target desensitizing SQL statement corresponding to the target metadata according to the target desensitizing label; Generate the target desensitized SQL script based on the target desensitized SQL statement.
[0007] In some feasible implementations, the above method further includes: When the target desensitizing label corresponding to the target metadata is a desensitizing label, According to the key system parameter list, the target desensitization label is modified, wherein the key system parameter list includes: multiple parameters whose contribution to the running of the SQL script is greater than or equal to the preset contribution.
[0008] In some feasible implementations, the above-mentioned modification of the target desensitization label according to the key system parameter list includes: When the target metadata belongs to the key system parameter list, the target desensitization label is modified to a desensitization-free label.
[0009] In some feasible implementations, the above-mentioned desensitization label includes: a desensitization method; the above-mentioned generating a target desensitization SQL statement corresponding to the target metadata according to the target desensitization label includes: Generate a target desensitization mapping table based on the target desensitization label; According to the target desensitization mapping table, a target desensitized SQL statement corresponding to the target metadata is generated, and / or, an original SQL statement corresponding to the target metadata is reversely generated.
[0010] In some feasible implementations, the above-mentioned generating a target desensitizing SQL statement corresponding to the target metadata according to the target desensitizing label also includes: When the target desensitization label corresponding to the target metadata is a desensitization label, Based on the target replacement table, replace corresponding bytes in the target metadata to generate a target metadata replacement result; Based on the target row transformation rule, transform the row data in the target metadata replacement result to generate a target metadata row transformation result; Based on the target column mixing rule and the target metadata row transformation result, the target metadata encryption result is generated; Generate the target desensitized SQL statement based on the target metadata encryption result.
[0011] In some feasible implementations, the above-mentioned generating a target desensitizing SQL statement corresponding to the target metadata according to the target desensitizing label also includes: According to the target function, generate the target metadata encryption result: Among them, the objective function includes: Ciphertext=(((SubBytes(P)⊕ShiftRows(SubBytes(P))) MixColumns(SubBytes(P)))⊕K); S(x)=Table[mod(x⊕K,256)].
[0012] In some feasible implementations, the above method further includes: A round of key XOR operation is performed on the target metadata encryption result based on the following formula: ; in, The result of a round of key XOR for the target metadata. is a round key, Encrypts the result for the target metadata.
[0013] In some feasible implementations, the above method further includes: Based on the following formula, multiple rounds of key XOR operations are performed on the target metadata encryption result: ; in, It is the result of multiple rounds of key XOR of target metadata. is the target round key, is the target wheel state.
[0014] In a second aspect, the present application proposes a desensitized SQL script generation device, comprising: An acquisition unit, used for acquiring target metadata and a desensitization rule set; the desensitization rule set includes: a desensitization field and / or a desensitization method; A first generating unit is used to generate a target desensitization label corresponding to the target metadata according to a desensitization rule set, wherein the target desensitization label includes: a desensitization label and a desensitization-free label; The second generating unit is used to generate a target desensitizing SQL statement corresponding to the target metadata according to the target desensitizing label; The third generating unit is used to generate a target desensitized SQL script according to the target desensitized SQL statement.
[0015] In a third aspect, the present application proposes an electronic device, comprising a processor and a memory, wherein the memory stores computer program instructions, and the computer program instructions are used by the processor to execute the method for generating a desensitized SQL script as described in any of the above items when the processor is running.
[0016] The present application proposes a method, device and electronic device for generating a desensitized SQL script, wherein the method comprises: obtaining target metadata and a desensitization rule set; the desensitization rule set comprises: desensitized fields and / or desensitization methods; according to the desensitization rule set, generating a target desensitization label corresponding to the target metadata, wherein the target desensitization label comprises: a desensitization label and a desensitization-free label; according to the target desensitization label, generating a target desensitized SQL statement corresponding to the target metadata; according to the target desensitized SQL statement, generating a target desensitized SQL script. The present application can realize the automatic generation of desensitized SQL scripts, shorten the desensitization time of SQL scripts, and improve the desensitization efficiency and desensitization accuracy of SQL scripts.
[0017] Other advantages, objectives and features of the present application will be reflected in part through the following description, and in part will be understood by those skilled in the art through study and practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the exemplary embodiments below. The accompanying drawings are only for the purpose of illustrating exemplary embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings: Figure 1 A schematic diagram of a process for generating a desensitized SQL script provided in an embodiment of the present application; Figure 2 A structural schematic diagram of a desensitized SQL script generation device provided in an embodiment of the present application; Figure 3 A structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0019] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the scheme of the present application will be further described below. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0020] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices. The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments.
[0021] In the following description, many specific details are set forth to facilitate a full understanding of the present application, but the present application may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only part of the embodiments of the present application, rather than all of the embodiments.
[0022] In order to solve the above technical problems, according to the first aspect of the embodiments of the present application, the present application proposes a method for generating a desensitized SQL script. Figure 1 A schematic diagram of a process for generating a desensitized SQL script provided in an embodiment of the present application is shown in FIG. Figure 1As shown, including: Step S110, obtaining target metadata and a desensitization rule set; the desensitization rule set includes: desensitization fields and / or desensitization methods.
[0023] Exemplarily, the above-mentioned target metadata may include: database metadata, such as: table structure, field type, field description, etc.
[0024] Exemplarily, the above desensitization rule set can be defined by the user according to the user's needs. The above desensitization rule set includes: desensitization fields and / or desensitization methods defined by the user.
[0025] It should be noted that the above-mentioned target metadata and the above-mentioned desensitizing rule set can be loaded into the memory synchronously to improve the efficiency of data retrieval.
[0026] Step S120: Generate a target desensitization label corresponding to the target metadata according to the desensitization rule set, wherein the target desensitization label includes: a desensitization label and a desensitization-free label.
[0027] It should be noted that the key information in the above target metadata can be identified based on natural language processing (NPL) technology. The above natural language processing technology can include: word segmentation recognition, part-of-speech tagging, named entity recognition, etc. The above key information can include: instructions, table names, fields, business names, etc.
[0028] Exemplarily, the target desensitization label corresponding to the target metadata can be generated by traversing and comparing the key information and the desensitization fields in the desensitization rule set, wherein the target desensitization label includes: a desensitization label and a desensitization-free label.
[0029] Specifically, based on natural language processing (NPL) technology, the audit statistics business table can be screened and processed to determine the key information in the audit statistics business table, and the key information in the above audit statistics business table and the desensitized fields in the desensitization rule set can be traversed and compared to generate the target desensitized label of the audit statistics business table.
[0030] Step S130: Generate a target desensitized SQL statement corresponding to the target metadata according to the target desensitized label.
[0031] Exemplarily, a target metadata desensitization result can be generated according to the above-mentioned target desensitization label to generate a target desensitization SQL statement.
[0032] It should be noted that, in some feasible implementations, it is also possible to automatically determine the desensitized fields in the above-mentioned desensitization rule set based on the NPL technology and the query requirements expressed by the user in natural language based on the resident thread processing, traverse and compare the key information in the target metadata and the above-mentioned desensitized fields, and generate corresponding target desensitized labels. Then, based on the above-mentioned target desensitized labels, the big data model is used to automatically generate target desensitized SQL statements corresponding to the target metadata.
[0033] For example, when the natural language input by the user is: "The number of users who successfully handled the "current remaining traffic query" service on September 8, 2024, with duplicate mobile phone numbers", the mobile phone number is automatically determined to be a desensitized field, and a target desensitized label is generated corresponding to the mobile phone number. Then, according to the target desensitized label, the big data model is used to automatically generate the following target desensitized SQL statement to count the number of users who successfully handled the "current remaining traffic query" service on September 8, 2024: # Question: The number of users who successfully completed the "Current Remaining Traffic Query" service on 2024-09-08, with duplicate mobile phone numbers # """ # template="" # You are a text-to-SQL generator. Your main goal is to assist users in converting input text into correct SQL statements as much as possible.
[0034] # Context start # The generated table names and table fields are from the following tables: # Table 1: cargo # Field 1: name (business name), field 2: time (handling time), field 3: number (user phone number), field 4: result (handling result: 0 means success, others mean failure) # End of context # Question: The number of users who successfully completed the "Current Remaining Traffic Query" service on 2024-09-08, with duplicate mobile phone numbers # """ # In some feasible implementations, the above-mentioned desensitization label includes: a desensitization method.
[0035] Exemplarily, when the target desensitizing label corresponding to the target metadata is a desensitizing label, the above-mentioned desensitizing label also includes: traversing and querying the above-mentioned desensitizing rule set according to the above-mentioned target metadata, and determining the desensitizing method corresponding to the above-mentioned target metadata, so as to automatically perform a desensitizing operation on the target metadata according to the above-mentioned desensitizing method.
[0036] In the above step S130, generating a target desensitizing SQL statement corresponding to the target metadata according to the target desensitizing label includes: Step S131, generating a target desensitization mapping table according to the target desensitization label.
[0037] Exemplarily, a target metadata desensitization result can be generated according to the target desensitization tag. According to the target metadata desensitization result, a target desensitization mapping table can be generated to facilitate subsequent queries and calls.
[0038] Step S132: Generate a target desensitized SQL statement corresponding to the target metadata according to the target desensitization mapping table, and / or reversely generate an original SQL statement corresponding to the target metadata.
[0039] Exemplarily, based on the NLP advanced model, a target desensitization SQL statement corresponding to the target metadata can be generated according to the above-mentioned target desensitization mapping table.
[0040] And / or, based on the NLP advanced model, according to the above-mentioned target desensitization mapping table, reversely generate the original SQL statement corresponding to the target metadata.
[0041] Based on this, the above method can realize automatic and accurate generation of the target desensitization mapping table according to the target desensitization label; according to the target desensitization mapping table, automatically and accurately generate the target desensitized SQL statement corresponding to the target metadata, and / or automatically reverse generate the original SQL statement corresponding to the target metadata, which is conducive to realizing the bidirectional automatic generation of the original SQL statement and / or the target desensitized SQL statement, which is conducive to bidirectionally reducing the workload of operation and maintenance and developers, and bidirectionally improving the generation efficiency and generation accuracy of SQL statements.
[0042] In some feasible implementations, the above step S130 generates a target desensitized SQL statement corresponding to the target metadata according to the target desensitized label, and further includes: Step S133: When the target desensitization label corresponding to the target metadata is a desensitization label, based on the target replacement table, the corresponding bytes in the target metadata are replaced to generate a target metadata replacement result.
[0043] Exemplarily, when the target desensitization label corresponding to the target metadata is a desensitization label, the corresponding bytes in the target metadata can be replaced based on the target replacement table and the target function to generate a target metadata replacement result.
[0044] Step S134: based on the target row transformation rule, transform the row data in the target metadata replacement result to generate a target metadata row transformation result.
[0045] Exemplarily, based on the target row transformation rule, the row data in the target metadata replacement result may be transformed according to the target function to generate a target metadata row transformation result.
[0046] Step S135 , based on the target column mixing rule and the target metadata row transformation result, a target metadata encryption result is generated.
[0047] Exemplarily, the target metadata encryption result can be generated according to the target column mixing rule and the target metadata row transformation result according to the following formula: (1); in, Encrypt the result for the target metadata, is the original column vector of the target metadata row transformation result, is the target mixing matrix.
[0048] It should be noted that the target column mixing rule can be determined according to the version of the Advanced Encryption Standard (AES). Specifically, the target metadata encryption result is determined according to the product of a fixed polynomial and the original column vector of the target metadata row transformation result. domain.
[0049] Step S136, generating a target desensitized SQL statement according to the target metadata encryption result.
[0050] It should be noted that the desensitization of the target desensitized SQL statement is positively correlated with the encryption of the target metadata encryption result, that is, the higher the encryption of the target metadata encryption result, the higher the desensitization of the SQL statement, and the higher the desensitization of the desensitized SQL script.
[0051] Based on this, the above method can replace the corresponding bytes in the target metadata when the target desensitizing label corresponding to the target metadata is a desensitizing label to improve the encryption of the target metadata replacement result, transform the row data in the target metadata replacement result based on the target row transformation rule to improve the encryption of the target metadata row transformation result, and based on the target column mixing rule, according to the target metadata row transformation result to improve the encryption of the target metadata encryption result, generate a target desensitized SQL statement according to the target metadata encryption result, thereby achieving triple desensitization of the SQL script through byte replacement, row transformation, and column mixing to improve the desensitization effect of the SQL script.
[0052] In some feasible implementations, the above step S130 generates a target desensitized SQL statement corresponding to the target metadata according to the target desensitized label, and further includes: Step S137, generating a target metadata encryption result according to the target function: Among them, the objective function includes: Ciphertext=(((SubBytes(P)⊕ShiftRows(SubBytes(P))) MixColumns(SubBytes(P)))⊕K).
[0053] It should be noted that the above SubBytes(P) is used to indicate that the S-box replacement is applied to each byte in the target metadata plaintext P. The above S-box is a target replacement table, which is used to map each byte to the target byte. Based on this, it is possible to use key dynamic mapping to generate a modified S-box, and generate the target metadata encryption result by performing the above target function operation on the key and the input byte.
[0054] It should be noted that the above-mentioned target metadata encryption result can be used as an index of output bytes and / or input data for subsequent processing.
[0055] It should be noted that the above ShiftRows(SubBytes(P)) is used to indicate that the target metadata replacement result after the SubBytes transformation is shifted in rows. The above row shifting step is performed after the byte replacement. Specifically, the rows of the matrix or array can be circularly shifted according to a fixed rule to improve the diffusion effect of the target metadata replacement result.
[0056] It should be noted that the above MixColumns(SubBytes(P)) is used to represent the column mixing of the target metadata row transformation result. It is understandable that the above column mixing step is performed after the row shift. Specifically, it can be implemented on the columns of the matrix through a specific polynomial multiplication to further enhance the diffusion effect of the target metadata encryption result.
[0057] It should be noted that the above ⊕ is used to represent a bitwise XOR operation.
[0058] It should be noted that the above Used to represent a combination of target forms.
[0059] Among them, the above objective function also includes: S(x)=Table[mod(x⊕K,256)].
[0060] It should be noted that the above Table is used to represent a fixed or variable 256-byte array, where x is the input byte, K is the key byte, and mod(a, 256) is used to ensure that the result is a valid byte.
[0061] Based on this, the above method can be implemented according to the objective function: Ciphertext=(((SubBytes(P)⊕ShiftRows(SubBytes(P))) MixColumns(SubBytes(P)))⊕K) and the objective function: S(x)=Table[mod(x⊕K,256)], accurately generate the target metadata encryption result to improve the diffusibility of the target metadata encryption result, and then improve the encryption of the target metadata, thereby further improving the desensitization effect of the SQL script.
[0062] In some feasible implementations, the method 100 further includes: Step S138, performing a round of key XOR operation on the target metadata encryption result based on the following formula: (2); in, The result of a round of key XOR for the target metadata. is a round key, Encrypts the result for the target metadata.
[0063] It should be noted that the above Can be plain text in bytes.
[0064] Based on this, the above method can implement a round of key XOR operation on the target metadata encryption result based on the above formula (2) to further improve the encryption of the target metadata, thereby further improving the desensitization effect of the SQL script.
[0065] In some feasible implementations, the above method further includes: Step S139, performing multiple rounds of key XOR operations on the target metadata encryption result based on the following formula: (3); Among them, Ci is the XOR result of multiple rounds of key of target metadata, Ki is the target round key, and Si is the target round state.
[0066] Exemplarily, the multi-round key XOR operation may be a multi-round key XOR operation of the Advanced Encryption Standard (AES). Specifically, the multi-round key XOR operation of the Advanced Encryption Standard (AES) may include: 10 rounds of key XOR operations corresponding to AES-128, 12 rounds of key XOR operations corresponding to AES-192, and / or 14 rounds of key XOR operations corresponding to AES-256.
[0067] It should be noted that each round of the above-mentioned multi-round key XOR operation includes: performing an S-box replacement operation, a row shift operation, a column mixing operation and a round key addition operation on the corresponding bytes in the target metadata.
[0068] Specifically, the code for generating the multi-round key XOR result of the target metadata is as follows: function SKPEDA(databaseMetadata, desensitizationRules,keyParameters): # Initialization markedForDesensitization = {} for table in databaseMetadata.tables: for field in table.fields: if field.name in desensitizationRules: markedForDesensitization[table.name, field.name] = True # Exclude key system parameters for param in keyParameters: if (param.tableName, param.fieldName) in markedForDesensitization:markedForDesensitization[(param.tableName, param.fieldName)] = False #Generate and apply desensitization strategy for (tableName, fieldName) in markedForDesensitization: if markedForDesensitization[(tableName, fieldName)]: strategy = getDesensitizationStrategy(fieldName,desensitizationRules)applyDesensitization(databaseMetadata, tableName,fieldName, strategy) # Verify and return the result validateDesensitization(databaseMetadata) return updatedDatabase, desensitizationLog Based on this, the above method can implement multiple rounds of key XOR operations on the target metadata encryption result based on the above formula (3) to further improve the encryption of the target metadata, thereby further improving the desensitization effect of the SQL script.
[0069] Step S140, generating a target desensitized SQL script according to the target desensitized SQL statement.
[0070] Exemplarily, the target desensitized SQL script includes the target desensitized SQL statements and the relationship between the target desensitized SQL statements, wherein the relationship includes: a logical relationship, an inclusion relationship, and a hierarchical relationship, etc.
[0071] Based on this, the present application provides a method for generating a desensitized SQL script, including: obtaining target metadata and a desensitizing rule set, wherein the desensitizing rule set includes: desensitized fields, and / or desensitizing methods; generating a target desensitizing label corresponding to the target metadata according to the desensitizing rule set, wherein the target desensitizing label includes: a desensitizing label and a desensitizing-free label; generating a target desensitized SQL statement corresponding to the target metadata according to the target desensitizing label; generating a target desensitized SQL script according to the target desensitizing SQL statement. The present application can accurately and automatically generate a target desensitizing label corresponding to the target metadata based on the desensitizing rule set by comparing the target metadata and the desensitizing rule set, and accurately and automatically generate a target desensitizing SQL statement corresponding to the target metadata according to the above target desensitizing label; accurately and automatically generate a target desensitized SQL script according to the target desensitizing SQL statement. The generation of the desensitized SQL script in the present application gets rid of the dependence on manual operation, which is conducive to reducing the workload of operation and maintenance and developers, reducing the labor cost in the desensitization process of SQL scripts, and improving the generation efficiency and generation accuracy of the desensitized SQL script.
[0072] In some feasible implementations, the method 100 further includes: Step S150, when the target desensitizing label corresponding to the target metadata is a desensitizing label, correct the target desensitizing label according to the key system parameter list, wherein the key system parameter list includes: multiple parameters whose contribution to the running of the SQL script is greater than or equal to the preset contribution.
[0073] Exemplarily, the above-mentioned key system parameter list, the above-mentioned target metadata and the above-mentioned desensitization rule set can be loaded into the memory together to improve data retrieval efficiency.
[0074] Exemplarily, the preset contribution can be determined based on the user's requirements for the running stability and / or smoothness of the SQL script. Specifically, the preset contribution is negatively correlated with the requirements for the running stability and / or smoothness, that is, the higher the requirements for the running stability and / or smoothness, the lower the preset contribution. It should be noted that the preset contribution is also related to the attributes of the parameters, that is, the preset contribution with different values can be set according to different attributes of the parameters.
[0075] Based on this, the above method can be implemented, when the target desensitizing label corresponding to the target metadata is a desensitizing label, according to the contribution of the target metadata to the operation of the SQL script, the target desensitizing label is corrected accordingly, so as to improve the matching between the desensitization degree of the SQL script and the user's requirements for the running stability and / or smoothness of the SQL script, and improve the personalized generation level of the desensitized SQL script.
[0076] In some feasible implementations, the above step S150, based on the key system parameter list, corrects the target desensitization label, including: Step S151, when the target metadata belongs to the key system parameter list, modify the target desensitization label to a desensitization-free label.
[0077] It should be noted that, based on the above-mentioned key system parameter list, the target metadata that has been marked with a desensitization label can be traversed and identified. When the above-mentioned target metadata belongs to the above-mentioned key system parameter list, the target desensitization label corresponding to the above-mentioned target metadata is corrected to a desensitization-free label.
[0078] Based on this, the above method can accurately correct the target desensitization label according to the list of key system parameters to avoid mistakenly performing desensitization operations on target metadata that has a greater impact on the operation of SQL scripts. While ensuring the stable operation of SQL scripts, the desensitization accuracy and efficiency of the target metadata can be further improved.
[0079] In a second aspect of the embodiment of the present application, a desensitized SQL script generation device is provided. FIG2 is a structural schematic diagram of a desensitized SQL script generation device 200 provided in an embodiment of the present application. Figure 2As shown, the apparatus 200 includes: an acquisition unit 210 , a first generation unit 220 , a second generation unit 230 and a third generation unit 240 .
[0080] The acquisition unit 210 is used to acquire target metadata and a desensitization rule set; the desensitization rule set includes: a desensitization field and / or a desensitization method.
[0081] The first generating unit 220 is used to generate a target desensitization label corresponding to the target metadata according to the desensitization rule set, wherein the target desensitization label includes: a desensitization label and a desensitization-free label.
[0082] The second generating unit 230 is used to generate a target desensitizing SQL statement corresponding to the target metadata according to the target desensitizing label.
[0083] The third generating unit 240 is used to generate a target desensitized SQL script according to the target desensitized SQL statement.
[0084] In a third aspect, the present application proposes an electronic device. Figure 3 FIG. 1 is a structural diagram of an electronic device 300 provided in an embodiment of the present application. Figure 3 As shown, the electronic device 300 includes a processor 310 and a memory 320, wherein the memory 320 stores computer program instructions, and the computer program instructions are used by the processor 310 to execute the method for generating a desensitized SQL script of any one of the first aspects when the processor 310 is running.
[0085] A person skilled in the art may understand the specific details and beneficial effects of the desensitized SQL script generation device and electronic device by reading the above description of the desensitized SQL script generation method, which will not be described here for the sake of brevity.
[0086] It should be noted that in the above embodiments, the description of each embodiment has its own emphasis, and for parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0087] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
[0088] Although the preferred embodiments of this specification have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of this specification.
[0089] Obviously, those skilled in the art can make various changes and modifications to this specification without departing from the spirit and scope of this specification. Thus, if these modifications and variations of this specification fall within the scope of the claims of this specification and their equivalents, this specification is also intended to include these modifications and variations.
Claims
1. A method for generating a desensitized SQL script, characterized in that: include: Obtain target metadata and desensitization rule sets; The desensitization rule set includes: desensitization fields and / or desensitization methods; Generate a target desensitization label corresponding to the target metadata according to the desensitization rule set, wherein the target desensitization label includes: a desensitization label and a desensitization-free label; Generate a target desensitizing SQL statement corresponding to the target metadata according to the target desensitizing label; Generate a target desensitized SQL script based on the target desensitized SQL statement.
2. The method according to claim 1, characterized in that: Also includes: When the target desensitizing label corresponding to the target metadata is a desensitizing label, The target desensitizing label is modified according to a key system parameter list, wherein the key system parameter list includes: multiple parameters whose contribution to the running of the SQL script is greater than or equal to a preset contribution.
3. The method according to claim 2, characterized in that: According to the key system parameter list, the target desensitization label is modified, including: In the case that the target metadata belongs to the key system parameter list, the target desensitization label is modified to be a desensitization-free label.
4. The method according to any one of claims 1 to 3, characterized in that: The desensitization label includes: the desensitization method; The step of generating a target desensitizing SQL statement corresponding to the target metadata according to the target desensitizing label includes: Generate a target desensitization mapping table according to the target desensitization label; According to the desensitization mapping table, a target desensitized SQL statement corresponding to the target metadata is generated, and / or an original SQL statement corresponding to the target metadata is reversely generated.
5. The method according to claim 4, characterized in that: The step of generating a target desensitizing SQL statement corresponding to the target metadata according to the target desensitizing label also includes: In the case where the target desensitization label corresponding to the target metadata is a desensitization label, Based on the target replacement table, replace corresponding bytes in the target metadata to generate a target metadata replacement result; Based on the target row transformation rule, transform the row data in the target metadata replacement result to generate a target metadata row transformation result; Based on the target column mixing rule, generating a target metadata encryption result according to the target metadata row transformation result; The target desensitized SQL statement is generated according to the target metadata encryption result.
6. The method according to claim 5, characterized in that: The step of generating a target desensitizing SQL statement corresponding to the target metadata according to the target desensitizing label also includes: According to the target function, the target metadata encryption result is generated: Wherein, the objective function includes: Ciphertext=(((SubBytes(P)⊕ShiftRows(SubBytes(P))) MixColumns(SubBytes(P)))⊕K); S(x)=Table[mod(x⊕K,256)].
7. The method according to claim 6, characterized in that: Also includes: Based on the following formula, a round of key XOR operation is performed on the target metadata encryption result: ; in, The result of a round of key XOR for the target metadata. is a round key, Encrypts the result for the target metadata.
8. The method according to claim 7, characterized in that: Also includes: Based on the following formula, multiple rounds of key XOR operations are performed on the target metadata encryption result: ; in, It is the result of multiple rounds of key XOR of target metadata. is the target round key, is the target wheel state.
9. A device for generating a desensitized SQL script, characterized in that: include: An acquisition unit, used to acquire target metadata and desensitization rule sets; The desensitization rule set includes: desensitization fields and / or desensitization methods; A first generating unit, configured to generate a target desensitization label corresponding to the target metadata according to the desensitization rule set, wherein the target desensitization label includes: a desensitization label and a desensitization-free label; A second generating unit, configured to generate a target desensitizing SQL statement corresponding to the target metadata according to the target desensitizing label; The third generating unit is used to generate a target desensitized SQL script according to the target desensitized SQL statement.
10. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores computer program instructions, and the computer program instructions are used by the processor to execute the method for generating a desensitized SQL script as described in any one of claims 1 to 8 when the processor is running.
Citation Information
Patent Citations
Song ci poetry text message hiding technology based on hybrid encryption
CN106254074A
Data desensitization method and device and electronic equipment
CN114996758A
Private data protection method and device for low-code platform, equipment and storage medium
CN115146315A
Data processing method and device and related equipment
CN115270185A
Dynamic desensitization method for structured data
CN119066698A