Data encryption method and device
By inserting zero-width characters in the data encryption process and establishing a mapping relationship, the problems of high cost and low efficiency of data encryption in the prior art are solved, and efficient data encryption and decryption are realized, which is suitable for data back-passing across system scenarios.
Patent Information
- Application Number
- CN202411195433.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-06
AI Technical Summary
The existing technology needs to define two fields in the process of data encryption, which increases development costs and reduces the efficiency of data encryption and decryption. Especially when data back-passing is carried out across systems, multiple system transformations are required, which increases the cost. and complexity.
By inserting zero-width characters into the mask field of the data to be masked, a mask string is generated and its mapping relationship with the data to be masked is established, and sent to the receiver to realize the encryption and decryption of the data, avoiding the addition of the display field and realize mask restoration of data across systems through database synchronization mapping relationships.
It reduces the development cost of data encryption, improves the efficiency of data encryption and decryption, reduces the workload during the transformation of existing systems, and realizes the need for data encryption and decryption across systems without adding fields and encryption and decryption codes.
Smart Images

Figure CN119089468A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a data encryption method and device. Background Art
[0002] During the development process, there is a lot of sensitive data that needs to be masked, and some of this masked data needs to be sent back to the provider by the receiver. Taking the front-end and back-end interaction as an example, two fields are usually used to store sensitive data returned by the back-end to the front-end. One field stores the masked data and displays it on the front-end; the other is used to store the ciphertext data and send it back to the back-end. After receiving the ciphertext data, the back-end can decrypt the masked data.
[0003] However, if two fields need to be defined for each sensitive data returned, the development cost of data encryption will increase and the efficiency of data encryption and decryption will decrease. Summary of the invention
[0004] In view of this, the embodiments of the present disclosure at least provide a data encryption method, which can reduce the development cost of data encryption and improve the efficiency of data encryption and decryption.
[0005] In a first aspect, an embodiment of the present disclosure provides a data encryption method, the method comprising:
[0006] Insert a zero-width character into the mask field obtained based on the data to be masked to obtain a mask string;
[0007] Generate a mapping relationship between the data to be masked and the mask string;
[0008] The mapping relationship and the mask string are sent to the receiver, so that the receiver uses the mapping relationship to find the to-be-masked data corresponding to the mask string.
[0009] Optionally, inserting a zero-width character into a mask field obtained based on the data to be masked includes:
[0010] Determine the insertion rule of the zero-width character, and insert the zero-width character into the mask field according to the insertion quantity and insertion position of the zero-width character indicated by the insertion rule.
[0011] Optionally, inserting a zero-width character into a mask field obtained based on the data to be masked includes:
[0012] Generate a unique identifier corresponding to the data to be masked;
[0013] Based on the unique identifier, a zero-width character sequence corresponding to the data to be masked is determined, and the zero-width character sequence is inserted into the mask field.
[0014] Optionally, the mask field is obtained by:
[0015] Obtain annotation information corresponding to the data to be masked; the annotation information includes a mask type and a mask position for masking the data to be masked;
[0016] Based on the annotation information, the data to be masked is masked to obtain a mask field.
[0017] Optionally, after generating the mapping relationship between the data to be masked and the mask string, the following steps are further included:
[0018] Set the effective period of the mapping relationship between the masked data and the mask string;
[0019] In response to the end of the valid period, the mask string corresponding to the data to be masked is updated, and a mapping relationship between the data to be masked and the updated mask string is generated.
[0020] Optionally, the method further comprises:
[0021] Store the mapping relationship in a database;
[0022] In response to the receiver being an external system, the mapping relationship stored in the database is synchronized to a database associated with the receiver, so that the receiver uses the mapping relationship to search for the to-be-masked data corresponding to the mask character string.
[0023] In a second aspect, an embodiment of the present disclosure provides a data encryption device, including:
[0024] An inserting module, used for inserting a zero-width character into a mask field obtained based on the data to be masked, to obtain a mask string;
[0025] A generation module, used to generate a mapping relationship between the data to be masked and the mask string;
[0026] The sending module is used to send the mapping relationship and the mask string to the receiving party, so that the receiving party can use the mapping relationship to find the to-be-masked data corresponding to the mask string.
[0027] In a third aspect, an embodiment of the present disclosure further provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the above-mentioned first aspect, or the steps in any optional implementation of the first aspect are performed.
[0028] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned first aspect, or any optional implementation of the first aspect are executed.
[0029] In a fifth aspect, an embodiment of the present disclosure further provides a computer program product, including a computer program, which implements the method of any of the above embodiments when executed by a processor.
[0030] Any of the above aspects or any implementation methods of any of the aspects, by inserting zero-width characters in the mask field obtained based on the data to be masked, a mask string is obtained; a mapping relationship between the data to be masked and the mask string is generated; the mapping relationship and the mask string are sent to the receiver, so that the receiver uses the mapping relationship to find the data to be masked corresponding to the mask string. Thus, by adding zero-width characters to the mask field, when transmitting the mask string, there is no need to add and define new display fields to display the mask field to the user, and the display effect of the mask string and the mask field on the user display device is the same; in addition, since the zero-width character is visible to the program, it can also ensure that the program can recognize different mask strings, so that only the mask string needs to be transmitted when the data is returned to realize the display and transmission, thereby reducing the development cost of data encryption and improving the efficiency of data encryption and decryption. In addition, when the above method is used to transform the stock system, there is no need to add fields and encryption and decryption codes, only the jar package needs to be introduced and the annotation information needs to be configured.
[0031] In a further embodiment of the present disclosure, the mapping relationship is stored in a database; in response to the recipient being an external system, the mapping relationship stored in the database is synchronized to the database associated with the recipient, so that the recipient uses the mapping relationship to find the masked data corresponding to the mask string. Therefore, when facing cross-system or cross-application data encryption and decryption within a single system, there is no need to add fields and encryption and decryption codes, and the mask restoration process of the data can be realized by synchronizing the mapping relationship, which further reduces the cost of restoring the data after encryption and improves the efficiency of data encryption and decryption.
[0032] The effects of the above-mentioned data encryption device, electronic device and storage medium refer to the description of the above-mentioned data encryption method, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.
[0034] Figure 1A schematic diagram of the process of encrypting and returning sensitive data in the prior art is shown;
[0035] Figure 2 A flow chart of a data encryption method provided by an embodiment of the present disclosure is shown;
[0036] Figure 3 A schematic diagram of a data encryption method provided by an embodiment of the present disclosure is shown;
[0037] Figure 4 A schematic diagram of a data encryption device provided by an embodiment of the present disclosure is shown;
[0038] Figure 5 An exemplary system architecture is shown in which embodiments of the present disclosure may be applied;
[0039] Figure 6 A schematic diagram of the structure of a computer system of a terminal device or a server used to implement an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.
[0041] It should be noted that in the technical solution of the present invention, the collection, use, storage, sharing and transfer of user personal information involved are in compliance with the provisions of relevant laws and regulations, and it is necessary to inform the user and obtain the user's consent or authorization. When applicable, the user's personal information is de-identified and / or anonymized and / or encrypted.
[0042] Research has found that during the development process, there is a lot of sensitive data that needs to be masked, and some of this masked data needs to be sent back to the provider by the recipient. Figure 1 This is a schematic diagram of the process of encrypting and returning sensitive data using existing technology. Figure 1As shown, when the prior art returns mask data, it is usually necessary to define two fields to store the returned mask data, one of which stores the mask data and displays it on the front end; the other is used to store the ciphertext data and return it to the back end, and the back end can decrypt the mask data after receiving the ciphertext data.
[0043] However, if two fields need to be defined for each sensitive data returned, the development cost of data encryption will increase and the efficiency of data encryption and decryption will be reduced. In the face of cross-system scenarios, if the front-end query depends on system A, the data needs to be returned to system B after the data is displayed, and system B decrypts it for use, then it will involve the transformation of multiple systems, which will undoubtedly further increase the cost of encrypting and decrypting data and reduce the efficiency of data transmission. In addition, for the existing systems that originally used plain text to transmit data, when it is necessary to improve their security and encrypt data, if the existing technology solution is used to transform them, each interface involving sensitive data needs to be redeveloped, such as adding new data fields and manually encrypting them. This transformation method is extremely labor-intensive. Even if a unified filter is used for operation, since each field may have different encryption requirements and processing methods, the filter cannot meet the specific requirements of each field.
[0044] Based on the above research, the embodiment of the present disclosure provides a data encryption method, which obtains a mask string by inserting a zero-width character in a mask field obtained based on the data to be masked; generates a mapping relationship between the data to be masked and the mask string; and sends the mapping relationship and the mask string to the receiver, so that the receiver uses the mapping relationship to find the data to be masked corresponding to the mask string. Thus, by adding a zero-width character to the mask field, when transmitting the mask string, it is realized that there is no need to add a new display field to display the mask field to the user, and the display effect of the mask string and the mask field on the user display device is the same; in addition, since the zero-width character is visible to the program, it can also ensure that the program can recognize different mask strings, so that only the mask string needs to be transmitted when the data is returned to realize the display and transmission, thereby reducing the development cost of data encryption and improving the efficiency of data encryption and decryption. In addition, when the above method is used to transform the stock system, there is no need to add fields and encryption and decryption codes, only the jar package needs to be introduced and the annotation information needs to be configured.
[0045] In addition, the mapping relationship is stored in a database; in response to the receiver being an external system, the mapping relationship stored in the database is synchronized to the receiver's associated database, so that the receiver can use the mapping relationship to find the masked data corresponding to the mask string. Therefore, when facing cross-system or cross-application data encryption and decryption within a single system, there is no need to add fields and encryption and decryption codes. The mask restoration process of the data can be realized by synchronizing the mapping relationship, further reducing the cost of restoring the data after encryption, improving the efficiency of data encryption and decryption, and thus improving the efficiency of data return.
[0046] The raising of the above problems and the solutions are the results obtained by the inventor after practice and careful research. The discovery process of the above problems and the solutions proposed for the above problems should be the contributions made by the inventor to the present disclosure during the disclosure process.
[0047] The technical solutions in the present disclosure will be clearly and completely described below in conjunction with the drawings in the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure claimed for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.
[0048] 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.
[0049] To facilitate understanding of this embodiment, a data encryption method disclosed in the embodiment of the present disclosure is first introduced in detail. The execution subject of the data encryption method provided in the embodiment of the present disclosure is generally a computer device with certain computing capabilities, and the computer device includes, for example: a terminal device or a server or other processing device, and the terminal device can be a user equipment (User Equipment, UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (Personal Digital Assistant, PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. In some possible implementations, the data encryption method can be implemented by a processor calling a computer-readable instruction stored in a memory.
[0050] See also Figure 2FIG. 2 is a flowchart of a data encryption method provided by an embodiment of the present disclosure, and the method includes S201 to S203, wherein:
[0051] S201: inserting a zero-width character into a mask field obtained based on the data to be masked to obtain a mask string.
[0052] Zero-width characters can also be called blank characters or control characters. Such characters occupy a position in the text encoding, that is, they are visible in the program; but they are invisible in text processing. When users view information with zero-width characters inserted, they can only see information other than zero-width characters. Zero-width characters include zero-width spaces (used to split words or characters without displaying spaces, such as U200B), zero-width non-ligatures (used to prevent two characters from forming a ligature, such as U200C), zero-width ligatures (indicating that two characters should be displayed as a ligature, such as U200D), zero-width non-breaking spaces (used to prevent hyphenation within the line and keep the characters linked without displaying spaces, such as U2060), zero-width left-to-right symbols (used to force the text direction from left to right, such as U200E), zero-width right-to-left symbols (used to force the text direction from right to left, such as U200F), zero-width empty ligatures (used to indicate the byte order of the text or prevent hyphenation, such as UFEFF), and so on.
[0053] It should be noted that the above are only examples of zero-width characters that can be used in the embodiments of the present disclosure, and do not constitute an improper limitation on the present invention. In practical applications, the above or any other zero-width characters, or other types of characters that can achieve the same functions as zero-width characters, can be selected. The embodiments of the present disclosure do not make specific limitations on this, and the ability to achieve its functions shall prevail.
[0054] In this step, a zero-width character can be inserted into the mask field obtained based on the data to be masked, thereby ensuring that the obtained mask string can be directly displayed to the user, and only the mask field can be seen by the user when it is displayed to the user. Therefore, there is no need to define a field for displaying the mask field to the user, thereby reducing development costs.
[0055] In an embodiment of the present disclosure, inserting a zero-width character in a mask field obtained based on the data to be masked includes: determining an insertion rule for zero-width characters, and inserting zero-width characters in the mask field according to the number and position of zero-width characters to be inserted indicated by the insertion rule.
[0056] In a specific implementation, before inserting a zero-width character into the mask field, the insertion rule of the zero-width character corresponding to the masked data can be determined first; the insertion rule can include the number and position of the zero-width characters inserted in the mask field. Specifically, the insertion rule can be determined based on the demand of the current business system. Assuming that there are 15 zero-width characters currently available, if the demand of the current business system is not large, the insertion rule can be determined as inserting a zero-width character at the beginning, end, and middle of the mask field, thereby obtaining different mask strings; when the current business system has a large demand, the insertion rule can be determined as inserting 7 zero-width characters before the end of the mask field, thus obtaining Through this method, the insertion rule of zero-width characters can be determined according to the demand of the current business system, and the insertion rule can be flexibly adjusted based on the business system demand. In addition, by inserting zero-width characters into the mask field according to the insertion rule of zero-width characters, the diversity of insertion methods corresponding to the insertion rule can be used to ensure the uniqueness of each mask string obtained in the current system.
[0057] In another possible implementation, n zero-width characters may be randomly selected from currently available zero-width characters and the selected n zero-width characters may be randomly inserted into the mask field; fixed insertion rules may also be set for different applications. The embodiment of the present disclosure does not specifically limit the method for determining the insertion rule, which shall be based on the ability to achieve its function.
[0058] In the embodiment of the present disclosure, the mask field is obtained through the following steps: obtaining annotation information corresponding to the data to be masked; the annotation information includes the mask type and mask position for masking the data to be masked; based on the annotation information, the data to be masked is masked to obtain the mask field.
[0059] Figure 3 A flowchart of a data encryption method provided by an embodiment of the present disclosure is shown in FIG. Figure 3 As shown, the embodiment of the present disclosure does not need to add mask fields and encryption fields, but only needs to introduce a jar package, which includes annotation information corresponding to the data to be masked. In this way, zero-width characters can be used to share the display field and the transmission field, reducing the development cost of data encryption and decryption and improving the efficiency of data return.
[0060] In a specific implementation, annotation information can be added to the sensitive data that needs to be masked (that is, the data to be masked). When the system receives data with annotation information, the data can be masked as the data to be masked. Specific masking rules can also be included in the annotation information. For example, the mask type and mask position corresponding to the data to be masked can be indicated in the annotation information. The annotation information here can be automatically generated by the system according to the data type of the data to be masked, or it can be generated according to custom rules. The mask type here can refer to the data type corresponding to the data to be masked. For example, when the data to be masked is a user's mobile phone number, the middle four digits of the mobile phone number can be masked; and when the data to be masked is the user's ID number, the middle eight digits can be masked; the embodiment of the present disclosure does not specifically limit the specific masking rules.
[0061] In the disclosed embodiment, for each data to be masked that needs to be masked, a corresponding unique identifier can be generated. The unique identifier can be used to determine the sequence of zero-width characters inserted into the mask field. Specifically, inserting zero-width characters into the mask field obtained based on the data to be masked includes: generating a unique identifier corresponding to the data to be masked; based on the unique identifier, determining the sequence of zero-width characters corresponding to the data to be masked, and inserting the sequence of zero-width characters into the mask field.
[0062] In a specific implementation, in order to ensure that the identifier is unique, a unique identifier corresponding to each data to be masked can be generated in an incremental manner; and a unique identifier for each data to be masked can also be generated in combination with the timestamp information of the data to be masked. The above method of generating a unique identifier for the data to be masked is only a possible implementation method of the disclosed embodiment and does not constitute an improper limitation on the present invention. In actual application, it shall be based on the ability to realize its functions.
[0063] Take the insertion rule of zero-width characters as inserting 7 zero-width characters before the end of the mask field as an example. Assuming there are 8 zero-width characters A, B, C, D, E, F, G, H, any 7 zero-width characters can be selected from these 8 zero-width characters in advance, and all sorting methods can be traversed, so that 40320 zero-width character sequences of arrangement methods such as ABCDEFG, BCDEFGH, etc. can be obtained. Then, a unique identifier can be assigned to each character sequence. In order to simplify the process of determining the zero-width character sequence based on the unique identifier of the data to be masked, the method for determining the identifier of the zero-width character sequence can be the same as the method for determining the identifier of the data to be masked. Assuming that the unique identifier of the data to be masked corresponding to the current mask field is 1, a zero-width character sequence with a unique identifier of 1 can be found as the zero-width character sequence corresponding to the current mask field, and the zero-width character sequence can be inserted into the current mask field. In this way, the uniqueness of each mask string obtained can be further guaranteed.
[0064] In another possible implementation, a zero-width character sequence corresponding to the current mask field may be randomly generated according to the insertion quantity and insertion position indicated by the insertion rule, and the zero-width character sequence may be inserted into the current mask field. Alternatively, multiple zero-width character sequences may not be predetermined, but when insertion into the mask field is required, a corresponding zero-width character sequence may be generated according to a unique identifier of the masked data corresponding to the mask field. The disclosed embodiment does not specifically limit this, and in practical applications, it shall be based on the ability to realize its functions.
[0065] Through the above method, assuming that the mask fields of the masked data "Zhang San", "Zhang Si" and "Zhang Wu" are all "Zhang*", and the masked fields displayed to the user are also "Zhang*", but different data to be masked can be distinguished by the different zero-width character sequences therein, thereby ensuring the uniqueness of each mask string.
[0066] Exemplarily, assuming that the data to be masked is "Zhang San", after the execution subject of the embodiment of the present disclosure receives the data to be masked, a unique identifier corresponding thereto can be generated, and masking can be performed according to the annotation information corresponding thereto. Assuming that the mask field obtained is "Zhang*", the insertion rule is to insert 3 zero-width characters before the end character of the mask field. At this time, the generated unique identifier can be used to determine which three zero-width characters to insert into the mask field and the arrangement of these three zero-width characters, that is, the zero-width character sequence in the above text. Assuming that the corresponding zero-width character sequence is BCA, the mask string finally obtained can be "Zhang BCA*". It should be noted that only uppercase English letters are used to replace specific zero-width characters, such as A can represent zero-width character U200C, B can represent zero-width character U200D, C can represent zero-width character U200E, etc. That is, in a specific implementation, the mask string obtained above can be "Zhang U200DU200EU200C*".
[0067] S102: Generate a mapping relationship between the data to be masked and the mask character string.
[0068] In this step, after obtaining the mask string corresponding to the data to be masked, a mapping relationship between the data to be masked and the mask string may be generated, so as to achieve the ability to search for the data to be masked according to the mask string.
[0069] S103: Send the mapping relationship and the mask string to the receiver, so that the receiver uses the mapping relationship to search for the to-be-masked data corresponding to the mask string.
[0070] In this step, the generated mapping relationship and the mask string may be sent to a receiver, and the receiver may find the to-be-masked data corresponding to the mask string according to the mapping relationship.
[0071] In the embodiment of the present disclosure, after generating the mapping relationship between the data to be masked and the mask string, it also includes: setting the effective period of the mapping relationship between the data to be masked and the mask string; in response to the end of the effective period, updating the mask string corresponding to the data to be masked, and generating a mapping relationship between the data to be masked and the updated mask string.
[0072] In a specific implementation, after the mapping relationship is generated, the validity period of the mapping relationship can be set to ensure the security of the data to be masked. When the mapping relationship expires, the expired mapping relationship can be deleted, and then the unique identifier corresponding to the data to be masked can be regenerated, and the zero-width character sequence inserted into the mask field can be re-determined based on the unique identifier to obtain a new mask string. After obtaining the new mask string, a new mapping relationship can be generated, and when the receiving party receives the updated mask string, the corresponding data to be masked can be found according to the new mapping relationship.
[0073] In another possible implementation, each time the mapping relationship is used to search for the corresponding data to be masked, the search timestamp information can be recorded. When the distance between the current time and the last recorded timestamp information exceeds a preset threshold, it indicates that the mapping relationship has not been used for a long time, and it can be considered invalid at this time.
[0074] By setting a validity period for the mapping relationship, the timeliness of the mapping relationship can be guaranteed, thereby ensuring the security of the data to be masked. The above-mentioned method of determining whether the mapping relationship is invalid is only used as an example of a possible implementation method of the embodiment of the present disclosure, and does not constitute an improper limitation of the present invention. In practical applications, it is subject to the ability to realize its functions.
[0075] In an embodiment of the present disclosure, after generating a correspondence between the data to be masked and the mask string, the mapping relationship can be stored. Specifically, the method also includes: storing the mapping relationship in a database; in response to the recipient being an external system, synchronizing the mapping relationship stored in the database to a database associated with the recipient, so that the recipient can use the mapping relationship to search for the data to be masked corresponding to the mask string.
[0076] In a specific implementation, if the receiver and the execution subject of the embodiment of the present disclosure are different applications within the same system, the mapping relationship can be stored in a database within the system, so that when the receiver receives the mask string, the data to be masked corresponding to the mask string can be searched from the database according to the mapping relationship, thereby realizing the restoration of the mask string. If the receiver and the execution subject of the embodiment of the present disclosure belong to different systems, the external system can be connected to the database corresponding to the execution subject of the embodiment of the present disclosure, or the mapping relationship in the database corresponding to the execution subject of the embodiment of the present disclosure can be synchronized to the database of the external system, thereby enabling the external system to use the mapping relationship to find the data to be masked corresponding to the mask string, thereby realizing the restoration of the mask string. In this way, data encryption and decryption can be realized in a cross-system scenario without adding fields and encryption and decryption codes, further reducing the cost of restoring data after encryption, and improving the efficiency of data encryption and decryption.
[0077] According to a second aspect of the embodiment of the present disclosure, Figure 4 As shown, a data encryption device 400 is provided, comprising:
[0078] Insertion module 401, used for inserting zero-width characters into a mask field obtained based on the data to be masked, to obtain a mask character string;
[0079] A generating module 402 is used to generate a mapping relationship between the data to be masked and the mask string;
[0080] The sending module 403 is used to send the mapping relationship and the mask string to the receiving party, so that the receiving party can use the mapping relationship to search for the to-be-masked data corresponding to the mask string.
[0081] Optionally, the insertion module 401 is specifically used for:
[0082] Determine the insertion rule of the zero-width character, and insert the zero-width character into the mask field according to the insertion quantity and insertion position of the zero-width character indicated by the insertion rule.
[0083] Optionally, the insertion module 401 is specifically used for:
[0084] Generate a unique identifier corresponding to the data to be masked;
[0085] Based on the unique identifier, a zero-width character sequence corresponding to the data to be masked is determined, and the zero-width character sequence is inserted into the mask field.
[0086] Optionally, the insertion module 401 is further used for:
[0087] Obtain annotation information corresponding to the data to be masked; the annotation information includes a mask type and a mask position for masking the data to be masked;
[0088] Based on the annotation information, the data to be masked is masked to obtain a mask field.
[0089] Optionally, the generating module 402 is further used for:
[0090] Set the effective period of the mapping relationship between the masked data and the mask string;
[0091] In response to the end of the valid period, the mask string corresponding to the data to be masked is updated, and a mapping relationship between the data to be masked and the updated mask string is generated.
[0092] Optionally, the sending module 403 is further configured to:
[0093] Store the mapping relationship in a database;
[0094] In response to the receiver being an external system, the mapping relationship stored in the database is synchronized to a database associated with the receiver, so that the receiver uses the mapping relationship to search for the to-be-masked data corresponding to the mask character string.
[0095] According to the third aspect of an embodiment of the present disclosure, a data encryption electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by one or more processors, the one or more processors implement the method provided by the first aspect of the embodiment of the present invention.
[0096] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method provided by the first aspect of the embodiment of the present disclosure is implemented.
[0097] According to a fifth aspect of an embodiment of the present invention, a computer program product is provided, including a computer program, and the computer program implements the method of any of the above embodiments when executed by a processor.
[0098] Figure 5 An exemplary system architecture 500 to which the data encryption method or data encryption device implemented by the present disclosure can be applied is shown.
[0099] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0100] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).
[0101] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0102] The server 505 may be a server that provides various services, such as a background management server (only as an example) that provides support for shopping websites browsed by users using the terminal devices 501, 502, and 503. The background management server may process the received data encryption request and feed back the processing result (only as an example) to the terminal device.
[0103] It should be noted that the data encryption method provided in the embodiment of the present invention is generally executed by the server 505, and accordingly, the data encryption device is generally set in the server 505. The data encryption method provided in the embodiment of the present invention can also be executed by the terminal devices 501, 502, and 503, and accordingly, the data encryption device can be set in the terminal devices 501, 502, and 503.
[0104] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.
[0105] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of a terminal device suitable for implementing an embodiment of the present invention. Figure 6 The terminal 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.
[0106] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0107] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.
[0108] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.
[0109] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0110] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method 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 above-mentioned module, program segment, or a part of a 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 or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0111] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor. For example, a processor includes an insertion module, a generation module, and a sending module, wherein the names of these modules do not constitute a limitation on the modules themselves in certain cases. For example, the generation module may also be described as a "module for generating a mapping relationship between data to be masked and a mask string".
[0112] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device implements the following method: inserting a zero-width character into a mask field obtained based on the data to be masked to obtain a mask string; generating a mapping relationship between the data to be masked and the mask string; sending the mapping relationship and the mask string to a receiver, so that the receiver uses the mapping relationship to find the data to be masked corresponding to the mask string.
[0113] Finally, it should be noted that the above embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A data encryption method, It is characterized in that include: Insert a zero-width character into the mask field obtained based on the data to be masked to obtain a mask string; Generate a mapping relationship between the data to be masked and the mask string; The mapping relationship and the mask string are sent to a receiver, so that the receiver uses the mapping relationship to search for the to-be-masked data corresponding to the mask string.
2. The method according to claim 1, It is characterized in that Insert zero-width characters into the mask field based on the masked data, including: Determine a zero-width character insertion rule, and insert zero-width characters into the mask field according to the insertion quantity and insertion position of the zero-width characters indicated by the insertion rule.
3. The method according to claim 1, It is characterized in that Insert zero-width characters into the mask field based on the masked data, including: Generate a unique identifier corresponding to the data to be masked; Based on the unique identifier, a zero-width character sequence corresponding to the data to be masked is determined, and the zero-width character sequence is inserted into the mask field.
4. The method according to claim 1, It is characterized in that The mask field is obtained by the following steps: Acquire annotation information corresponding to the data to be masked; the annotation information includes a mask type and a mask position for masking the data to be masked; Based on the annotation information, the data to be masked is masked to obtain a mask field.
5. The method according to claim 1, It is characterized in that After generating the mapping relationship between the data to be masked and the mask string, the method further includes: Setting a valid period of a mapping relationship between the data to be masked and the mask character string; In response to the end of the valid period, the mask string corresponding to the data to be masked is updated, and a mapping relationship between the data to be masked and the updated mask string is generated.
6. The method according to claim 1, It is characterized in that The method further comprises: Storing the mapping relationship in a database; In response to the receiver being an external system, the mapping relationship stored in the database is synchronized to a database associated with the receiver, so that the receiver uses the mapping relationship to search for the to-be-masked data corresponding to the mask string.
7. A data encryption device, It is characterized in that include: An inserting module, used for inserting a zero-width character into a mask field obtained based on the data to be masked, to obtain a mask string; A generating module, used for generating a mapping relationship between the data to be masked and the mask string; The sending module is used to send the mapping relationship and the mask string to a receiving party, so that the receiving party uses the mapping relationship to search for the to-be-masked data corresponding to the mask string.
8. An electronic device, It is characterized in that include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
9. A computer readable medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 6.
Citation Information
Cited By
Data encryption and identity verification method and device, equipment and medium
CN120512280A
Watermark processing method and apparatus, and computer device and readable storage medium
WO2026040281A1
