Data encryption and decryption method and computer storage medium

By imaged information and keys and performing image fusion processing, the problem that traditional key methods cannot guarantee information security in physical entity transmission is solved, and the security and applicability of information during the transmission process is realized.

CN114036542BActive Publication Date: 2025-03-14ALIBABA (CHINA) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111347955.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-15
Publication Date
2025-03-14
Estimated Expiration
2041-11-15

AI Technical Summary

Technical Problem

In scenarios where physical entities are required as information presentation carriers, it is difficult for traditional key methods to implement information encryption, resulting in the inability to ensure security during the transmission process.

Method used

By imaged the information to be encrypted and the key to be encrypted, and image fusion processing of pixel positions is performed to generate an encrypted information image. During decryption, the same key is used to generate a binary key image, and fuse and superimpose it with the encrypted information image to obtain the decrypted information image.

Benefits of technology

It realizes the security of information in the transmission process of physical entities, avoids information leakage, and is suitable for scenarios where physical entities need to present carriers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114036542B_ABST
    Figure CN114036542B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a data encryption and decryption method, an electronic device, a computer storage medium, and a computer program product, wherein the data encryption method includes: obtaining information to be encrypted and a key for encrypting the information to be encrypted; converting the information to be encrypted into an information image, and converting the key into a binary key image matching the information image according to the size of the information image; performing image fusion processing on the information image and the binary key image according to the pixel position; and obtaining an encrypted information image according to the result of the image fusion processing. Through the embodiment of the present application, information security is achieved in scenarios where a physical entity is required as an information presentation carrier.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a data encryption and decryption method and a computer storage medium. Background Art

[0002] With the development of information technology, various digital information contents are widely used in all walks of life, bringing many conveniences to people.

[0003] But at the same time, a large amount of personal information needs to be transmitted on the Internet for communication, transactions, payment, logistics, entertainment, etc., which may lead to its theft and illegal use. For example, after obtaining this information, black and gray industry practitioners on the Internet use it to profile users and then conduct targeted advertising and direct product promotion. What's worse, this information will be used by some lawless elements to conduct targeted fraud and other serious illegal activities against target users. Therefore, protecting the security of user personal information has become a hot topic in Internet technology.

[0004] In the traditional way, the information that needs to be encrypted is directly encrypted with a key to ensure information security, but this method is not applicable in some scenarios, especially in scenarios where physical entities are required as information presentation carriers. Take logistics express delivery as an example. When delivering express delivery, the user's name, address, telephone number and other private information need to be physically presented on the physical bill, and then the physical bill is delivered together with the package, and the delivery link involves multiple parties such as the sender, storage party, forwarder, dispatcher, and recipient. In this scenario, if the traditional key method is used, although information encryption can be achieved, multiple participants in the express delivery process such as storage party, forwarder, dispatcher, recipient, etc. will not be able to obtain the information of the goods to be delivered, and thus the goods cannot be delivered and delivered.

[0005] Therefore, how to achieve information protection in the above scenarios has become an urgent problem to be solved. Summary of the invention

[0006] In view of this, an embodiment of the present application provides a data encryption and decryption solution to at least partially solve the above problems.

[0007] According to the first aspect of an embodiment of the present application, a data encryption method is provided, comprising: obtaining information to be encrypted and a key for encrypting the information to be encrypted; converting the information to be encrypted into an information image, and converting the key into a binary key image matching the information image according to the size of the information image; performing image fusion processing on the information image and the binary key image according to pixel positions; and obtaining an encrypted information image according to a result of the image fusion processing.

[0008] According to a second aspect of an embodiment of the present application, a data decryption method is provided, comprising: obtaining an encrypted information image carrying encrypted information, and a binary key image generated based on a key, wherein the key is the same as the encryption key used for the encrypted information in the encrypted information image; fusing and superimposing the encrypted information image and the binary key image; and obtaining a decrypted information image corresponding to the encrypted information image based on the result of the fusion and superposition, wherein the decrypted information image contains the plaintext of the encrypted information.

[0009] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform an operation corresponding to the method described in the first aspect or the second aspect.

[0010] According to a fourth aspect of an embodiment of the present application, a computer storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in the first aspect or the second aspect is implemented.

[0011] According to the data encryption and decryption scheme provided in the embodiment of the present application, on the one hand, through the data encryption scheme therein, both the information to be encrypted and the key are imaged, and then the two are image fused to achieve information encryption. Therefore, after the information is encrypted by the key image, even if it is printed on an entity such as a face sheet, it will not be recognized by the naked eye and can be safely transmitted. It is suitable for scenarios where physical entities are required as information presentation carriers to achieve information security in such scenarios.

