Two-Dimensional Code Mask Encryption for Secure Authentication
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing two-dimensional code encryption technologies are vulnerable to security attacks, as attackers can regenerate or modify user ID and password data within intercepted two-dimensional code images, and lack protection for encryption mode databases.
Innovation Solution
A method and system for encrypting and decrypting two-dimensional code masks, where a two-dimensional code generating device generates a target code containing a function pattern, an initial mask pattern, and a key, encrypts the mask pattern using the key, and embeds it into an encrypted mask pattern, with only the identification and key transmitted between devices and the server, ensuring high security and reduced server load.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Ease of operation
If user ID and password are added in designated areas of the two-dimensional code, then the code can be scanned and decoded to obtain authentication data, but the attacker can regenerate or modify the data by intercepting the target two-dimensional code image and reserving the areas where the user ID and password are located
Solution Approach 1:
The patent embeds the two-dimensional code within a mask pattern, creating a nested structure where the code is contained within the mask. This nesting prevents attackers from directly accessing or modifying the code data, as it is hidden within the mask's structural framework. The mask pattern acts as a protective container that maintains code integrity while allowing legitimate scanning operations.
Solution Approach 2:
The patent introduces a mask pattern as an intermediary layer between the two-dimensional code and the external environment. This mask pattern serves as a mediator that protects the code from direct interception and modification by attackers, while still enabling the code to be scanned and decoded through the mask's structured design. The mask pattern acts as a security barrier that maintains data integrity.
2Reliability
If the two-dimensional code is encrypted and decoded using symmetric encryption, then the code can be secured, but there is no protection measure for the encrypting mode database which can be easily attacked if leaked
Solution Approach 1:
The patent extracts the encryption key and mask pattern generation logic from the server and relocates them to the client device. By taking out these critical security elements from the centralized database, the system eliminates the vulnerability where database leakage would expose encryption keys. Each client device maintains its own key locally, ensuring that even if the server database is compromised, the encryption security remains intact.
Solution Approach 2:
The patent implements self-service encryption where each client device generates and stores its own encryption key and mask pattern independently. This self-service approach eliminates dependency on a centralized encryption mode database, allowing devices to encrypt and decrypt data autonomously without requiring server access. The system becomes resistant to database leakage attacks because security is distributed across individual devices rather than centralized.
3Ease of operation
If the two-dimensional code contains user ID and password information, then authentication can be performed, but the server cannot identify the true from the false when data is modified
Solution Approach 1:
The patent nests the two-dimensional code within a mask pattern structure, creating a hierarchical organization where the code is embedded within the mask. This nesting relationship creates a structural dependency that makes it impossible to modify the code without disrupting the mask's structural integrity. The mask pattern acts as a verification framework that confirms the authenticity of the embedded code.
Solution Approach 2:
The patent implements a feedback mechanism where the mask pattern serves as a verification reference for the embedded two-dimensional code. When a code is scanned and decoded, the system compares the extracted code against the corresponding mask pattern structure. This feedback verification process enables the server to identify authentic codes versus modified or false codes by checking structural consistency between the code and its parent mask pattern.
Data Source
AI summary
The invention provides a method and system for encrypting and decrypting two-dimensional code mask. The method comprises: generating a target two-dimensional code containing a function pattern and an identification, an initial mask pattern and a key by a two-dimensional code generating device; sending the identification, the initial mask pattern and the key to a server by the two-dimensional code generating device; sending the identification to the server by the two-dimensional code decoding device; receiving the identification by the server; sending the key and the initial mask pattern to the two-dimensional code decoding device by the server according to the identification; receiving by the two-dimensional code decoding device the key and the initial mask pattern sent by the server; and decrypting the encrypted two-dimensional code by the two-dimensional code decoding device according to the key and the initial mask pattern to acquire the target two-dimensional code. The system has high security.

