Data desensitization method, device, electronic device and computer-readable storage medium

By determining the target desensitization method according to the destination identification of the data, and using different desensitization methods to process the fields to be desensitized, the risk of privacy leakage caused by the unified desensitization method in the existing technology is solved, and more flexible and secure data desensitization is achieved. .

CN115098464BActive Publication Date: 2024-08-23PING AN BANK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210731837.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-25
Publication Date
2024-08-23
Estimated Expiration
2042-06-25

AI Technical Summary

Technical Problem

Existing data desensitization methods use a unified desensitization method when stored locally or sent to other terminal devices, resulting in a greater risk of privacy leakage.

Method used

By obtaining the destination identifier of the field to be desensitized and comparing it with the preset destination identifier, the target desensitization method is determined, and different desensitization methods are used for processing according to different destinations, including value filters, encryption, hashing and other methods. .

Benefits of technology

The risk of private data leakage is reduced, making the desensitization of private data more flexible and adaptable to different usage scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115098464B
    Figure CN115098464B
Patent Text Reader

Abstract

The embodiments of the present invention provide a data desensitization method, device, electronic device and computer-readable storage medium, and relate to the field of data processing technology. The data desensitization method provided by the embodiments of the present invention includes: obtaining a field to be desensitized and field data of the field to be desensitized; determining a destination identifier of the field to be desensitized; comparing the destination identifier with at least one preset destination identifier, and obtaining a target preset destination identifier that is the same as the destination identifier in at least one preset destination identifier; each preset destination identifier corresponds to a desensitization method; according to the target preset destination identifier, obtaining a target desensitization method for the field to be desensitized; according to the target desensitization method, desensitizing the field data of the field to be desensitized to obtain a desensitization result. The data desensitization method, device, electronic device and computer-readable storage medium provided by the embodiments of the present invention can reduce the risk of privacy leakage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a data desensitization method, device, electronic device and computer-readable storage medium. Background Art

[0002] Existing servers automatically generate a lot of log files, for example, log files generated during the development process of programmers. Log files may contain private data, such as ID number, name, mobile phone number, age, address, product purchase records, etc. The leakage of these private data poses a great threat to user privacy, so it is necessary to desensitize the sensitive fields in the log files.

[0003] However, the existing desensitization processing, regardless of whether the data is stored locally or sent to other terminal devices, is performed in a unified desensitization manner, which poses a high risk of privacy leakage. Summary of the invention

[0004] Based on the above research, embodiments of the present invention provide a data desensitization method, device, electronic device and computer-readable storage medium to reduce the risk of privacy leakage.

[0005] The embodiments of the present invention can be implemented through the following two aspects:

[0006] In a first aspect, a data desensitization method is provided, the method comprising:

[0007] Get the field to be desensitized and the field data of the field to be desensitized;

[0008] Determine the destination identifier of the field to be desensitized;

[0009] Compare the destination identifier with at least one preset destination identifier to obtain a target preset destination identifier that is the same as the destination identifier in the at least one preset destination identifier; each preset destination identifier corresponds to a desensitization method;

[0010] According to the target preset destination identifier, the target desensitization method of the field to be desensitized is obtained;

[0011] According to the target desensitization method, the field data of the field to be desensitized is desensitized to obtain the desensitization result.

[0012] In a second aspect, a data desensitization device is provided, the device comprising:

[0013] An acquisition unit, used to acquire the field to be desensitized and the field data of the field to be desensitized;

[0014] A determination unit, used to determine the destination identifier of the field to be desensitized;

[0015] A comparison unit, used to compare the destination identifier with at least one preset destination identifier, and obtain a target preset destination identifier that is the same as the destination identifier in the at least one preset destination identifier; each preset destination identifier corresponds to a desensitization method;

[0016] A method unit, used to obtain a target desensitization method of the field to be desensitized according to a target preset destination identifier;

[0017] The desensitizing unit is used to perform desensitization processing on the field data of the to-be-desensitized field according to a target desensitization method to obtain a desensitization result.

[0018] In a third aspect, an electronic device is provided, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps in the data desensitization method of the first aspect.

[0019] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and the computer program is executed by a processor to implement the steps in the data desensitization method of the first aspect.

[0020] The data desensitization method, device, electronic device and computer-readable storage medium provided in the embodiments of the present invention first obtain the field to be desensitized and the field data of the field to be desensitized, determine the destination identifier of the field to be desensitized, and then obtain the target desensitization method of the field to be desensitized according to the destination identifier, and finally perform desensitization by the target desensitization method. Since different destinations have different desensitization methods, the risk of privacy leakage is reduced to a certain extent, and the desensitization of privacy data is made more flexible. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0022] Figure 1 A structural block diagram of an electronic device provided by an embodiment of the present invention.

[0023] Figure 2 A flowchart of a data desensitization method provided in an embodiment of the present invention.

[0024] Figure 3 A schematic diagram of a data table provided in an embodiment of the present invention.

[0025] Figure 4A schematic diagram of the composition structure of the data desensitizing device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0027] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0028] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0029] As mentioned in the background technology, the existing desensitization processing, regardless of whether the data is stored locally or sent to other terminal devices, is performed in a unified desensitization manner, which poses a high risk of privacy leakage.

[0030] Based on this, the data desensitization method, device, electronic device and computer-readable storage medium provided in the embodiments of the present invention first obtain the field to be desensitized and the field data of the field to be desensitized, determine the destination identifier of the field to be desensitized, and then obtain the target desensitization method of the field to be desensitized according to the destination identifier, and finally perform desensitization using the target desensitization method. Since different destinations have different desensitization methods, the risk of privacy leakage is reduced to a certain extent, and the desensitization of privacy data is made more flexible.