[0012] On the other hand, through the data decryption scheme in the embodiment of the present application, only the key used when encrypting information is needed, and the decrypted information image can be obtained by fusion and superposition of the binary key image corresponding to the key and the encrypted information image generated after encryption, from which the original plaintext information can be obtained. Among them, the plaintext information finally decrypted will still be presented in the form of a visual image, which can be obtained through human eye recognition, so as to effectively avoid the problem of automated and large-scale information leakage, and realize information security in the scenario where a physical entity is required as an information presentation carrier. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0014] Figure 1 A schematic diagram of an exemplary system for the data encryption and decryption method according to an embodiment of the present application;

[0015] Figure 2 This is a flowchart of a data encryption method according to Embodiment 1 of the present application;

[0016] Figure 3 A flowchart of a data decryption method according to Embodiment 2 of the present application;

[0017] Figure 4A This is a flow chart of a data encryption and decryption process according to Embodiment 3 of the present application;

[0018] Figure 4B for Figure 4A A schematic diagram of an example scenario in the illustrated embodiment;

[0019] Figure 5 This is a schematic diagram of the structure of an electronic device according to the fourth embodiment of the present application. DETAILED DESCRIPTION

[0020] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the embodiments of the present application should fall within the scope of protection of the embodiments of the present application.

[0021] The specific implementation of the embodiment of the present application is further explained below in conjunction with the accompanying drawings of the embodiment of the present application.

[0022] Figure 1 An exemplary system for a data encryption and decryption solution applicable to an embodiment of the present application is shown. Figure 1 As shown, the system 100 may include a server 102, a communication network 104 and / or one or more user devices 106. Figure 1 The example in FIG. 1 is a plurality of user devices.

[0023] Server 102 can be any suitable server for storing and transmitting information, data, programs and / or any other suitable type of content. In some embodiments, server 102 can perform any suitable function. For example, in some embodiments, server 102 can be used to transmit keys between user devices. As an optional example, in some embodiments, server 102 can also be used to update the keys sent to user devices based on a preset update algorithm.

[0024] In some embodiments, the communication network 104 can be any suitable combination of one or more wired and / or wireless networks. For example, the communication network 104 can include any one or more of the following: the Internet, an intranet, a wide area network (WAN), a local area network (LAN), a wireless network, a digital subscriber line (DSL) network, a frame relay network, an asynchronous transfer mode (ATM) network, a virtual private network (VPN) and / or any other suitable communication network. The user device 106 can be connected to the communication network 104 via one or more communication links (e.g., communication link 112), and the communication network 104 can be linked to the server 102 via one or more communication links (e.g., communication link 114). The communication link can be any communication link suitable for transmitting data between the user device 106 and the server 102, such as a network link, a dial-up link, a wireless link, a hard-wired link, any other suitable communication link or any suitable combination of such links.

[0025] The user device 106 may include any one or more user devices suitable for obtaining keys, updating keys, collecting images, presenting images, etc. In some embodiments, the user device 106 may include any suitable type of device. For example, in some embodiments, the user device 106 may include a mobile device, a dedicated device for face sheet information processing, a tablet computer, a laptop computer, a desktop computer, a wearable computer and / or any other suitable type of user device. In some embodiments, the user device 106 may encrypt the information image corresponding to the information to be encrypted based on the binary key image corresponding to the key, and generate an encrypted information image to be printed on a physical entity that can carry the information image, such as a physical face sheet. In other embodiments, the user device 106 may collect an encrypted information image carried on a physical entity such as a physical face sheet, and decrypt it using the binary key image corresponding to the key to obtain the plaintext of the original information.

[0026] Although server 102 is illustrated as one device, in some embodiments, any suitable number of devices may be used to perform the functions performed by server 102. For example, in some embodiments, multiple devices may be used to implement the functions performed by server 102. Alternatively, the functions of server 102 may be implemented using cloud services.

[0027] Based on the above system, an embodiment of the present application provides a data encryption and decryption solution, which is described below through multiple embodiments.

[0028] Embodiment 1

[0029] Reference Figure 2 , shows a step flow chart of a data encryption method according to embodiment 1 of the present application.

[0030] The data encryption method of this embodiment includes the following steps:

[0031] Step S202: Obtain information to be encrypted and a key used to encrypt the information to be encrypted.

[0032] The information to be encrypted may be information such as personal information, commercial security data, etc. that needs to be encrypted during the transmission process, especially information that needs to be encrypted and needs to be carried by a physical entity, including but not limited to logistics express information, take-out information, verification information, etc. Such information is usually character information, which can be any one or any combination of letters, numbers, symbols, etc. However, it is not limited to this, simple graphic symbol information, such as triangles, circles, rectangles, various simple stick figures, etc., can also be applied to the scheme of the embodiment of the present application.

