A method and system for encrypting and decrypting QR codes

By dividing the QR code into multiple areas and encrypting them, the problems of QR code information leakage and tampering are solved, achieving higher security and transmission reliability.

CN116258162BActive Publication Date: 2026-11-10SWIFTPLUS TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211497760.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-25
Publication Date
2026-11-10
Estimated Expiration
2042-11-25

AI Technical Summary

Technical Problem

Existing QR codes have several drawbacks: they expose information that could lead to privacy leaks, make it difficult to accurately determine the source of the information, are easily tampered with, and lack protection during transmission, resulting in insufficient security.

Method used

The original QR code is divided into multiple regions, expanded into sub-QR code images, and the valid region information is identified and encrypted. The encrypted QR code image is then formed using encryption algorithms and splicing techniques.

Benefits of technology

It improves the security of QR codes, prevents the leakage and tampering of privacy information, and ensures the security of information transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116258162B_ABST
    Figure CN116258162B_ABST
Patent Text Reader

Abstract

This invention discloses a method for encrypting and decrypting QR codes, comprising: S1: acquiring an original QR code image; S2: dividing the original QR code image into several QR code regions; S3: expanding each of the several QR code regions into several sub-QR code images, forming a QR code set; S4: recognizing each sub-QR code in the QR code set to obtain the valid area information corresponding to the sub-QR code; S5: stitching the valid areas together to obtain an encrypted QR code image; S6: scanning the encrypted QR code image using a scanning device to obtain the information within the encrypted QR code image. This application improves the security of QR code usage and prevents malicious tampering of QR code information by splitting and stitching the original QR code and performing multiple encryption steps.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information security technology, and in particular to a QR code encryption and decryption system. Background Technology

[0002] With the widespread use of smartphones, various QR code applications have emerged. QR codes, also known as two-dimensional barcodes, are widely used due to their low technical barrier and high practicality. However, the current use of QR codes still faces the following problems:

[0003] 1) Most of the information in existing QR codes is open, which will lead to the leakage of users' privacy information and may even be maliciously tampered with;

[0004] 2) Currently, when users use QR codes for payment, they often cannot accurately determine the source of the QR code from its appearance. They can only determine it from the logo on the outside of the QR code. However, this method still carries the risk of the QR code being maliciously tampered with.

[0005] 3) Most of the QR codes currently available on the market are transmitted without protection, and the content of the QR codes can be easily identified.

[0006] Therefore, finding an encryption method that can provide new QR code encryption, improve security, and reduce the risk of QR code information being stolen and tampered with is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0007] The purpose of this invention is to provide a method for encrypting and decrypting QR codes, which can...

[0008] To achieve the above objectives, the present invention provides a QR code encryption and decryption method, comprising:

[0009] S1: Obtain the original QR code image;

[0010] S2: Divide the original QR code image into several QR code regions;

[0011] S3: Expand the plurality of QR code regions into a plurality of sub-QR code images, and the plurality of sub-QR code images form a QR code set;

[0012] S4: Identify the sub-QR codes in the QR code set respectively to obtain the valid area information corresponding to the sub-QR code;

[0013] S5: The effective areas are stitched together to obtain an encrypted QR code image;

[0014] S6: Scan the encrypted QR code image using a scanning device to obtain the information within the encrypted QR code image.

[0015] In one embodiment of the present invention, the identification in step S4 specifically includes:

[0016] S41: Obtain the first QR code in the QR code set, and decrypt and recognize the first QR code to obtain the version information, format information and main data area of ​​the first QR code data;

[0017] S42: By recognizing the format information, the vertex coordinates of the effective area of ​​the first QR code are obtained;

[0018] S43: Delete the first QR code from the QR code set, and repeat the above steps S41 to S43 to obtain the vertex coordinates of the effective area of ​​all QR code images in the QR code set.

[0019] In one embodiment of the present invention, the splicing process in step S5 includes:

[0020] S51: Convert the vertex coordinates of the effective region to hexadecimal coordinates;