[0031] See also Figure 1 , Figure 1 This is a structural block diagram of an electronic device 100 provided in this embodiment. The electronic device may include a data desensitization device 10, a memory 20, a processor 30 and a communication unit 40, the memory 20 stores a computer program executable by the processor 30, when the electronic device 100 is running, the processor 30 and the memory 20 communicate through a bus, and the processor 30 executes the computer program to execute the data desensitization method.

[0032] The memory 20, the processor 30 and the communication unit 40 are electrically connected to each other directly or indirectly to realize the transmission or interaction of signals. For example, these elements can be electrically connected to each other through one or more communication buses or signal lines. The data desensitization device 10 includes at least one software function unit that can be stored in the memory 20 in the form of software or firmware. The processor 30 is used to execute the software function unit stored in the memory 20.

[0033] Among them, the memory 20 can be, but is not limited to, random access memory (Random Access memory, RAM), read only memory (Read Only Memory, ROM), programmable read-only memory (Programmable Read-Only Memory, PROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, EPROM), electrically erasable read-only memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc.

[0034] In some embodiments, the processor 30 is used to perform one or more functions described in the present embodiment. In some embodiments, the processor 30 may include one or more processing cores (e.g., a single-core processor (S) or a multi-core processor (S)). By way of example only, the processor 30 may include a central processing unit (CPU), an application specific integrated circuit (ASIC), an application specific instruction set processor (ASIP), a graphics processing unit (GPU), a physical processing unit (PPU), a digital signal processor (DSP), a field programmable gate array (FPGA), a programmable logic device (PLD), a controller, a microcontroller unit, a reduced instruction set computer (RISC) or a microprocessor, or any combination thereof.

[0035] For ease of explanation, only one processor is described in the electronic device 100. However, it should be noted that the electronic device 100 in this embodiment may also include multiple processors, so the steps performed by one processor described in this embodiment may also be performed jointly or individually by multiple processors. For example, if the processor of the server executes step A and step B, it should be understood that step A and step B may also be performed jointly by two different processors or individually in one processor. For example, the first processor executes step A, the second processor executes step B, or the first processor and the second processor execute steps A and B together.

[0036] In this embodiment, the memory 20 is used to store programs, and the processor 30 is used to execute the computer program after receiving it. The process definition method disclosed in any implementation of this embodiment can be applied to the processor 30, or implemented by the processor 30.

[0037] The communication unit 40 is used to establish a communication connection between the electronic device 100 and other devices through a network, and to send and receive data through the network.

[0038] In some embodiments, the network may be any type of wired or wireless network, or a combination thereof. By way of example only, the network may include a wired network, a wireless network, a fiber optic network, a telecommunications network, an intranet, the Internet, a local area network (LAN), a wide area network (WAN), a wireless local area network (WLAN), a metropolitan area network (MAN), a wide area network (WAN), a public switched telephone network (PSTN), a Bluetooth network, a ZigBee network, or a near field communication (NFC) network, or any combination thereof.

[0039] In this embodiment, the electronic device 100 can be but is not limited to a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a server, a server cluster, etc. This embodiment does not impose any restrictions on the specific type of the electronic device.

[0040] Understandably, Figure 1The structure shown is for illustration only. The electronic device 100 may also have Figure 1 More or fewer components than shown, or with Figure 1 Different configurations are shown. Figure 1 The components shown may be implemented in hardware, software or a combination thereof.

[0041] based on Figure 1 This embodiment provides a data desensitization method. Figure 1 The electronic device shown performs the following based on Figure 1 The structure diagram of the electronic device 100 shown in FIG. 1 is used to describe in detail the steps of the data desensitization method provided in this embodiment. Figure 2 The data desensitization method provided in this embodiment includes steps S101 to S105. The data desensitization method provided in this embodiment of the present invention can be used in the field of credit cards, but is not limited to the field of credit cards. For example, it can also be applied to the field of online transactions and insurance.

[0042] Step S101: Obtain the field to be desensitized and the field data of the field to be desensitized.

[0043] The field to be desensitized refers to the field to be desensitized; the field data refers to the data of the object in the field. The field to be desensitized can be all the fields of all the objects in the data table, where the data table includes multiple objects; the field to be desensitized can also be part of the fields in the data table. For example, the field to be desensitized is a field in the data table that contains user privacy. Therefore, it is necessary to desensitize such fields to reduce the risk of user privacy leakage. For example, all the fields in the data table are: name, age, ID number, mobile phone number, address, gender, graduation school, bank card number, so the field to be desensitized can be: name, ID number, mobile phone number, address and bank card number; it can also be a piece of data of an object, which includes at least one field, and the at least one field is the field to be desensitized, or some of the at least one field are the fields to be desensitized.

[0044] The fields to be desensitized and the field data of the fields to be desensitized can be acquired in real time, so that the electronic device can desensitize the real-time data, for example, the data sent by other electronic devices; the fields to be desensitized and the field data of the fields to be desensitized can also be stored in the electronic device, so that the electronic device can also desensitize the stored data.

[0045] In one example, a field is compared with at least one sensitive word in a sensitive word list to determine whether the field is a field to be desensitized. Specifically, if the field is the same as a sensitive word in the sensitive word list, the field is a field to be desensitized and needs to be desensitized. If the field is different from at least one sensitive word in the sensitive word list, the field is not a field to be desensitized and does not need to be desensitized. The sensitive word list is a table for recording sensitive words, and at least one sensitive word is recorded in the sensitive word list.