[0033] As for the key, the encryption party and the decryption party can agree on it in advance. In one feasible way, the key can be a binary sequence of sufficient length generated by a key seed. The key can be generated at any time before the encrypted information is encrypted. It can be generated immediately before use, or before the information to be encrypted is imaged to generate an information image. This method is also called a pre-key. It can be seen that the generation and use of the key in the embodiment of the present application is more flexible and convenient. In the embodiment of the present application, the pre-key method is used as an example for explanation, but as mentioned above, the method of generating immediately after use is also applicable to the scheme of the embodiment of the present application.

[0034] Step S204: converting the information to be encrypted into an information image, and converting the key into a binary key image matching the information image according to the size of the information image.

[0035] In one feasible manner, if the information to be encrypted is character information, a character image is generated for the entire character information; similarly, when the information to be encrypted is graphic symbol information, a graphic symbol image can also be generated for the entire graphic symbol information.

[0036] In another feasible manner, if the information to be encrypted is character information, each character in the information to be encrypted can be obtained, and each character can be converted into a corresponding character information image. Similarly, if the information to be encrypted is a combination of multiple graphic symbol information, each graphic symbol can also be obtained, and each graphic symbol can be converted into a corresponding graphic symbol image; if the information to be encrypted is a combination of characters and graphic symbols, each character and graphic symbol is obtained, and converted into corresponding character information images and graphic symbol images respectively. By splitting into single characters or graphic symbols, it can be processed in units of characters or graphic symbols in subsequent processing to provide materials for achieving better data encryption effects.

[0037] Further optionally, a plurality of character information images corresponding to each character can be queried and obtained from a database pre-stored with character information images; for each character, a character information image is selected from the corresponding plurality of character information images according to a preset rule as a character information image matching the character. In this way, a large number of character information images are pre-stored in the database, and the character information image and the character are in an N:1 relationship, where N is greater than 1. For each character, although each of the N character information images corresponding to it is an image corresponding to the character, the shape of the character in each image is different. When selecting a character information image from a plurality of character information images, it can be selected according to a preset rule, and the preset rule can be set by a person skilled in the art according to actual needs, such as random selection, sequential selection, etc., and the embodiment of the present application does not limit this. In this way, the security of information can be improved. It should be noted that in the embodiment of the present application, unless otherwise specified, "multiple", "multiple", etc., and the number related to "multiple" all mean two or more. Of course, the case where N is equal to 1 is also applicable to the solution of the embodiment of the present application.

[0038] After obtaining the information image, the key can be converted into a binary key image that matches the information image according to the size of the information image. If the information image is obtained after the information to be encrypted is converted as a whole, the key can be directly converted into a binary key image that matches the information image according to the size of the converted information image; if the information image is obtained based on the image corresponding to a single character in the information to be encrypted or the image corresponding to a single graphic symbol, the key needs to be converted into a binary key image that matches the information image according to the total size of the information image composed of these single images. In specific implementation, the bit corresponding to the size of the information image can be calculated first, assuming it is 60*80, then the binary sequence corresponding to the key can be intercepted based on the size to obtain a binary sequence of the corresponding length, and then converted into a binary key image. Alternatively, assuming this, in a feasible way, the binary sequence corresponding to the key can be obtained first; then the binary sequence can be intercepted according to the size of the information image to obtain a binary matrix that matches the size of the information image; and the binary matrix can be converted into a binary key image. The method of expressing the intercepted binary sequence as a binary matrix can effectively improve the speed and efficiency of converting into a binary key image.

[0039] In the method of converting each character into a corresponding character information image, in order to reduce the subsequent calculation amount and simplify the subsequent encryption processing, in a feasible method, the character information image corresponding to each character can be binarized and uniformly sized to obtain a binarized character information image with a uniform size corresponding to each character. In this way, the character information image adopts the form of a bitmap of uniform size, which will be simpler when calculating the bits corresponding to the size of the information image. For example, each character information image is 40*60 after the uniform size, and there are 4 character information images in total, that is, the size of the total information image is 40*60*4=40*240=9600, then 9600 bits can be directly intercepted from the binarization sequence corresponding to the key. Then the 9600 bits are converted into a 40*240 binary matrix by row (240 bits per row) or by column (40 bits per column) or by zig-zag order, and then the binary matrix is ​​converted into a binary key image. In this method, the character information image is also binarized, that is, the information image and the key image are both binarized images, so the calculation is simplified and convenient in the subsequent encryption process. When the information to be encrypted includes graphic symbols, this method can also be used, which will not be repeated here.