[0021] S52: Encrypt and / or process the hexadecimal coordinates into ASCII;

[0022] S53: Piece together the valid regions in the QR code set according to the vertex coordinates of the valid regions.

[0023] In one embodiment of the present invention, step S42 further includes:

[0024] The QR code image of the effective area is captured and encrypted using an encryption algorithm to obtain an encrypted string;

[0025] The encrypted string and the vertex coordinates of the valid region are assembled into an encrypted packet.

[0026] In one embodiment of the present invention, the encryption algorithm includes asymmetric encryption and / or symmetric encryption.

[0027] This application also provides a QR code encryption and decryption system, employing any of the encryption and decryption methods described above, including:

[0028] A management platform is used to receive the scanned original QR code image and divide the original QR code image into several QR code regions.

[0029] A Java platform for QR codes is used to expand the QR code into sub-QR codes by region, and to identify and stitch the sub-QR codes to obtain an encrypted QR code image.

[0030] An enterprise service bus is used to connect and integrate the management platform and the QR code Java platform and map them into services.

[0031] In one embodiment of the present invention, the QR code Java platform further includes:

[0032] A QR code generation service is used to expand the QR code area into a sub-QR code;

[0033] The QR code parsing service is used to identify and decompose the valid areas of the sub-QR codes, and then stitch the valid areas together to form an encrypted QR code image.

[0034] In one embodiment of the present invention, the QR code parsing service further includes:

[0035] The recognition module is used to recognize the version information and format information of the sub-QR code image;

[0036] The information security module is used to verify whether the sub-QR code is abnormal based on the version information;

[0037] The splicing module is used to splice the valid areas according to the vertex coordinates of the valid areas contained in the format information to form the encrypted QR code information.

[0038] This application also provides a computer device, including a memory and a processor; the memory stores a computer program that can be executed by the processor; when the processor runs the computer program, it performs the steps of the encryption and decryption method for the QR code described in any of the above claims.

[0039] This application also provides a computer-readable storage medium, characterized in that it includes program code, which, when run on an electronic device, causes the electronic device to perform the steps of the encryption and decryption methods for QR codes described in any of the preceding claims.

[0040] Compared with the prior art, this application has the following beneficial effects:

[0041] 1. This application obtains the original QR code through a management platform, divides the original QR code into several QR code areas, and uses a QR code generation service and encryption algorithm to expand each QR code area into a sub-QR code, thereby encrypting the information in the original QR code and preventing the leakage of personal privacy information in the original QR code.

[0042] 2. This application uses an identification module to identify the sub-QR code, obtain the version information and format information of the sub-QR code, and uses an information security module to verify whether the sub-QR code is abnormal. If the sub-QR code is not abnormal, the vertex coordinates of the valid area in the format information are identified, and the valid area is spliced ​​according to the vertex coordinates of the valid area by the splicing module to obtain an encrypted QR code image, thereby improving the security of QR code use, preventing the QR code information from being maliciously tampered with, and ensuring the secure transmission of QR codes. Attached Figure Description

[0043] Figure 1 This is a structural diagram of a standard QR code according to an embodiment of the present invention;

[0044] Figure 2 This is a flowchart of a QR code encryption and decryption method according to an embodiment of the present invention;

[0045] Figure 3 This is a schematic diagram of QR code splicing according to an embodiment of the present invention;

[0046] Figure 4 This is a flowchart of the splicing process according to an embodiment of the present invention;

[0047] Figure 5 This is a schematic diagram of a QR code encryption and decryption system according to an embodiment of the present invention. Detailed Implementation

[0048] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings, but it should be understood that the scope of protection of the present invention is not limited to the specific embodiments.

[0049] Unless otherwise expressly stated, throughout the specification and claims, the term "comprising" or its variations such as "including" or "comprises" shall be understood to include the stated elements or components without excluding other elements or other components.

[0050] In this application, "at least one (item)" means one or more, "more than one" means two or more, "at least two (items)" means two or three or more, and "and / or" is used to describe the relationship between related objects, indicating that there can be three relationships. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the related objects before and after are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items. For example, at least one (item) of a, b, or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c".

[0051] like Figure 1 As will be understood by those skilled in the art, a standard QR code consists of two parts: a functional graphic 10 and an encoding format 20. The functional graphic 10 is related to QR code recognition, while the encoding format 20 is related to the information contained in the QR code. The functional graphic 10 mainly includes five parts: a blank area 11, a position detection graphic 12, a separator 13, a positioning graphic 14, and a correction graphic 15. The encoding format 20 includes three parts: format information 21, version information 22, and data and error correction codewords 23. The QR code's functional graphic, format information, and version information are all diagonally symmetrical, and both the format information and version information surround the detection marker.

[0052] like Figure 2 As shown in the embodiment of this application, a QR code encryption and decryption method is provided, including:

[0053] S1: Obtain the original QR code image.

[0054] In one embodiment of this invention, before obtaining the original QR code image, the method further includes: encrypting the text information to be encrypted using an encryption algorithm to obtain ciphertext corresponding to the text information to be encrypted; and encoding the ciphertext using QR code encoding to generate the original QR code image. That is, encrypting the text to be encrypted, such as R3Kjuk6ogQVbZ6DcwIDAQAB444444444444, and obtaining the corresponding ciphertext, such as...

[0055] Sa4+JbV33Dos4uX3wDaN6fR2xF9sQY3bya1QMyc4Z9t9zMomnUty / MpWgw6mV1WiiuRam0CeqoRnQ3FqsBY+U3gbnALtcWr2LzP9DTp0aSBnMWNJ7TSWy Op6Vx / doqb+TwsvG / 76r3Qjs81+Qdmcvh / TtoFy4w6oa / 2em90r+Ac=, and encode the ciphertext using a QR code to generate an original QR code image. The information in the original QR code image can be obtained by scanning the original QR code image with a scanning device.

[0056] In one embodiment of this invention, before obtaining the original QR code image, the method further includes: encoding the text information to be encrypted using QR code encoding to generate a second QR code; encrypting the second QR code using an encryption algorithm to generate the original QR code. That is, the text to be encrypted is first encoded using QR code encoding to generate a second QR code, and then the second QR code is encrypted using an encryption algorithm to obtain the original QR code. In this embodiment, the original QR code is encrypted using an encryption algorithm before generation, avoiding the exposure of information within the original QR code, reducing the risk of QR code leakage and tampering, and improving the security of the original QR code.

[0057] In one embodiment of this invention, before obtaining the original QR code image, the method further includes: encrypting the text information to be encrypted using an encryption algorithm to obtain ciphertext corresponding to the text information to be encrypted; encoding the ciphertext using QR code to generate a third QR code; and encrypting the third QR code using an encryption algorithm to generate the original QR code. That is, the text information to be encrypted is first encrypted using an encryption algorithm to obtain the corresponding ciphertext, the ciphertext is encoded using QR code to generate a third QR code, and the third QR code is then encrypted again using an encryption algorithm to obtain the original QR code image, thereby improving the security of the original QR code.

[0058] S2: Divide the original QR code image into several QR code regions.

[0059] In this embodiment, the original QR code is segmented, for example, starting from one edge of the original QR code image and segmented by dividing lines according to the matrix module; the shape of the QR code area can be a regular quadrilateral or an irregular shape. This application does not impose specific restrictions on the shape of the QR code area. Preferably, the QR code area is a regular quadrilateral.