[0046] In another example, the field is compared with at least one whitelist word in the whitelist table to determine whether the field is a field to be desensitized. Specifically, if the field is the same as a sensitive word in the whitelist table, the field is not a field to be desensitized. If the field is different from at least one whitelist word in the whitelist table, the field is a field to be desensitized. The whitelist table is a table for recording whitelist words, and at least one whitelist word is recorded in the whitelist table.

[0047] Step S102: Determine the destination identifier of the field to be desensitized.

[0048] The destination identifier is used to uniquely identify the destination of the field to be desensitized. The destination identifier can be composed of numbers and / or letters and / or characters. For example, the destination identifier is 123ert45*IOP%.

[0049] In one example, the destination identifier of the field to be desensitized can be determined based on the destination of the field to be desensitized. For example, if the destination of the field to be desensitized is to be displayed locally on the electronic device, then the destination identifier is a display identifier; if the destination of the field to be desensitized is to be stored locally on the electronic device, then the destination identifier is a storage identifier; if the destination of the field to be desensitized is to be sent to other electronic devices, then the destination identifier is an outbound identifier.

[0050] In another example, the data table where the field to be desensitized is located records the destination identifier of each field, so the destination identifier of the field to be desensitized can be obtained from the data table where the field to be desensitized is located.

[0051] In another example, the destination table records at least one data table and the destination identifier of the data table, the at least one data table includes the data table where the field to be desensitized is located, the destination identifier of the data table where the field to be desensitized is located is obtained from the destination table, and the destination identifier of the data table where the field to be desensitized is located is used as the destination identifier of the field to be desensitized. The destination identifier of the data table is used to uniquely identify the destination of the destination table, and the destination identifier of the data table can also be composed of numbers and / or letters and / or characters.

[0052] Step S103: Compare the destination identifier with at least one preset destination identifier to obtain a target preset destination identifier that is the same as the destination identifier in the at least one preset destination identifier.

[0053] The preset destination identifier is a pre-set destination identifier.

[0054] The preset destination identifier may include, but is not limited to, a display identifier, a storage identifier, and an outbound identifier. Among them, the display identifier means that the field and the field data of the field will be displayed locally on the electronic device. For example, the display identifier includes a printing sub-identifier and a display sub-identifier. When the display identifier is a printing sub-identifier, it means that the field to be desensitized and the field data of the field to be desensitized will be printed by a local printer. When the display identifier is a display sub-identifier, it means that the field to be desensitized and the field data of the field to be desensitized will be displayed and fed back through the display unit of the electronic device; the storage identifier means that the field and the field data of the field will be stored locally on the electronic device for subsequent use; the outbound identifier means that the field and the field data of the field will be sent to other electronic devices.

[0055] Each of the at least one preset destination identifier corresponds to a desensitization method, as shown in the destination method table in Table 1. The desensitization method corresponding to the preset destination identifier 1 is desensitization method 1, the desensitization method corresponding to the preset destination identifier 2 is desensitization method 2, and the desensitization method corresponding to the preset destination identifier N is desensitization method N.

[0056] Table 1

[0057]

[0058]

[0059] The target preset destination identifier is a preset destination identifier among at least one preset destination identifier that is the same as the destination identifier of the field to be desensitized. The similarity between the destination identifier and each preset destination identifier is calculated respectively, and the preset destination identifier with a similarity of 100% is used as the target preset destination identifier. For example, the similarity is cosine similarity.

[0060] Step S104: Obtain the target desensitization method of the field to be desensitized according to the target preset destination identifier.

[0061] In one example, the target desensitization method of the field to be desensitized is obtained according to the target preset destination identifier and the query destination method table.

[0062] If it is a display mark, since it is only for display, it only needs to be masked and desensitized through a value filter. In this way, others cannot see the full picture of the private data. If it is a storage mark, in order to prevent the private data from being hacked, encryption is used for desensitization, which effectively prevents hacker intrusion and facilitates subsequent decryption. If it is an outbound mark, since the data is easily intercepted during the transmission process, an irreversible hash method is used for desensitization. Thus, different desensitization processes for different destinations are achieved, so that the desensitization process can be adapted to the destination, effectively reducing the risk of private data leakage. In another example, according to the target preset destination mark, the target desensitization method of the field to be desensitized is obtained, including: if the target preset destination mark is a display mark, then the target desensitization method of the field to be desensitized is determined to be a value filter desensitization processing method; if the target preset destination mark is a storage mark, then the target desensitization method of the field to be desensitized is determined to be an encryption desensitization processing method; if the target preset destination mark is an outbound mark, then the target desensitization method of the field to be desensitized is determined to be a hash desensitization processing method.

[0063] The value filter desensitization processing method refers to a desensitization processing method that modifies the field data of the desensitized field through a value filter, wherein the value filter can modify the value in the field data. For example, the value filter can mask the field data, that is, modify some values ​​in the field data, and modify them to *. For example, the field data is 12356789032, and the value filter performs mask processing to obtain 123****903*. For example, the value filter is ValueFilter. Of course, the value filter can not only modify the value to *, but also to &, ¥, and #, and can be set according to specific needs.

[0064] The encryption desensitization processing method refers to using a reversible encryption method to encrypt the field data of the desensitized field so that the field data can be restored later.

[0065] Hash desensitization processing refers to the use of irreversible hashing to process the field data of the desensitized field, which can greatly reduce the risk of data leakage.

[0066] Step S105: According to the target desensitization method, the field data of the field to be desensitized is desensitized to obtain a desensitization result.

[0067] Since the target desensitization method has been determined, at this point, the field data of the desensitized field can be directly desensitized using the target desensitization method.

[0068] Desensitization result refers to the result obtained after desensitization treatment.