[0040] In addition, a graphical base can be generated for the information to be encrypted according to the size of the character information image corresponding to each character; the character information image corresponding to each character is placed in the graphical base according to the order of the characters in the information to be encrypted to generate an information image corresponding to the information to be encrypted. Although each character information image can also be directly spliced ​​to generate the final information image, each splicing requires the allocation of new storage computing resources. By generating a graphical base, storage resources and computing resources can be allocated for the final information image to be generated at one time, saving resource consumption and improving the efficiency of information image generation.

[0041] Step S206: performing image fusion processing on the information image and the binary key image according to the pixel positions.

[0042] In this step, the pixel position is used to determine the corresponding relationship between the pixel points in the two images, based on which the two images can be fused. In one feasible way, the image fusion process can be achieved by XOR processing of pixel values. For example, when both the information image and the binary key image are binary images, the XOR processing of the two can be simply implemented as the XOR processing between the pixel values ​​of 0 and 1. It can be seen that both images are binary images, which can greatly improve the speed and efficiency of encryption processing.

[0043] However, if the information image is a non-binary image, the XOR processing in this step can be understood as a generalized XOR processing. For example, a pixel value threshold such as 127 can be set. If the pixel value of a certain pixel of the information image is 156, which is greater than 127, when performing XOR processing with the binary key image, if the pixel value of the corresponding pixel in the binary key image is 1, the result of the XOR processing is 1; and if the pixel value of the corresponding pixel in the binary key image is 0, the result of the XOR processing is 0. Alternatively, it can be simply considered that if the pixel value of a pixel of the information image is less than or equal to 127, it can be considered to be biased towards black, and its pixel value can be regarded as 1; and if the pixel value of a pixel of the information image is greater than 127, it can be considered to be biased towards white, and its pixel value can be regarded as 0. Based on this, the result of the XOR processing of the information image and the binary key image is obtained.

[0044] Step S208: Obtain an encrypted information image based on the result of the image fusion processing.

[0045] After the information image and the binarized key image are fused, the information to be encrypted is no longer easy to identify. For example, after the information image and the binarized key image are XORed according to the pixel position, the image obtained will also be a binary image, because the original information image has been fused with the binarized key image to generate a new information image, thereby achieving effective encryption of the information to be encrypted.

[0046] It should be noted that if a graphical base plate is used when generating the information image corresponding to the information to be encrypted, then in an optional solution, a reserved position for positioning information can be set in the graphical base plate, and this step can also be implemented as follows: obtaining the encrypted main information image according to the result of the XOR process; adding a positioning mark to the reserved position for positioning information of the graphical base plate based on the main information image; generating the encrypted information image according to the main information image and the positioning mark. The positioning mark can be used to accurately locate the image portion to be decrypted during subsequent decryption.

[0047] In an application scenario of an embodiment of the present application, the encrypted information image generated above can be printed on a physical entity, such as a physical face sheet, which can realize information transmission and avoid information leakage, effectively ensuring information security.

[0048] It can be seen that through this embodiment, the information to be encrypted and the key are both imaged, and then the two are subjected to XOR processing based on pixel values, thereby realizing information encryption. Therefore, after the information is encrypted by the key image, even if it is printed on an entity such as a face sheet, it will not be recognized by the naked eye and can be safely transmitted. It is suitable for scenarios where a physical entity is required as a carrier for information presentation to achieve information security in such scenarios.

[0049] The data encryption method of this embodiment can be executed by any appropriate electronic device with data processing capabilities, including but not limited to: servers, mobile terminals (such as mobile phones, PADs, etc.) and PCs, etc.

[0050] Embodiment 2

[0051] Reference Figure 3 , shows a step flow chart of a data decryption method according to Embodiment 2 of the present application.

[0052] The data decryption method of this embodiment includes the following steps:

[0053] Step S302: Acquire an encrypted information image carrying encrypted information and a binary key image generated based on a key.

[0054] The key is the same as the encryption key used to encrypt the information image. In the embodiment of the present application, the encrypted information image can be a binary encrypted information image obtained by the data encryption method described in the first embodiment, but it can also be an image obtained by fusing the information image and the key image using a similar principle. It is sufficient that the key used to decrypt the encrypted information image is the same as the key used for encryption, and the key can be transmitted by any appropriate secure transmission method, which is not limited by the embodiment of the present application.

[0055] In a feasible manner, the generation of a binary key image based on a key can be implemented as follows: obtaining a binary sequence corresponding to the key, and intercepting the binary sequence according to the size of the encrypted information image to obtain a binary matrix that matches the size of the encrypted information image; converting the binary matrix into a binary key image. It should be noted that in this embodiment, due to image acquisition, the size of the encrypted information image obtained by image acquisition may not be consistent with the size of the original encrypted information image (such as the encrypted information image generated in Example 1). However, as long as the size of the binary key image is kept consistent with the size of the encrypted information image, subsequent decryption processing can be performed. In addition, the specific implementation of the above-mentioned generation of a binary key image based on a key can refer to the relevant description of generating a binary key image in Example 1, which will not be repeated here.

