Bank type transaction complex object desensitization method and device
By performing type judgment and recursive analysis on complex banking transaction objects, combined with non-annotation and custom annotation strategies, the problem of sensitive information desensitization of complex banking transaction objects that cannot be effectively processed by existing technology is solved, and desensitization of nested objects is achieved. Log desensitization and extension of sensitive information types.
Patent Information
- Application Number
- CN202410735825.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-09-10
AI Technical Summary
Existing log desensitization technology cannot effectively handle complex objects in banking transactions, especially sensitive information desensitization of built-in classes such as Map and JSONObject, and cannot be applied to nested objects.
By judging the type of complex banking transaction objects, distinguishing Map, JSONObject and other objects, using recursive parsing and non-annotation desensitization strategies, combined with custom annotation strategies, to achieve log desensitization of nested objects.
It achieves comprehensive desensitization of complex objects in banking transactions, including Map, JSONObject and other objects that cannot be desensitized using custom annotations. It is suitable for nested objects and expands the processing capabilities of sensitive information types.
Smart Images

Figure CN118627112A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of log desensitization, and in particular to a method and device for desensitizing complex objects of banking transactions. Background Art
[0002] Logs are information output during program operation to monitor the execution of a program. Log desensitization refers to the process of incomplete or encrypted output of part of the output information to prevent the leakage of complete information. In a project, log printing is an indispensable link. In order to protect customer or transaction information and prevent information leakage, it is very important to desensitize sensitive content in the log. In the process of log printing, sensitive information is generally required to be desensitized.
[0003] There are many log desensitization methods in the prior art. The method most similar to the present invention is to implement log desensitization through custom Java annotations. When using this method, you only need to add corresponding annotations to the fields to be desensitized, which is very simple and efficient. The principle of this method is as follows:
[0004] (1) Define different Java annotations to mark different types of sensitive information and implement desensitization methods for each type of information. For example, for the Chinese name field, define an annotation @SensitiveStrategyChineseName and implement a method to convert the plain text Chinese name into a desensitized name.
[0005] (2) When defining a class, add annotations of the corresponding type to the fields that need to be desensitized, mark the field as a field to be desensitized, and the desensitization method used for the field.
[0006] (3) When printing the log, determine whether to desensitize the field based on whether there is a desensitization-related annotation on the field. If not, the content of the field is not processed; if so, the field content is desensitized according to the method specified by the annotation to obtain the desensitized content.
[0007] There are also some open source tools or components on the market that use Java annotations to implement log desensitization. Other developers only need to use these open source tools to implement log desensitization. However, these open source versions currently have the following shortcomings:
[0008] (1) They only desensitize the following common information: Chinese name, card number, mobile phone number, email address, and password. Other sensitive information cannot be desensitized and cannot cover all scenarios of banking transactions.
[0009] (2) The custom Java annotation method can only be applied to user-defined classes. Annotations must be added to the fields to be desensitized when defining the class. However, for built-in classes such as Map and JSONObject, rather than custom classes, it is impossible to desensitize the sensitive information in them. Summary of the invention
[0010] Based on the above description, the present invention provides a method and device for desensitizing complex objects in banking transactions.
[0011] According to a first aspect of the present invention, a method for desensitizing complex objects of banking transactions is provided, comprising the following steps:
[0012] S1, judge the type of complex objects of banking transactions and distinguish three types: Map objects, JSONObject objects, and other class objects;
[0013] S2, respectively parsing the three types of complex objects using corresponding methods, wherein if the complex object is nested, a recursive method is used to parse it layer by layer;
[0014] S31, for the key-value pairs of the Map object and the JSONObject object obtained by parsing, match the key fields and the desensitization strategy mapping table according to the key names, and perform non-annotation desensitization using the desensitization rules corresponding to the matched key fields;
[0015] S32, desensitizing the attributes of other class objects obtained by parsing according to the custom annotations on the attributes using the corresponding custom annotation strategy.
[0016] According to a second aspect of the present invention, a desensitizing device for complex objects of banking transactions is provided, comprising:
[0017] The object type distinguishing unit is used to judge the type of complex objects in banking transactions and distinguish three types: Map objects, JSONObject objects, and other class objects;
[0018] A complex object parsing unit, used to parse the three types of complex objects using corresponding methods respectively, wherein if the complex object is nested, a recursive method is used to parse it layer by layer;
[0019] The non-annotation desensitization unit is used to perform non-annotation desensitization on the key-value pairs of the parsed Map object and JSONObject object, match the key fields with the desensitization strategy mapping table according to the key names, and use the desensitization rules corresponding to the matched key fields;
[0020] The custom annotation desensitization unit is used to desensitize the attributes of other class objects obtained through parsing, according to the custom annotations on the attributes, using the corresponding custom annotation strategy.
[0021] According to a third aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and the computer program executes the aforementioned method when executed by a processor.
[0022] According to the fourth aspect of the present invention, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the aforementioned method.
[0023] The advantages and beneficial effects of the embodiments of the present invention are:
[0024] The desensitization method and device for complex objects of banking transactions provided in an embodiment of the present invention distinguish three types of objects, namely Map objects, JSONObject objects, and other types of objects by performing type judgment on complex objects of banking transactions, and then respectively parse the three types of complex objects using corresponding methods, wherein if the complex objects are nested, a recursive method is used to perform layer-by-layer parsing; then, for the key-value pairs of the parsed Map objects and JSONObject objects, non-annotation desensitization is performed using a desensitization rule corresponding to the matched key fields according to a key name matching key field and a desensitization strategy mapping table; for the attributes of the parsed objects of other types, the corresponding custom annotation strategy is used to perform desensitization according to the custom annotations on the attributes, thereby, on the basis of the custom annotation strategy, log desensitization is performed by introducing a method of non-annotation key field mapping, which can not only realize log desensitization for objects such as Map and JSONObject that cannot be desensitized using custom annotations, but also is applicable to nested Map and JSONObject objects. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The drawings constituting part of the present application are used to provide a further understanding of the present application. The exemplary embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0026] Figure 1 A schematic diagram of a process for desensitizing a complex object of a banking transaction provided by an embodiment of the present invention is shown;
[0027] Figure 2 A schematic diagram of the desensitization logic of complex objects of banking transactions provided by an embodiment of the present invention is shown;
[0028] Figure 3 A schematic diagram of the structure of a bank transaction sensitive information desensitization system provided by an embodiment of the present invention is shown;
[0029] Figure 4 A schematic diagram of the structure of a desensitizing device for complex objects of banking transactions provided by an embodiment of the present invention is shown;
[0030] Figure 5 A schematic structural diagram of an electronic device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0031] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution 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. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0032] It should be noted that the terms "including" and "having" and any variations thereof in the specification and claims of the present invention are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or inherent to these processes, methods, products or apparatuses.
[0033] The design concept of the present invention is that, based on the custom annotation strategy, by introducing non-annotation key field mapping, not only can the log desensitization of Map, JSONObject objects and nested objects be achieved, but also the type of sensitive information that can be processed is expanded to be suitable for the desensitization processing of complex objects of banking transactions.
[0034] Example 1
[0035] According to the first aspect of the present invention, see Figure 1 and Figure 2 As shown, an embodiment of the present invention provides a method for desensitizing complex objects of banking transactions, including the steps of:
[0036] S1, judge the type of complex objects of banking transactions and distinguish three types: Map objects, JSONObject objects, and other class objects.
[0037] Complex objects refer to input objects of banking transactions whose object attributes are not of a single basic data type, but include collections, custom class objects, etc. Among them, the Map object is a data structure built into Java that can store data in a "key-value" manner; the JSONObject object is also a data structure built into Java that uses a "key-value" format and can be used to store data in JSON format. Map and JSONObject are both Java built-in classes, not user-defined classes, and annotations cannot be added to the fields to be desensitized when defining the class. Other class objects refer to other complex objects except Map objects and JSONObject objects.
[0038] This step is the pre-processing of complex objects of banking transactions. Three types of complex objects, namely Map, JSONObject and other objects, are selected from the input objects of banking transactions.
[0039] S2, respectively parse the three types of complex objects using corresponding methods, wherein if the complex objects are nested, parse them layer by layer using a recursive method.
[0040] In the running state of a Java program, the Java reflection mechanism can construct an object of any class, understand the class to which any object belongs, understand the member variables and methods of any class, and call the properties and methods of any object. This step S2 uses the Java reflection mechanism to deeply analyze complex objects. If it is a nested complex object, a recursive method is used to analyze layer by layer to mine sensitive information in the nesting, specifically including:
[0041] Execute the parsing method of the Map object to obtain the key-value pair of the Map object. If it is a nested Map object, use a recursive method to parse it layer by layer;
[0042] Execute the parsing method of the JSONObject object on the JSONObject object to obtain the key-value pairs of the JSONObject object. If it is a nested JSONObject object, use a recursive method to parse it layer by layer;
[0043] Execute the parsing method of other class objects on other class objects to obtain the properties of other class objects. If it is a nested property, use a recursive method to parse it layer by layer. For the parsed nested properties, distinguish whether it is a Map object property or a non-Map object property based on the annotations on the nested properties. If it is a Map object property, return to execute the parsing method of the Map object. If it is a non-Map object property, continue to execute the parsing method of other class objects.
[0044] S31, for the key-value pairs of the parsed Map object and JSONObject object, match the key fields and the desensitization strategy mapping table according to the key names, and perform non-annotation desensitization using the desensitization rules corresponding to the matched key fields.
[0045] S32, desensitizing the attributes of other class objects obtained by parsing according to the custom annotations on the attributes using the corresponding custom annotation strategy.
[0046] It can be seen that the desensitization method for complex objects of banking transactions provided in an embodiment of the present invention distinguishes three types of objects, namely Map objects, JSONObject objects, and other types of objects by performing type judgment on complex objects of banking transactions; then the three types of complex objects are parsed using corresponding methods respectively, wherein if the complex objects are nested, a recursive method is used to perform layer-by-layer parsing; then, for the key-value pairs of the parsed Map objects and JSONObject objects, non-annotation desensitization is performed according to the key name matching key field and desensitization strategy mapping table, using the desensitization rules corresponding to the matched key fields; for the attributes of the parsed objects of other types, the corresponding custom annotation strategy is used to desensitize them according to the custom annotations on the attributes, so that on the basis of the custom annotation strategy, log desensitization is performed by introducing the method of non-annotation key field mapping, which can not only realize log desensitization for objects such as Map and JSONObject that cannot be desensitized using custom annotations, but also is applicable to nested Map and JSONObject objects.
[0047] In order to implement the desensitization method of complex objects of banking transactions in the embodiment of the present invention, the embodiment of the present invention builds Figure 3 See the bank transaction sensitive information desensitization system shown in Figure 3 The various classes / interfaces and functions included in the desensitization system are as follows:
[0048] (1)IStrategy
[0049] IStrategy is an interface for customizing annotation desensitization strategies. This interface is responsible for customizing annotation desensitization strategies. It includes multiple implementation classes from StrategyPhone to StrategyChineseName, which respectively represent desensitization strategies for common sensitive information in banking transactions. Among them, StrategyOtherWord represents the desensitization strategy for other keyword information in banking. Since there are many fields involved, they are not listed here one by one.
[0050] (2)SensitiveStrategyUtil
[0051] SensitiveStrategyUtil is the implementation class of the specific desensitization rules of the custom annotation desensitization strategy. This class is responsible for the specific desensitization rules of the custom annotation desensitization strategy. Each rule uniquely corresponds to the custom annotation. For sensitive information of banking transactions, such as passwords, mobile phone numbers, email addresses, Chinese names, card numbers, addresses and other fields, unified and standardized desensitization rules are implemented.
[0052] (3)SensitiveStrategyBuiltinUtil
[0053] SensitiveStrategyBuiltinUtil is an annotation class for obtaining the unique desensitization strategy corresponding to a custom annotation. This class is responsible for obtaining the unique desensitization strategy corresponding to a custom annotation. The getStratege() method included therein is used to obtain the desensitization strategy annotated by the custom annotation. Only the custom annotation modified by the annotation @SensitiveStrategyBuilt can obtain the corresponding desensitization strategy. The mapping relationship table between custom annotations and desensitization strategies is shown in Table 1.
[0054] Table 1 Custom annotation and desensitization strategy mapping table
[0055]
[0056]
[0057] (4)ClassTypeUtil
[0058] ClassTypeUtil is a class that provides a basis for judging the type of bank transaction parameters. This class is responsible for judging the type of bank transaction parameters and provides a basis for type judgment when deeply parsing complex objects using the Java reflection mechanism. For example, the isMap() method is used to determine whether a parameter is of Map type.
[0059] (5)KeyWord
[0060] KeyWord is an enumeration class that stores the mapping table of key fields and desensitization strategies. This enumeration class stores the key field mapping table of non-annotated desensitization methods, that is, the field parameters of Map and JSONObject are mapped and then desensitized. The mapping table of KeyWord is classified according to the sensitive information fields of bank transactions, as shown in Table 2. The containsKey() method of this class provides the Boolean value of the keyword mapping field hit by sensitive information, which is true if hit, otherwise false.
[0061] Table 2 Partial examples of the mapping table between key fields and desensitization strategies in KeyWord
[0062] Mapping table name Common key field mapping fields Desensitization strategy CUSTNAME name、custname StrategyChineseName PASSWORD password、pindata StrategyPassword EMAIL email, qq-email, StrategyEmail CARD_ID idno、certno StrategyIdNo CARD_NO bankcardno、account StrategyCardId PHONE mbphone、mobileno StrategyPhone ADDRESS address、addr StrategyAddress MONEY amount、fee StrategyMoney OTHER_KEY_WORDS base64、jsonstr StrategyOtherWord
[0063] (6)SensitiveEntry, SensitiveMap
[0064] SensitiveEntry and SensitiveMap are annotation classes used to distinguish nested attributes from Map object attributes and non-Map object attributes. The annotations @SensitiveEntry and @SensitiveMap are applicable to complex objects. When object attributes are nested in Map collections and non-Map collections, the annotation @SensitiveMap is applicable to nested Map collection attributes, and the annotation @SensitiveEntry is applicable to nested non-Map collection attributes.
[0065] (7)SensitiveUtil
[0066] SensitiveUtil is an implementation class for desensitizing sensitive information in banking transactions. This class implements desensitization of sensitive information in banking transactions. The implementation classes include:
[0067] deSenSiTive() is a method for determining the type of complex objects in banking transactions. It deeply analyzes the properties of complex objects in banking transactions through the Java reflection mechanism and selects three types of complex objects: Map, JSONObject, and other class objects.
[0068] handleSensitiveMap() is a method for parsing Map objects and is used to desensitize Map objects.
[0069] handleSensitiveJsonObject() is a method for parsing JSONObject objects and is used to desensitize JSONObject objects.
[0070] handleClassField() is a method for parsing objects of other classes and is used to desensitize objects of other classes.
[0071] handleSensitiveWord() is a method for implementing non-annotation desensitization. It matches the key fields of the KeyWord class and the desensitization strategy mapping table according to the key names for the key-value pairs of the parsed Map object and JSONObject object. For details, see Table 2 above. After the sensitive information hits the mapping table of the KeyWord class, the desensitization rules corresponding to the matched key fields are used for desensitization. Specifically, the desensitization rules in the SensitiveStrategyUtil implementation class are used for desensitization.
[0072] handleSensitiveEntry() and handleSensitive() are methods for implementing custom annotation desensitization. They desensitize the attributes of other class objects obtained by parsing according to the custom annotations on the attributes, as shown in Table 1 above, using the corresponding custom annotation strategy.
[0073] It can be understood that the method of the embodiment of the present invention can also expand the types of sensitive information that can be processed, expand the implementation class of the IStrategy custom annotation desensitization strategy interface, and expand the key fields in the KeyWord enumeration class, and add corresponding desensitization strategies, so as to cover banking transaction scenarios and realize the log desensitization function in a low development cost and high decoupling form.
[0074] Example 2
[0075] According to a second aspect of the present invention, Figure 4 As shown, the embodiment of the present invention provides a desensitizing device for complex objects of banking transactions, including:
[0076] The object type distinguishing unit 41 is used to judge the type of complex objects of banking transactions and distinguish three types: Map objects, JSONObject objects, and other class objects;
[0077] A complex object parsing unit 42, used to parse the three types of complex objects using corresponding methods respectively, wherein if the complex object is nested, a recursive method is used to parse it layer by layer;
[0078] The non-annotation desensitization unit 43 is used to perform non-annotation desensitization on the key-value pairs of the parsed Map object and the JSONObject object, match the key fields with the desensitization strategy mapping table according to the key names, and use the desensitization rules corresponding to the matched key fields;
[0079] The custom annotation desensitization unit 44 is used to desensitize the attributes of other class objects obtained by parsing according to the custom annotations on the attributes using the corresponding custom annotation strategy.
[0080] According to some embodiments of the present invention, see Figure 4 , wherein the complex object parsing unit 42 comprises:
[0081] A Map object parsing module 421 is used to execute a parsing method of a Map object to obtain a key-value pair of the Map object. If the Map object is a nested Map object, a recursive method is used to parse the objects layer by layer.
[0082] The JSONObject object parsing module 422 is used to execute a JSONObject object parsing method on the JSONObject object to obtain a key-value pair of the JSONObject object. If the JSONObject object is a nested one, a recursive method is used to parse the object layer by layer.
[0083] The other class object parsing module 423 is used to execute the parsing method of other class objects on other class objects to obtain the attributes of other class objects. If it is a nested attribute, a recursive method is used to perform layer-by-layer parsing, and for the parsed nested attributes, it is distinguished whether it is a Map object attribute or a non-Map object attribute according to the annotation on the nested attribute. If it is a Map object attribute, it returns to the Map object parsing module 421 to execute the Map object parsing method. If it is a non-Map object attribute, the other class object parsing module 423 continues to execute the parsing method of other class objects.
[0084] According to some embodiments of the present invention, the device of the embodiment of the present invention further includes: a desensitization system building unit, which is used to build a bank transaction sensitive information desensitization system, and the classes / interfaces of the built desensitization system include:
[0085] Interface for customizing annotation desensitization strategies;
[0086] The implementation class of the specific desensitization rules of the custom annotation desensitization strategy;
[0087] Get the annotation class of the desensitization strategy that uniquely corresponds to the custom annotation;
[0088] A class that provides the basis for judging the type of bank transaction parameters;
[0089] An enumeration class that stores the mapping table of key fields and desensitization strategies;
[0090] Annotation class used to distinguish whether nested attributes are Map object attributes or non-Map object attributes;
[0091] Implementation class for desensitizing sensitive information in banking transactions.
[0092] According to some embodiments of the present invention, the implementation class of desensitizing sensitive information of banking transactions includes:
[0093] Methods for determining the type of complex objects in banking transactions;
[0094] Method for parsing Map objects;
[0095] Method for parsing JSONObject object;
[0096] Methods for parsing objects of other classes;
[0097] For the key-value pairs of the parsed Map object and JSONObject object, a method of non-annotation desensitization is used to match the key fields and the desensitization strategy mapping table according to the key names, and the desensitization rules corresponding to the matched key fields are used;
[0098] For the attributes of other class objects obtained by parsing, desensitization is performed using the corresponding custom annotation strategy according to the custom annotations on the attributes.
[0099] According to some embodiments of the present invention, the device of the embodiment of the present invention further includes:
[0100] The desensitization strategy extension unit is used to extend the implementation class of the custom annotation desensitization strategy interface, to extend the key fields in the enumeration class, and to add corresponding desensitization strategies.
[0101] It can be understood that the device embodiment 2 has the same inventive concept as the aforementioned method embodiment 1. Figure 4 The implementation of each unit / module in the device embodiment shown can be referred to the aforementioned method embodiment 1, which will not be repeated here. In addition, it should be noted that the unit / module name described in device embodiment 2 does not constitute a limitation on the unit / module itself in some cases.
[0102] Example 3
[0103] According to a third aspect of the present invention, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program executes the method described in the above-mentioned embodiment 1 when executed by a processor.
[0104] The computer-readable storage medium of the embodiment of the present invention may be any tangible medium containing a storage program. Moreover, the computer-readable storage medium of the embodiment of the present invention may be located in any computer terminal in a computer terminal group in a computer network, or in any communication device in a communication device group.
[0105] Example 4
[0106] According to the fourth aspect of the present invention, an embodiment of the present invention provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method of the present invention.
[0107] Reference below Figure 5, which shows a schematic diagram of the structure of an electronic device suitable for implementing an embodiment of the present invention. The electronic device in the embodiment of the present invention may include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0108] like Figure 5 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) or a program loaded from a storage device into a random access memory (RAM). In the RAM, various programs and data required for the operation of the electronic device are also stored. The processing device, ROM, and RAM are connected to each other via a bus. An input / output (I / O) interface is also connected to the bus.
[0109] Typically, the following systems can be connected to the I / O interface: input devices including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices including, for example, a magnetic tape, a hard disk, etc.; and communication devices. The communication device can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an electronic device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have alternatively.
[0110] In particular, according to an embodiment of the present invention, the processes described in the above flowcharts can be implemented as computer software programs. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device, or installed from a ROM. When the computer program is executed by a processing device, the above-mentioned functions defined in the method of the embodiment of the present invention are executed.
[0111] Finally, it is necessary to explain:
[0112] The serial numbers of the embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The embodiments of the present invention can be implemented by hardware, software, firmware or a combination thereof.
[0113] In the several embodiments provided by the present invention, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the system embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, units or modules, which can be electrical or other forms.
[0114] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the method, device and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0115] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The unit described as a separate component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of a software functional unit. Moreover, if the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention is essentially or partly contributed to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which may be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention.
Claims
1. A method for desensitizing complex objects of banking transactions, characterized in that: include: S1, judge the type of complex objects of banking transactions and distinguish three types: Map objects, JSONObject objects, and other class objects; S2, respectively parsing the three types of complex objects using corresponding methods, wherein if the complex object is nested, a recursive method is used to parse it layer by layer; S31, for the key-value pairs of the parsed Map object and the JSONObject object, match the key field and the desensitization strategy mapping table according to the key name, and perform non-annotation desensitization using the desensitization rules corresponding to the matched key fields; S32, desensitizing the attributes of other class objects obtained by parsing according to the custom annotations on the attributes using the corresponding custom annotation strategy.
2. The method according to claim 1, characterized in that The step S2 comprises: Execute the parsing method of the Map object to obtain the key-value pair of the Map object. If it is a nested Map object, use a recursive method to parse it layer by layer; Execute the parsing method of the JSONObject object on the JSONObject object to obtain the key-value pairs of the JSONObject object. If it is a nested JSONObject object, use a recursive method to parse it layer by layer; Execute the parsing method of other class objects on other class objects to obtain the properties of other class objects. If it is a nested property, use a recursive method to parse it layer by layer. For the parsed nested properties, distinguish whether it is a Map object property or a non-Map object property based on the annotations on the nested properties. If it is a Map object property, return to execute the parsing method of the Map object. If it is a non-Map object property, continue to execute the parsing method of other class objects.
3. The method according to claim 2, characterized in that The method further includes: building a bank transaction sensitive information desensitization system, and the classes / interfaces of the built desensitization system include: Interface for customizing annotation desensitization strategies; The implementation class of the specific desensitization rules of the custom annotation desensitization strategy; Get the annotation class of the desensitization strategy that uniquely corresponds to the custom annotation; A class that provides the basis for judging the type of bank transaction parameters; An enumeration class that stores the mapping table of key fields and desensitization strategies; Annotation class used to distinguish whether nested attributes are Map object attributes or non-Map object attributes; Implementation class for desensitizing sensitive information in banking transactions.
4. The method according to claim 3, characterized in that The implementation classes for desensitizing sensitive information of banking transactions include: Methods for determining the type of complex objects in banking transactions; Method for parsing Map objects; Method for parsing JSONObject object; Methods for parsing objects of other classes; For the key-value pairs of the parsed Map object and JSONObject object, a method of non-annotation desensitization is used to match the key fields and the desensitization strategy mapping table according to the key names, and the desensitization rules corresponding to the matched key fields are used; For the attributes of other class objects obtained by parsing, desensitization is performed using the corresponding custom annotation strategy according to the custom annotations on the attributes.
5. The method according to claim 3, characterized in that: The method further comprises: The implementation class of the custom annotation desensitization strategy interface is expanded, the key fields in the enumeration class are expanded, and the corresponding desensitization strategies are added.
6. A desensitizing device for complex banking transaction objects, characterized in that: include: The object type distinguishing unit is used to judge the type of complex objects in banking transactions and distinguish three types: Map objects, JSONObject objects, and other class objects; A complex object parsing unit, used to parse the three types of complex objects using corresponding methods respectively, wherein if the complex object is nested, a recursive method is used to parse it layer by layer; The non-annotation desensitization unit is used to perform non-annotation desensitization on the key-value pairs of the parsed Map object and JSONObject object, match the key fields with the desensitization strategy mapping table according to the key names, and use the desensitization rules corresponding to the matched key fields; The custom annotation desensitization unit is used to desensitize the attributes of other class objects obtained through parsing, according to the custom annotations on the attributes, using the corresponding custom annotation strategy.
7. The device according to claim 6, characterized in that The complex object parsing unit comprises: Map object parsing module, used to execute the parsing method of Map object to obtain the key-value pair of Map object. If it is a nested Map object, it adopts recursive method to parse it layer by layer. The JSONObject object parsing module is used to execute the JSONObject object parsing method on the JSONObject object to obtain the key-value pairs of the JSONObject object. If it is a nested JSONObject object, a recursive method is used to parse it layer by layer; The other class object parsing module is used to execute the parsing method of other class objects on other class objects to obtain the attributes of other class objects. If it is a nested attribute, a recursive method is used to perform layer-by-layer parsing. For the parsed nested attributes, it is distinguished whether it is a Map object attribute or a non-Map object attribute according to the annotation on the nested attribute. If it is a Map object attribute, it is returned to the Map object parsing module to execute the Map object parsing method. If it is a non-Map object attribute, the other class object parsing module continues to execute the other class object parsing method.
8. The device according to claim 7, characterized in that The device further includes: a desensitization system building unit, which is used to build a desensitization system for sensitive information of banking transactions. The classes / interfaces of the built desensitization system include: Interface for customizing annotation desensitization strategies; The implementation class of the specific desensitization rules of the custom annotation desensitization strategy; Get the annotation class of the desensitization strategy that uniquely corresponds to the custom annotation; A class that provides the basis for judging the type of bank transaction parameters; An enumeration class that stores the mapping table of key fields and desensitization strategies; Annotation class used to distinguish whether nested attributes are Map object attributes or non-Map object attributes; Implementation class for desensitizing sensitive information in banking transactions.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 5 is executed.
10. An electronic device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 5.