[0069] The desensitization result may be a conclusive result obtained after the desensitization process. For example, the desensitization result includes desensitization success and desensitization failure. If the desensitization is successful, it is considered that multiple field data of the field to be desensitized are all desensitized successfully. If the desensitization fails, it is considered that there is field data that fails to be desensitized among the multiple field data of the field to be desensitized.

[0070] The desensitization result can also be the desensitized field data obtained after the desensitization process. For example, there are two field data in the field to be desensitized, namely: 12345678 and 87654321. The desensitized field data of 12345678 is 1234**78, and the desensitized field data of 87654321 is 8765**21. Therefore, the desensitization results are: 1234**78, and 8765**21.

[0071] The data desensitization method provided in this embodiment first obtains the field to be desensitized and the field data of the field to be desensitized, determines the destination identifier of the field to be desensitized, then obtains the target desensitization method of the field to be desensitized according to the destination identifier, and finally desensitizes the data using the target desensitization method. Since different destinations have different desensitization methods, the risk of privacy leakage is reduced to a certain extent, and the desensitization of privacy data is made more flexible.

[0072] In one embodiment, multiple value filters are set, so that different fields are desensitized using different value filters, thereby achieving a variety of desensitization methods. According to the target desensitization method, the field data of the field to be desensitized is desensitized to obtain a desensitization result, including:

[0073] If the target desensitization method of the field to be desensitized is the value filter desensitization processing method, the annotation of the field to be desensitized is obtained;

[0074] Get the field ID of the field to be desensitized from the annotation;

[0075] According to the field identifier of the field to be desensitized, a target value filter is obtained;

[0076] In the serialization process of the field to be desensitized, the field data of the field to be desensitized is desensitized through the target value filter to obtain a desensitization result.

[0077] Field annotations are annotations that act on fields. An annotation is a Java class that provides metadata for Java code. Metadata refers to data that describes data. Therefore, field annotations are essentially data that describes fields. For example, the annotation for a field is @MaskField.

[0078] The annotation of a field includes a field identifier, where the field identifier is used to uniquely identify a field. The field identifier is equivalent to the field's ID number. Therefore, the annotation of a field can describe the identity of the field. Of course, in addition to the field identifier, the annotation of a field can also include more data, through which the field can be described more. For example, the annotation of a field can also include a description of the field's desensitization method. The annotation of a field can also include a description of the table identifier of the data table to which the field belongs, where the table identifier is used to uniquely identify a data table.

[0079] The target value filter is a value filter used to process the field data of the field to be desensitized. Different field identifiers have different value filters. One field identifier corresponds to one value filter, and one value filter desensitizes the field data corresponding to one field. Therefore, according to the field identifier of the field to be desensitized, the target value filter can be obtained from multiple value filters.

[0080] Serialization is the process of converting the information of an object into something that can be stored or transmitted. The information of an object can be the fields of the object and the field data of each field. The serialization of the field to be desensitized specifically refers to the serialization of the object corresponding to the field to be desensitized.

[0081] In an example, the serialization processing of the field to be desensitized can be performed through the AbstractStringLayout plug-in of log4j. The AbstractStringLayout plug-in includes the toSerializable method, which is the entry point for serialization processing. Multiple value filters are added to the toSerializable method, and each value filter processes the field data corresponding to a field identifier. Therefore, after determining the field identifier, the toSerializable method can determine the target value filter from multiple value filters, and then the toSerializable method desensitizes the field data of the field to be desensitized through the target value filter.

[0082] In another example, the serialization processing of the field to be desensitized can also be carried out through logback. Logback includes MessageConverter middleware, and MessageConverter middleware includes convert method. The convert method is the entry of serialization processing. Multiple value filters are added to the convert method. Therefore, after determining the field identifier, the convert method can determine the target value filter from multiple value filters. Then, the convert method desensitizes the field data of the field to be desensitized through the target value filter.

[0083] In one embodiment, in order to effectively prevent privacy data leakage and reduce the risk of privacy data leakage, a field data is encrypted with multiple encryption keys. Even if one of the encryption keys is leaked, there is no need to worry about privacy leakage. According to the target desensitization method, the field data of the desensitized field is desensitized to obtain the desensitization result, including:

[0084] If the target desensitization method of the field to be desensitized is the encryption desensitization processing method, the field data of the field to be desensitized is segmented to obtain multiple field sub-data of equal length and a segment number corresponding to each field sub-data;

[0085] For each field sub-data, add the segment number corresponding to the field sub-data to obtain the target sub-data corresponding to the field sub-data;

[0086] Determine the encryption key corresponding to the sub-data of the field;

[0087] Using the encryption key corresponding to the field sub-data to encrypt the target sub-data corresponding to the field sub-data, to obtain the target encrypted sub-data corresponding to the field sub-data;

[0088] According to the segment number corresponding to each field sub-data, the target encrypted sub-data corresponding to each field sub-data are spliced ​​to obtain the desensitizing result.

[0089] Among them, segmentation processing refers to dividing the field data into multiple segments according to the preset length, each segment is a field sub-data, wherein the preset length is a preset length. It should be noted that if the length of a field data is not an integer multiple of the preset length, a complete field sub-data is obtained by using a padding method for data whose length is less than the preset length, for example, padding 0. For example, the preset length is 4, and the field data is 12345678923456, so it is divided into 4 segments, and therefore, there are 4 field sub-data, and the 4 field sub-data are: 1234, 5678, 9234, 5600. The target sub-data is the field sub-data with the segment number added. In one example, the segment number is added at the end of the field sub-data, and in another example, the segment number is added at the beginning of the field sub-data. The encryption key is a key used in the encryption process, for example, DES encryption process. Of course, DES encryption process may not be used. The encryption key corresponding to the segment number is preset. For example, segment number 1 corresponds to encryption key 1, segment number 2 corresponds to encryption key 2, segment number 3 corresponds to encryption key 3, and segment number N corresponds to encryption key N. Therefore, determining the encryption key corresponding to the field sub-data includes: determining the encryption key corresponding to the segment number of the field sub-data. The target encrypted sub-data is the encrypted target sub-data.

[0090] For example, the preset length is 4, and the field data is 123X567892345678, so it is divided into 4 segments, and the 4 field sub-data are: 123X, 5678, 9234, 5678, and the segment numbers are: 1, 2, 3 and 4, so the target sub-data corresponding to the 4 field sub-data are: 123X1, 56782, 92343, 56784, the encryption key corresponding to segment number 1 is 11, the encryption key corresponding to segment number 2 is 22, and the encryption key corresponding to segment number 3 is 23. The corresponding encryption key is 33, and the encryption key corresponding to segment number 4 is 44. Therefore, the encryption key is used to encrypt the target sub-data, and the four target encrypted sub-data are: 11123X1, 5226782, 9332343, 5446784. Finally, the four target encrypted sub-data are concatenated to obtain the desensitized result of the field data 123X567892345678: 11123X1522678293323435446784.

[0091] In one embodiment, if the hash desensitization processing method is used, the hash processing can be performed directly. According to the target desensitization method, the field data of the field to be desensitized is desensitized to obtain the desensitization result, including:

[0092] If the target desensitization method of the field to be desensitized is a hash desensitization processing method, the field data of the field to be desensitized is hashed to obtain a desensitization result.

[0093] The field to be desensitized corresponds to at least one field data (the number of field data corresponding to the field to be desensitized is equal to the number of objects), and the desensitization result includes the content hash value of each field data of the field to be desensitized, wherein the content hash value is the hash processing result of a field data, that is, the desensitized field data corresponding to the field data. Exemplarily, the SM3 digest algorithm is used to hash the field data of the field to be desensitized to obtain a content hash value with a length of 32 bytes. Of course, other digest algorithms can also be used, for example, the SHA-1 digest algorithm is used. The purpose of preferably using the SM3 digest algorithm is that the length of the content hash value obtained by the SM3 digest algorithm is relatively short, which can save storage space.

[0094] In one embodiment, in order to perform local data reverse query, the data desensitization method further includes:

[0095] Compare the content hash value in the desensitization result with multiple preset content hash values ​​to obtain a target preset content hash value that is the same as the content hash value among the multiple preset content hash values;

[0096] Determine the target object to which the target preset content hash value belongs, and the data table to which the target object belongs;

[0097] From the data table, obtain each field of the target object and the field data of each field.

[0098] The multiple preset content hash values ​​refer to the hash values ​​of the field data in all local data tables of the electronic device, such as Figure 3 In the data table shown, each object has 5 fields, and there are 9 objects in total. Therefore, the data table has a total of 45 field data. If the electronic device has a total of 20 local data tables, each data table has 45 field data, then the number of preset content hash values ​​of the local electronic device is 45×20=900. For each content hash value in the desensitizing result, the content hash value is compared with 900 preset content hash values ​​to obtain the target preset content hash value corresponding to the content hash value.

[0099] Comparing the content hash value with multiple preset content hash values ​​to obtain a target preset content hash value that is the same as the content hash value among the multiple preset content hash values ​​includes: calculating the similarity between the content hash value and each preset content hash value to obtain multiple similarities; using the preset content hash value corresponding to the target similarity among the multiple similarities as the target preset content hash value, wherein the target similarity refers to a similarity with a similarity of 100%. The similarity includes cosine similarity.

[0100] By searching the vector table, the character vector of each character in the content hash value is obtained; the character vector of each character in the content hash value is combined to obtain the value vector of the content hash value; by searching the vector table, the character vector of each character in each preset content hash value is obtained; the character vector of each character in the preset content hash value is combined to obtain the value vector of the preset content hash value; according to the value vector of the content hash value and the value vector of the preset content hash value, the similarity between the content hash value and the preset content hash value is obtained. In which, the vector table records the character vectors of multiple characters, and the dimension of the value vector is fixed, for example, fixed to 1×M, where M is an integer greater than 1, M is equal to N×d, where N is the number of preset characters, N is an integer greater than 1, and d is the dimension of the character vector. Therefore, if the number of characters in the content hash value or the preset content hash value is less than N, 0-filling processing is performed to obtain a value vector of size 1×M. In which, characters may include but are not limited to numbers, letters, symbols, and Chinese characters.

[0101] For example, N=3, d=3, the value vector of the content hash value is [0.05, 0.05, 0.1, 0.2, 0.2, 0.05, 0.05, 0.1, 0.2], and the value vector of the preset content hash value is [0.05, 0.1, 0.05, 0.1, 0.3, 0.05, 0.05, 0.2, 0.1]. According to the formula: (X, Y) / (|X|×|Y|), the cosine similarity between the content hash value and the preset content hash value is calculated, where (X, Y) refers to the inner product between vector X and vector Y, |X| is the modulus of vector X, and |Y| is the modulus of vector Y.

[0102] The target object refers to the object to which the target preset content hash value belongs among multiple objects. For example, the multiple objects include object 1, object 2, object 3, object 4 and object 5. The target preset content hash value is the hash value of the field data of field 5 of object 3. Therefore, the target object is object 3. If object 1 and object 2 are in data table 1, and object 3, object 4 and object 5 are in data table 2, then the data table to which the target object belongs is data table 2. Assuming that data table 2 has a total of 10 fields, then the 10 fields of object 3 and the field data of the 10 fields are obtained from data table 2. Further, the obtained 10 fields of object 3 and the field data of the 10 fields can be displayed, and the obtained 10 fields of object 3 and the field data of the 10 fields can also be encrypted using the public key of the recipient to obtain the encrypted field result, and the encrypted field result is sent to the recipient.

[0103] In one embodiment, the hash desensitization processing method not only performs hash processing on the field data, but also uses the public key of the recipient to encrypt the content hash value. In this way, if the recipient is not the real recipient, then even if the fake recipient receives the encrypted content hash value, it cannot decrypt the encrypted content hash value to obtain the content hash value, so that the fake recipient cannot use the content hash value to perform other processing. According to the target desensitization method, the field data of the field to be desensitized is desensitized to obtain the desensitization result, including:

[0104] If the target desensitization method of the field to be desensitized is the hash desensitization processing method, the field data of the field to be desensitized is hashed to obtain the content hash value corresponding to the field data;

[0105] The recipient's public key is used to encrypt the content hash value corresponding to the field data to obtain a desensitized result.

[0106] The desensitization result includes the encrypted content hash value corresponding to the content hash value of each field data of the field to be desensitized, wherein the encrypted content hash value is the encryption result of the content hash value, that is, the desensitized field data of the field data.

[0107] The electronic device locally stores the public keys of multiple recipients. Therefore, when a recipient who is to receive the current desensitization result is determined from multiple recipients, the public key of the recipient can be used to encrypt each content hash value to obtain a desensitization result (multiple encrypted content hash values), and then the desensitization result is sent to the recipient. After receiving the desensitization result, the recipient can use the private key stored locally by the recipient to decrypt each encrypted content hash value in the desensitization result to obtain multiple content hash values. Then, the decrypted content hash value is used for other processing. For example, the other processing is: comparing the content hash value with multiple preset content hash values ​​to obtain a target preset content hash value that is the same as the content hash value in the multiple preset content hash values; determining the target object to which the target preset content hash value belongs, and the data table to which the target object belongs; obtaining each field of the target object and the field data of each field from the data table to which the target object belongs; and displaying each field of the target object and the field data of each field for relevant personnel to view.

[0108] In one embodiment, a configuration center is set to configure the switch of the desensitization mode so that data desensitization can be flexibly controlled. According to the target desensitization mode, the field data of the field to be desensitized is desensitized to obtain the desensitization result, including:

[0109] If it is detected that the switch of the target desensitization mode of the configuration center is in the off state, a prompt message for turning on the switch is generated, and feedback is given on the prompt message for turning on the switch;

[0110] When it is detected that the switch of the target desensitization mode of the configuration center is in the on state, the field data of the field to be desensitized is desensitized according to the target desensitization mode to obtain a desensitization result.

[0111] Among them, the configuration center can set the configuration information, for example, the Apollo configuration center can set the configuration information, for example, set the on or off switch of the desensitizing mode. If the configuration center configures the switch of the desensitizing mode to be on, then before the field data of the desensitized field is desensitized according to the desensitizing mode and the desensitizing result is obtained, it can be detected that the switch of the desensitizing mode is in the on state. If the configuration center configures the switch of the desensitizing mode to be stopped, before the field data of the desensitized field is desensitized according to the desensitizing mode and the desensitizing result is obtained, it can be detected that the switch of the desensitizing mode is in the off state. Among them, the off state indicates that the switch of the desensitizing mode is off, and the on state indicates that the switch of the desensitizing mode is on. The switch-on prompt information refers to the information used to prompt the switch to be turned on for the desensitizing mode. For example, the switch-on prompt information is "The switch of the desensitizing mode xxx is in the off state. Please enter the configuration center to turn it on." Feedback on the switch-on prompt information includes: sending a message including the switch-on prompt information to the relevant personnel through the contact information of the relevant personnel. For example, the contact information of the relevant personnel is a mobile phone number, so a text message including the switch-on prompt information is sent to the relevant personnel. The contact information of the relevant personnel is an email address, so an email including the switch-on prompt information is sent to the relevant personnel. After seeing the switch-on prompt information, the relevant personnel can go to the configuration center and turn on the desensitizing mode. After turning on the desensitizing mode, it can be detected that the desensitizing mode switch in the configuration center is in the on state. In addition to setting the switch of the desensitization mode on or off, the configuration center can also set the package name of the log to be desensitized. The log corresponding to the package name is the log to be desensitized. After the configuration center sets the package name of the log to be desensitized, only the field data of the to-be-desensitized field in the log to be desensitized in the package name will be desensitized. It should be noted that a package is associated with at least one log, and each package corresponds to a unique package name. For example, package 1 contains logs 1 to 5, package 2 contains logs 6 to 10, and package 3 contains logs 11 to 20. The package name of the log to be desensitized set by the configuration center is the package name of package 2. Therefore, only the field data of the to-be-desensitized field in logs 6 to 10 in package 2 will be desensitized.

[0112] In one embodiment, Figure 4 As shown, a data desensitization device 10 is provided, which is applied to Figure 1 Electronic devices such as Figure 4 As shown, the data desensitizing device 10 includes an acquisition unit 11, a determination unit 12, a comparison unit 13, a method unit 14 and a desensitizing unit 15.

[0113] An acquisition unit 11 is used to acquire a field to be desensitized and field data of the field to be desensitized;

[0114] A determination unit 12, used to determine the destination identifier of the field to be desensitized;

