CN110598421B - Two-dimensional code encryption method and device and two-dimensional code decryption method and device - Google Patents

Two-dimensional code encryption method and device and two-dimensional code decryption method and device Download PDF

Info

Publication number
CN110598421B
CN110598421B CN201810607769.8A CN201810607769A CN110598421B CN 110598421 B CN110598421 B CN 110598421B CN 201810607769 A CN201810607769 A CN 201810607769A CN 110598421 B CN110598421 B CN 110598421B
Authority
CN
China
Prior art keywords
dimensional code
decrypted
key
candidate
decryption
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.)
Active
Application number
CN201810607769.8A
Other languages
Chinese (zh)
Other versions
CN110598421A (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.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology 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 Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201810607769.8A priority Critical patent/CN110598421B/en
Publication of CN110598421A publication Critical patent/CN110598421A/en
Application granted granted Critical
Publication of CN110598421B publication Critical patent/CN110598421B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06037Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking multi-dimensional coding

Abstract

The embodiment of the invention provides a two-dimension code encryption method and device and a two-dimension code decryption method and device, wherein the encryption method comprises the following steps: acquiring a two-dimensional code to be encrypted; carrying out image segmentation on the two-dimensional code to be encrypted; removing the at least one divided image area from the two-dimensional code to be encrypted to obtain the two-dimensional code to be decrypted and a real key of the two-dimensional code to be decrypted, wherein the two-dimensional code to be decrypted is as follows: the image area after the two-dimensional code to be encrypted removes at least one image area; the true key is: at least one image area removed. The security of the two-dimensional code is improved, and the two-dimensional code is effectively prevented from being illegally decrypted to a certain extent.

Description

Two-dimensional code encryption method and device and two-dimensional code decryption method and device
Technical Field
The invention relates to the technical field of information security, in particular to a two-dimensional code encryption method and device and a two-dimensional code decryption method and device.
Background
With the rapid development of the information age, the information storage capacity is larger and larger. The two-dimensional code with strong data storage capacity and data error correction capacity is widely applied to the fields of identity recognition, electronic payment and the like.
With the wide application of the two-dimensional code, the problem of the security of the two-dimensional code is more and more emphasized. In some scenarios, the user does not want the two-dimensional code held by the user to be displayed to others completely and randomly, for example, the two-dimensional code payment is not wanted to be displayed to others completely and randomly for the payment user to avoid the property loss of the payment user, and the display of the two-dimensional code payment to others completely and randomly is unsafe, and the two-dimensional code payment method is easily decrypted illegally by others.
How to improve the security of the two-dimensional code and to a certain extent prevent the two-dimensional code from being illegally decrypted becomes a problem to be solved urgently.
Disclosure of Invention
The embodiment of the invention aims to provide a two-dimensional code encryption method and device and a two-dimensional code decryption method and device, so that the safety of a two-dimensional code is improved, and the two-dimensional code is prevented from being decrypted illegally to a certain extent. The specific technical scheme is as follows:
in one aspect, an embodiment of the present invention provides a two-dimensional code encryption method, where the method includes:
acquiring a two-dimensional code to be encrypted;
carrying out image segmentation on the two-dimensional code to be encrypted;
removing the at least one divided image area from the two-dimensional code to be decrypted to obtain the two-dimensional code to be decrypted and a real key of the two-dimensional code to be decrypted, wherein the two-dimensional code to be decrypted is as follows: the image area of the two-dimensional code to be encrypted after the at least one image area is removed; the true key is: the at least one image region removed.
On the other hand, an embodiment of the present invention provides a two-dimensional code decryption method, where the method includes:
receiving elected decryption information associated with a to-be-decrypted two-dimensional code, wherein the to-be-decrypted two-dimensional code is as follows: carrying out image segmentation on the two-dimensional code to be encrypted, and removing at least one segmented image area from the two-dimensional code to be encrypted; the key associated with the elected decryption information is the same as the size of the removed at least one image area;
when the key associated with the elected decryption information is determined to be the same as the real key of the two-dimensional code to be decrypted, marking that the two-dimensional code to be decrypted is valid and is decrypted successfully, and when the key associated with the elected decryption information is determined to be different from the real key, marking that the two-dimensional code to be decrypted is invalid, wherein the real key is the removed at least one image area.
In another aspect, an embodiment of the present invention provides a two-dimensional code encryption apparatus, where the apparatus includes:
the acquisition module is used for acquiring the two-dimension code to be encrypted;
the segmentation module is used for carrying out image segmentation on the two-dimensional code to be encrypted;
the encryption module is used for removing the at least one divided image area from the two-dimensional code to be encrypted to obtain the two-dimensional code to be decrypted and a real key of the two-dimensional code to be decrypted, wherein the two-dimensional code to be decrypted is as follows: the image area of the two-dimensional code to be encrypted after the at least one image area is removed; the true key is: the at least one image region removed.
In another aspect, an embodiment of the present invention provides a two-dimensional code decryption apparatus, where the apparatus includes:
the receiving module is used for receiving the elected decryption information associated with the to-be-decrypted two-dimensional code, and the to-be-decrypted two-dimensional code is as follows: carrying out image segmentation on the two-dimensional code to be encrypted, and removing at least one segmented image area from the two-dimensional code to be encrypted; the key associated with the elected decryption information is the same as the size of the removed at least one image area;
the decryption module is used for marking the two-dimensional code to be decrypted to be effective and successfully decrypted when the key associated with the elected decryption information is determined to be the same as the real key of the two-dimensional code to be decrypted, wherein the real key is the removed at least one image area;
and when the key associated with the elected decryption information is determined to be different from the real key, marking the two-dimensional code to be decrypted as invalid.
In another aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
the processor is configured to implement any one of the two-dimensional code encryption method steps provided in the embodiments of the present invention when executing the computer program stored in the memory.
In another aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements any one of the steps of the two-dimensional code encryption method provided in the embodiment of the present invention.
In another aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
the processor is configured to implement any one of the steps of the two-dimensional code decryption method provided in the embodiments of the present invention when executing the computer program stored in the memory.
In another aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements any one of the steps of the two-dimensional code decryption method provided in the embodiment of the present invention.
In the embodiment of the invention, a two-dimension code to be encrypted is obtained; carrying out image segmentation on the two-dimensional code to be encrypted; removing the at least one divided image area from the two-dimensional code to be encrypted to obtain the two-dimensional code to be decrypted and a real key of the two-dimensional code to be decrypted, wherein the two-dimensional code to be decrypted is as follows: the image area after the two-dimensional code to be encrypted removes at least one image area; the true key is: at least one image area removed.
In the embodiment of the invention, in the encryption process of the two-dimensional code to be encrypted, the two-dimensional code to be encrypted is subjected to image segmentation, and at least one segmented image area is removed from the two-dimensional code to be encrypted to obtain the decrypted two-dimensional code and a real key of the two-dimensional code to be decrypted, wherein the two-dimensional code to be decrypted is the two-dimensional code without partial content and contains incomplete information. After the two-dimensional code to be decrypted is acquired by the user, when the user does not acquire the true key of the two-dimensional code to be decrypted, the user cannot decrypt to obtain the true information corresponding to the two-dimensional code to be decrypted, that is, cannot decrypt the two-dimensional code to be decrypted, that is, only the user who can acquire the true key of the two-dimensional code to be decrypted can complete the subsequent decryption of the two-dimensional code to be decrypted. The security of the two-dimensional code is improved to a certain extent, and the two-dimensional code is effectively prevented from being illegally decrypted. Of course, it is not necessary for any product or method of practicing the invention to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1a is a schematic flowchart of a two-dimensional code encryption method according to an embodiment of the present invention;
fig. 1b is another schematic flow chart of a two-dimensional code encryption method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a two-dimensional code to be decrypted and candidate decryption information associated with the two-dimensional code according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of a two-dimensional code decryption method according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a two-dimensional code encryption device according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a two-dimensional code decryption apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of another electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Before describing the two-dimensional code encryption method and the two-dimensional code decryption method in detail, terms related to the present invention will be briefly described.
The terms of the present invention are explained as follows:
image segmentation is a technique of dividing an image into regions having respective characteristics, which do not overlap each other.
Identity verification, also known as "verification" or "authentication", refers to the completion of user identity confirmation by a certain means. There are many methods for authentication, which can be basically divided into: shared key based authentication, biometric based authentication, and public key encryption algorithm based authentication.
A legitimate user, a user that passes authentication, may be referred to as a legitimate user.
And (3) illegally decrypting the two-dimensional code, wherein the two-dimensional code is decrypted by an illegal user to obtain the real information of the two-dimensional code, such as: in a payment scenario, a cashier and a customer who needs to pay in a supermarket are legal users who pay two-dimensional codes and other customers are illegal users who pay two-dimensional codes and are held by the customer, and at this time, the true information of the two-dimensional codes is as follows: the amount the customer needs to pay.
The invention concept of the invention is as follows:
the two-dimensional code encryption device firstly obtains a two-dimensional code to be encrypted as the two-dimensional code to be encrypted, and the two-dimensional code can be any type of two-dimensional code generated by using a related two-dimensional code generation algorithm, such as: a DM (data matrix) code and a QR (quick response) code. Further, performing image segmentation on the two-dimensional code to be encrypted to obtain at least two image areas; and removing the at least one image area obtained by segmentation from the two-dimensional code to be encrypted, taking the two-dimensional code to be encrypted with the at least one image area removed as the two-dimensional code to be decrypted, and taking the at least one image area removed as a real key of the two-dimensional code to be decrypted. The two-dimensional code to be decrypted is a two-dimensional code missing part of content, and contains incomplete information. After the two-dimensional code to be decrypted is acquired by the user, when the user does not acquire the true key of the two-dimensional code to be decrypted, the user cannot decrypt to obtain the true information corresponding to the two-dimensional code to be decrypted, namely cannot decrypt the two-dimensional code to be decrypted, and the two-dimensional code can be effectively prevented from being decrypted illegally to a certain extent. In one case, the at least one removed image area may be: and partial area of the data area of the two-dimensional code.
In one implementation manner, the two-dimensional code decryption device can obtain the two-dimensional code to be encrypted and display the two-dimensional code to the user, in one case, the two-dimensional code decryption device performs identity verification on the user, and when the two-dimensional code decryption device performs identity verification on the user and determines that the identity of the user is legal, the true key of the two-dimensional code to be encrypted can be pushed to the user, so that the user with the legal identity, namely the legal user can decrypt the two-dimensional code to be encrypted to obtain the true information corresponding to the two-dimensional code to be encrypted. When the two-dimensional code decryption device verifies the identity of the user and determines that the identity of the user is illegal, the real key of the two-dimensional code to be encrypted is not pushed to the user, the user cannot decrypt the two-dimensional code to be encrypted, and the real information corresponding to the two-dimensional code to be encrypted cannot be obtained.
The two-dimensional code encryption device and the two-dimensional code decryption device may be installed in the same electronic device or in different electronic devices, and the electronic devices may be any types of devices, which is not limited herein.
In another implementation manner, in order to better ensure the security and confidentiality of the two-dimensional code and the convenience of using the two-dimensional code, the two-dimensional code encryption device may further configure N candidate keys for the two-dimensional code to be decrypted, and generate candidate decryption information associated with the two-dimensional code to be decrypted according to the N candidate keys and the true key, where the N candidate keys are two-dimensional code blocks, i.e., partial image areas of the two-dimensional code, which have the same size as the true key and are different from the true key. Wherein N is a positive integer.
Correspondingly, in one case, the two-dimensional code decryption device may obtain the two-dimensional code to be encrypted and display the two-dimensional code to the user, and simultaneously display the candidate decryption information associated with the two-dimensional code to be encrypted to the user. If the user is a legal user, the legal user can obtain real decryption information indicating the real key of the two-dimensional code to be encrypted to the legal user, and then the legal user can determine and select the real key from candidate decryption information associated with the two-dimensional code to be encrypted based on the real decryption information, so that decryption of the two-dimensional code to be encrypted can be realized, and the real information corresponding to the two-dimensional code to be encrypted is obtained.
If the user is not a legitimate user, the user cannot obtain the true decryption information indicating the true key of the two-dimensional code to be encrypted to the legitimate user, that is, under the interference of M candidate keys among the N candidate keys, the user does not know which key is the true key among the candidate decryption information associated with the two-dimensional code to be encrypted, and the user may not be able to accurately determine and select the true key from the candidate decryption information due to the interference of the M candidate keys. Wherein M is a positive integer.
In response to the above situation, in one implementation, when the user does not accurately determine and select the true key from the candidate decryption information, the two-dimensional code decryption device may mark that the two-dimensional code to be decrypted is invalid, so that the two-dimensional code to be decrypted cannot be decrypted any more, and the two-dimensional code to be decrypted is prevented from being decrypted illegally.
In another implementation, a situation that a legal user performs an incorrect operation, so that the determination and selection of the real key cannot be completed at one time may occur, so as to avoid that the legal user cannot decrypt the two-dimensional code to be decrypted due to the situation. The two-dimensional code decryption device can be preset with preset times to limit the execution times of decryption operation of a user aiming at the two-dimensional code to be decrypted, so that the situation that a legal user cannot decrypt the two-dimensional code to be decrypted due to misoperation of the user can be avoided, and illegal decryption of the two-dimensional code to be decrypted by an illegal user in a multi-trial mode can be effectively prevented. In order to achieve the effect, the two-dimensional code decryption device can monitor the selection times of the user for the candidate decryption information in real time, and when the selection times of the user exceed the preset times and the real secret key is not accurately determined and selected, the two-dimensional code decryption device can mark the invalidity of the two-dimensional code to be decrypted, so that the two-dimensional code to be decrypted cannot be decrypted again, and the two-dimensional code to be decrypted is prevented from being illegally decrypted.
In one implementation mode, illegal decryption of the to-be-decrypted two-dimensional code by an illegal user through multiple attempts is effectively prevented. In the process that a user executes decryption operation aiming at the two-dimensional code to be decrypted, when the two-dimensional code decryption device determines that the execution times of the user, namely the selection times aiming at the candidate decryption information, do not exceed the preset times, the candidate decryption information is updated when the decryption operation executed by the user once is detected, and the updated candidate decryption information is displayed to the user. The updating of the candidate decryption information may be reconfiguring N candidate keys for the to-be-decrypted two-dimensional code.
By means of the scheme, the two-dimensional code to be decrypted is subjected to image segmentation, and the segmented at least one image area is removed from the two-dimensional code to be encrypted, so that the two-dimensional code to be decrypted is obtained, namely the image area of the two-dimensional code to be decrypted after the at least one image area is removed, and the true key of the two-dimensional code to be decrypted is obtained, namely the removed at least one image area. And enabling the two-dimensional code to be decrypted to be the two-dimensional code missing part of the content, wherein the two-dimensional code contains incomplete information. After the two-dimensional code to be decrypted is acquired by the user, when the user does not acquire the true key of the two-dimensional code to be decrypted, the user cannot decrypt to obtain the true information corresponding to the two-dimensional code to be decrypted, that is, cannot decrypt the two-dimensional code to be decrypted, that is, only the user who can acquire the true key of the two-dimensional code to be decrypted can complete the subsequent decryption of the two-dimensional code to be decrypted. The security of the two-dimensional code is improved to a certain extent, and the two-dimensional code is effectively prevented from being illegally decrypted. And N candidate keys are configured for the two-dimension code to be decrypted so as to interfere the selection of a user, and the safety of the two-dimension code is better improved. And then candidate decryption information associated with the two-dimension code to be decrypted is generated, and the candidate decryption information is displayed for a user when the two-dimension code to be encrypted is displayed, so that the user can select the candidate decryption information, and the safety of the two-dimension code and the convenience of the two-dimension code can be better guaranteed.
Based on the same inventive concept, the embodiment of the invention provides a two-dimension code encryption method and device and a two-dimension code decryption method and device, so that the security of the two-dimension code is improved, and the two-dimension code is prevented from being decrypted illegally to a certain extent.
As shown in fig. 1a, an embodiment of the present invention provides a two-dimensional code encryption method, which may be executed by a two-dimensional code encryption apparatus, where the method may include the following steps:
s101: acquiring a two-dimensional code to be encrypted;
in the embodiment of the present invention, the two-dimensional code encryption device may be installed in any electronic device, and the electronic device may be a computer, a smart phone, or the like. In one case, the two-dimension code encryption device can obtain the two-dimension code to be encrypted through scanning of a camera of the electronic equipment; the two-dimensional code to be encrypted can also be generated and obtained through a related two-dimensional code generator arranged in the electronic equipment.
The two-dimensional code to be encrypted may be any two-dimensional code, which may be a dm (data matrix) code, a qr (quick response) code, and the like. The Data Matrix code is named as Data code.
S102: carrying out image segmentation on the two-dimensional code to be encrypted;
s103: and removing the at least one divided image area from the two-dimensional code to be encrypted to obtain the two-dimensional code to be decrypted and a real key of the two-dimensional code to be decrypted.
Wherein, the two-dimensional code to be decrypted is: the image area after the two-dimensional code to be encrypted removes at least one image area; the true key is: at least one image area removed. In one case, the at least one removed image area may be: and partial area of the data area of the two-dimensional code.
In the embodiment of the present invention, after the two-dimensional code encryption device obtains the two-dimensional code to be encrypted, the two-dimensional code to be encrypted may be subjected to image segmentation based on a related image segmentation technology to obtain at least two image regions. Further, removing the at least one divided image area from the two-dimensional code to be encrypted to obtain the two-dimensional code to be decrypted which lacks the at least one image area; and obtaining a true key of the two-dimensional code to be decrypted, namely the removed at least one image area.
In one implementation, the process of performing image segmentation on the to-be-encrypted two-dimensional code may include: the method includes the steps that image segmentation is conducted on a two-dimensional code to be encrypted based on a preset segmentation model, the preset segmentation model can be a four-square grid, a six-square grid, a nine-square grid and the like, and the type of the preset segmentation model is not limited in the embodiment of the invention.
In another implementation, the process of performing image segmentation on the to-be-encrypted two-dimensional code may include: and dividing the two-dimensional code to be encrypted into a plurality of image areas according to the preset division size and the preset division initial position.
Wherein, the preset dividing size and the preset dividing initial position may be: the two-dimensional code encryption device is set by default; or the manager can set the two-dimensional codes according to different types and/or sizes, which is all possible. The preset division size can be identified by height and width, and the preset division starting position can be identified by offset, that is, the identification is divided from the position of the two-dimensional code to be encrypted after a preset offset data volume. The preset dividing size and the preset dividing starting position may be one or more pairs.
In one case, after obtaining the to-be-decrypted two-dimensional code, the two-dimensional code encryption device may directly display the to-be-decrypted two-dimensional code, or may store the to-be-decrypted two-dimensional code and the real key, and record a corresponding relationship between the to-be-decrypted two-dimensional code and the real key. In one implementation manner, the two-dimensional code encryption device and the subsequently mentioned two-dimensional code decoding device are installed in the same electronic device, when the two-dimensional code encryption device receives a decryption request for a two-dimensional code to be decrypted, the two-dimensional code to be decrypted can be displayed to a user, the user who triggers the decryption request can be authenticated, and the true secret key can be pushed to the user after the authentication is passed, so that the user can successfully decrypt the two-dimensional code to be decrypted. In one case, the electronic device where the two-dimensional code encryption apparatus is located is a terminal device, and the displaying the two-dimensional code to be decrypted to the user may be: and displaying the two-dimension code to be decrypted on a display screen of the electronic equipment so as to be displayed to a user. In another case, the electronic device where the two-dimensional code encryption apparatus is located is a server, and the displaying the two-dimensional code to be decrypted to a user may be: and sending the two-dimension code to be decrypted to terminal equipment held by a user, and displaying the two-dimension code to be decrypted through a display screen of the terminal equipment so as to be displayed to the user.
By applying the embodiment of the invention, in the encryption process of the two-dimensional code to be encrypted, the two-dimensional code to be encrypted is subjected to image segmentation, and at least one segmented image area is removed from the two-dimensional code to be encrypted to obtain the decrypted two-dimensional code and the real key of the two-dimensional code to be decrypted, wherein the two-dimensional code to be decrypted is the two-dimensional code without partial content and contains incomplete information. After the two-dimensional code to be decrypted is acquired by the user, when the user does not acquire the true key of the two-dimensional code to be decrypted, the user cannot decrypt to obtain the true information corresponding to the two-dimensional code to be decrypted, that is, cannot decrypt the two-dimensional code to be decrypted, that is, only the user who can acquire the true key of the two-dimensional code to be decrypted can complete the subsequent decryption of the two-dimensional code to be decrypted. The security of the two-dimensional code is improved to a certain extent, and the two-dimensional code is effectively prevented from being illegally decrypted.
In an implementation manner, in order to better improve the security of the two-dimensional code, an interference option may be set, so as to increase the difficulty of the user in the decryption process of the two-dimensional code to be decrypted. Based on the above idea, as shown in fig. 1b, the method may further include:
s201: acquiring a two-dimensional code to be encrypted;
s202: carrying out image segmentation on the two-dimensional code to be encrypted;
s203: removing the at least one divided image area from the two-dimensional code to be encrypted to obtain the two-dimensional code to be decrypted and a real key of the two-dimensional code to be decrypted;
wherein, the above S201 is the same as S101 shown in fig. 1a, the above S202 is the same as S102 shown in fig. 1a, and the above S203 is the same as S103 shown in fig. 1a, which are not repeated herein.
S204: configuring N candidate keys for the two-dimension code to be decrypted;
any candidate key is a two-dimensional code image different from the real key, and the size of the candidate key is the same as that of the removed at least one image area;
s205: and generating candidate decryption information associated with the two-dimension code to be decrypted according to the N candidate keys and the real key.
Wherein the candidate decryption information is for: after a user submits a decryption request associated with the two-dimensional code to be decrypted, the decryption request is displayed to the user, and the candidate decryption information comprises: the key comprises a real key and M candidate keys in N candidate keys, wherein M is less than or equal to N, and N and M are positive integers.
The decryption request associated with the to-be-decrypted two-dimensional code may be a request submitted by a user when the user has a need to decrypt the to-be-decrypted two-dimensional code. After the two-dimensional code encryption device generates the candidate decryption information associated with the two-dimensional code to be decrypted, the candidate decryption information, and the corresponding relationship between the two-dimensional code to be decrypted and the candidate decryption information may be stored. Therefore, a legal user can successfully decrypt the two-dimensional code to be decrypted, and meanwhile, illegal decoding of the decrypted two-dimensional code by an illegal user is interfered through the M candidate keys.
It can be understood that the larger the value of M is, the more interference is caused to the selection of the user who needs to decrypt the two-dimensional code to be decrypted, and the higher the security of the two-dimensional code is.
In one case, the step of configuring N candidate keys for the to-be-decrypted two-dimensional code may include:
and dividing the two-dimensional code to be decrypted into N sub-image areas, and taking the N sub-image areas as candidate keys.
In another case, the step of configuring N candidate keys for the two-dimensional code to be decrypted may include:
obtaining N other two-dimensional codes, wherein each other two-dimensional code is different from the two-dimensional code to be encrypted;
for each other two-dimensional code, performing image segmentation on the other two-dimensional code;
and for each other two-dimensional code, determining an image area of the other two-dimensional code which is divided and has the same size as at least one image area removed from the two-dimensional code to be encrypted as a candidate key.
The two-dimensional code encryption device may obtain the N other two-dimensional codes in a manner that: scanning through a camera of the electronic equipment to obtain the N other two-dimensional codes; or, the N other two-dimensional codes are generated and obtained by a related two-dimensional code generator provided in the electronic device.
In an implementation manner, in order to ensure that the interference effect of the N candidate keys is better, N other two-dimensional codes of the same type as the two-dimensional code to be encrypted can be obtained, and the N other two-dimensional codes of the same type as the two-dimensional code to be encrypted can be subjected to image segmentation respectively based on the same segmentation manner as the two-dimensional code to be encrypted; furthermore, for each other two-dimensional code, from the image areas obtained by dividing the two-dimensional code, the image area at the same position as the position of the at least one image area removed from the two-dimensional code to be encrypted is determined, and the determined N image areas are used as candidate keys.
Wherein, the image segmentation is respectively carried out on N other two-dimensional codes with the same type as the two-dimensional code to be encrypted based on the segmentation mode which is the same as the segmentation mode of the two-dimensional code to be encrypted, and the method can be understood as follows: when a preset segmentation model is used for carrying out image segmentation on a two-dimensional code to be encrypted, the same preset segmentation model can be used for respectively carrying out image segmentation on N other two-dimensional codes of the same type as the two-dimensional code to be encrypted; when the image segmentation is performed on the two-dimensional code to be encrypted based on the preset segmentation size and the preset segmentation initial position, the image segmentation can be performed on N other two-dimensional codes of the same type as the two-dimensional code to be encrypted based on the same preset segmentation size and the same preset segmentation initial position.
For example, based on a preset segmentation size and a preset segmentation initial position, segmenting a two-dimensional code to be encrypted to obtain four image areas, namely an upper left corner image area, a lower left corner image area, an upper right corner image area and a lower right corner image area; when the upper left corner image area is used as a real key, when N candidate keys are configured for the two-dimensional code to be decrypted, N other two-dimensional codes of the same type as the two-dimensional code to be encrypted can be obtained, each other two-dimensional code is segmented based on the preset segmentation size and the preset segmentation initial position, and each other two-dimensional code obtains four image areas which are respectively an upper left corner image area, a lower left corner image area, an upper right corner image area and a lower right corner image area.
In an implementation manner, the process of generating the candidate decryption information associated with the to-be-decrypted two-dimensional code according to the N candidate keys and the true key may be: and randomly selecting M candidate keys from the N candidate keys, and taking the N candidate keys and the real key as candidate decryption information associated with the two-dimensional code to be decrypted.
As shown in fig. 2, a schematic structural diagram of a to-be-decrypted two-dimensional code and associated candidate decryption information thereof according to an embodiment of the present invention is provided, where the candidate decryption information includes a real key and 8 candidate keys, position index information corresponding to the to-be-decrypted two-dimensional code is a label and is 0, and position index information corresponding to the real key and the 8 candidate keys in the upper candidate decryption information is labels and is labels 1 to 9, respectively.
In one implementation manner, encrypting the to-be-encrypted two-dimensional code is to prevent an unauthorized user from illegally decrypting the two-dimensional code, and in order to ensure that the encrypted to-be-decrypted two-dimensional code can be successfully decrypted by a legitimate user, the method may further include:
generating real decryption information for providing to a legal user according to the position index information of the real key in the candidate decryption information, wherein the real decryption information is used for: the true key is indicated to the legitimate user.
The position index information of the true key in the candidate decryption information may be: information capable of indicating the true key in the candidate decryption information. The position index information may be a label to distinguish each candidate key from the true key in the candidate decryption information, where each label has uniqueness, or the position index information may be information identifying a position of the true key in the candidate decryption information to distinguish each candidate key from the true key in the candidate decryption information. In one implementation, the true decryption information may include: and the position index information of the true key in the candidate decryption information. The actual decryption information may include a label of the actual key, or a position of the actual key in the candidate decryption information. For example, the position index information may specifically be: the true key is at a third position in the candidate decryption information, or the true key is at the leftmost position in the candidate decryption information, or the true key is at the (a, b) position in the candidate decryption information.
The true decryption information can guide a legal user who decrypts the two-dimensional code to be decrypted in the process that the user decrypts the two-dimensional code, and the true key of the two-dimensional code to be decrypted is determined from the candidate decryption information.
Subsequently, the two-dimension code encryption device can send the real decryption information of the two-dimension code to be decrypted to a legal user, so that the legal user can quickly and accurately determine the real key of the two-dimension code to be decrypted from the candidate decryption information associated with the two-dimension code to be decrypted based on the real decryption information, and decryption of the two-dimension code to be decrypted is achieved.
Corresponding to the method embodiment of the two-dimensional code encryption method, as shown in fig. 3, an embodiment of the present invention provides a two-dimensional code decryption method, where the method may be executed by a two-dimensional code decryption device, and the method may include the following steps:
s301: receiving elected decryption information associated with the two-dimensional code to be decrypted;
the two-dimensional code to be decrypted is: carrying out image segmentation on the two-dimensional code to be encrypted, and removing at least one segmented image area from the two-dimensional code to be encrypted; when the key associated with the selected decryption information is the same size as the removed at least one image area;
it can be understood that, in the embodiment of the present invention, the two-dimensional code decryption apparatus may be installed in any electronic device, and the electronic device may be the same device as the electronic device on which the two-dimensional code encryption apparatus is installed, or may be a different device. The two-dimensional code decryption device can be equipment such as a smart phone and a computer.
In an implementation manner, the elected decryption information may be triggered by a user, may be triggered by a third electronic device, and may also be triggered by the two-dimensional code decryption apparatus itself. The two-dimensional code decryption device receives elected decryption information associated with the two-dimensional code to be decrypted, wherein a key associated with the elected decryption information is the same as the size of the removed at least one image area, and the key associated with the elected decryption information can be a real key of the two-dimensional code to be decrypted or a candidate key of the two-dimensional code to be decrypted.
Wherein, the real secret key is: performing image segmentation on the two-dimensional code to be encrypted, and removing at least one image area from the two-dimensional code to be encrypted, wherein the candidate key is as follows: a two-dimensional code block, i.e., a partial image area of the two-dimensional code, configured to have the same size as the removed at least one image area, i.e., the true key. In one case, the at least one removed image area may be: and partial area of the data area of the two-dimensional code.
S302: when the key associated with the elected decryption information is determined to be the same as the real key of the two-dimensional code to be decrypted, marking the two-dimensional code to be decrypted as valid and successfully decrypting;
wherein the real key is the removed at least one image area;
s303: and marking the two-dimensional code to be decrypted invalid when the key associated with the selected decryption information is determined to be different from the real key.
In one implementation manner, a corresponding relation between the two-dimensional code to be decrypted and a real key thereof is stored in a local electronic device where the two-dimensional code decryption device is located or a storage device connected to the electronic device, after the two-dimensional code decryption device receives electing decryption information associated with the two-dimensional code to be decrypted, the key associated with the electing decryption information is matched with the corresponding relation, when matching is successful, it can be determined that the key associated with the electing decryption information is the same as the real key of the two-dimensional code to be decrypted, and at this time, it can be marked that the two-dimensional code to be decrypted is valid and decryption is successful. When the matching is unsuccessful, it may be determined that the key associated with the elected decryption information is different from the true key of the to-be-decrypted two-dimensional code, and at this time, the to-be-decrypted two-dimensional code may be marked as invalid.
In one case, the above-mentioned elected decryption information carries position index information of the associated key, and in the storage device local to the electronic device where the two-dimensional code decryption apparatus is located or connected to, the stored correspondence between the two-dimensional code to be decrypted and the real key thereof may be: and the stored corresponding relation between the two-dimensional code to be decrypted and the position index information of the real key of the two-dimensional code. In another case, when the elected decryption information carries the associated key, and the two-dimensional code decryption apparatus is located in a local or connected storage device of the electronic device, the stored correspondence between the two-dimensional code to be decrypted and the real key thereof may be: and the stored two-dimensional code to be decrypted corresponds to the real secret key of the two-dimensional code.
By applying the embodiment of the invention, the elected decryption information associated with the two-dimensional code to be decrypted is received, and the two-dimensional code to be decrypted is as follows: carrying out image segmentation on the two-dimensional code to be encrypted, and removing at least one segmented image area from the two-dimensional code to be encrypted; when the two-dimensional code image associated with the selected decryption information is the same as the size of the removed at least one image area; when the key associated with the elected decryption information is determined to be the same as the real key of the two-dimensional code to be decrypted, marking the two-dimensional code to be decrypted as valid and successfully decrypting, and when the key associated with the elected decryption information is determined to be different from the real key, marking the two-dimensional code to be decrypted as invalid, wherein the real key is at least one removed image area. When the key associated with the elected decryption information is determined to be the same as the real key, the two-dimensional code to be decrypted is marked to be effective and the decryption is successful, and when the key associated with the elected decryption information is determined to be different from the real key, the two-dimensional code to be decrypted is marked to be invalid, so that the two-dimensional code to be decrypted cannot be decrypted any more, the safety of the two-dimensional code is improved to a certain extent, and the two-dimensional code is effectively prevented from being decrypted illegally to a certain extent.
In one implementation, before the step of receiving elected decryption information associated with the two-dimensional code to be decrypted, the method may further include:
receiving a decryption request associated with a two-dimension code to be decrypted, which is submitted by a user;
and acquiring and displaying candidate decryption information associated with the two-dimension code to be decrypted according to the decryption request.
The candidate decryption information comprises M candidate keys and a real key, and any one of the candidate keys is: and the candidate key is the same as the size of the removed at least one image area, wherein M is a positive integer.
In the embodiment of the invention, when a user has a requirement for decrypting the two-dimensional code to be decrypted, a decryption request associated with the two-dimensional code to be decrypted can be submitted, namely triggered. The two-dimension code decryption device can receive the decryption request associated with the two-dimension code to be decrypted, and then can acquire and display the candidate decryption information associated with the two-dimension code to be decrypted according to the decryption request. Specifically, the decryption request may carry identification information of the two-dimensional code to be decrypted, and the two-dimensional code decryption device may obtain candidate decryption information associated with the two-dimensional code to be decrypted based on the identification information of the two-dimensional code to be decrypted, and may further display the obtained candidate decryption information, so that the user may decrypt the two-dimensional code to be decrypted based on the candidate decryption information.
In one case, the two-dimensional code decryption device may further obtain and display the two-dimensional code to be decrypted before obtaining and displaying the candidate decryption information associated with the two-dimensional code to be decrypted according to the decryption request.
In one implementation, after the two-dimensional code decryption device displays the candidate decryption information to the user, that is, after the true keys of the two-dimensional code to be decrypted and the M candidate keys included in the candidate decryption information are displayed to the user, the user may select a key from the candidate decryption information to decrypt the two-dimensional code to be decrypted.
The electronic device where the two-dimensional code decryption apparatus is located is a terminal device, and the displaying of the candidate decryption information to the user may be: and displaying the candidate decryption information on a display screen of the terminal equipment so as to display the candidate decryption information to a user. The electronic device where the two-dimensional code decryption apparatus is located is a server, and the displaying of the candidate decryption information to the user may be: and the server sends the candidate decryption information to the terminal equipment held by the user, and displays the candidate decryption information on a display screen of the terminal equipment so as to display the candidate decryption information to the user.
In one implementation, the two-dimensional code decryption device may monitor a selection operation of a user for the candidate decryption information, and each time the user performs the selection operation for the candidate decryption information, the two-dimensional code decryption device receives elected decryption information associated with the two-dimensional code to be decrypted, and the two-dimensional code decryption device determines a key associated with the received elected decryption information, that is, whether the key selected by the user is a true key of the two-dimensional code to be decrypted.
In one case, when the two-dimensional code decryption device determines that the key selected by the user is the true key of the two-dimensional code to be decrypted, that is, determines that the key associated with the selected decryption information is the same as the true key of the two-dimensional code to be decrypted, the two-dimensional code to be decrypted is marked as valid and the decryption is successful.
The process of marking that the two-dimensional code to be decrypted is effective and the decryption is successful may be: directly displaying the real information corresponding to the two-dimension code to be decrypted, wherein the real information corresponding to the two-dimension code to be decrypted is that: and information contained in the complete two-dimensional code obtained by splicing the two-dimensional code to be decrypted and the real secret key. It can also be: and directly displaying the complete two-dimensional code after the two-dimensional code to be decrypted and the real key are successfully spliced, namely the two-dimensional code to be encrypted. It can also be: and displaying prompt information representing that the two-dimensional code to be decrypted is decrypted successfully. This is all possible.
The electronic device where the two-dimensional code decryption apparatus is located is a terminal device, and the directly displaying the real information corresponding to the two-dimensional code to be decrypted may be: and displaying the real information corresponding to the two-dimension code to be decrypted on a display screen of the terminal equipment so as to be displayed to a user. The above directly displaying the complete two-dimensional code after the two-dimensional code to be decrypted and the real key are successfully spliced may be: and displaying the complete two-dimensional code after the two-dimensional code to be decrypted and the real key are successfully spliced on a display screen of the terminal equipment so as to be displayed to a user. The display of the prompt information representing that the two-dimensional code to be decrypted is decrypted successfully may be: and displaying the prompt information for indicating that the two-dimensional code to be decrypted is successfully decrypted on a display screen of the terminal equipment so as to show the prompt information to a user.
The electronic device where the two-dimensional code decryption apparatus is located is a server, and the directly displaying the real information corresponding to the two-dimensional code to be decrypted may be: and the server sends the real information corresponding to the two-dimension code to be decrypted to the terminal equipment held by the user, and the real information corresponding to the two-dimension code to be decrypted is displayed on a display screen of the terminal equipment so as to be displayed to the user. The above directly displaying the complete two-dimensional code after the two-dimensional code to be decrypted and the real key are successfully spliced may be: and the server sends the complete two-dimensional code obtained by successfully splicing the two-dimensional code to be decrypted and the real key to the terminal equipment held by the user, and displays the complete two-dimensional code obtained by successfully splicing the two-dimensional code to be decrypted and the real key on a display screen of the terminal equipment so as to show the complete two-dimensional code to the user. The display of the prompt information representing that the two-dimensional code to be decrypted is decrypted successfully may be: and the server sends the prompt information representing the successful decryption of the two-dimension code to be decrypted to the terminal equipment held by the user, and the prompt information representing the successful decryption of the two-dimension code to be decrypted is displayed on a display screen of the terminal equipment so as to be displayed to the user.
Wherein, the selecting operation may be: and clicking, pressing for a long time or sliding the real key or M candidate keys of the to-be-decrypted two-dimensional code contained in the candidate decryption information by the user.
In another case, when it is determined that the key selected by the user is not the true key of the two-dimensional code to be decrypted, that is, it is determined that the key associated with the selected decryption information is different from the true key of the two-dimensional code to be decrypted, the two-dimensional code to be decrypted is directly marked to be invalid.
In another case, when it is determined that the key selected by the user is not the true key of the two-dimensional code to be decrypted, it may be continuously determined whether the number of times of selection by the user exceeds a set threshold, that is, whether the number of times of selection by the user, that is, the number of times of selection of the key associated with the decryption information submitted by the same user, and the number of times of the true key are different, exceeds the set threshold; and when the two-dimensional code to be decrypted is determined to be exceeded, marking that the two-dimensional code to be decrypted is invalid. Specifically, the step of marking that the two-dimensional code to be decrypted is invalid when it is determined that the key associated with the decryption information is different from the true key may include:
and when the number of times that the key associated with the candidate decryption information submitted by the same user is different from the real key exceeds a set threshold value, marking that the two-dimensional code to be decrypted is invalid.
The process of marking that the two-dimensional code to be decrypted is invalid may be: and graying the two-dimension code to be decrypted and/or the candidate decryption information of the two-dimension code to be decrypted so that the user can not continue to perform selection operation on the candidate decryption information of the two-dimension code to be decrypted. In one case, the two-dimensional code is prevented from being illegally decrypted for better effectiveness. After the step of marking that the two-dimensional code to be decrypted is invalid, the method may further include:
and clearing the two-dimension code to be decrypted and/or clearing the candidate decryption information of the two-dimension code to be decrypted.
In another case, the two-dimensional code is prevented from being illegally decrypted for better effectiveness. After the step of marking the invalidity of the two-dimensional code to be decrypted, the two-dimensional code decryption device can also send a deletion instruction to a database storing the real information corresponding to the two-dimensional code to be decrypted so as to delete the real information corresponding to the two-dimensional code to be decrypted.
In another implementation manner, when it is determined that the number of times that the key associated with the elected decryption information submitted by the same user is different from the true key does not exceed the set threshold, the two-dimensional code decryption device can update the candidate decryption information and display the updated candidate decryption information in order to better prevent the unauthorized user from illegally decrypting the to-be-decrypted two-dimensional code in a multi-trial manner.
The set threshold value can be a positive integer greater than or equal to 1, and the smaller the set threshold value is, the more the decryption difficulty of the two-dimensional code to be decrypted can be increased to a certain extent, and the more illegal decryption of the two-dimensional code to be decrypted by an illegal user through multiple attempts can be prevented.
In one case, the M candidate keys included in the candidate decryption information are: selecting a key from N candidate keys configured for the two-dimensional code to be decrypted in advance, wherein M is less than or equal to N, and N is a positive integer;
the step of updating the candidate decryption information may include:
reconfiguring N candidate keys for the two-dimensional code to be decrypted again, and updating candidate decryption information based on the reconfigured candidate keys; alternatively, the first and second electrodes may be,
and reselecting M candidate keys from the N candidate keys, and updating the candidate decryption information according to the reselected M candidate keys.
The reconfiguring N candidate keys for the to-be-decrypted two-dimensional code, and updating the candidate decryption information based on the reconfigured candidate keys may be: acquiring N new other two-dimensional codes again, wherein the N new other two-dimensional codes can be different from the N other two-dimensional codes and the two-dimensional code to be encrypted; for each new other two-dimensional code, carrying out image segmentation on the new other two-dimensional code; and for each new other two-dimensional code, determining an image area of the new other two-dimensional code which is divided and has the same size as at least one image area removed from the two-dimensional code to be encrypted as a new candidate key.
When M is smaller than N, M candidate keys may be reselected from the N candidate keys, and the candidate decryption information may be updated according to the reselected M candidate keys. For example, the N candidate keys include candidate keys whose corresponding labels are 1 to 12, respectively, and M currently selected candidate keys are candidate keys whose labels are 1 to 8, respectively, at this time, M candidate keys are newly selected from the N candidate keys, and the candidate keys whose labels are 4 to 11 may be used as the newly selected M candidate keys, and the candidate decryption information may be updated according to the newly selected candidate keys whose labels are 4 to 11, respectively, that is, the candidate keys whose labels are 1 to 8 in the candidate decryption information are deleted and added into the candidate keys whose labels are 4 to 11. The M candidate keys currently selected and the M candidate keys newly selected are relatively, the M candidate keys currently selected are candidate keys before the new selection, and the M candidate keys newly selected are candidate keys after the new selection.
In another case, the step of updating the candidate decryption information may include: and disordering the display sequence of the real key and the M candidate keys contained in the candidate decryption information, and redisplaying the disordering candidate decryption information. To confuse the user's selection.
In order to ensure that a legal user can accurately and quickly decrypt the two-dimensional code to be decrypted, after the two-dimensional code decryption device receives a decryption request associated with the two-dimensional code to be decrypted, the method may further include:
and when the user submitting the decryption request is determined to be a legal user, sending real decryption information, wherein the real decryption information is used for indicating a real key.
In the embodiment of the invention, after the two-dimensional code decryption device receives a decryption request associated with the two-dimensional code to be decrypted submitted by a user, the identity of the user can be verified through a related identity verification method, when the verification is passed, that is, the user submitting the decryption request is determined to be a legal user, the two-dimensional code decryption device can send real decryption information, and the user is prompted by the real decryption information to a real key in candidate decryption information of the two-dimensional code to be decrypted, wherein the real decryption information can include position index information of the real key in the candidate decryption information, for example, a mark number and/or a position of the real key in the candidate decryption information.
The electronic device where the two-dimensional code decryption apparatus is located is a terminal device, and the sending of the real decryption information may be: internal transmission of the terminal device, for example: and sending the real decryption information to the terminal equipment by a short message mode or an email mode so as to display the real decryption information on a display screen of the terminal equipment for showing to a user. The electronic device where the two-dimensional code decryption apparatus is located is a server, and the sending of the real decryption information may be: and the server sends the real decryption information to the terminal equipment held by the user, and displays the real decryption information on a display screen of the terminal equipment so as to display the real decryption information to the user.
In one case, the two-dimensional code to be encrypted may be only divided into two image areas, where one image area is used as the two-dimensional code to be decrypted and the other image area is used as the true key of the two-dimensional code to be decrypted, so that convenience is higher when the two-dimensional code to be decrypted and the true key are combined in the decryption process.
The two-dimensional code decryption process is described by taking fig. 2 as an example:
the two-dimension code decryption device receives a decryption request associated with a two-dimension code to be decrypted submitted by a user;
the two-dimension code decryption device acquires and displays candidate decryption information associated with the two-dimension code to be decrypted according to the decryption request, wherein the candidate decryption information comprises a real key and 8 candidate keys, and the corresponding position index information is labels which are respectively 1-9; the two-dimensional code to be decrypted can be obtained and displayed, and the two-dimensional code to be decrypted corresponds to an identifier 0;
in one case, the two-dimensional code decryption device carries out identity verification on a user, and when the user submitting a decryption request is determined to be a legal user, real decryption information is sent, and the real decryption information is used for indicating a real secret key; the position index information of the real key carried by the real decryption information is a label 4;
in one case, when the two-dimensional code decryption device receives elected decryption information associated with a two-dimensional code to be decrypted, and position index information of a key associated with the two-dimensional code is label 4, the two-dimensional code decryption device determines that the position index information of the key associated with the elected decryption information is label 4 and is the same as a real key (the position index information is label 4) of the two-dimensional code to be decrypted, namely determines that the key associated with the elected decryption information is the same as the real key of the two-dimensional code to be decrypted, and marks that the two-dimensional code to be decrypted is valid and is successfully decrypted;
in another case, when the two-dimensional code decryption device receives the elected decryption information associated with the two-dimensional code to be decrypted, and the position index information of the key associated with the two-dimensional code is label 2, at this time, the two-dimensional code decryption device determines that the position index information of the key associated with the elected decryption information is label 2, and is different from the true key (the position index information is label 4) of the two-dimensional code to be decrypted, that is, determines that the key associated with the elected decryption information is different from the true key of the two-dimensional code to be decrypted, and marks that the two-dimensional code to be decrypted is invalid. In one case, the two-dimensional code to be decrypted is cleared after marking the two-dimensional code to be decrypted as invalid.
Corresponding to the above method embodiment, as shown in fig. 4, an embodiment of the present invention provides a two-dimensional code encryption apparatus, where the apparatus includes:
an obtaining module 410, configured to obtain a two-dimensional code to be encrypted;
the segmentation module 420 is configured to perform image segmentation on the to-be-encrypted two-dimensional code;
the encrypting module 430 is configured to remove the at least one divided image area from the to-be-encrypted two-dimensional code to obtain a to-be-decrypted two-dimensional code and a true key of the to-be-decrypted two-dimensional code, where the to-be-decrypted two-dimensional code is: the image area of the two-dimensional code to be encrypted after the at least one image area is removed; the true key is: the at least one image region removed.
By applying the embodiment of the invention, in the encryption process of the two-dimensional code to be encrypted, the two-dimensional code to be encrypted is subjected to image segmentation, and at least one segmented image area is removed from the two-dimensional code to be encrypted to obtain the decrypted two-dimensional code and the real key of the two-dimensional code to be decrypted, wherein the two-dimensional code to be decrypted is the two-dimensional code without partial content and contains incomplete information. After the two-dimensional code to be decrypted is acquired by the user, when the user does not acquire the true key of the two-dimensional code to be decrypted, the user cannot decrypt to obtain the true information corresponding to the two-dimensional code to be decrypted, that is, cannot decrypt the two-dimensional code to be decrypted, that is, only the user who can acquire the true key of the two-dimensional code to be decrypted can complete the subsequent decryption of the two-dimensional code to be decrypted. The security of the two-dimensional code is improved to a certain extent, and the two-dimensional code is effectively prevented from being illegally decrypted.
In one implementation, the apparatus further comprises:
a configuration module, configured to configure N candidate keys for the to-be-decrypted two-dimensional code, where any one of the candidate keys is a two-dimensional code image different from the true key, and the candidate key is the same as the removed at least one image area in size;
a first generating module, configured to generate candidate decryption information associated with the to-be-decrypted two-dimensional code according to the N candidate keys and the true key, where the candidate decryption information is used to: after a user submits a decryption request associated with the two-dimensional code to be decrypted, the decryption request is displayed to the user, and the candidate decryption information comprises: the true key and M of the N candidate keys, where M is less than or equal to N, and both N and M are positive integers.
In one implementation, the apparatus further comprises:
a second generating module, configured to generate, according to the position index information of the true key in the candidate decryption information, true decryption information for providing to a legitimate user, where the true decryption information is used to: indicating the true key to the legitimate user.
In one implementation, the segmentation module 420 is specifically configured to
And dividing the two-dimensional code to be encrypted into a plurality of image areas according to a preset division size and a preset division starting position.
Optionally, the configuration module is specifically for
And dividing the two-dimensional code to be decrypted into N sub-image areas, and taking the N sub-image areas as the candidate key.
Corresponding to the foregoing method embodiment, an embodiment of the present invention provides a two-dimensional code decryption apparatus, as shown in fig. 5, where the apparatus includes:
a receiving module 510, configured to receive elected decryption information associated with a to-be-decrypted two-dimensional code, where the to-be-decrypted two-dimensional code is: carrying out image segmentation on the two-dimensional code to be encrypted, and removing at least one segmented image area from the two-dimensional code to be encrypted; the key associated with the elected decryption information is the same as the size of the removed at least one image area;
a decryption module 520, configured to mark that the to-be-decrypted two-dimensional code is valid and is decrypted successfully when it is determined that the key associated with the elected decryption information is the same as the true key of the to-be-decrypted two-dimensional code, where the true key is the removed at least one image area;
and when the key associated with the elected decryption information is determined to be different from the real key, marking the two-dimensional code to be decrypted as invalid.
By applying the embodiment of the invention, the elected decryption information associated with the two-dimensional code to be decrypted is received, and the two-dimensional code to be decrypted is as follows: carrying out image segmentation on the two-dimensional code to be encrypted, and removing at least one segmented image area from the two-dimensional code to be encrypted; when the two-dimensional code image associated with the selected decryption information is the same as the size of the removed at least one image area; when the key associated with the elected decryption information is determined to be the same as the real key of the two-dimensional code to be decrypted, marking the two-dimensional code to be decrypted as valid and successfully decrypting, and when the key associated with the elected decryption information is determined to be different from the real key, marking the two-dimensional code to be decrypted as invalid, wherein the real key is at least one removed image area. When the key associated with the elected decryption information is determined to be the same as the real key, the two-dimensional code to be decrypted is marked to be effective and the decryption is successful, and when the key associated with the elected decryption information is determined to be different from the real key, the two-dimensional code to be decrypted is marked to be invalid, so that the two-dimensional code to be decrypted cannot be decrypted any more, the safety of the two-dimensional code is improved to a certain extent, and the two-dimensional code is effectively prevented from being decrypted illegally to a certain extent.
In an implementation manner, the receiving module is further configured to receive a decryption request associated with the to-be-decrypted two-dimensional code, which is submitted by a user, before the receiving elected decryption information associated with the to-be-decrypted two-dimensional code;
a display module, configured to obtain and display candidate decryption information associated with the to-be-decrypted two-dimensional code according to the decryption request, where the candidate decryption information includes M candidate keys and the true key, and any one of the candidate keys is: and a two-dimensional code image different from the real key, wherein the candidate key has the same size as the removed at least one image area, and M is a positive integer.
In one implementation, the apparatus further comprises:
and the sending module is used for sending real decryption information when the user submitting the decryption request is determined to be a legal user after receiving the decryption request associated with the two-dimension code to be decrypted submitted by the user, wherein the real decryption information is used for indicating the real secret key.
Optionally, the apparatus further comprises:
and the clearing module is used for clearing the two-dimension code to be decrypted after the two-dimension code to be decrypted is marked to be invalid.
In one implementation, the decryption module 520 is specifically configured to
And when the times that the key associated with the elected decryption information and the real key are different, which are submitted by the same user, exceed a set threshold value, marking that the two-dimensional code to be decrypted is invalid.
In one implementation, the apparatus further comprises:
the updating module is used for updating the candidate decryption information when the number of times that the key associated with the elected decryption information submitted by the same user is different from the real key does not exceed a set threshold;
the display module is further configured to display the updated candidate decryption information.
In one implementation, the M candidate keys included in the candidate decryption information are: selecting a key from N candidate keys configured for the two-dimensional code to be decrypted in advance, wherein M is less than or equal to N, and N is a positive integer;
the update module is particularly for
Reconfiguring N candidate keys for the two-dimension code to be decrypted again, and updating the candidate decryption information based on the reconfigured candidate keys; alternatively, the first and second electrodes may be,
and reselecting M candidate keys from the N candidate keys, and updating the candidate decryption information according to the reselected M candidate keys.
Based on the same inventive concept, the two-dimensional code encryption device and the two-dimensional code decryption device in the above embodiments may be located in one electronic device at the same time, or may be located in different electronic devices.
Corresponding to the above method embodiment, an electronic device according to an embodiment of the present invention is further provided, as shown in fig. 6, and includes a processor 610, a communication interface 620, a memory 630, and a communication bus 640, where the processor 610, the communication interface 620, and the memory 630 complete communication with each other through the communication bus 640,
a memory 630 for storing computer programs;
the processor 610 is configured to implement any one of the two-dimensional code encryption methods provided in the embodiments of the present invention when executing the computer program stored in the memory 630, and the method includes the steps of:
acquiring a two-dimensional code to be encrypted;
carrying out image segmentation on the two-dimensional code to be encrypted;
removing the at least one divided image area from the two-dimensional code to be decrypted to obtain the two-dimensional code to be decrypted and a real key of the two-dimensional code to be decrypted, wherein the two-dimensional code to be decrypted is as follows: the image area of the two-dimensional code to be encrypted after the at least one image area is removed; the true key is: the at least one image region removed.
By applying the embodiment of the invention, in the encryption process of the two-dimensional code to be encrypted, the two-dimensional code to be encrypted is subjected to image segmentation, and at least one segmented image area is removed from the two-dimensional code to be encrypted to obtain the decrypted two-dimensional code and the real key of the two-dimensional code to be decrypted, wherein the two-dimensional code to be decrypted is the two-dimensional code without partial content and contains incomplete information. After the two-dimensional code to be decrypted is acquired by the user, when the user does not acquire the true key of the two-dimensional code to be decrypted, the user cannot decrypt to obtain the true information corresponding to the two-dimensional code to be decrypted, that is, cannot decrypt the two-dimensional code to be decrypted, that is, only the user who can acquire the true key of the two-dimensional code to be decrypted can complete the subsequent decryption of the two-dimensional code to be decrypted. The security of the two-dimensional code is improved to a certain extent, and the two-dimensional code is effectively prevented from being illegally decrypted.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
Corresponding to the above method embodiments, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements any one of the steps of the two-dimensional code encryption method provided in the embodiment of the present invention.
Corresponding to the above method embodiments, the embodiment of the present invention further provides an electronic device, as shown in fig. 7, including a processor 710, a communication interface 720, a memory 730, and a communication bus 740, where the processor 710, the communication interface 720, and the memory 730 communicate with each other through the communication bus 740,
a memory 730 for storing a computer program;
the processor 710 is configured to, when executing the computer program stored in the memory 730, implement any one of the two-dimensional code decryption methods provided in the embodiments of the present invention, and the method includes the steps of:
receiving elected decryption information associated with a to-be-decrypted two-dimensional code, wherein the to-be-decrypted two-dimensional code is as follows: carrying out image segmentation on the two-dimensional code to be encrypted, and removing at least one segmented image area from the two-dimensional code to be encrypted; the key associated with the elected decryption information is the same as the size of the removed at least one image area;
when the key associated with the elected decryption information is determined to be the same as the real key of the two-dimensional code to be decrypted, marking that the two-dimensional code to be decrypted is valid and is decrypted successfully, and when the key associated with the elected decryption information is determined to be different from the real key, marking that the two-dimensional code to be decrypted is invalid, wherein the real key is the removed at least one image area.
By applying the embodiment of the invention, the elected decryption information associated with the two-dimensional code to be decrypted is received, and the two-dimensional code to be decrypted is as follows: carrying out image segmentation on the two-dimensional code to be encrypted, and removing at least one segmented image area from the two-dimensional code to be encrypted; when the two-dimensional code image associated with the selected decryption information is the same as the size of the removed at least one image area; when the key associated with the elected decryption information is determined to be the same as the real key of the two-dimensional code to be decrypted, marking the two-dimensional code to be decrypted as valid and successfully decrypting, and when the key associated with the elected decryption information is determined to be different from the real key, marking the two-dimensional code to be decrypted as invalid, wherein the real key is at least one removed image area. When the key associated with the elected decryption information is determined to be the same as the real key, the two-dimensional code to be decrypted is marked to be effective and the decryption is successful, and when the key associated with the elected decryption information is determined to be different from the real key, the two-dimensional code to be decrypted is marked to be invalid, so that the two-dimensional code to be decrypted cannot be decrypted any more, the safety of the two-dimensional code is improved to a certain extent, and the two-dimensional code is effectively prevented from being decrypted illegally to a certain extent.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
Corresponding to the above method embodiments, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements any one of the two-dimensional code encryption method steps provided by the embodiment of the present invention:
acquiring a two-dimensional code to be encrypted;
carrying out image segmentation on the two-dimensional code to be encrypted;
removing the at least one divided image area from the two-dimensional code to be decrypted to obtain the two-dimensional code to be decrypted and a real key of the two-dimensional code to be decrypted, wherein the two-dimensional code to be decrypted is as follows: the image area of the two-dimensional code to be encrypted after the at least one image area is removed; the true key is: the at least one image region removed.
By applying the embodiment of the invention, in the encryption process of the two-dimensional code to be encrypted, the two-dimensional code to be encrypted is subjected to image segmentation, and at least one segmented image area is removed from the two-dimensional code to be encrypted to obtain the decrypted two-dimensional code and the real key of the two-dimensional code to be decrypted, wherein the two-dimensional code to be decrypted is the two-dimensional code without partial content and contains incomplete information. After the two-dimensional code to be decrypted is acquired by the user, when the user does not acquire the true key of the two-dimensional code to be decrypted, the user cannot decrypt to obtain the true information corresponding to the two-dimensional code to be decrypted, that is, cannot decrypt the two-dimensional code to be decrypted, that is, only the user who can acquire the true key of the two-dimensional code to be decrypted can complete the subsequent decryption of the two-dimensional code to be decrypted. The security of the two-dimensional code is improved to a certain extent, and the two-dimensional code is effectively prevented from being illegally decrypted.
Corresponding to the foregoing method embodiment, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements any one of the two-dimensional code decryption method steps provided in the embodiment of the present invention:
receiving elected decryption information associated with a to-be-decrypted two-dimensional code, wherein the to-be-decrypted two-dimensional code is as follows: carrying out image segmentation on the two-dimensional code to be encrypted, and removing at least one segmented image area from the two-dimensional code to be encrypted; the key associated with the elected decryption information is the same as the size of the removed at least one image area;
when the key associated with the elected decryption information is determined to be the same as the real key of the two-dimensional code to be decrypted, marking that the two-dimensional code to be decrypted is valid and is decrypted successfully, and when the key associated with the elected decryption information is determined to be different from the real key, marking that the two-dimensional code to be decrypted is invalid, wherein the real key is the removed at least one image area.
By applying the embodiment of the invention, the elected decryption information associated with the two-dimensional code to be decrypted is received, and the two-dimensional code to be decrypted is as follows: carrying out image segmentation on the two-dimensional code to be encrypted, and removing at least one segmented image area from the two-dimensional code to be encrypted; when the two-dimensional code image associated with the selected decryption information is the same as the size of the removed at least one image area; when the key associated with the elected decryption information is determined to be the same as the real key of the two-dimensional code to be decrypted, marking the two-dimensional code to be decrypted as valid and successfully decrypting, and when the key associated with the elected decryption information is determined to be different from the real key, marking the two-dimensional code to be decrypted as invalid, wherein the real key is at least one removed image area. When the key associated with the elected decryption information is determined to be the same as the real key, the two-dimensional code to be decrypted is marked to be effective and the decryption is successful, and when the key associated with the elected decryption information is determined to be different from the real key, the two-dimensional code to be decrypted is marked to be invalid, so that the two-dimensional code to be decrypted cannot be decrypted any more, the safety of the two-dimensional code is improved to a certain extent, and the two-dimensional code is effectively prevented from being decrypted illegally to a certain extent.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (20)

1. A two-dimensional code encryption method is characterized by comprising the following steps:
acquiring a two-dimensional code to be encrypted;
carrying out image segmentation on the two-dimensional code to be encrypted;
removing the at least one divided image area from the two-dimensional code to be decrypted to obtain the two-dimensional code to be decrypted and a real key of the two-dimensional code to be decrypted, wherein the two-dimensional code to be decrypted is as follows: the image area of the two-dimensional code to be encrypted after the at least one image area is removed; the true key is: the at least one image region removed;
the method further comprises the following steps:
configuring N candidate keys for the two-dimensional code to be decrypted, wherein any one of the candidate keys is a two-dimensional code image different from the real key, and the size of the candidate key is the same as that of the removed at least one image area;
generating candidate decryption information associated with the two-dimensional code to be decrypted according to the N candidate keys and the real key, wherein the candidate decryption information is used for: after a user submits a decryption request associated with the two-dimensional code to be decrypted, the decryption request is displayed to the user, and the candidate decryption information comprises: the true key and M of the N candidate keys, wherein M is less than or equal to N, and N and M are both positive integers;
the method further comprises the following steps:
generating real decryption information for providing to a legal user according to the position index information of the real key in the candidate decryption information, wherein the real decryption information is used for: indicating the true key to the legitimate user.
2. The method according to claim 1, wherein the step of performing image segmentation on the two-dimensional code to be encrypted comprises:
and dividing the two-dimensional code to be encrypted into a plurality of image areas according to a preset division size and a preset division starting position.
3. The method according to claim 1, wherein the step of configuring N candidate keys for the two-dimensional code to be decrypted includes:
and dividing the two-dimensional code to be decrypted into N sub-image areas, and taking the N sub-image areas as the candidate key.
4. A two-dimensional code decryption method is characterized by comprising the following steps:
receiving elected decryption information associated with a to-be-decrypted two-dimensional code, wherein the to-be-decrypted two-dimensional code is as follows: carrying out image segmentation on the two-dimensional code to be encrypted, and removing at least one segmented image area from the two-dimensional code to be encrypted; the key associated with the elected decryption information is the same as the size of the removed at least one image area;
when the key associated with the elected decryption information is determined to be the same as the real key of the two-dimensional code to be decrypted, marking the two-dimensional code to be decrypted as valid and successfully decrypted, and when the key associated with the elected decryption information is determined to be different from the real key, marking the two-dimensional code to be decrypted as invalid, wherein the real key is the removed at least one image area;
before the step of receiving elected decryption information associated with the two-dimensional code to be decrypted, the method further includes:
receiving a decryption request associated with the two-dimension code to be decrypted, which is submitted by a user;
according to the decryption request, candidate decryption information associated with the two-dimensional code to be decrypted is obtained and displayed, the candidate decryption information comprises M candidate keys and the real key, and any one of the candidate keys is: a two-dimensional code image different from the real key, wherein the candidate key has the same size as the removed at least one image area, and M is a positive integer;
after the step of receiving a decryption request associated with the two-dimensional code to be decrypted, which is submitted by a user, the method further includes:
when the user submitting the decryption request is determined to be a legal user, real decryption information is sent, and the real decryption information is used for indicating the real secret key;
wherein the real decryption information is generated according to the position index information of the real key in the candidate decryption information.
5. The method according to claim 4, wherein after the step of marking that the two-dimensional code to be decrypted is invalid, the method further comprises:
and clearing the two-dimension code to be decrypted.
6. The method of claim 4, wherein the step of marking the two-dimensional code to be decrypted invalid when the key associated with the elected decryption information is determined to be different from the true key comprises:
and when the times that the key associated with the elected decryption information and the real key are different, which are submitted by the same user, exceed a set threshold value, marking that the two-dimensional code to be decrypted is invalid.
7. The method according to any one of claims 4 to 6, further comprising:
and when the times of the key associated with the elected decryption information submitted by the same user and the real key are different do not exceed a set threshold value, updating the candidate decryption information, and displaying the updated candidate decryption information.
8. The method according to claim 7, wherein the candidate decryption information comprises M candidate keys: selecting a key from N candidate keys configured for the two-dimensional code to be decrypted in advance, wherein M is less than or equal to N, and N is a positive integer;
the step of updating the candidate decryption information comprises:
reconfiguring N candidate keys for the two-dimension code to be decrypted again, and updating the candidate decryption information based on the reconfigured candidate keys; alternatively, the first and second electrodes may be,
and reselecting M candidate keys from the N candidate keys, and updating the candidate decryption information according to the reselected M candidate keys.
9. A two-dimensional code encryption device, characterized in that the device comprises:
the acquisition module is used for acquiring the two-dimension code to be encrypted;
the segmentation module is used for carrying out image segmentation on the two-dimensional code to be encrypted;
the encryption module is used for removing the at least one divided image area from the two-dimensional code to be encrypted to obtain the two-dimensional code to be decrypted and a real key of the two-dimensional code to be decrypted, wherein the two-dimensional code to be decrypted is as follows: the image area of the two-dimensional code to be encrypted after the at least one image area is removed; the true key is: the at least one image region removed;
the device further comprises:
a configuration module, configured to configure N candidate keys for the to-be-decrypted two-dimensional code, where any one of the candidate keys is a two-dimensional code image different from the true key, and the candidate key is the same as the removed at least one image area in size;
a first generating module, configured to generate candidate decryption information associated with the to-be-decrypted two-dimensional code according to the N candidate keys and the true key, where the candidate decryption information is used to: after a user submits a decryption request associated with the two-dimensional code to be decrypted, the decryption request is displayed to the user, and the candidate decryption information comprises: the true key and M of the N candidate keys, wherein M is less than or equal to N, and N and M are both positive integers;
the device further comprises:
a second generating module, configured to generate, according to the position index information of the true key in the candidate decryption information, true decryption information for providing to a legitimate user, where the true decryption information is used to: indicating the true key to the legitimate user.
10. The apparatus according to claim 9, wherein the segmentation module is specifically configured to:
and dividing the two-dimensional code to be encrypted into a plurality of image areas according to a preset division size and a preset division starting position.
11. The device according to claim 9, characterized in that the configuration module is, in particular, for
And dividing the two-dimensional code to be decrypted into N sub-image areas, and taking the N sub-image areas as the candidate key.
12. A two-dimensional code decryption apparatus, characterized in that the apparatus comprises:
the receiving module is used for receiving the elected decryption information associated with the to-be-decrypted two-dimensional code, and the to-be-decrypted two-dimensional code is as follows: carrying out image segmentation on the two-dimensional code to be encrypted, and removing at least one segmented image area from the two-dimensional code to be encrypted; the key associated with the elected decryption information is the same as the size of the removed at least one image area;
the decryption module is used for marking the two-dimensional code to be decrypted to be effective and successfully decrypted when the key associated with the elected decryption information is determined to be the same as the real key of the two-dimensional code to be decrypted, wherein the real key is the removed at least one image area;
when the key associated with the elected decryption information is determined to be different from the real key, marking the two-dimensional code to be decrypted as invalid;
the receiving module is further configured to receive a decryption request associated with the to-be-decrypted two-dimensional code, which is submitted by a user, before the elected decryption information associated with the to-be-decrypted two-dimensional code is received;
a display module, configured to obtain and display candidate decryption information associated with the to-be-decrypted two-dimensional code according to the decryption request, where the candidate decryption information includes M candidate keys and the true key, and any one of the candidate keys is: a two-dimensional code image different from the real key, wherein the candidate key has the same size as the removed at least one image area, and M is a positive integer;
the device further comprises:
the sending module is used for sending real decryption information when a user submitting the decryption request is determined to be a legal user after receiving the decryption request associated with the two-dimension code to be decrypted submitted by the user, wherein the real decryption information is used for indicating the real secret key;
wherein the real decryption information is generated according to the position index information of the real key in the candidate decryption information.
13. The apparatus of claim 12, further comprising:
and the clearing module is used for clearing the two-dimension code to be decrypted after the two-dimension code to be decrypted is marked to be invalid.
14. The apparatus according to claim 12, wherein the decryption module is specifically configured to:
and when the times that the key associated with the elected decryption information and the real key are different, which are submitted by the same user, exceed a set threshold value, marking that the two-dimensional code to be decrypted is invalid.
15. The apparatus of any one of claims 12 to 14, further comprising:
the updating module is used for updating the candidate decryption information when the number of times that the key associated with the elected decryption information submitted by the same user is different from the real key does not exceed a set threshold;
the display module is further configured to display the updated candidate decryption information.
16. The apparatus according to claim 15, wherein the candidate decryption information comprises M candidate keys: selecting a key from N candidate keys configured for the two-dimensional code to be decrypted in advance, wherein M is less than or equal to N, and N is a positive integer;
the update module is particularly for
Reconfiguring N candidate keys for the two-dimension code to be decrypted again, and updating the candidate decryption information based on the reconfigured candidate keys; alternatively, the first and second electrodes may be,
and reselecting M candidate keys from the N candidate keys, and updating the candidate decryption information according to the reselected M candidate keys.
17. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the steps of the two-dimensional code encryption method according to any one of claims 1 to 3 when executing the computer program stored in the memory.
18. A computer-readable storage medium, in which a computer program is stored, which, when being executed by a processor, implements the two-dimensional code encryption method steps of any one of claims 1 to 3.
19. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the two-dimensional code decryption method steps of any one of claims 4 to 8 when executing the computer program stored in the memory.
20. A computer-readable storage medium, in which a computer program is stored, and the computer program is executed by a processor to implement the two-dimensional code decryption method steps of any one of claims 4 to 8.
CN201810607769.8A 2018-06-13 2018-06-13 Two-dimensional code encryption method and device and two-dimensional code decryption method and device Active CN110598421B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810607769.8A CN110598421B (en) 2018-06-13 2018-06-13 Two-dimensional code encryption method and device and two-dimensional code decryption method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810607769.8A CN110598421B (en) 2018-06-13 2018-06-13 Two-dimensional code encryption method and device and two-dimensional code decryption method and device

Publications (2)

Publication Number Publication Date
CN110598421A CN110598421A (en) 2019-12-20
CN110598421B true CN110598421B (en) 2021-10-15

Family

ID=68849517

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810607769.8A Active CN110598421B (en) 2018-06-13 2018-06-13 Two-dimensional code encryption method and device and two-dimensional code decryption method and device

Country Status (1)

Country Link
CN (1) CN110598421B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111582857A (en) * 2020-04-30 2020-08-25 中国工商银行股份有限公司 Two-dimensional code display method and device, electronic equipment and medium
CN112529586B (en) * 2020-12-15 2023-07-28 深圳市快付通金融网络科技服务有限公司 Transaction information management method, device, equipment and storage medium
CN113868618B (en) * 2021-09-03 2022-04-26 浙江创建科技有限公司 Multi-code collaborative fusion and authentication system based on multiple two-dimensional code standards

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102902997A (en) * 2012-09-21 2013-01-30 华南农业大学 Two-dimensional code hybrid coding and decoding device and method
CN105357008A (en) * 2014-08-22 2016-02-24 腾讯科技(深圳)有限公司 Identity verification method and device
CN106971114A (en) * 2017-03-31 2017-07-21 联想(北京)有限公司 A kind of method and device of image security

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100459495C (en) * 2004-08-01 2009-02-04 常志文 Password dynamic enciphering inputmethod of public emipering mode
JP2008117324A (en) * 2006-11-08 2008-05-22 Nec Corp Verification system, method therefor, data processing terminal using the same, and program
CN102270294A (en) * 2011-08-12 2011-12-07 华南农业大学 Bar code and two-dimension code hybrid coding and decoding methods and devices
CN104660561B (en) * 2013-11-21 2020-05-08 深圳市腾讯计算机系统有限公司 Identity verification method and device
CN105354501B (en) * 2015-10-28 2017-09-12 广东欧珀移动通信有限公司 The processing method and processing system of photo
CN105447375B (en) * 2015-11-09 2018-01-19 广东欧珀移动通信有限公司 A kind of method and electronic equipment of picture decryption
CN107133993A (en) * 2017-04-19 2017-09-05 珠海市魅族科技有限公司 A kind of image processing method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102902997A (en) * 2012-09-21 2013-01-30 华南农业大学 Two-dimensional code hybrid coding and decoding device and method
CN105357008A (en) * 2014-08-22 2016-02-24 腾讯科技(深圳)有限公司 Identity verification method and device
CN106971114A (en) * 2017-03-31 2017-07-21 联想(北京)有限公司 A kind of method and device of image security

Also Published As

Publication number Publication date
CN110598421A (en) 2019-12-20

Similar Documents

Publication Publication Date Title
US20220191012A1 (en) Methods For Splitting and Recovering Key, Program Product, Storage Medium, and System
CN110138744B (en) Method, device and system for replacing communication number, computer equipment and storage medium
US9769654B2 (en) Method of implementing a right over a content
CN110598421B (en) Two-dimensional code encryption method and device and two-dimensional code decryption method and device
CN104811428A (en) Method, device and system for verifying client identity by social relation data
CN109120395B (en) Tag data generation method, tag and data processing based on NFC tag
CN109145628B (en) Data acquisition method and system based on trusted execution environment
Wang et al. 2D barcodes for visual cryptography
CN107124279B (en) Method and device for erasing terminal data
CN108667784B (en) System and method for protecting internet identity card verification information
CN111741268B (en) Video transmission method, device, server, equipment and medium
CN111400745A (en) Picture management method and device and electronic equipment
CN106487758B (en) data security signature method, service terminal and private key backup server
CN108846277B (en) Reading control method, reading control equipment and computer storage medium
CN110414243B (en) Two-dimensional code encryption method and device and two-dimensional code decryption method and device
CN112307875A (en) Face verification method and face verification system
CN112347458A (en) Password resetting method and device, terminal equipment and server
TWI741413B (en) Fingerprint encryption method, fingerprint encryption transmission method, decryption method and device, storage medium, terminal
CN111127019B (en) Method, system and device for backing up mnemonic words
CN111984961A (en) Password resetting system, method, device, equipment and storage medium
CN110740112B (en) Authentication method, apparatus and computer readable storage medium
CN113422687A (en) Verification method, verification server and verification system
CN112464203A (en) Data format detection method based on intelligent password key application interface and electronic equipment
CN107959670B (en) Dynamic password generation method and device, terminal equipment and storage medium
CN112417424A (en) Authentication method and system for power terminal

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