[0056] In the case where the encrypted information image has a positioning mark, optionally, an image can be captured on the entity carrying the encrypted information image to obtain a captured image containing the encrypted information image; the positioning mark is determined from the captured image, and the encrypted information image is obtained according to the positioning mark. In this way, the encrypted information image can be accurately positioned and obtained.

[0057] In a specific optional manner, when obtaining an encrypted information image according to a positioning mark, an information image area can be obtained according to the positioning mark; an affine transformation can be performed on the information image area; and the information image area after the affine transformation can be binarized to obtain the encrypted information image. This is because the entity carrying the encrypted information image may cause deformation of the encrypted information image during the transmission process, and the deformation can be corrected by the affine transformation, thereby avoiding decryption anomalies or incorrect decrypted information caused by the deformation. Further optionally, the information image area after the affine transformation can also be uniformly sized to be processed into a size suitable for decryption.

[0058] Step S304: fusing and superimposing the encrypted information image and the binary key image.

[0059] In a feasible manner, this step can be implemented as follows: performing pixel value XOR processing on the encrypted information image and the binarized key image according to the pixel position. As mentioned above, the encrypted information image is usually a binarized image, so the process of performing pixel value XOR processing on the encrypted information image and the binarized key image can be considered as the reverse process of the aforementioned encryption processing of the information image using the binarized key image. In this way, a decrypted information image with less noise, clearer and easier to identify can be obtained.

[0060] In another feasible manner, this step can be implemented as follows: pixel blocks are superimposed on the encrypted information image and the binary key image according to the preset pixel block size and pixel position. The preset pixel block size can be appropriately set by a person skilled in the art according to actual needs. The smaller the block, the higher the accuracy. In this manner, black block + black block -> black block; black block + white block -> black block; white block + white block -> white block. Using this manner, due to the presence of noise, OCR decryption recognition can be effectively resisted.

[0061] Step S306: Obtain the decrypted information image corresponding to the encrypted information image according to the result of the fusion and superposition.

[0062] Through the above-mentioned fusion and superposition processing, a decrypted information image containing the encrypted information plaintext can be obtained, and the encrypted information plaintext can be recognized by naked eyes from the decrypted information image.

[0063] However, in some cases, the encrypted information image may be greatly deformed due to transmission and other reasons, resulting in deviations in the positioning and affine transformation of the encrypted information image after acquisition, which in turn makes the plaintext information obtained after decryption difficult to identify. Based on this, in a feasible manner of this embodiment, the encrypted information image can also be offset according to the preset offset position; the encrypted information image after the offset operation is fused and superimposed with the binary key image to obtain an alternative decryption information image corresponding to the offset position, wherein the alternative decryption information image contains the plaintext information corresponding to the encrypted information. That is, the offset deformation that may be generated by the encrypted information is corrected by the offset operation, so that a more correct result can be obtained after decryption. Among them, the preset offset position can be appropriately set by those skilled in the art according to actual conditions, such as performing eight offset operations on the encrypted information image according to eight offset positions of [0, -1], [-1, 0], [-1, -1], [0, 1], [1, 0], [1, 1], [1, -1], [-1, 1]. Accordingly, the candidate decryption information images finally obtained will have eight images corresponding to eight offset positions. Based on these candidate decryption information images and the previously obtained decryption information images, by mutual comparison and reference, a relatively accurate plaintext corresponding to the encrypted information can be obtained.

[0064] Those skilled in the art should understand that the number and specific offset settings of the above eight offset positions are exemplary descriptions, and other data and offset positions are also within the protection scope of this application.

[0065] Through this embodiment, only the key used to encrypt information is needed, and based on the binary key image corresponding to the key and the encrypted information image generated after encryption, the decrypted information image can be obtained by fusion and superposition of the two, from which the original plaintext information can be obtained. Among them, the plaintext information finally decrypted will still be presented in the form of a visual image, which can be obtained through human eye recognition, thereby effectively avoiding the problem of automated and large-scale information leakage, and realizing information security in scenarios where physical entities are required as information presentation carriers.

[0066] The data encryption method of this embodiment can be executed by any appropriate electronic device with data processing capabilities, including but not limited to: servers, mobile terminals (such as mobile phones, PADs, etc.) and PCs, etc.

[0067] Embodiment 3

[0068] This embodiment takes the waybill in the logistics express scenario as an example. Figure 4A and 4B , explaining the whole process of data encryption and data decryption.

[0069] like Figure 4AAs shown, it shows a data encryption and decryption process according to the third embodiment of the present application, which includes the following steps:

[0070] Step S402: Convert the information to be encrypted into an information image.

[0071] The specific process may include:

[0072] A) Get information from pre-built databases.

[0073] In order to improve security, the database is constructed to store a large number of character information images in a one-to-many manner, and optionally, images of graphic symbols can also be stored. The database uses a one-to-many method, that is, one information corresponds to multiple images, and the characters or graphic symbols in these images can be visually recognized by the human eye and recognized as corresponding information, but there are significant differences in shape.

[0074] B) Obtaining the character information image corresponding to the information to be encrypted from the database.

[0075] In this embodiment, the information to be encrypted is a character as an example. Figure 4B As shown in , the information to be encrypted is the sensitive information "2795". Then, the character information image corresponding to each character in the information to be encrypted is obtained from the database, such as the character information image corresponding to "2", the character information image corresponding to "7", the character information image corresponding to "9" and the character information image corresponding to "5".

[0076] C) Perform uniform binarization processing on all character information images.

[0077] D) Sampling the binary character information image and unifying it to a preset size.

[0078] The specific setting of the preset size can be appropriately set by those skilled in the art according to actual needs, and the embodiments of the present application do not limit this. If the size of the character information image is larger than the preset size, it can be adjusted to the preset size by downsampling; if the size of the character information image is smaller than the preset size, it can be adjusted to the preset size by upsampling.

[0079] D) Generate a graphic base plate of corresponding size according to the size of the unified character information image, and reserve a certain space at the four corners of the base plate for adding positioning marks later.

[0080] As in this example, since the four character information images of "2", "7", "9" and "5" have the same image width of the same size, a graphic base plate of the corresponding size can be generated based on the width and the total length of the four character information images.

[0081] E) placing the obtained character information image in the graphic base plate in sequence according to the character sequence in the information to be encrypted, thereby generating a complete information image corresponding to the information to be encrypted.

[0082] like Figure 4B The graphical representation of “2795” is shown in the figure.

[0083] Step S404: Encrypt the information image using the binary key image corresponding to the key.

[0084] The specific process includes:

[0085] F) Generate a key.

[0086] For example, a key seed may be used to generate a binary sequence of sufficient length. Figure 4B The key seed can be generated at any time before the encryption operation, and can be generated immediately before use, or before the encrypted information is visualized in step S402 (ie, the pre-key).

[0087] G) Generate a binary key image based on the key.

[0088] According to the size of the information image generated in step S402, the corresponding length can be intercepted from the binary sequence corresponding to the key, converted into a binary matrix of the same size, and then the binary matrix is ​​converted into a binary key image. Figure 4B The “binarized key image” shown in .

[0089] H) Information image encryption.

[0090] The information image generated in step S402 and the binary key image are XORed in sequence according to pixel positions to obtain an encrypted information image, i.e., a ciphertext image, such as Figure 4B The “imaged ciphertext” shown in .

[0091] I) Add positioning markers.

[0092] For example, add distinctive positioning marks (such as Figure 4B ), and then generate the final encrypted information image that can be printed on the face sheet, such as Figure 4B The “materialized ciphertext” shown in the lower right corner.

[0093] Step S406: Restoration processing of the encrypted information image.

[0094] Taking the waybill as an example, the encrypted information image is finally printed on the waybill for transmission. When decrypting, the decryption personnel first obtain the image of the corresponding area by taking a photo or scanning, and then perform a series of operations such as positioning, correcting, and restoring the image to obtain the corresponding encrypted information image. The specific steps are as follows:

[0095] J) Acquire an image containing the complete encrypted information image area through an image acquisition device.

[0096] K) Searching for the preset positioning mark in the encrypted information image in the captured image to obtain four positioning coordinates A, B, C, and D.

[0097] L) The corresponding ciphertext image area is extracted according to the four positioning coordinate points. Due to physical deformation and shooting angle, the extracted ciphertext image area has deformation problems and may be non-rectangular. The ciphertext image area can be corrected to a rectangle through affine transformation based on the four positioning coordinates.

[0098] When the size of the ciphertext image is available, the corrected rectangular image can be further transformed to a size corresponding to the ciphertext image.

[0099] M) restores the image obtained in L) into a clean binary image through binarization processing.

[0100] The above process Figure 4B It is simply indicated as "restore processing".

[0101] Step S408: decrypting the encrypted information image after the restoration process.

[0102] The key seed can be transmitted to the decryption party through a preset or secret channel, and the decryption party uses the key to decrypt the restored face sheet image. The key seed is the same as the key seed in the aforementioned step S404. For security reasons, the key seed can be preset on the device, and the encryption end and the decryption end have the same key; or the key seed can be updated regularly or transmitted on demand to achieve higher confidentiality.

[0103] The decryption process may include:

[0104] N) Generate a binary sequence through a key seed, convert the binary sequence into a binary matrix, and then convert it into a binary key image.