[0115] A comparison unit 13 is used to compare the destination identifier with at least one preset destination identifier to obtain a target preset destination identifier that is the same as the destination identifier in the at least one preset destination identifier; each preset destination identifier corresponds to a desensitization method;

[0116] A method unit 14 is used to obtain a target desensitization method of the field to be desensitized according to a target preset destination identifier;

[0117] The desensitizing unit 15 is used to perform desensitization processing on the field data of the field to be desensitized according to the target desensitization method to obtain a desensitization result.

[0118] In an optional implementation manner, the mode unit 14 is specifically configured to:

[0119] If the target preset destination identifier is a display identifier, the target desensitization method of the field to be desensitized is determined to be a value filter desensitization processing method;

[0120] If the target preset destination identifier is a storage identifier, the target desensitization method of the field to be desensitized is determined to be an encryption desensitization processing method;

[0121] If the target preset destination identifier is an outbound identifier, the target desensitization method of the field to be desensitized is determined to be a hash desensitization processing method.

[0122] In an optional embodiment, the desensitization unit 15 is specifically used for:

[0123] If the target desensitization method of the field to be desensitized is the value filter desensitization processing method, the annotation of the field to be desensitized is obtained;

[0124] Get the field ID of the field to be desensitized from the annotation;

[0125] According to the field identifier of the field to be desensitized, a target value filter is obtained;

[0126] In the serialization process of the field to be desensitized, the field data of the field to be desensitized is desensitized through the target value filter to obtain a desensitization result.

[0127] In an optional embodiment, the desensitization unit 15 is specifically used for:

[0128] If the target desensitization method of the field to be desensitized is the encryption desensitization processing method, the field data of the field to be desensitized is segmented to obtain multiple field sub-data of equal length and a segment number corresponding to each field sub-data;

[0129] For each field sub-data, add the segment number corresponding to the field sub-data to obtain the target sub-data corresponding to the field sub-data;

[0130] Determine the encryption key corresponding to the sub-data of the field;

[0131] Using the encryption key corresponding to the field sub-data to encrypt the target sub-data corresponding to the field sub-data, to obtain the target encrypted sub-data corresponding to the field sub-data;

[0132] According to the segment number corresponding to each field sub-data, the target encrypted sub-data corresponding to each field sub-data are spliced ​​to obtain the desensitizing result.

[0133] In an optional embodiment, the desensitization unit 15 is specifically used for:

[0134] If the target desensitization method of the field to be desensitized is a hash desensitization processing method, the field data of the field to be desensitized is hashed to obtain a desensitization result.

[0135] In an optional implementation, the data desensitization device 10 further includes: an object unit, configured to:

[0136] Compare the content hash value in the desensitization result with multiple preset content hash values ​​to obtain a target preset content hash value that is the same as the content hash value among the multiple preset content hash values;

[0137] Determine the target object to which the target preset content hash value belongs, and the data table to which the target object belongs;

[0138] From the data table, obtain each field of the target object and the field data of each field.

[0139] In an optional embodiment, the desensitization unit 15 is specifically used for:

[0140] If it is detected that the switch of the target desensitization mode of the configuration center is in the off state, a prompt message for turning on the switch is generated, and feedback is given on the prompt message for turning on the switch;

[0141] When it is detected that the switch of the target desensitization mode of the configuration center is in the on state, the field data of the field to be desensitized is desensitized according to the target desensitization mode to obtain a desensitization result.

[0142] The data desensitizing device provided in the embodiment of the present invention first obtains the field to be desensitized and the field data of the field to be desensitized, determines the destination identifier of the field to be desensitized, then obtains the target desensitization method of the field to be desensitized according to the destination identifier, and finally performs desensitization by the target desensitization method. Since different destinations have different desensitization methods, the risk of privacy leakage is reduced to a certain extent, and the desensitization of privacy data is made more flexible.

[0143] In one embodiment, Figure 1As shown, an electronic device 100 is provided, the electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the data desensitization method of any of the aforementioned implementations when executing the computer program, including:

[0144] Get the field to be desensitized and the field data of the field to be desensitized;

[0145] Determine the destination identifier of the field to be desensitized;

[0146] Compare the destination identifier with at least one preset destination identifier to obtain a target preset destination identifier that is the same as the destination identifier in the at least one preset destination identifier; each preset destination identifier corresponds to a desensitization method;

[0147] According to the target preset destination identifier, the target desensitization method of the field to be desensitized is obtained;

[0148] According to the target desensitization method, the field data of the field to be desensitized is desensitized to obtain the desensitization result.

[0149] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for desensitizing data in any of the aforementioned embodiments is implemented, including:

[0150] Get the field to be desensitized and the field data of the field to be desensitized;

[0151] Determine the destination identifier of the field to be desensitized;

[0152] Compare the destination identifier with at least one preset destination identifier to obtain a target preset destination identifier that is the same as the destination identifier in the at least one preset destination identifier; each preset destination identifier corresponds to a desensitization method;

[0153] According to the target preset destination identifier, the target desensitization method of the field to be desensitized is obtained;

[0154] According to the target desensitization method, the field data of the field to be desensitized is desensitized to obtain the desensitization result.

[0155] The data desensitization method, device, electronic device and computer-readable storage medium provided in the embodiments of the present invention belong to the same inventive concept. Therefore, the contents in the embodiments of the data desensitization method, device, electronic device and computer-readable storage medium are applicable to each other and will not be described in detail here.

[0156] In summary, the data desensitization method, device, electronic device and computer-readable storage medium provided in the embodiments of the present invention first obtain the field to be desensitized and the field data of the field to be desensitized, determine the destination identifier of the field to be desensitized, and then obtain the target desensitization method of the field to be desensitized according to the destination identifier, and finally perform desensitization by the target desensitization method. Since different destinations have different desensitization methods, the risk of privacy leakage is reduced to a certain extent, and the desensitization of privacy data is made more flexible.

[0157] The above are only various embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A data desensitization method, characterized in that: include: Obtaining a field to be desensitized and field data of the field to be desensitized; Determine the destination identifier of the field to be desensitized; Compare the destination identifier with at least one preset destination identifier to obtain a target preset destination identifier that is the same as the destination identifier among the at least one preset destination identifier; Each of the preset destination identifiers corresponds to a desensitization method; According to the target preset destination identifier, the target desensitization method of the field to be desensitized is obtained, including: if the target preset destination identifier is a display identifier, the target desensitization method of the field to be desensitized is determined to be a value filter desensitization processing method; if the target preset destination identifier is a storage identifier, the target desensitization method of the field to be desensitized is determined to be an encryption desensitization processing method; if the target preset destination identifier is an outbound identifier, the target desensitization method of the field to be desensitized is determined to be a hash desensitization processing method; According to the target desensitization method, the field data of the field to be desensitized is desensitized to obtain a desensitization result, including: if the target desensitization method of the field to be desensitized is the value filter desensitization processing method, the annotation of the field to be desensitized is obtained; the field identifier of the field to be desensitized is obtained from the annotation; according to the field identifier of the field to be desensitized, a target value filter is obtained; in the serialization processing of the field to be desensitized, the field data of the field to be desensitized is desensitized by the target value filter to obtain a desensitization result; If the target desensitization method of the field to be desensitized is an encryption desensitization processing method, the field data of the field to be desensitized is segmented to obtain a plurality of field sub-data of equal length and a segment number corresponding to each of the field sub-data; for each of the field sub-data, the segment number corresponding to the field sub-data is added to obtain the target sub-data corresponding to the field sub-data; the encryption key corresponding to the field sub-data is determined; the target sub-data corresponding to the field sub-data is encrypted using the encryption key corresponding to the field sub-data to obtain the target encrypted sub-data corresponding to the field sub-data; the target encrypted sub-data corresponding to each of the field sub-data are spliced ​​according to the segment number corresponding to each of the field sub-data to obtain the desensitization result; If the target desensitization method of the field to be desensitized is a hash desensitization processing method, the field data of the field to be desensitized is hashed to obtain a desensitization result.

2. The method according to claim 1, characterized in that The method further comprises: Compare the content hash value in the desensitization result with multiple preset content hash values ​​to obtain a target preset content hash value that is the same as the content hash value among the multiple preset content hash values; Determine the target object to which the target preset content hash value belongs, and the data table to which the target object belongs; From the data table, each field of the target object and field data of each field are obtained.

3. The method according to claim 1, characterized in that The desensitizing process is performed on the field data of the field to be desensitized according to the target desensitization mode to obtain a desensitization result, including: If it is detected that the switch of the target desensitization mode of the configuration center is in the off state, a prompt message for turning on the switch is generated, and feedback is provided on the prompt message for turning on the switch; When it is detected that the switch of the target desensitization mode of the configuration center is in the on state, the field data of the field to be desensitized is desensitized according to the target desensitization mode to obtain a desensitization result.

4. A data desensitization device, characterized in that: include: An acquisition unit, used for acquiring a field to be desensitized and field data of the field to be desensitized; A determination unit, used to determine the destination identifier of the field to be desensitized; A comparison unit, configured to compare the destination identifier with at least one preset destination identifier, and obtain a target preset destination identifier that is the same as the destination identifier in the at least one preset destination identifier; Each of the preset destination identifiers corresponds to a desensitization method; A method unit, used for obtaining a target desensitization method of the field to be desensitized according to the target preset destination identifier, including: if the target preset destination identifier is a display identifier, determining that the target desensitization method of the field to be desensitized is a value filter desensitization processing method; if the target preset destination identifier is a storage identifier, determining that the target desensitization method of the field to be desensitized is an encryption desensitization processing method; if the target preset destination identifier is an outgoing identifier, determining that the target desensitization method of the field to be desensitized is a hash desensitization processing method; The desensitizing unit is used to perform desensitization processing on the field data of the field to be desensitized according to the target desensitization method to obtain a desensitization result, including: if the target desensitization method of the field to be desensitized is the value filter desensitization processing method, then obtain the annotation of the field to be desensitized; obtain the field identifier of the field to be desensitized from the annotation; obtain the target value filter according to the field identifier of the field to be desensitized; in the serialization processing of the field to be desensitized, perform desensitization processing on the field data of the field to be desensitized through the target value filter to obtain a desensitization result; If the target desensitization method of the field to be desensitized is an encryption desensitization processing method, the field data of the field to be desensitized is segmented to obtain a plurality of field sub-data of equal length and a segment number corresponding to each of the field sub-data; for each of the field sub-data, the segment number corresponding to the field sub-data is added to obtain the target sub-data corresponding to the field sub-data; the encryption key corresponding to the field sub-data is determined; the target sub-data corresponding to the field sub-data is encrypted using the encryption key corresponding to the field sub-data to obtain the target encrypted sub-data corresponding to the field sub-data; the target encrypted sub-data corresponding to each of the field sub-data are spliced ​​according to the segment number corresponding to each of the field sub-data to obtain the desensitization result; If the target desensitization method of the field to be desensitized is a hash desensitization processing method, the field data of the field to be desensitized is hashed to obtain a desensitization result.

5. An electronic device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps in the data desensitization method described in any one of claims 1 to 3.

6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which is executed by a processor to implement the steps in the data desensitization method described in any one of claims 1 to 3.