CN115001676A - Two-dimensional code encryption method, decryption method, system, terminal and storage medium - Google Patents

Two-dimensional code encryption method, decryption method, system, terminal and storage medium Download PDF

Info

Publication number
CN115001676A
CN115001676A CN202210622056.5A CN202210622056A CN115001676A CN 115001676 A CN115001676 A CN 115001676A CN 202210622056 A CN202210622056 A CN 202210622056A CN 115001676 A CN115001676 A CN 115001676A
Authority
CN
China
Prior art keywords
target
dimensional code
encrypted data
key
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210622056.5A
Other languages
Chinese (zh)
Other versions
CN115001676B (en
Inventor
林辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Axint Intelligent Co ltd
Original Assignee
Shenzhen Axint Intelligent Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Axint Intelligent Co ltd filed Critical Shenzhen Axint Intelligent Co ltd
Priority to CN202210622056.5A priority Critical patent/CN115001676B/en
Publication of CN115001676A publication Critical patent/CN115001676A/en
Application granted granted Critical
Publication of CN115001676B publication Critical patent/CN115001676B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0869Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • H04L63/0478Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload applying multiple layers of encryption, e.g. nested tunnels or encrypting the content with a first key and then with at least a second key

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Storage Device Security (AREA)

Abstract

The invention discloses a two-dimensional code encryption method, a two-dimensional code decryption system, a two-dimensional code encryption terminal and a two-dimensional code storage medium. When the target data is encrypted, the target key information is randomly generated, the target key information and the target data are respectively encrypted according to the preset key and the target key to generate first encrypted data and second encrypted data, the target two-dimensional code is generated according to the first encrypted data and the second encrypted data, when the target two-dimensional code is decrypted, the first encrypted data and the second encrypted data are obtained according to the target two-dimensional code, the target key is obtained according to the second encrypted data, then the first encrypted data is decrypted to obtain the target data, and the two-dimensional code can be effectively prevented from being copied and used and from being cracked in a multi-layer encryption mode through dynamic generation and a multi-layer encryption mode, so that the use safety of the two-dimensional code is enhanced.

Description

Two-dimensional code encryption method, decryption method, system, terminal and storage medium
Technical Field
The invention relates to the technical field of data encryption, in particular to a two-dimensional code encryption method, a two-dimensional code decryption system, a two-dimensional code encryption terminal and a two-dimensional code storage medium.
Background
The two-dimensional code is a very convenient graphic code, bears various data information, and is widely applied to the fields of identity recognition, authority control and the like.
However, the two-dimensional code is a graphic identifier and can be easily copied; once generated, the image is imaged and does not have interaction capacity with the identification terminal equipment; in addition, the encrypted two-dimensional code is difficult to support a dynamic key, and data is easy to crack. In general, a secret key is stored in two-dimensional code identification equipment for encryption of two-dimensional code information on the market, and the two-dimensional code identification equipment reads a two-dimensional code and then decodes the two-dimensional code. The method needs to replace the secret key on the two-dimensional code identification device and the two-dimensional code generation device at intervals so as to prevent the secret key from being cracked. The key updating mode is complex and is inconvenient to manage.
Thus, there is a need for improvements and enhancements in the art.
Disclosure of Invention
The invention provides a two-dimensional code encryption method, a two-dimensional code decryption system, a terminal and a storage medium, and aims to solve the problems that in the prior art, the two-dimensional code is prevented from being copied and used and a data decryption mode is complicated.
In a first aspect of the present invention, a two-dimensional code encryption method is provided, including:
acquiring target data;
randomly generating target key information, and determining a target key according to the target key information;
encrypting the target data according to the target key to generate first encrypted data;
encrypting the target key information according to a preset first key to generate second encrypted data;
and generating a target two-dimensional code according to the first encrypted data and the second encrypted data, wherein the target two-dimensional code is one or more than one.
The two-dimensional code encryption method, which determines the target key according to the target key information, includes:
taking the target key information as the target key;
or, the target key information is address information, and the address information points to the target key in the target key group.
The two-dimensional code encryption method, wherein the generating a target two-dimensional code according to the first encrypted data and the second encrypted data, comprises:
acquiring target verification information, and encoding the first encrypted data, the second encrypted data and the target verification information to obtain a target two-dimensional code;
the target verification information comprises at least one of a user password, effective time, effective times, an effective place and effective two-dimensional code reading equipment;
when the target two-dimensional code comprises a plurality of two-dimensional codes, the target two-dimensional code comprises at least one first two-dimensional code and at least one second two-dimensional code;
the first two-dimensional code comprises the target verification information, and the second two-dimensional code comprises the first encrypted data and the second encrypted data.
In a second aspect of the present invention, a two-dimensional code decryption method is provided, including:
acquiring a target two-dimensional code, wherein the target two-dimensional code is one or more;
acquiring first encrypted data and second encrypted data according to the target two-dimensional code;
decrypting the second encrypted data according to a preset first key to obtain target key information;
determining a target key according to the target key information;
and decrypting the first encrypted data according to the target key to obtain target data.
The two-dimensional code decryption method, wherein the obtaining of the first encrypted data and the second encrypted data according to the target two-dimensional code, further comprises:
obtaining target verification information according to the target two-dimensional code;
when the target verification information passes the authentication, acquiring first encrypted data and second encrypted data according to the target two-dimensional code;
the target verification information comprises at least one of a user password, effective time, effective times, an effective place and effective two-dimensional code reading equipment;
when the target two-dimensional code comprises a plurality of two-dimensional codes, the target two-dimensional code comprises at least one first two-dimensional code and at least one second two-dimensional code;
the first two-dimensional code comprises the target verification information, and the second two-dimensional code comprises the first encrypted data and the second encrypted data.
The two-dimensional code decryption method, wherein when the target verification information includes the user password, the method further includes:
acquiring input data;
judging whether the input data is matched with the user password, and if the input data is matched with the user password, the authentication is passed;
and judging whether the input data is matched with the duress password, if so, passing the authentication, and sending alarm information at the rear end.
The two-dimensional code decryption method, wherein the determining a target key according to the target key information includes:
the target key information is the target key;
or, the target key information is address information, and the address information points to the target key in the target key group.
In a third aspect of the invention, a system is provided, comprising:
the two-dimensional code reading device comprises a two-dimensional code generating end and a two-dimensional code reading end;
the two-dimensional code generating end is used for:
acquiring target data;
randomly generating target key information, and determining a target key according to the target key information;
encrypting the target data according to the target key to generate first encrypted data;
encrypting the target key information according to a preset first key to generate second encrypted data;
generating a target two-dimensional code according to the first encrypted data and the second encrypted data, wherein the target two-dimensional code is one or more than one;
the two-dimensional code reading end is used for:
acquiring a target two-dimensional code, wherein the target two-dimensional code is one or more;
acquiring first encrypted data and second encrypted data according to the target two-dimensional code;
decrypting the second encrypted data according to a preset first key to obtain target key information;
determining a target key according to the target key information;
and decrypting the first encrypted data according to the target key to obtain target data.
In a fourth aspect of the present invention, a terminal is provided, where the terminal includes: the two-dimensional code encryption method comprises a processor and a storage medium which is in communication connection with the processor, wherein the storage medium is suitable for storing a plurality of instructions, and the processor is suitable for calling the instructions in the storage medium to execute the steps of implementing the two-dimensional code encryption method according to any one of claims 1 to 3 and/or the steps of implementing the two-dimensional code decryption method according to any one of claims 4 to 7.
In a fifth aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores one or more programs, which are executable by one or more processors to implement the steps of the two-dimensional code encryption method according to any one of claims 1 to 3 and/or the steps of the two-dimensional code decryption method according to any one of claims 4 to 7.
Has the advantages that: compared with the prior art, the invention provides a two-dimensional code encryption method, a two-dimensional code decryption system, a two-dimensional code encryption terminal and a two-dimensional code storage medium. In the two-dimensional code encryption method and the two-dimensional code decryption method, when target data are encrypted, target key information is randomly generated, the target key information and the target data are respectively encrypted according to a preset key and a target key to generate first encrypted data and second encrypted data, then the target two-dimensional code is generated according to the first encrypted data and the second encrypted data, when the target two-dimensional code is decrypted, the first encrypted data and the second encrypted data are obtained according to the target two-dimensional code, then the target key is obtained according to the second encrypted data, then the first encrypted data is decrypted to obtain the target data, and the two-dimensional code can be effectively prevented from being copied and used and from being cracked in a multi-layer encryption mode through dynamic generation and the multi-layer encryption mode, and the use safety of the two-dimensional code is enhanced.
Drawings
Fig. 1 is a flowchart of an embodiment of a two-dimensional code encryption method provided in the present invention;
fig. 2 is a flowchart of an embodiment of a two-dimensional code decryption method provided in the present invention;
FIG. 3 is a diagram of a two-dimensional code generating device according to the present invention;
FIG. 4 is a diagram of a two-dimensional code reading apparatus provided by the present invention;
FIG. 5 is a diagram of data processing, analysis and control equipment provided by the present invention;
FIG. 6 is a schematic block diagram of an embodiment of a system provided by the present invention;
fig. 7 is a schematic structural diagram of an embodiment of a terminal provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and effects of the present invention clearer and clearer, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Example one
In a first aspect of the present invention, a two-dimensional code encryption method is provided, where the two-dimensional code encryption method provided in this embodiment may be executed by a two-dimensional code generation terminal, and the two-dimensional code generation terminal may be, but is not limited to, a smart phone, a smart watch, a wearable device, and the like, as shown in fig. 3, the following description takes the smart phone as an example. As shown in fig. 1, the two-dimensional code encryption method provided in this embodiment includes the steps of:
and S110, acquiring target data.
In this embodiment, the two-dimensional code generating end is a smart phone, the smart phone is provided with a program for generating the two-dimensional code according to the method, and the two-dimensional code generating end is also a two-dimensional code display device.
The target data is a file needing concealed transmission, such as a certificate number and the like.
And S120, randomly generating target key information, and determining a target key according to the target key information.
Wherein, the determining a target key according to the target key information includes:
s121, taking the target key information as the target key;
s122, or the target key information is address information, and the address information points to the target key in the target key group.
The target key information is randomly and dynamically generated.
In one implementation, a key is directly and dynamically generated as target key information, in which case the target key information is the target key.
In another implementation manner, key groups are respectively implanted in a two-dimensional code generation end and a two-dimensional code generation end, when the target data is encrypted, one piece of address information is randomly selected from the key groups, the address information is the target key information, and the address information points to the target key in the key groups.
The target key information is dynamically generated, so that the encrypted target data has higher security and is more difficult to crack.
S130, encrypting the target data according to the target key to generate first encrypted data.
And encrypting the target data based on the target key and the encryption algorithm corresponding to the target key.
In one possible implementation, different encryption algorithms may be employed depending on the security level requirements. Specifically, a group of preset encryption algorithms is arranged at the two-dimensional code generating end, the encryption algorithms comprise encryption algorithms with different difficulties, and the encryption algorithms with different difficulties are adopted according to the requirement degree on the security level input by a user. And the target data is encrypted by combining the target key with a more difficult encryption algorithm with high security level requirement, and the target data is encrypted by combining the target key with a simpler encryption algorithm with low security level requirement.
Further, encryption algorithms with different difficulties can be grouped, the encryption algorithms with the same or similar difficulties are grouped in the same group, when the target key information is generated randomly, the target algorithm difficulty can be obtained, the target encryption algorithm information can be generated randomly, the target encryption algorithm information points to the target encryption algorithm in the encryption algorithm group corresponding to the target algorithm difficulty, and the target data is encrypted according to the target key to generate first encrypted data.
The encrypting the target data according to the target key to generate first encrypted data further includes:
and encrypting the target data according to the target key by adopting the target encryption algorithm to generate the first encrypted data.
S140, encrypting the target key information according to a preset first key to generate second encrypted data.
In this embodiment, the two-dimensional code generating end is a smart phone, a secret key is preset in an encryption program of the smart phone, the secret key is a first secret key, the first secret key is synchronously updated at the two-dimensional code generating end and the two-dimensional code reading end, and after the target secret key information is obtained, the target secret key information is encrypted according to the first secret key to generate second encrypted data. The second encrypted data is for making the first encrypted data more secure and less susceptible to hacking.
Further, in a case where the target encryption algorithm is generated, encrypting the target key information according to the first secret key to generate second encrypted data includes:
and encrypting the target key information and the target encryption algorithm information according to a preset first secret key to generate second encrypted data.
S150, generating a target two-dimensional code according to the first encrypted data and the second encrypted data, wherein the target two-dimensional code is one or more than one.
Wherein the generating a target two-dimensional code according to the first encrypted data and the second encrypted data comprises:
s151, acquiring target verification information, and encoding the first encrypted data, the second encrypted data and the target verification information to obtain a target two-dimensional code;
s152, the target verification information comprises at least one of a user password, effective time, effective times, an effective place and effective two-dimensional code reading equipment;
s153, when the target two-dimensional code comprises a plurality of two-dimensional codes, the target two-dimensional code comprises at least one first two-dimensional code and at least one second two-dimensional code;
s154, the first two-dimensional code comprises the target verification information, and the second two-dimensional code comprises the first encrypted data and the second encrypted data.
In this embodiment, the generating a target two-dimensional code according to the first encrypted data and the second encrypted data further includes: and acquiring target verification information, and encoding the first encrypted data, the second encrypted data and the target verification information to obtain the target two-dimensional code.
Specifically, the target two-dimensional code is one or more, works as when the target two-dimensional code is many, the target two-dimensional code includes at least one first two-dimensional code and at least one second two-dimensional code, include in the first two-dimensional code the target verification information, first two-dimensional code can be one or more, carries more the target verification information, include in the second two-dimensional code the target data information after encrypting, the second two-dimensional code can be one or more, wherein all include in each second two-dimensional code first encrypted data with the second encrypted data.
Specifically, in an embodiment, the target two-dimensional code includes two pieces:
the first two-dimensional code is used as a first two-dimensional code and used as effective verification, and the target verification information comprises at least one of a user password, effective time, effective times, an effective place and effective two-dimensional code reading equipment. The user password is a verification password set by a user when the target two-dimensional code is generated, the user needs to input the user password at the two-dimensional code reading end after scanning the code at the two-dimensional code reading end, and if matching is successful, the two-dimensional code is adopted, the user password can be input through a keyboard of the two-dimensional code reading end, and can also be a fingerprint password or face feature template data, and can also be related ID data of the two-dimensional code generating end; the valid time refers to a single or a plurality of data associated with the use time, such as a timestamp and a valid time age, or valid start and end periods, when the target two-dimensional code is generated at the two-dimensional code generating end; the effective times are the times that the target two-dimensional code can be repeatedly used on a two-dimensional code reading end; the effective place refers to one or more two-dimensional code reading devices installed in a single place or a plurality of places; the effective two-dimension code reading device is a display device of the two-dimension code, so that a two-dimension code reading end can read information of the two-dimension code.
And the second two-dimension code is the second two-dimension code and contains the first encrypted data and the second encrypted data information as effective data information. By adopting the method of more two-dimension codes, larger and more complex data can be safely transmitted by utilizing the two-dimension codes, and meanwhile, the safe transmission and receiving of larger data can be realized when a user uses a decryption end with lower cost.
In further implementation manners, the generating a target two-dimensional code according to the first encrypted data and the second encrypted data may further include: implanting effective time on the target two-dimensional code, making the target two-dimensional code can only be used in effective time, surpassing after the effective time that the target two-dimensional code carried certainly, the target two-dimensional code is useless, does not possess the verification function.
In summary, according to the two-dimensional code encryption method provided by this embodiment, when target data is encrypted, target key information is randomly generated, the target key information and the target data are respectively encrypted according to a preset key and a target key to generate first encrypted data and second encrypted data, and then a target two-dimensional code is generated according to the first encrypted data and the second encrypted data, so that the target two-dimensional code carries multi-level key information, thereby effectively preventing the risk of copying and using the two-dimensional code and the risk of being cracked, and enhancing the use safety of the two-dimensional code.
Example two
The first aspect of the present invention provides a two-dimensional code decryption method, where the two-dimensional code decryption method provided in this embodiment may be executed by a two-dimensional code reading terminal, and the two-dimensional code reading terminal may be, but is not limited to, an intelligent access control, a two-dimensional code scanning platform, and the like, and as shown in fig. 4, the following description takes the intelligent access control as an example. As shown in fig. 2, the two-dimensional code decryption method provided in this embodiment includes the steps of:
s210, obtaining a target two-dimensional code, wherein the target two-dimensional code is one or more.
And when the user needs to check the information, the target two-dimensional code is displayed to a two-dimensional code reading end. The target two-dimensional code is multiple in one or more, and when the target two-dimensional code is multiple in number, the two-dimensional code can contain more data information.
S220, acquiring first encrypted data and second encrypted data according to the target two-dimensional code.
The acquiring of the first encrypted data and the second encrypted data according to the target two-dimensional code further includes:
s221, obtaining target verification information according to the target two-dimensional code;
s222, when the target verification information passes the authentication, acquiring first encrypted data and second encrypted data according to the target two-dimensional code;
s222, the target verification information comprises at least one of a user password, effective time, effective times, an effective place and effective two-dimensional code reading equipment;
s223, when the target two-dimensional code comprises a plurality of two-dimensional codes, the target two-dimensional code comprises at least one first two-dimensional code and at least one second two-dimensional code;
s224, the first two-dimensional code includes the target verification information, and the second two-dimensional code includes the first encrypted data and the second encrypted data.
In one implementation manner, the target two-dimensional code is one, and the target two-dimensional code includes the first encrypted data information, the second encrypted data information, and the target verification information.
In another implementation, the target two-dimensional code is multiple in number. When the target two-dimensional code is many, the target two-dimensional code includes at least one first two-dimensional code and at least one second two-dimensional code, include in the first two-dimensional code the information is verified to the target, first two-dimensional code can be one or many, carries more the information is verified to the target, include in the second two-dimensional code the target data information after encrypting, the second two-dimensional code can be one or many, wherein all include in each second two-dimensional code first encrypted data with the second encrypted data. When the two-dimension code reading end reads the target two-dimension code, the first two-dimension code is read firstly to obtain the target verification information, and then the second two-dimension code is read to obtain the encrypted data for decryption.
Specifically, in an embodiment, the target two-dimensional code includes two pieces:
the first two-dimensional code is used as a first two-dimensional code and used as effective verification, and the target verification information comprises at least one of a user password, effective time, effective times, an effective place and effective two-dimensional code reading equipment. The user password is a verification password set by a user when the target two-dimensional code is generated, the user needs to input the user password at the two-dimensional code reading end after scanning the code at the two-dimensional code reading end, and if matching is successful, the two-dimensional code is adopted, the user password can be input through a keyboard of the two-dimensional code reading end, and can also be a fingerprint password or face feature template data, and can also be related ID data of the two-dimensional code generating end; the valid time refers to a single or a plurality of data related to the use time, such as a timestamp, a valid time age, or valid start and end periods when the target two-dimensional code is generated at the two-dimensional code generation end; the effective times are the times that the target two-dimensional code can be repeatedly used on a two-dimensional code reading end; the effective place refers to one or more two-dimensional code reading devices installed in a single place or a plurality of places; the effective two-dimension code display equipment is display equipment of the two-dimension code, so that the two-dimension code reading end can read information of the two-dimension code.
And the second two-dimension code is the second two-dimension code and contains the first encrypted data and the second encrypted data information as effective data information. And when the target verification information passes the authentication, reading the second two-dimensional code, and acquiring first encrypted data and second encrypted data according to the second two-dimensional code. Decrypting the first encrypted data and the second encrypted data. By adopting the method of more two-dimension codes, larger and more complex data can be safely transmitted by utilizing the two-dimension codes, and meanwhile, a user can also realize the safe transmission and receiving of larger data when using a two-dimension code reading end with lower cost. And when the two-dimension code reading end is a lower-cost reading end, more target data are obtained by reading a plurality of first two-dimension codes.
In more implementation manners, the two-dimensional code reading end has a clock function, the target two-dimensional code can also comprise valid time, the target two-dimensional code can only be used within the valid time, when the two-dimensional code reading end reads the target two-dimensional code information, and simultaneously verifies the timeliness information of the target two-dimensional code, when the timeliness information exceeds the valid time of the target two-dimensional code, the target two-dimensional code is invalidated and does not pass the authentication.
In this embodiment, when the target verification information includes the user password:
s225, acquiring input data;
s226, judging whether the input data is matched with the target data or not, and if the input data is matched with the target data, passing the authentication;
and S227, judging whether the input data is matched with the duress password, if so, passing the authentication, and sending alarm information at the rear end.
In this embodiment, after obtaining the target verification information according to the target two-dimensional code, the two-dimensional code reading end performs validity verification on the target two-dimensional code. When the two-dimensional code reading end verifies the effectiveness of the target two-dimensional code and the target verification information comprises the user password, the two-dimensional code reading end prompts a user to input the user password at the two-dimensional code reading end so as to obtain the input data, if the input data is matched with the user password, the authentication is passed, and if the input data is not matched with the user password, the authentication is not passed. In order to ensure the safety of the user password, the user password is discarded after the two-dimensional code reading end completes the comparison, and the user password is ensured not to leave traces in the use of the two-dimensional code reading end.
Specifically, in this embodiment, the two-dimensional code reading end is further provided with a duress password, and when the input data acquired by the two-dimensional code reading end is consistent with the duress password, the input data is still determined as passing the authentication, but at the same time, the two-dimensional code reading end can conceal and send out alarm information at the rear end.
The two-dimensional code decryption method further comprises the following steps:
s230, decrypting the second encrypted data according to a preset first key to obtain target key information.
In this embodiment, the two-dimensional code reading end is an intelligent access control, a secret key is preset in a decryption program of the intelligent access control, the secret key is a first secret key, the first secret key is synchronously updated at the two-dimensional code generating end and the two-dimensional code reading end, when the second encrypted data is obtained, the second encrypted data is decrypted according to the first secret key, and the target secret key information is obtained and is key information for obtaining the target secret key.
Further, the second encrypted data further includes target encryption algorithm information, and the target encryption algorithm information points to a target decryption algorithm in a preset decryption algorithm group.
And decrypting the second encrypted data according to a preset first key to obtain the target key information and the target encryption algorithm information.
And S240, determining a target key according to the target key information.
Wherein the determining a target key according to the target key information comprises:
s241, the target key information is the target key;
s242, or the target key information is address information, and the address information points to the target key in the target key group.
In one implementation manner, the target key information is the target key, and when the target key information is the target key, the intelligent access control does not need to set a key group in advance, and decryption is performed directly according to the target key obtained in the target two-dimensional code.
In another implementation, the target key information is address information, and in this implementation, a group of key groups needs to be preset in the smart door access, where the key groups include multiple groups of key information, and the address information points to the target key in the key groups.
And a key group is preset in the two-dimensional code reading end, so that the target two-dimensional code does not need to carry a target key, and only needs to carry address information pointing to the target key, thereby improving the security of the two-dimensional code and making the target two-dimensional code more difficult to crack.
S250, decrypting the first encrypted data according to the target key to obtain target data.
After the target key is obtained, decrypting first encrypted data carried in the target two-dimensional code according to the target key to obtain target data, wherein the target data is a password set by a user at the two-dimensional code generating end, the password can be a numeric or alphabetic password, and the password can be input through a keyboard of a two-dimensional code reading end, or can be a fingerprint password or face feature template data, or can be related ID data of the two-dimensional code generating end, and the like.
And decrypting the first encrypted data according to the target key, wherein decrypting the first encrypted data according to the target key and a decryption algorithm corresponding to the first encrypted data comprises decrypting the first encrypted data according to the target key and a decryption algorithm corresponding to the first encrypted data.
In one possible implementation, the decryption algorithms are classified into different levels.
Specifically, a preset decryption algorithm with difficulty is provided in the two-dimensional code reading end, and the corresponding decryption algorithm is obtained according to the encryption algorithms with different difficulties selected according to the degree of demand for security level input by the user. The security level requirement is high, the difficulty of the correspondingly obtained decryption algorithm is also higher, the security level requirement is lower, and the difficulty of the correspondingly obtained decryption algorithm is also simpler.
Further, the decryption algorithms with different difficulties may be grouped, the decryption algorithms with the same or similar difficulties are grouped in the same group, when the first encrypted data is decrypted, a target algorithm difficulty and the encryption algorithm information are obtained first, the encryption algorithm information points to a target decryption algorithm in the decryption algorithm group corresponding to the target algorithm difficulty, a corresponding target decryption algorithm group is found according to the target algorithm difficulty, the target decryption algorithm is obtained in the target decryption algorithm group according to the encryption algorithm information, and the first encrypted data is decrypted according to the target decryption algorithm to obtain the target data.
The decrypting the first encrypted data according to the target decryption algorithm to obtain the target data further includes:
and decrypting the first encrypted data according to the target key by adopting the target decryption algorithm to obtain the target data.
In summary, the embodiment provides a two-dimension code decryption method, which includes obtaining a target two-dimension code, obtaining first encrypted data and second encrypted data according to the target two-dimension code, and decrypting the second encrypted data according to a preset first key to obtain target key information; and determining a target key according to the target key information, finally decrypting the first encrypted data according to the target key to obtain target data, and effectively preventing the copying and using of the two-dimensional code and the risk of being cracked by a multi-layer decryption mode, thereby enhancing the use safety of the two-dimensional code.
It should be understood that, although the steps in the flowcharts shown in the figures of the present specification are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps of the present invention are not limited to being performed in the exact order disclosed, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a portion of the steps of the present invention may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware related to a computer program, which can be stored in a non-volatile computer readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, databases, or other media used in embodiments provided herein may include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), Rambus (Rambus) direct RAM (RDRAM), direct bused dynamic RAM (DRDRAM), and bused dynamic RAM (RDRAM).
EXAMPLE III
Based on the above embodiment, the present invention further provides a system, a schematic diagram of functional modules of which is shown in fig. 6, the system including:
the two-dimensional code reading device comprises a two-dimensional code generating end and a two-dimensional code reading end;
the two-dimensional code generating end is used for:
acquiring target data;
randomly generating target key information, and determining a target key according to the target key information;
encrypting the target data according to the target key to generate first encrypted data;
encrypting the target key information according to a preset first key to generate second encrypted data;
generating a target two-dimensional code according to the first encrypted data and the second encrypted data, wherein the target two-dimensional code is one or more than one;
the two-dimensional code reading end is used for:
acquiring a target two-dimensional code, wherein the target two-dimensional code is one or more;
acquiring first encrypted data and second encrypted data according to the target two-dimensional code;
decrypting the second encrypted data according to a preset first key to obtain target key information;
determining a target key according to the target key information;
and decrypting the first encrypted data according to the target key to obtain target data.
Example four
Based on the first embodiment and the second embodiment, the invention further provides a terminal, and a schematic block diagram of the terminal can be as shown in fig. 7. The terminal includes a processor 10 and a memory 20, where the processor 10 is shown in fig. 5, the memory 20 stores a computer program, and the processor 10 executes the computer program and at least implements the following steps:
acquiring target data;
randomly generating target key information, and determining a target key according to the target key information;
encrypting the target data according to the target key to generate first encrypted data;
encrypting the target key information according to a preset first key to generate second encrypted data;
and generating a target two-dimensional code according to the first encrypted data and the second encrypted data, wherein the target two-dimensional code is one or more than one.
Wherein, the determining the target key according to the target key information includes:
taking the target key information as the target key;
or, the target key information is address information, and the address information points to the target key in the target key group.
Wherein the generating a target two-dimensional code according to the first encrypted data and the second encrypted data comprises:
acquiring target verification information, and encoding the first encrypted data, the second encrypted data and the target verification information to obtain a target two-dimensional code;
the target verification information comprises at least one of a user password, effective time, effective times, an effective place and effective two-dimensional code reading equipment;
when the target two-dimensional code comprises a plurality of two-dimensional codes, the target two-dimensional code comprises at least one first two-dimensional code and at least one second two-dimensional code;
the first two-dimensional code comprises the target verification information, and the second two-dimensional code comprises the first encrypted data and the second encrypted data.
The processor 10, when executing the computer program, may further perform the steps of:
acquiring a target two-dimensional code, wherein the target two-dimensional code is one or more;
acquiring first encrypted data and second encrypted data according to the target two-dimensional code;
decrypting the second encrypted data according to a preset first key to obtain target key information;
determining a target key according to the target key information;
and decrypting the first encrypted data according to the target key to obtain target data.
Wherein, the obtaining first encryption data and second encryption data according to the target two-dimensional code further comprises:
obtaining target verification information according to the target two-dimensional code;
when the target verification information passes the authentication, acquiring first encrypted data and second encrypted data according to the target two-dimensional code;
the target verification information comprises at least one of a user password, effective time, effective times, an effective place and effective two-dimensional code reading equipment;
when the target two-dimensional code comprises a plurality of two-dimensional codes, the target two-dimensional code comprises at least one first two-dimensional code and at least one second two-dimensional code;
the first two-dimensional code comprises the target verification information, and the second two-dimensional code comprises the first encrypted data and the second encrypted data.
Wherein, when the target verification information includes the user password, the method further includes:
acquiring input data;
judging whether the input data is matched with the user password, and if the input data is matched with the user password, the authentication is passed;
and judging whether the input data is matched with the duress password, if so, passing the authentication, and sending alarm information at the rear end.
Wherein the determining a target key according to the target key information comprises:
the target key information is the target key;
or, the target key information is address information, and the address information points to the target key in the target key group.
EXAMPLE five
The present invention also provides a computer readable storage medium, on which one or more programs are stored, where the one or more programs are executable by one or more processors to implement the steps of the two-dimensional code encryption method according to the first embodiment and/or the steps of the two-dimensional code decryption method according to the second embodiment.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A two-dimensional code encryption method is characterized by comprising the following steps:
acquiring target data;
randomly generating target key information, and determining a target key according to the target key information;
encrypting the target data according to the target key to generate first encrypted data;
encrypting the target key information according to a preset first key to generate second encrypted data;
and generating a target two-dimensional code according to the first encrypted data and the second encrypted data, wherein the target two-dimensional code is one or more than one.
2. The two-dimensional code encryption method according to claim 1, wherein the determining a target key according to the target key information includes:
taking the target key information as the target key;
or, the target key information is address information, and the address information points to the target key in the target key group.
3. The two-dimensional code encryption method according to claim 1, wherein the generating a target two-dimensional code according to the first encrypted data and the second encrypted data comprises:
acquiring target verification information, and encoding the first encrypted data, the second encrypted data and the target verification information to obtain a target two-dimensional code;
the target verification information comprises at least one of a user password, effective time, effective times, an effective place and effective two-dimensional code reading equipment;
when the target two-dimensional code comprises a plurality of two-dimensional codes, the target two-dimensional code comprises at least one first two-dimensional code and at least one second two-dimensional code;
the first two-dimensional code comprises the target verification information, and the second two-dimensional code comprises the first encrypted data and the second encrypted data.
4. A two-dimensional code decryption method is characterized by comprising the following steps:
acquiring a target two-dimensional code, wherein the target two-dimensional code is one or more;
acquiring first encrypted data and second encrypted data according to the target two-dimensional code;
decrypting the second encrypted data according to a preset first key to obtain target key information;
determining a target key according to the target key information;
and decrypting the first encrypted data according to the target key to obtain target data.
5. The two-dimensional code decryption method of claim 4, wherein the obtaining of the first encrypted data and the second encrypted data according to the target two-dimensional code further comprises:
obtaining target verification information according to the target two-dimensional code;
when the target verification information passes the authentication, acquiring first encrypted data and second encrypted data according to the target two-dimensional code;
the target verification information comprises at least one of a user password, effective time, effective times, an effective place and effective two-dimensional code reading equipment;
when the target two-dimensional code comprises a plurality of two-dimensional codes, the target two-dimensional code comprises at least one first two-dimensional code and at least one second two-dimensional code;
the first two-dimensional code comprises the target verification information, and the second two-dimensional code comprises the first encrypted data and the second encrypted data.
6. The two-dimensional code decryption method of claim 5, wherein when the target verification information includes a user password:
acquiring input data;
judging whether the input data is matched with the user password, and if the input data is matched with the user password, the authentication is passed;
and judging whether the input data is matched with the duress password, if so, passing the authentication, and sending alarm information at the rear end.
7. The two-dimensional code decryption method of claim 4, wherein the determining a target key according to the target key information comprises:
the target key information is the target key;
or, the target key information is address information, and the address information points to the target key in the target key group.
8. A system, characterized in that the system comprises:
the two-dimensional code reading device comprises a two-dimensional code generating end and a two-dimensional code reading end;
the two-dimensional code generating end is used for:
acquiring target data;
randomly generating target key information, and determining a target key according to the target key information;
encrypting the target data according to the target key to generate first encrypted data;
encrypting the target key information according to a preset first key to generate second encrypted data;
generating a target two-dimensional code according to the first encrypted data and the second encrypted data, wherein the target two-dimensional code is one or more than one;
the two-dimensional code reading end is used for:
acquiring a target two-dimensional code, wherein the target two-dimensional code is one or more;
obtaining first encrypted data and second encrypted data according to the target two-dimensional code;
decrypting the second encrypted data according to a preset first key to obtain target key information;
determining a target key according to the target key information;
and decrypting the first encrypted data according to the target key to obtain target data.
9. A terminal, characterized in that the terminal comprises:
the two-dimensional code encryption method comprises a processor and a storage medium which is in communication connection with the processor, wherein the storage medium is suitable for storing a plurality of instructions, and the processor is suitable for calling the instructions in the storage medium to execute the steps of implementing the two-dimensional code encryption method according to any one of claims 1 to 3 and/or the steps of implementing the two-dimensional code decryption method according to any one of claims 4 to 7.
10. A computer readable storage medium, characterized in that the computer readable storage medium stores one or more programs which are executable by one or more processors to implement the steps of the two-dimensional code encryption method according to any one of claims 1 to 3 and/or the steps of the two-dimensional code decryption method according to any one of claims 4 to 7.
CN202210622056.5A 2022-06-02 2022-06-02 Two-dimensional code encryption method, decryption method, system, terminal and storage medium Active CN115001676B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210622056.5A CN115001676B (en) 2022-06-02 2022-06-02 Two-dimensional code encryption method, decryption method, system, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210622056.5A CN115001676B (en) 2022-06-02 2022-06-02 Two-dimensional code encryption method, decryption method, system, terminal and storage medium