[0105] O) Transform the encrypted information image and the binary key image obtained in step S406 to a uniform size.

[0106] P) The transformed encrypted information image is fused and superimposed with the binary key image.

[0107] There are two ways of fusion and superposition, and any one of them can be used. One is to perform XOR operation on the encrypted information image and the binary key image directly according to the pixel position; the other is to simulate the visual effect for fusion and superposition, that is: black block + black block -> black block; black block + white block -> black block; white block + white block -> white block.

[0108] Based on this, the decrypted information image can be obtained, for example, Figure 4B As shown in the “decryption result” in the figure, it can be seen from the “decryption result” that the four characters “2795” can be recognized by the naked eye in a form different from the back.

[0109] However, if the "decryption result" cannot clearly display the encrypted information, the following process Q may be optionally performed.

[0110] Q) Generate alternative decryption information images.

[0111] For example, the transformed encrypted information image is shifted in eight shift positions [0,-1], [-1,0], [-1,-1], [0,1], [1,0], [1,1], [1,-1], [-1,1], and then fused and superimposed with the binary key image to generate the corresponding candidate decryption image. In this way, the accidental misalignment of the single image can be effectively resisted;

[0112] It can be seen that through the above processes P) and Q), the decrypted information image obtained in the P) process can be first presented to the decryptor, and the decryptor can visually identify the decrypted information content; if the information content is not clear enough, the decryptor can also choose to view alternative decrypted information images. In this case, multiple alternative decrypted information images can be presented to the decryptor at one time or in sequence.

[0113] Through this embodiment, the information to be encrypted is first visualized, and then encrypted through a binary key image to protect the information content after the image. The encrypted information still exists in the form of an image and can be printed on the face sheet. At the same time, the encrypted key is also visualized, and can support key pre-positioning and one key for multiple uses. The key corresponding to the face sheet will be passed to or pre-positioned in the participant device that needs to decrypt and read the information. The participant device scans the encrypted information image on the face sheet, and then fuses it with the binary key image of the corresponding key to obtain the visualized information content. The participant obtains the information content through visual recognition of the human eye. Since the final decrypted information is presented in the form of a visual image and obtained in the form of human eye recognition, it can effectively avoid the problem of automated and large-scale information leakage. Since the encrypted information is presented in the form of an image in the face sheet, in order to reduce the distortion and positioning problems caused by image scanning, this embodiment provides an automated decoding solution that integrates image acquisition, positioning, restoration, and fusion, which greatly improves the decryption efficiency and reduces the decryption cost.

[0114] Embodiment 4

[0115] Reference Figure 5 , shows a schematic diagram of the structure of an electronic device according to the fourth embodiment of the present application. The specific embodiment of the present application does not limit the specific implementation of the electronic device.

[0116] like Figure 5 As shown, the electronic device may include: a processor (processor) 502 , a communication interface (Communications Interface) 504 , a memory (memory) 506 , and a communication bus 508 .

[0117] in:

[0118] The processor 502 , the communication interface 504 , and the memory 506 communicate with each other via a communication bus 508 .

[0119] The communication interface 504 is used to communicate with other electronic devices or servers.

[0120] The processor 502 is used to execute the program 510, and specifically can execute the relevant steps described in any one of the above method embodiments 1 to 3.

[0121] Specifically, the program 510 may include program codes, which include computer operation instructions.

[0122] The processor 502 may be a CPU, or an application specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.

[0123] The memory 506 is used to store the program 510. The memory 506 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0124] The program 510 can be specifically used to enable the processor 502 to perform operations corresponding to the method in any one of the above method embodiments 1 to 3.

[0125] The specific implementation of each step in program 510 can refer to the corresponding description of the corresponding steps and units in the above method embodiment, and has corresponding beneficial effects, which will not be repeated here. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described devices and modules can refer to the corresponding process description in the above method embodiment, which will not be repeated here.

[0126] An embodiment of the present application also provides a computer program product, including computer instructions, which instruct a computing device to execute operations corresponding to any data encryption and decryption method in the above-mentioned multiple method embodiments.

[0127] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.

[0128] The above-mentioned method according to the embodiment of the present application can be implemented in hardware, firmware, or implemented as software or computer code that can be stored in a recording medium (such as a CD ROM, RAM, floppy disk, hard disk or magneto-optical disk), or implemented as a computer code originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded through a network and to be stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a dedicated processor or programmable or dedicated hardware (such as an ASIC or FPGA). It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code, and when the software or computer code is accessed and executed by a computer, a processor or hardware, the data encryption and decryption method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the data encryption and decryption method shown here, the execution of the code converts the general-purpose computer into a dedicated computer for executing the data encryption and decryption method shown here.

[0129] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.

[0130] The above implementation methods are only used to illustrate the embodiments of the present application, and are not limitations on the embodiments of the present application. Ordinary technicians in the relevant technical field can make various changes and modifications without departing from the spirit and scope of the embodiments of the present application. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present application. The scope of patent protection of the embodiments of the present application should be limited by the claims.

Claims

1. A data encryption method, comprising: Obtaining information to be encrypted and a key used to encrypt the information to be encrypted; Converting the information to be encrypted into an information image, and converting the key into a binary key image matching the information image according to the bit positions corresponding to the size of the information image; Performing image fusion processing on the information image and the binary key image according to pixel positions; According to the result of image fusion processing, an encrypted information image is obtained; The step of converting the information to be encrypted into an information image comprises: Obtain each character in the information to be encrypted, and convert each character into a corresponding character information image; Generating a graphical base for the information to be encrypted according to the size of the character information image corresponding to each character; According to the order of characters in the information to be encrypted, the character information image corresponding to each character is placed in the graphic base plate to generate the information image corresponding to the information to be encrypted.

2. The method according to claim 1, wherein: The step of converting the key into a binary key image matching the information image according to the size of the information image comprises: Get the binary sequence corresponding to the key; The binary sequence is intercepted according to the size of the information image to obtain a binary matrix matching the size of the information image; The binarized matrix is ​​converted into a binarized key image.

3. The method according to claim 1, wherein: The step of converting each character into a corresponding character information image comprises: Querying and obtaining a plurality of character information images corresponding to each character from a database pre-stored with character information images; For each character, a character information image is selected from the corresponding multiple character information images according to a preset rule as the character information image matching the character.

4. The method according to claim 1, wherein: The step of converting each character into a corresponding character information image comprises: The character information image corresponding to each character is binarized and uniformly sized to obtain a binarized character information image with a uniform size corresponding to each character.

5. The method according to claim 1, wherein: The image fusion processing of the information image and the binary key image according to the pixel position includes: performing pixel value XOR processing of the information image and the binary key image according to the pixel position; The step of obtaining an encrypted information image according to the result of image fusion processing includes: obtaining an encrypted information image according to the result of XOR processing.

6. A data decryption method, comprising: Acquire an encrypted information image carrying encrypted information, and a binary key image generated based on a key according to bits corresponding to the size of the information image after the encrypted information is converted, wherein the key is the same as the encryption key used by the encrypted information in the encrypted information image, and the information image after the encrypted information is converted is generated by acquiring each character in the encrypted information, converting each character into a corresponding character information image, generating a graphic base according to the size of the character information image corresponding to each character, and placing the character information image corresponding to each character in the graphic base according to the order of the characters in the encrypted information; fusing and superimposing the encrypted information image and the binary key image; The decrypted information image corresponding to the encrypted information image is obtained according to the result of fusion and superposition, wherein the decrypted information image contains the plain text of the encrypted information.

7. The method according to claim 6, wherein: The fusing and superimposing the encrypted information image and the binary key image comprises: According to pixel positions, performing pixel value XOR processing on the encrypted information image and the binary key image; or, According to the preset pixel block size and pixel position, the encrypted information image and the binarized key image are pixel-block superimposed.

8. The method according to claim 6 or 7, wherein: The method further comprises: Performing an offset operation on the encrypted information image according to a preset offset position; The encrypted information image after the shift operation is fused and superimposed with the binary key image to obtain an alternative decryption information image corresponding to the shift position, wherein the alternative decryption information image contains plaintext information corresponding to the encrypted information.

9. The method according to claim 6 or 7, wherein: The step of obtaining an encrypted information image carrying encrypted information and a binary key image generated based on a key includes: Acquire an encrypted information image carrying encrypted information; Acquire a binary sequence corresponding to the key, and intercept the binary sequence according to the size of the encrypted information image to obtain a binary matrix matching the size of the encrypted information image; The binarized matrix is ​​converted into a binarized key image.

10. The method according to claim 6 or 7, wherein: The step of obtaining the encrypted information image carrying the encrypted information includes: Performing image acquisition on the entity carrying the encrypted information image to obtain an acquired image containing the encrypted information image; A positioning mark is determined from the collected image, and the encrypted information image is obtained according to the positioning mark.

11. The method according to claim 10, wherein: The step of obtaining the encrypted information image according to the positioning mark comprises: According to the positioning mark, obtaining the information image area; Performing affine transformation on the information image area; The information image region after affine transformation is binarized to obtain the encrypted information image.

12. A computer storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the program implements the data encryption method as described in any one of claims 1 to 5, or implements the data decryption method as described in any one of claims 6 to 11.

Citation Information

Patent Citations

  • Binary two-dimensional code image encryption and decryption method and device

    CN106651734A