[0060] Image segmentation methods can include GrabCut, MRF-MAP, CRF, and FC-CRF, etc. This embodiment employs the Random Walk algorithm. The Random Walk algorithm is a graph-based segmentation algorithm, belonging to interactive image segmentation. It can be understood that the Random Walk algorithm uses image pixels as vertices, and the four- or eight-neighbor relationships between adjacent pixels as edges. Weights are defined for each edge based on pixel attributes and the similarity of features between adjacent pixels, thus constructing a network graph. Then, foreground and background labels (seed pixels for foreground and background objects) are manually specified by the user. The transition probabilities are based on the edge weights, with unlabeled pixel nodes as initial points. The probability of each unlabeled node reaching various sub-pixels for the first time is calculated. Based on the probability magnitude, unlabeled nodes are divided, yielding the final segmentation result. In this embodiment, the original QR code can be segmented using a unified Random Walk algorithm, and the vertex coordinates of the valid QR code region are obtained based on the segmentation results.

[0061] S3: Expand the plurality of QR code regions into a plurality of sub-QR code images, and the plurality of sub-QR code images form a QR code set. Optionally, fill the area around the QR code region with blank space to obtain the sub-QR code corresponding to the QR code region.

[0062] S4: Identify the sub-QR codes in the QR code set respectively to obtain the effective area information corresponding to the sub-QR codes, that is, scan and identify the sub-QR codes in the QR code set respectively to obtain the vertex coordinates of the effective area of ​​multiple sub-QR codes.

[0063] S5: The effective areas are stitched together to obtain an encrypted QR code image.

[0064] like Figure 3 As shown in this embodiment, the valid areas of multiple sub-QR codes are stitched together. During stitching, if the multiple valid areas do not have overlapping logic and can be stitched together perfectly, an encrypted QR code image is obtained. If the multiple valid areas have overlapping logic, the valid areas are stitched together according to a covering algorithm. If gaps exist between adjacent valid areas or at the edges of the encrypted QR code image after stitching, a covering algorithm is used to cover the gaps, improving the security of the encrypted QR code. Optionally, the covering logic can be an XOR algorithm or a transformation of the valid area graphic, such as enlargement, deformation, or unidirectional stretching.

[0065] S6: Scan the encrypted QR code image using a scanning device to obtain the information within the encrypted QR code image.

[0066] In this embodiment, the original QR code is divided into multiple QR code regions, and each region is expanded into a sub-QR code image. These sub-QR code images form a QR code set. By separately splitting all the sub-QR codes within the set, the valid regions of each sub-QR code are obtained. All valid regions are then stitched together to form an encrypted QR code image. When a scanning device scans the encrypted QR code, the information contained within the encrypted QR code image can be obtained through decryption using an encryption algorithm. By segmenting, recombining, splitting, and stitching the original QR code, the original QR code image is encrypted multiple times, effectively preventing the leakage of user privacy information within the QR code and preventing malicious tampering that could cause losses.

[0067] Understandably, the scanning device in this application refers to a terminal device capable of performing QR code scanning, including but not limited to mobile phones, tablets, POS machines, etc., and no specific limitation is made on the scanning device here.

[0068] As will be understood by those skilled in the art, the encryption algorithms used in this application include RSA asymmetric encryption algorithm and / or symmetric encryption algorithms such as SHA, 3DES, and AES. This application does not impose specific restrictions on the encryption algorithms used.

[0069] As a further embodiment of this application, the identification in step S4 includes:

[0070] S41: Obtain the first QR code in the QR code set, and decrypt and recognize the first QR code to obtain the version information, format information and main data area of ​​the first QR code data;

[0071] S42: By recognizing the format information, the vertex coordinates of the effective area of ​​the first QR code are obtained;

[0072] S43: Delete the first QR code from the QR code set, and repeat the above steps S41 to S44 to obtain the vertex coordinates of the effective area of ​​all QR code images in the QR code set.

[0073] In this embodiment, a corresponding QR code processing strategy is adopted according to different versions of sub-QR codes in the QR code set. It is determined whether the serial number of the sub-QR code is abnormal. If an abnormality is found, it indicates that the sub-QR code is abnormal, and the sub-QR code is decrypted and recognized again. If no abnormality is found, the format information of the sub-QR code is identified to obtain the vertex coordinates of the effective area of ​​the sub-QR code. All sub-QR codes in the QR code set are decrypted and recognized in sequence until the vertex coordinates of the effective area of ​​all sub-QR codes are obtained. The vertex coordinates of the effective area of ​​the sub-QR codes are transmitted to the backend system for splicing the effective area according to the vertex coordinates of the effective area, thereby improving the security of the original QR code image and preventing the information in the original QR code image from being stolen or even tampered with.

[0074] Furthermore, prior to step S43, the following is also included:

[0075] Based on the version information, determine if the serial number of the first QR code is abnormal. If an abnormality is found, it indicates that the sub-QR code is abnormal. If no abnormality is found, identify the format information of the sub-QR code to obtain the vertex coordinates of the valid area of ​​the sub-QR code. Optionally, if the sub-QR code is abnormal, it can be re-identified. If the abnormality still occurs after re-identification, delete all sub-QR codes in the QR code set and re-segment the original QR code to improve the security of QR code use and avoid errors in the information in the QR code during splicing.

[0076] Understandably, the version information stores the version information of the QR code. For example, the version information Version = {cardnum:1.0&512-1024&ExpiredDate&CodeSetSequence&CodeSequence&…} indicates that the number of QR codes in version 1.0 is between 512 and 1024. ExpiredData indicates the validity period of the QR code set, CodeSetSequence indicates the sequence number of the QR code set, and CodeSequence is the sequence number of the QR code. These two elements are mutual verification points. If the sequence number of the sub-QR code is incorrect or the inclusion relationship is abnormal, it indicates that the sub-QR code is abnormal.

[0077] In this embodiment of the application, the planar coordinates of the effective area of ​​the sub-QR code are {(1A, 2B, 36F, 7D), (2A, 3B, 33B, 7E), (6F, 3B, 7F, 36C), (6F, 2B, 1A, 36D)}, which represent the coordinates of the four vertices of the effective area. Each coordinate consists of four elements: the first two elements represent the position of the vertex in the sub-QR code image, and the last two elements represent the coordinates of the vertex in the encrypted QR code image.

[0078] Furthermore, step S42 also includes:

[0079] The QR code image of the effective area is captured and encrypted using an encryption algorithm to obtain an encrypted string;

[0080] The encrypted string and the vertex coordinates of the valid region are assembled into an encrypted packet.

[0081] In this embodiment, the captured QR code image is encrypted to obtain an encrypted string, such as: ey1Zhv4D7rp3ERAKyKP1SWpDMB+aM / Tq0tF6mLxGisRbyGUPqNUjuSuIBFOqetr62Dotl2dubSrbH8bXnydyxiPJ / KPI5LetUCQkQa3kkeWY3QrGVwmeNJ3eR9iL1S7xTpMQHcGoRHwtajJfm5pU4TTzO0LqUywrokCnklWPy64=. The encrypted string and the vertex coordinates of the valid region are assembled into a message in JSON format and transmitted. If the point coordinates are (1A, 2B, 36F, 7D), then the JSON message is: {“imageEncryption”:“ey1Zhv4D7rp3ERAKyKP1SWpDMB+aM / Tq0tF6mLxGisRbyGUPqNUjuSuIBFOqetr62Dotl2dubSrbH8bXnydyxiPJ / KPI5LetUCQkQa3kkeWY3QrGVwmeNJ3eR9iL1S7xTpMQHcGoRHwtajJfm5pU4TTzO0LqUywrokCnklWPy64=”,zone”:“1A,2B,36F,7D”}.

[0082] like Figure 4 As shown, in a further embodiment of this application, the splicing process in step S5 includes:

[0083] S51: Convert the vertex coordinates of the effective region to hexadecimal coordinates;

[0084] S52: Encrypt and / or process the hexadecimal coordinates into ASCII;

[0085] S53: Piece together the valid regions in the QR code set according to the vertex coordinates of the valid regions.

[0086] In this embodiment, the vertex coordinates of the valid region are converted to hexadecimal and then encrypted and processed using ASCII codes. The valid regions of all sub-QR codes in the QR code set are then concatenated according to their vertex coordinates. Optionally, the concatenation position of the valid regions is defined by the center position and rotation angle of the valid region graphic. If overlapping regions occur during concatenation, these overlapping regions can be processed using an XOR algorithm and / or by overwriting logic and thresholding methods.

[0087] In one embodiment of this application, a sub-QR code may have multiple valid areas, or a QR code may have multiple areas, with the intersection of these areas being the valid area. This application does not specifically limit the valid area, and the valid area can be changed as needed.

[0088] like Figure 5 As shown, this application also provides a QR code encryption and decryption system, employing any of the encryption and decryption methods described above, including:

[0089] A management platform is used to receive the scanned original QR code image and divide the original QR code image into several QR code regions.

[0090] A Java platform for QR codes is used to expand the QR code into sub-QR codes by region, and to identify and stitch the sub-QR codes to obtain an encrypted QR code image.

[0091] An enterprise service bus is used to connect and integrate the management platform and the QR code Java platform and map them into services.

[0092] In this embodiment, the scanning device scans the original QR code image and transmits the scanned original QR code image to the management platform. The management platform divides the original QR code image into multiple QR code regions and transports these regions to the QR code Java platform via the enterprise service bus. The QR code Java platform expands, recognizes, and stitches the QR code regions to generate an encrypted QR code image. By splitting and stitching the original QR code image multiple times, the security of the QR code is improved, preventing the encrypted QR code image from leaking private information or even being tampered with.

[0093] As a further embodiment of this application, the QR code Java platform also includes a QR code generation service and a QR code parsing service. The QR code generation service is used to expand the QR code area into a sub-QR code, and the QR code parsing service is used to identify and decompose the valid area of ​​the sub-QR code, and stitch the valid area together to form an encrypted QR code image.

[0094] Furthermore, the QR code parsing service also includes an identification module, an information security module, and a stitching module. The identification module is used to identify the version information and format information of the sub-QR code image. The information security module is used to verify whether the sub-QR code is abnormal based on the version information. The stitching module is used to stitch the valid areas according to the vertex coordinates of the valid areas contained in the format information to form the encrypted QR code information.

[0095] In this embodiment, the original QR code is obtained through a management platform and divided into several QR code regions. These regions are then transmitted to a QR code Java platform via an enterprise service bus. The QR code sound field service within the QR code Java platform is used to expand each QR code region into a sub-QR code. The sub-QR codes are then identified through a QR code parsing service to obtain the corresponding valid regions. These valid regions are then stitched together to form an encrypted QR code image. By splitting, stitching, and encrypting the original QR code, the security of QR code usage is improved, thereby preventing the leakage of personal privacy information within the QR code and its tampering, and enhancing the transmission security of the QR code.

[0096] This application also provides a computer device, including a memory and a processor; the memory stores a computer program that can be executed by the processor; when the processor runs the computer program, it performs the steps of the encryption and decryption method for the QR code described in any of the above claims.

[0097] This application also provides a computer-readable storage medium, characterized in that it includes program code, which, when run on an electronic device, causes the electronic device to perform the steps of the encryption and decryption methods for QR codes described in any of the preceding claims.

[0098] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0099] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0100] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0101] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0102] The foregoing description of specific exemplary embodiments of the invention is for illustrative and explanatory purposes. These descriptions are not intended to limit the invention to the precise forms disclosed, and it will be apparent that many changes and variations can be made in accordance with the foregoing teachings. The exemplary embodiments were chosen and described in order to explain the specific principles of the invention and its practical application, thereby enabling those skilled in the art to implement and utilize various different exemplary embodiments of the invention, as well as various different choices and variations. The scope of the invention is intended to be defined by the claims and their equivalents.

Claims

1. A method for encrypting and decrypting QR codes, characterized in that, Includes the following steps: S1: Obtain the original QR code image; S2: Divide the original QR code image into several QR code regions; S3: Expand the plurality of QR code regions into a plurality of sub-QR code images, and the plurality of sub-QR code images form a QR code set; S4: Identify the sub-QR codes in the QR code set to obtain the valid area information corresponding to the sub-QR codes; the identification in step S4 specifically includes: S41: Obtain the first QR code in the QR code set, and decrypt and identify the first QR code to obtain the version information, format information, and main data area of ​​the first QR code data; S42: Obtain the valid area vertex coordinates of the first QR code by identifying the format information; S43: Delete the first QR code from the QR code set, and repeat the above steps S41~S42 to obtain the valid area vertex coordinates of all QR code images in the QR code set; wherein, each valid area vertex coordinate consists of four elements, the first two elements represent the position of the vertex in the sub-QR code image, and the last two elements represent the coordinates of the vertex in the encrypted QR code image; S5: The effective regions are stitched together to obtain an encrypted QR code image; wherein, if multiple effective regions do not have overlapping logic and can be stitched together exactly, the encrypted QR code image is obtained; if multiple effective regions have overlapping logic, the effective regions are stitched together according to the overlapping algorithm, wherein the overlapping logic is an XOR algorithm, or the effective region graphic is enlarged, deformed, or unidirectionally stretched; if after multiple effective regions are stitched together, there are gaps between two adjacent effective regions or gaps appear at the edge of the encrypted QR code image, then the overlapping algorithm is used to cover the gaps; S6: Scan the encrypted QR code image using a scanning device, and decrypt it using an encryption algorithm to obtain the information within the encrypted QR code image.

2. The encryption and decryption method for QR codes as described in claim 1, characterized in that, Step S5, the splicing process, includes: S51: Convert the vertex coordinates of the effective region to hexadecimal coordinates; S52: Encrypt and / or process the hexadecimal coordinates into ASCII; S53: Piece together the valid regions in the QR code set according to the vertex coordinates of the valid regions.

3. The encryption and decryption method for QR codes as described in claim 1, characterized in that, Also includes: The QR code image of the effective area is captured and encrypted using an encryption algorithm to obtain an encrypted string; The encrypted string and the vertex coordinates of the valid region are assembled into an encrypted packet.

4. The encryption and decryption method for QR codes as described in claim 1, characterized in that, The encryption algorithm includes asymmetric encryption and / or symmetric encryption.

5. A QR code encryption and decryption system, employing the encryption and decryption method according to any one of claims 1-4, characterized in that, include: A management platform is used to receive the scanned original QR code image and divide the original QR code image into several QR code regions. A Java platform for QR codes is used to expand the QR code into sub-QR codes by region, and to identify and stitch the sub-QR codes to obtain an encrypted QR code image. An enterprise service bus is used to connect and integrate the management platform and the QR code Java platform and map them into services.

6. The QR code encryption and decryption system as described in claim 5, characterized in that, The QR code Java platform also includes: A QR code generation service is used to expand the QR code area into a sub-QR code; The QR code parsing service is used to identify and decompose the valid areas of the sub-QR codes, and then stitch the valid areas together to form an encrypted QR code image.

7. The QR code encryption and decryption system as described in claim 6, characterized in that, The QR code parsing service also includes: The recognition module is used to recognize the version information and format information of the sub-QR code image; The information security module is used to verify whether the sub-QR code is abnormal based on the version information; The splicing module is used to splice the valid areas according to the vertex coordinates of the valid areas contained in the format information to form the encrypted QR code information.

8. A computer device, comprising a memory and a processor; the memory storing a computer program executable by the processor; the processor, when executing the computer program, performing the steps of the encryption and decryption method for a QR code as described in any one of claims 1-4.

9. A computer-readable storage medium, characterized in that, It includes program code that, when run on an electronic device, causes the electronic device to perform the steps of the encryption and decryption method for the QR code as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Two-dimensional code cutting and splicing authentication method and system

    CN103679106A

  • Two-dimensional code recognition method and device, electronic equipment and storage medium

    CN113496132A