Publications (2)

Publication Number Publication Date
CN115001676A true CN115001676A (en) 2022-09-02
CN115001676B CN115001676B (en) 2022-12-02

Family

ID=83031516

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210622056.5A Active CN115001676B (en) 2022-06-02 2022-06-02 Two-dimensional code encryption method, decryption method, system, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN115001676B (en)

Citations (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103401679A (en) * 2013-07-18 2013-11-20 湖北楚天传媒网络科技有限责任公司 Method for encrypting and decoding two-dimensional codes
CN105007155A (en) * 2015-07-28 2015-10-28 福建联迪商用设备有限公司 Two-dimension code mask encrypting and decrypting method and system
CN105162599A (en) * 2015-08-12 2015-12-16 上海众人网络安全技术有限公司 Data transmission system and data transmission method
US20160351080A1 (en) * 2012-12-31 2016-12-01 Piyush Bhatnagar System, Design and Process for Secure Documents Credentials Management Using Out-of-Band Authentication
CN106529643A (en) * 2016-12-14 2017-03-22 北京龙贝世纪科技股份有限公司 Two-dimensional code encoding and decoding generation device and method
CN107395581A (en) * 2017-07-11 2017-11-24 上海众人网络安全技术有限公司 Quick Response Code generates and read method, device, system, equipment and storage medium
CN107809428A (en) * 2017-10-27 2018-03-16 咪咕互动娱乐有限公司 A kind of information ciphering method, decryption method, device and storage medium
CN108133165A (en) * 2018-01-16 2018-06-08 深圳市爱克信智能股份有限公司 A kind of Quick Response Code card reader encryption method
US20180176017A1 (en) * 2015-02-13 2018-06-21 Yoti Ltd Digital Identity System
CN109635906A (en) * 2018-12-07 2019-04-16 深圳市集虹鼎源科技有限公司 Two-dimensional code generation method and device
CN110197244A (en) * 2018-02-26 2019-09-03 Opto电子有限公司 Two dimensional code, two dimensional code output system and method, two dimensional code read system and method
CN110290109A (en) * 2019-05-20 2019-09-27 阿里巴巴集团控股有限公司 The acquisition methods and device of data processing method and device, processing authority
US20200104081A1 (en) * 2018-09-28 2020-04-02 Brother Kogyo Kabushiki Kaisha Non-Transitory Computer-Readable Medium Storing Computer-Readable Instructions for Terminal Device and Terminal Device
CN110995654A (en) * 2019-11-05 2020-04-10 合肥优尔电子科技有限公司 Remote terminal temporary authorization method, device and system based on dynamic two-dimensional code
CN111144531A (en) * 2019-12-10 2020-05-12 深圳左邻永佳科技有限公司 Two-dimensional code generation method and device, electronic equipment and computer readable storage medium
CN111181909A (en) * 2019-08-07 2020-05-19 腾讯科技(深圳)有限公司 Identity information acquisition method and related device
CN114219055A (en) * 2021-12-14 2022-03-22 平安壹钱包电子商务有限公司 Bar code generation method, bar code verification method and payment system
CN114239779A (en) * 2021-11-24 2022-03-25 深圳市元征科技股份有限公司 Data transmission method, transmission system, acquisition equipment and receiving equipment

Patent Citations (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160351080A1 (en) * 2012-12-31 2016-12-01 Piyush Bhatnagar System, Design and Process for Secure Documents Credentials Management Using Out-of-Band Authentication
CN103401679A (en) * 2013-07-18 2013-11-20 湖北楚天传媒网络科技有限责任公司 Method for encrypting and decoding two-dimensional codes
US20180176017A1 (en) * 2015-02-13 2018-06-21 Yoti Ltd Digital Identity System
CN105007155A (en) * 2015-07-28 2015-10-28 福建联迪商用设备有限公司 Two-dimension code mask encrypting and decrypting method and system
CN105162599A (en) * 2015-08-12 2015-12-16 上海众人网络安全技术有限公司 Data transmission system and data transmission method
CN106529643A (en) * 2016-12-14 2017-03-22 北京龙贝世纪科技股份有限公司 Two-dimensional code encoding and decoding generation device and method
CN107395581A (en) * 2017-07-11 2017-11-24 上海众人网络安全技术有限公司 Quick Response Code generates and read method, device, system, equipment and storage medium
CN107809428A (en) * 2017-10-27 2018-03-16 咪咕互动娱乐有限公司 A kind of information ciphering method, decryption method, device and storage medium
CN108133165A (en) * 2018-01-16 2018-06-08 深圳市爱克信智能股份有限公司 A kind of Quick Response Code card reader encryption method
CN110197244A (en) * 2018-02-26 2019-09-03 Opto电子有限公司 Two dimensional code, two dimensional code output system and method, two dimensional code read system and method
US20200104081A1 (en) * 2018-09-28 2020-04-02 Brother Kogyo Kabushiki Kaisha Non-Transitory Computer-Readable Medium Storing Computer-Readable Instructions for Terminal Device and Terminal Device
CN109635906A (en) * 2018-12-07 2019-04-16 深圳市集虹鼎源科技有限公司 Two-dimensional code generation method and device
CN110290109A (en) * 2019-05-20 2019-09-27 阿里巴巴集团控股有限公司 The acquisition methods and device of data processing method and device, processing authority
CN111181909A (en) * 2019-08-07 2020-05-19 腾讯科技(深圳)有限公司 Identity information acquisition method and related device
CN110995654A (en) * 2019-11-05 2020-04-10 合肥优尔电子科技有限公司 Remote terminal temporary authorization method, device and system based on dynamic two-dimensional code
CN111144531A (en) * 2019-12-10 2020-05-12 深圳左邻永佳科技有限公司 Two-dimensional code generation method and device, electronic equipment and computer readable storage medium
CN114239779A (en) * 2021-11-24 2022-03-25 深圳市元征科技股份有限公司 Data transmission method, transmission system, acquisition equipment and receiving equipment
CN114219055A (en) * 2021-12-14 2022-03-22 平安壹钱包电子商务有限公司 Bar code generation method, bar code verification method and payment system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
邹建华: "二维条码技术应用研究", 《现代计量通讯》 *

Also Published As

Publication number Publication date
CN115001676B (en) 2022-12-02

Similar Documents

Publication Publication Date Title
CN110519260B (en) Information processing method and information processing device
US6343361B1 (en) Dynamic challenge-response authentication and verification of identity of party sending or receiving electronic communication
US6845453B2 (en) Multiple factor-based user identification and authentication
US10313338B2 (en) Authentication method and device using a single-use password including biometric image information
AU2010318058B2 (en) A method of assigning a secret to a security token, a method of operating a security token, storage medium and security token
US10848304B2 (en) Public-private key pair protected password manager
US20100153738A1 (en) Authorized anonymous authentication
CN111768522A (en) CTID-based intelligent door lock unlocking method and system
US9984220B2 (en) Method of authenticating a user holding a biometric certificate
CN104125064B (en) A kind of dynamic cipher authentication method, client and Verification System
CN111768523B (en) CTID-based NFC intelligent door lock unlocking method, system, equipment and medium
US20070106903A1 (en) Multiple Factor-Based User Identification and Authentication
GB2457491A (en) Identifying a remote network user having a password
CN115001676B (en) Two-dimensional code encryption method, decryption method, system, terminal and storage medium
CN115834077B (en) Control method, control system, electronic device and storage medium
US11973872B2 (en) Data security solution using randomized 3-axis data shapes and tokenized data element placement of encrypted and non-encrypted data
CN113987446A (en) Authentication method and device
CN114065169A (en) Privacy protection biometric authentication method and device and electronic equipment
CN110113152B (en) Quantum communication service station key negotiation method and system based on asymmetric key pool pair and digital signature
KR101356795B1 (en) Method of generating and restorating security tag
CN110689351A (en) Financial service verification system and financial service verification method
CN113421085B (en) Smart card dynamic password authentication method and system
CN113312651B (en) Interactive authentication method, device, equipment and computer readable storage medium
KR20230058574A (en) Method and system for authenticating for on-line financial transaction
CN117391700A (en) Resource transfer method, device, computer equipment, storage medium and product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant