CN110718004A - Unlocking method and device and storage medium - Google Patents

Unlocking method and device and storage medium Download PDF

Info

Publication number
CN110718004A
CN110718004A CN201910933095.5A CN201910933095A CN110718004A CN 110718004 A CN110718004 A CN 110718004A CN 201910933095 A CN201910933095 A CN 201910933095A CN 110718004 A CN110718004 A CN 110718004A
Authority
CN
China
Prior art keywords
timestamp
dimensional code
time
user information
ciphertext
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910933095.5A
Other languages
Chinese (zh)
Other versions
CN110718004B (en
Inventor
张鸿俊
黄后健
单超群
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Shenlan Vision Technology Co Ltd
Original Assignee
Shenzhen Shenlan Vision 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 Shenzhen Shenlan Vision Technology Co Ltd filed Critical Shenzhen Shenlan Vision Technology Co Ltd
Priority to CN201910933095.5A priority Critical patent/CN110718004B/en
Publication of CN110718004A publication Critical patent/CN110718004A/en
Application granted granted Critical
Publication of CN110718004B publication Critical patent/CN110718004B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07CTIME OR ATTENDANCE REGISTERS; REGISTERING OR INDICATING THE WORKING OF MACHINES; GENERATING RANDOM NUMBERS; VOTING OR LOTTERY APPARATUS; ARRANGEMENTS, SYSTEMS OR APPARATUS FOR CHECKING NOT PROVIDED FOR ELSEWHERE
    • G07C9/00Individual registration on entry or exit
    • G07C9/00174Electronically operated locks; Circuits therefor; Nonmechanical keys therefor, e.g. passive or active electrical keys or other data carriers without mechanical keys
    • G07C9/00182Electronically operated locks; Circuits therefor; Nonmechanical keys therefor, e.g. passive or active electrical keys or other data carriers without mechanical keys operated with unidirectional data transmission between data carrier and locks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14172D bar codes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0872Generation of secret information including derivation or calculation of cryptographic keys or passwords using geo-location information, e.g. location data, time, relative position or proximity to other entities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/14Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using a plurality of keys or algorithms
    • H04L9/16Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using a plurality of keys or algorithms the keys or algorithms being changed during operation
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07CTIME OR ATTENDANCE REGISTERS; REGISTERING OR INDICATING THE WORKING OF MACHINES; GENERATING RANDOM NUMBERS; VOTING OR LOTTERY APPARATUS; ARRANGEMENTS, SYSTEMS OR APPARATUS FOR CHECKING NOT PROVIDED FOR ELSEWHERE
    • G07C9/00Individual registration on entry or exit
    • G07C9/00174Electronically operated locks; Circuits therefor; Nonmechanical keys therefor, e.g. passive or active electrical keys or other data carriers without mechanical keys
    • G07C9/00182Electronically operated locks; Circuits therefor; Nonmechanical keys therefor, e.g. passive or active electrical keys or other data carriers without mechanical keys operated with unidirectional data transmission between data carrier and locks
    • G07C2009/00238Electronically operated locks; Circuits therefor; Nonmechanical keys therefor, e.g. passive or active electrical keys or other data carriers without mechanical keys operated with unidirectional data transmission between data carrier and locks the transmittted data signal containing a code which is changed
    • G07C2009/00246Electronically operated locks; Circuits therefor; Nonmechanical keys therefor, e.g. passive or active electrical keys or other data carriers without mechanical keys operated with unidirectional data transmission between data carrier and locks the transmittted data signal containing a code which is changed periodically, e.g. after a time period
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07CTIME OR ATTENDANCE REGISTERS; REGISTERING OR INDICATING THE WORKING OF MACHINES; GENERATING RANDOM NUMBERS; VOTING OR LOTTERY APPARATUS; ARRANGEMENTS, SYSTEMS OR APPARATUS FOR CHECKING NOT PROVIDED FOR ELSEWHERE
    • G07C2209/00Indexing scheme relating to groups G07C9/00 - G07C9/38
    • G07C2209/08With time considerations, e.g. temporary activation, valid time window or time limitations

Abstract

The application belongs to the technical field of intelligent unlocking, and provides an unlocking method, an unlocking device and a storage medium, wherein a dynamic two-dimensional code is acquired; the serial number of a new frame of two-dimensional code generated when the dynamic two-dimensional code is refreshed each time is updated, and the serial number of the new frame of two-dimensional code comprises a timestamp updated according to the current time; acquiring a key for decrypting the first ciphertext according to the first timestamp and decrypting to obtain user information; after the user information is verified to be legal, the current frame displayed by the dynamic two-dimensional code is collected again when the local time difference value is detected to be larger than a preset threshold value; detecting the newly acquired current frame to obtain a second sequence number, a second timestamp and a second ciphertext; and if the second serial number is different from the first serial number and the user information is verified to be legal, correcting the local time according to the time information corresponding to the second timestamp and unlocking. The embodiment of the application solves the problem that the door lock time needs to be corrected in a networking mode.

Description

Unlocking method and device and storage medium
Technical Field
The invention relates to the technical field of intelligent unlocking, in particular to an unlocking method, an unlocking device and a storage medium.
Background
In order to improve the safety of residential buildings in residential areas and the security of office buildings, door locks or access controls are usually installed at the entrance and exit of the buildings. And along with the development of science and technology nowadays, entrance guard or lock also are along with upgrading into smart machine. At present, the intelligent access control or door lock on the market mostly adopts a radio frequency card technology, a fingerprint technology, a face identification technology or a two-dimensional code identification technology. Compared with an intelligent door lock or door lock realized by other identification technologies, the intelligent door lock or door lock realized by the two-dimensional code identification technology has the advantages of low cost, more convenience in use and wider application.
The intelligent entrance guard or the lock that exist in the market at present need just can realize the system time calibration of intelligent entrance guard or lock through networking or user manual setting after using a period, and high in clouds networking function causes the manufacturing cost of intelligent lock to be on the high side, influences user experience.
Disclosure of Invention
In view of this, embodiments of the present invention provide an unlocking method, an unlocking device, and a storage medium, so as to solve the problem that the door lock time needs to be corrected through networking.
A first aspect of an embodiment of the present invention provides an unlocking method for acquiring a dynamic two-dimensional code, where the method includes:
detecting the collected current frame displayed by the dynamic two-dimensional code to obtain a first sequence number, a first timestamp and a first ciphertext; the sequence number of a new frame of two-dimensional code generated when the dynamic two-dimensional code is refreshed each time is updated, and the sequence number of the new frame of two-dimensional code comprises a timestamp updated according to the current time;
acquiring a key for decrypting the first ciphertext according to the first timestamp, and decrypting the first ciphertext to obtain user information;
if the user information is verified to be legal, calculating a time difference value between the time information corresponding to the first timestamp and local time;
if the time difference is larger than a preset threshold value, the current frame displayed by the dynamic two-dimensional code is collected again;
detecting the newly acquired current frame to obtain a second sequence number, a second timestamp and a second ciphertext;
acquiring a key for decrypting the second ciphertext according to the second timestamp, and decrypting the second ciphertext to obtain the user information;
and if the second serial number is different from the first serial number and the user information is verified to be legal, correcting local time according to the time information corresponding to the second timestamp and unlocking.
In an implementation example, before calculating a time difference between the time information corresponding to the first timestamp and a local time if the user information is verified to be legal, the method further includes:
recording the user information in a first information list, and judging whether the data recorded in the first information list is complete or not;
and if the current frame is not complete, the current frame displayed by the dynamic two-dimensional code is collected again and detected, and a first sequence number, a first timestamp and a first ciphertext are obtained.
In an implementation example, before correcting the local time according to the time information corresponding to the second timestamp and unlocking if the second sequence number is different from the first sequence number and the user information is verified to be legal, the method includes:
recording the user information in a second information list, and judging whether the data recorded in the second information list is complete or not; the user information comprises a user name or a password;
and if the current display frame of the dynamic two-dimensional code is not complete, the current display frame of the dynamic two-dimensional code is collected again and detected, and a second sequence number, a second timestamp and a second ciphertext are obtained.
In an implementation example, if it is verified that the user information is valid, calculating a time difference between the time information corresponding to the first timestamp and a local time includes:
and if the user information of the first information list is verified to be legal, calculating the time difference between the time information corresponding to the first timestamp and the local time.
In an implementation example, if the second sequence number is different from the first sequence number and the user information is verified to be legal, correcting the local time according to the time information corresponding to the second timestamp and unlocking the local time includes:
and if the second sequence number is different from the first sequence number and the user information of the second information list is verified to be legal, correcting the local time according to the time information corresponding to the second timestamp and unlocking.
In an implementation example, after calculating a time difference between the time information corresponding to the first timestamp and a local time if the user information is verified to be legal, the method includes:
and if the time difference is smaller than a preset threshold value, unlocking.
A second aspect of the embodiments of the present invention provides an unlocking device for acquiring a dynamic two-dimensional code, where the unlocking device includes:
the first detection module is used for detecting the collected current frame displayed by the dynamic two-dimensional code to obtain a first serial number, a first timestamp and a first ciphertext; the sequence number of a new frame of two-dimensional code generated when the dynamic two-dimensional code is refreshed each time is updated, and the sequence number of the new frame of two-dimensional code comprises a timestamp updated according to the current time;
the first decryption module is used for acquiring a key for decrypting the first ciphertext according to the first timestamp and decrypting the first ciphertext to obtain user information;
the time difference value calculating module is used for calculating the time difference value between the time information corresponding to the first timestamp and the local time if the user information is verified to be legal;
the re-acquisition module is used for re-acquiring the current frame displayed by the dynamic two-dimensional code if the time difference value is greater than a preset threshold value;
the second detection module is used for detecting the newly acquired current frame to obtain a second sequence number, a second timestamp and a second ciphertext;
the second decryption module is used for acquiring a key for decrypting the second ciphertext according to the second timestamp and decrypting the second ciphertext to obtain the user information;
and the time correction and unlocking module is used for correcting the local time and unlocking according to the time information corresponding to the second timestamp if the second serial number is different from the first serial number and the user information is verified to be legal.
A fifth aspect of an embodiment of the present invention provides an unlocking system, including: a smart device and an unlocking device; wherein the content of the first and second substances,
the unlocking device collects the dynamic two-dimensional code generated by the intelligent device and executes the unlocking method in the first aspect.
A third aspect of embodiments of the present invention provides a computer-readable storage medium, which stores a computer program that, when executed by a processor, implements the steps of the method of the first aspect.
A fourth aspect of the embodiments of the present invention provides an intelligent door lock, including: a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the unlocking method of the first aspect when executing the computer program.
According to the unlocking method, the unlocking device and the storage medium provided by the embodiment of the invention, the first sequence number, the first timestamp and the first ciphertext are obtained by detecting the collected current frame displayed by the dynamic two-dimensional code; the sequence number of a new frame of two-dimensional code generated when the dynamic two-dimensional code is refreshed each time is updated, and the sequence number of the new frame of two-dimensional code comprises a timestamp updated according to the current time; acquiring a key for decrypting the first ciphertext according to the first timestamp, and decrypting the first ciphertext to obtain user information; if the user information is verified to be legal, calculating a time difference value between the time information corresponding to the first timestamp and local time; if the time difference is larger than a preset threshold value, the current frame displayed by the dynamic two-dimensional code is collected again; detecting the newly acquired current frame to obtain a second sequence number, a second timestamp and a second ciphertext; acquiring a key for decrypting the second ciphertext according to the second timestamp, and decrypting the second ciphertext to obtain the user information; and if the second serial number is different from the first serial number and the user information is verified to be legal, correcting local time according to the time information corresponding to the second timestamp and unlocking. The generated dynamic two-dimensional code has different timestamps carried by the two-dimensional code image which is refreshed and displayed every frame. And when the local time difference value is detected to be larger than the preset threshold value, the current frame displayed by the dynamic two-dimensional code is re-collected again, and when the second sequence number of the re-collected two-dimensional code is different from the first sequence number and the user information carried by the two-dimensional code is verified to be legal, the local time is corrected and unlocked by detecting the time of the second timestamp obtained by the re-collected two-dimensional code. Additional setting or networking synchronization is not needed, and the user experience is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed for the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a schematic flowchart of an unlocking method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of an unlocking method according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of an unlocking device provided in the third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an intelligent door lock according to a sixth embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood by those skilled in the art, the technical solutions in the embodiments of the present invention will be clearly described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some embodiments of the present invention, but not all 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.
The terms "comprises" and "comprising," and any variations thereof, in the description and claims of this invention and the above-described drawings are intended to cover non-exclusive inclusions. For example, a process, method, or system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus. Furthermore, the terms "first," "second," and "third," etc. are used to distinguish between different objects and are not used to describe a particular order.
Example one
Fig. 1 is a schematic flowchart of an unlocking method according to an embodiment of the present invention. The embodiment provides a method for acquiring a dynamic two-dimensional code and unlocking according to the acquired dynamic two-dimensional code. The unlocking method can be applied to an application scene of unlocking by an unlocking device, and the unlocking device can be an intelligent access control device or an intelligent door lock and the like; in the embodiment of the present invention, an unlocking device is used as an execution main body for description, and the method specifically includes the following steps:
s110, detecting the collected current frame displayed by the dynamic two-dimensional code to obtain a first sequence number, a first timestamp and a first ciphertext;
the unlocking device can acquire the current frame displayed by the dynamic two-dimensional code through infrared scanning. And detecting the current frame displayed by the acquired dynamic two-dimensional code to obtain a first sequence number, a first timestamp and a first ciphertext contained in the current frame two-dimensional code image. The sequence number of a new frame of two-dimensional code generated when the acquired dynamic two-dimensional code is refreshed each time is updated, and the sequence number comprises a timestamp updated according to the current time. Specifically, the unlocking device may collect a dynamic two-dimensional code generated by the intelligent device. The method for generating the dynamic two-dimensional code may be: acquiring current time information at a preset refreshing frequency to generate a timestamp; when each timestamp is generated, determining a key for encrypting user information from a key pool according to the latest generated timestamp; encrypting the user information by adopting the determined key to generate a ciphertext; generating a new frame of two-dimensional code image according to the timestamp and the ciphertext; and updating the displayed image information into the new frame of two-dimensional code image so as to update the sequence number of the new frame of two-dimensional code generated when the dynamic two-dimensional code is refreshed each time and include the timestamp updated according to the current time.
S120, acquiring a key for decrypting the first ciphertext according to the first timestamp, and decrypting the first ciphertext to obtain user information;
in order to decrypt the first ciphertext in the current frame of the dynamic two-dimensional code, the unlocking device and the intelligent device for generating the dynamic two-dimensional code need to share the same key pool, and the key pool is a preset key pool special for encrypting user information data. When the intelligent device generates the ciphertext contained in each frame of two-dimensional code image in the dynamic two-dimensional code, the ciphertext can be generated by encrypting the cipher key selected from the cipher key pool according to the timestamp contained in the same two-dimensional code image. The key pool of the unlocking device may be stored in a storage module of the unlocking device. In order to decrypt the ciphertext and extract the user information in the ciphertext, a key for decrypting the first ciphertext is also acquired from a key pool according to a first timestamp obtained by detecting a current frame displayed by the dynamic two-dimensional code, and the first ciphertext is decrypted according to the key to obtain the user information.
In an implementation example, since the time stamp included in the two-dimensional code image is subjected to encryption processing, before the key for decrypting the first ciphertext is acquired according to the first time stamp, standard decryption processing needs to be performed on the first time stamp to obtain a plaintext of the first time stamp, and the key for decrypting the first ciphertext is acquired according to the plaintext of the first time stamp.
The specific process of obtaining the key for decrypting the first ciphertext from the key pool according to the first timestamp may be: and linearly selecting a key corresponding to the first timestamp from the key pool according to a preset rule. In one embodiment, the preset rule may be to select a key corresponding to the first timestamp from a key pool according to the data parity of the first timestamp. Specifically, if there are 2 groups of keys (keys) in the preset key pool, key 1: 1357, preparing a mixture; key2: 2468. When the data of the first timestamp is an even number, selecting a key2 from the key pool as a key for decrypting the first ciphertext according to a preset rule; and when the data of the first timestamp is odd, selecting the key1 from the key pool as a key for decrypting the first ciphertext according to a preset rule.
In another embodiment, the preset rule may be to select a key corresponding to the first timestamp from the key pool according to a correspondence relationship between a last digit of the first timestamp data and the key in the key pool. Alternatively, the correspondence between the last digit of the first timestamp data and the key in the key pool may be that the last digit of the first timestamp data corresponds to the key numbered as that digit. And acquiring a key for decrypting the first ciphertext according to the first time stamp and decrypting the first ciphertext according to the key to obtain the user information.
For example, if there are 10 groups of keys (keys) in the preset key pool:
key1:11111111;
key2:22222222;
key3:33333333;
key4:44444444;
key5:55555555;
key6:66666666;
key7:77777777;
key8:88888888;
key9:99999999;
key0:00000000;
when the last digit of the first timestamp data is '1', selecting a key1 from the key pool as a key for decrypting the first ciphertext according to a preset rule; when the last number of the first timestamp data is '2', selecting a key2 from the key pool as a key for decrypting the first ciphertext according to a preset rule; and by analogy, when the last digit of the first timestamp data is other digits, selecting a corresponding key from the key pool according to a preset rule as a key for decrypting the first ciphertext.
S130, if the user information is verified to be legal, calculating a time difference value between the time information corresponding to the first timestamp and local time;
the unlocking device can judge whether to unlock or not by verifying whether the user identity is legal or not. Specifically, the unlocking device judges whether user information contained in a first ciphertext obtained by a current frame displayed by the acquired dynamic two-dimensional code is legal or not, and user identity verification is achieved. The storage module in the unlocking device can store user information data with legal identity, when the user information obtained by decrypting the first ciphertext is judged to be legal, whether data which are consistent with the user information obtained by decrypting the first ciphertext exist or not can be searched in the locally stored user information data, and if the consistent data exist, the user information obtained by decrypting the first ciphertext can be verified to be legal; if no consistent data exists, the user information obtained by decrypting the first ciphertext can be verified to be illegal.
When the user information obtained by decrypting the first ciphertext is verified to be illegal, the unlocking device collects the dynamic two-dimensional code again to obtain a new frame of current frame displayed by the dynamic two-dimensional code as the image of the dynamic two-dimensional code is refreshed at the preset frequency, the step 110 and the step 120 are executed again, and then whether the user information obtained by decrypting the first ciphertext is legal or not is judged again.
And when the user information obtained by decrypting the first ciphertext is verified to be legal, the unlocking device calculates the time difference between the time information and the local time or the system time of the unlocking device according to the time information corresponding to the first time stamp. And judging whether the local time or the system time of the unlocking device is accurate or not by judging whether the time difference value exceeds a preset threshold value or not. In one embodiment, if the time difference does not exceed the preset threshold, it is determined that the local time or the system time of the unlocking device is accurate in time within the error tolerance range, and the unlocking device controls the door lock or other lock to unlock.
S140, if the time difference value is larger than a preset threshold value, the current frame displayed by the dynamic two-dimensional code is collected again;
and if the time difference between the time information corresponding to the first timestamp and the local time or the system time of the unlocking device is greater than a preset threshold value, determining that the local time or the system time of the unlocking device has time delay. At the moment, the unlocking device collects the current frame displayed by the new frame of dynamic two-dimensional code again and records the first sequence number so as to correct the time of the unlocking device. Wherein the preset threshold is an allowable maximum time error value.
S150, detecting the newly collected current frame to obtain a second sequence number, a second timestamp and a second ciphertext;
and when the time difference value is judged to be larger than the preset threshold value, the unlocking device acquires the current frame displayed by the new frame of dynamic two-dimensional code again, and then detects the acquired current frame to obtain a second sequence number, a second timestamp and a second ciphertext.
S160, acquiring a key for decrypting the second ciphertext according to the second timestamp, and decrypting the second ciphertext to obtain the user information;
in order to decrypt the ciphertext and extract the user information in the ciphertext, a key for decrypting the second ciphertext can be obtained from the key pool according to a second timestamp obtained by detecting the current frame displayed by the newly acquired dynamic two-dimensional code, and the second ciphertext is decrypted according to the key to obtain the user information.
In an implementation example, since the time stamp included in the two-dimensional code image is subjected to the encryption processing, before the key for decrypting the second ciphertext is obtained according to the second time stamp, the second time stamp needs to be subjected to standard decryption processing to obtain the plaintext of the second time stamp, and the key for decrypting the second ciphertext is obtained according to the plaintext of the second time stamp.
The method for obtaining the key for decrypting the second ciphertext from the key pool according to the second timestamp is the same as the method for obtaining the key for decrypting the first ciphertext from the key pool according to the first timestamp, and the key corresponding to the second timestamp can be linearly selected from the key pool according to a preset rule. In one embodiment, the preset rule may be to select a key corresponding to the second timestamp from a key pool according to the data parity of the second timestamp. Specifically, if there are 2 groups of keys (keys) in the preset key pool, key 1: 1357, preparing a mixture; key2: 2468. When the data of the second timestamp is an even number, selecting key2 from the key pool as a key for decrypting the second ciphertext according to a preset rule; and when the data of the second timestamp is odd, selecting the key1 from the key pool as a key for decrypting the second ciphertext according to a preset rule. In another embodiment, the preset rule may be to select a key corresponding to the timestamp from the key pool according to a correspondence relationship between the last digit of the second timestamp data and the key in the key pool. Alternatively, the last digit of the second timestamp data may correspond to a key in the key pool such that the last digit of the second timestamp data corresponds to the key numbered as that digit. And acquiring a key for decrypting the second ciphertext according to the second time stamp and decrypting the second ciphertext according to the key to obtain the user information.
S170, if the second serial number is different from the first serial number and the user information is verified to be legal, correcting local time according to the time information corresponding to the second timestamp and unlocking.
The unlocking device needs to perform time correction by acquiring time information contained in a new frame of current frame displayed after the dynamic two-dimensional code is refreshed, and needs to detect whether the newly acquired current frame displayed by the dynamic two-dimensional code is a two-dimensional code image displayed after the dynamic two-dimensional code is refreshed. According to the characteristic that the sequence number of the two-dimensional code image displayed after each refreshing in the collected dynamic two-dimensional code can change, whether the newly collected current frame is a new two-dimensional code image displayed after the refreshing of the dynamic two-dimensional code can be judged by verifying whether the second sequence number of the current frame displayed by the newly collected dynamic two-dimensional code is different from the recorded first sequence number.
In an embodiment, if the second serial number is the same as the recorded first serial number, it may be determined that the dynamic two-dimensional code still does not refresh a new frame of two-dimensional code image, and the unlocking device continues to reacquire the current frame displayed by the dynamic two-dimensional code.
In an implementation example, if the second serial number is different from the recorded first serial number, it may be determined that the current frame displayed by the dynamic two-dimensional code acquired again by the unlocking device is a two-dimensional code image displayed after the dynamic two-dimensional code is refreshed. In the verification process, the situation that the user uses different dynamic two-dimensional codes for verification may exist, and the unlocking device needs to verify the user information in the second ciphertext contained in the newly acquired current frame again, so that the unlocking error rate is reduced. Specifically, the unlocking device collects the dynamic two-dimensional code again to obtain a new frame of current frame displayed by the dynamic two-dimensional code, and re-executes step 150 and step 160, and then re-determines whether the second sequence number is different from the recorded first sequence number.
Specifically, after the second serial number is judged to be different from the recorded first serial number, the unlocking device judges whether user information contained in a second ciphertext obtained by detecting the current frame displayed by the newly acquired dynamic two-dimensional code is legal or not, and user identity verification is achieved. The storage module in the unlocking device can store user information data with legal identity, when the user information obtained by decrypting the second ciphertext is judged to be legal, whether data which are consistent with the user information obtained by decrypting the second ciphertext exist or not can be searched in the locally stored user information data, and if the consistent data exist, the user information obtained by decrypting the second ciphertext can be verified to be legal; if no consistent data exists, the user information obtained by decrypting the second ciphertext can be verified to be illegal.
When the user information obtained by decrypting the second ciphertext is verified to be illegal, the unlocking device acquires the dynamic two-dimensional code again to obtain a new frame of current frame displayed by the dynamic two-dimensional code because the image of the dynamic two-dimensional code is refreshed at the preset frequency, and the steps 150 and 160 are executed again, and then whether the second sequence number is different from the recorded first sequence number or not and whether the user information obtained by decrypting the second ciphertext is legal or not are judged again.
When the user information obtained by decrypting the second ciphertext is verified to be legal, the unlocking device corrects the local time or the system time of the unlocking device according to the time information corresponding to the second timestamp, and the unlocking device controls the door lock or other latches to unlock.
According to the unlocking method provided by the embodiment of the invention, a first sequence number, a first timestamp and a first ciphertext are obtained by detecting the current frame displayed by the acquired dynamic two-dimensional code; the sequence number of a new frame of two-dimensional code generated when the dynamic two-dimensional code is refreshed each time is updated, and the sequence number of the new frame of two-dimensional code comprises a timestamp updated according to the current time; acquiring a key for decrypting the first ciphertext according to the first timestamp, and decrypting the first ciphertext to obtain user information; if the user information is verified to be legal, calculating a time difference value between the time information corresponding to the first timestamp and local time; if the time difference is larger than a preset threshold value, the current frame displayed by the dynamic two-dimensional code is collected again; detecting the newly acquired current frame to obtain a second sequence number, a second timestamp and a second ciphertext; acquiring a key for decrypting the second ciphertext according to the second timestamp, and decrypting the second ciphertext to obtain the user information; and if the second serial number is different from the first serial number and the user information is verified to be legal, correcting local time according to the time information corresponding to the second timestamp and unlocking. The generated dynamic two-dimensional code has different timestamps carried by the two-dimensional code image which is refreshed and displayed every frame. And when the local time difference value is detected to be larger than the preset threshold value, the current frame displayed by the dynamic two-dimensional code is re-collected again, and when the second sequence number of the re-collected two-dimensional code is different from the first sequence number and the user information carried by the two-dimensional code is verified to be legal, the local time is corrected and unlocked by detecting the time of the second timestamp obtained by the re-collected two-dimensional code. Additional setting or networking synchronization is not needed, and the user experience is improved.
Example two
Fig. 2 is a schematic flowchart of an unlocking method according to a second embodiment of the present invention. On the basis of the first embodiment, the present embodiment further provides a process of unlocking according to different user information contained in each frame of two-dimensional code image refreshed by the dynamic two-dimensional code, so that time consumed for unlocking is reduced. The method specifically comprises the following steps:
s201, detecting the collected current frame displayed by the dynamic two-dimensional code to obtain a first sequence number, a first timestamp and a first ciphertext;
the unlocking device can acquire the current frame displayed by the dynamic two-dimensional code through infrared scanning. And detecting the current frame displayed by the acquired dynamic two-dimensional code to obtain a first sequence number, a first timestamp and a first ciphertext contained in the current frame two-dimensional code image.
S202, acquiring a key for decrypting the first ciphertext according to the first timestamp, and decrypting the first ciphertext to obtain user information;
in order to decrypt the first ciphertext in the current frame of the dynamic two-dimensional code, the unlocking device and the intelligent device for generating the dynamic two-dimensional code need to share the same key pool, and the key pool is a preset key pool special for encrypting user information data. When the intelligent device generates the ciphertext contained in each frame of two-dimensional code image in the dynamic two-dimensional code, the ciphertext can be generated by encrypting the cipher key selected from the cipher key pool according to the timestamp contained in the same two-dimensional code image. The key pool of the unlocking device may be stored in a storage module of the unlocking device. In order to decrypt the ciphertext and extract the user information in the ciphertext, a key for decrypting the first ciphertext is also acquired from a key pool according to a first timestamp obtained by detecting a current frame displayed by the dynamic two-dimensional code, and the first ciphertext is decrypted according to the key to obtain the user information.
S203, recording the user information in a first information list, and judging whether the data recorded in the first information list is complete;
each frame of the two-dimensional code image due to dynamic two-dimensional code refresh may contain different user information. Specifically, the user information to be carried by the two-dimensional code may be split into multiple sub-data including different information, and an encryption cycle sequence of each sub-data may be preset. When a new frame of two-dimensional code image refreshed by the dynamic two-dimensional code is generated, corresponding user information subdata is selected according to the encryption sequence for encryption, so that each frame of two-dimensional code image displayed after the dynamic two-dimensional code is refreshed comprises different user information subdata.
After the unlocking device decrypts the first ciphertext to obtain the user information, the obtained user information can be recorded in the first information list. Whether the data is complete or not is judged by comparing the data recorded in the first information list with preset required user data, and whether the user information contained in the current frame displayed by the acquired dynamic two-dimensional code is user information subdata or complete user information is known.
S204, if the current frame displayed by the dynamic two-dimensional code is incomplete, re-collecting and detecting the current frame displayed by the dynamic two-dimensional code to obtain a first sequence number, a first timestamp and a first ciphertext;
when the data recorded in the first information list is judged to be incomplete, the user information contained in the current frame displayed by the acquired dynamic two-dimensional code is known to be the user information subdata. The unlocking device also needs to acquire a new frame of current frame displayed by the dynamic two-dimensional code again, detect the acquired current frame to obtain the first sequence number, the first timestamp and the first ciphertext, and then execute the steps 201 to 203 again until the complete user information is acquired and recorded in the first information list.
For example, if the user information includes: the user name (admin) and the user password (123456) are used as the sub-data, and the dynamic two-dimensional code is refreshed and displayed at the preset refreshing frequency of 300 ms. The display effect is as follows:
the two-dimensional code displayed in the first frame comprises the following data content: a user name, a timestamp and a two-dimensional code serial number;
example (c): admin-0-1
The second frame displays the two-dimensional code and comprises the following data content: a user password, a timestamp and a two-dimensional code serial number;
example (c): 123456-300-2
The third frame displays that the two-dimensional code contains data content: a user name, a timestamp and a two-dimensional code serial number;
example (c): admin-600-3
The fourth frame displays that the two-dimensional code contains data content: a user password, a timestamp and a two-dimensional code serial number;
example (c): 123456-900-4
……
The unlocking device can acquire complete user information data for the first time and record the data in the first information list after continuously scanning the 1 st and 2 nd continuous frames.
S205, if the user information of the first information list is verified to be legal, calculating a time difference value between the time information corresponding to the first timestamp and local time;
when the data recorded in the first information list is judged to be complete, the user information contained in the current frame displayed by the acquired dynamic two-dimensional code can be known to be complete, or the required user information is completely acquired after the current frame displayed by the dynamic two-dimensional code is acquired again for multiple times, and the unlocking device carries out validity check on the user information in the first information list. If the user information in the first information list is verified to be illegal, the unlocking device collects the dynamic two-dimensional code again to obtain a new frame of current frame displayed by the dynamic two-dimensional code as the image of the dynamic two-dimensional code is refreshed at the preset frequency, and the steps 201 to 203 are executed again.
And if the user information of the first information list is verified to be legal, calculating the time difference between the time information corresponding to the first timestamp and the local time or the system time of the unlocking device by adopting the first timestamp contained in the current frame of the acquired dynamic two-dimensional code. And judging whether the local time or the system time of the unlocking device is accurate or not by judging whether the time difference value exceeds a preset threshold value or not. In one embodiment, if the time difference does not exceed the preset threshold, it is determined that the local time or the system time of the unlocking device is accurate in time within the error tolerance range, and the unlocking device controls the door lock or other lock to unlock.
S206, if the time difference value is larger than a preset threshold value, re-collecting the current frame displayed by the dynamic two-dimensional code;
and if the time difference between the time information corresponding to the first timestamp and the local time or the system time of the unlocking device is greater than a preset threshold value, determining that the local time or the system time of the unlocking device has time delay. At the moment, the unlocking device collects the current frame displayed by the new frame of dynamic two-dimensional code again and records the first sequence number so as to correct the time of the unlocking device. Wherein the preset threshold is an allowable maximum time error value.
S207, detecting the newly collected current frame to obtain a second sequence number, a second timestamp and a second ciphertext;
s208, acquiring a key for decrypting the second ciphertext according to the second timestamp, and decrypting the second ciphertext to obtain the user information;
s209, recording the user information in a second information list, and judging whether the data recorded in the second information list is complete; the user information comprises a user name or a password;
the unlocking device needs to perform time correction by acquiring time information contained in a new frame of current frame displayed after the dynamic two-dimensional code is refreshed, and user identity authentication can be performed only when required user information is completely acquired. After the unlocking device decrypts the second ciphertext to obtain the user information, the obtained user information can be recorded in the second information list. Whether the data is complete or not is judged by comparing the data recorded in the second information list with preset required user data, and whether the user information contained in the current frame displayed by the newly collected dynamic two-dimensional code is sub-data of the user information or complete user information is known. The user information may include a user name or password, among others.
S210, if the current display frame of the dynamic two-dimensional code is incomplete, re-collecting and detecting the current display frame of the dynamic two-dimensional code to obtain a second sequence number, a second timestamp and a second ciphertext;
when the data recorded in the second information list is judged to be incomplete, the user information contained in the current frame displayed by the acquired dynamic two-dimensional code is known to be the user information subdata. The unlocking device also needs to reacquire a new frame of current frame displayed by the dynamic two-dimensional code, detect the reacquired current frame to obtain a second sequence number, a second timestamp and a second ciphertext, and then re-execute the steps 208 to 209 until the complete user information is acquired and recorded in the first information list.
S211, if the second serial number is different from the first serial number and the user information of the second information list is verified to be legal, correcting the local time according to the time information corresponding to the second timestamp and unlocking.
When the data recorded in the second information list is judged to be complete, it can be known that the user information contained in the current frame displayed by the dynamic two-dimensional code collected again is complete user information, or the required user information is completely collected after the current frame displayed by the dynamic two-dimensional code is collected again for multiple times.
The unlocking device needs to perform time correction by acquiring time information contained in a new frame of current frame displayed after the dynamic two-dimensional code is refreshed, and needs to detect whether the newly acquired current frame displayed by the dynamic two-dimensional code is a two-dimensional code image displayed after the dynamic two-dimensional code is refreshed. According to the characteristic that the serial number of the two-dimensional code image displayed after each refreshing in the dynamic two-dimensional code can change, after the data recorded in the second information list is judged to be complete, whether the second serial number of the current frame displayed by the acquired dynamic two-dimensional code is different from the recorded first serial number or not can be verified, and whether the current frame acquired at this time is a new frame of two-dimensional code image displayed after the refreshing of the dynamic two-dimensional code or not can be judged.
In an embodiment, if the second serial number is the same as the recorded first serial number, it may be determined that the dynamic two-dimensional code still does not refresh a new frame of two-dimensional code image, and the unlocking device continues to reacquire the current frame displayed by the dynamic two-dimensional code.
In an implementation example, if the second serial number is different from the recorded first serial number, it may be determined that the current frame displayed by the dynamic two-dimensional code acquired again by the unlocking device is a two-dimensional code image displayed after the dynamic two-dimensional code is refreshed. In the verification process, the situation that the user uses different dynamic two-dimensional codes for verification may exist, and the unlocking device needs to verify the user information in the second ciphertext contained in the newly acquired current frame again, so that the unlocking error rate is reduced. Specifically, the unlocking device collects the dynamic two-dimensional code again to obtain a new frame of current frame displayed by the dynamic two-dimensional code, and re-executes step 207 to step 210, and then re-determines whether the second sequence number is different from the recorded first sequence number.
Specifically, after the second serial number is judged to be different from the recorded first serial number, the unlocking device judges whether the user information of the second information list is detected to be legal or not, and user identity authentication is achieved. The storage module in the unlocking device can store user information data with legal identity, when the user information of the second information list is judged to be legal, whether data which are consistent with the user information of the second information list exist or not can be searched in the locally stored user information data, and if the consistent data exist, the user information of the second information list can be verified to be legal; if no consistent data exists, the user information of the second information list may be verified as being illegal.
When the user information of the second information list is verified to be illegal, the unlocking device collects the dynamic two-dimensional code again to obtain a new frame of current frame displayed by the dynamic two-dimensional code because the image of the dynamic two-dimensional code is refreshed at the preset frequency, and the steps 207 to 210 are executed again, and then whether the second serial number is different from the recorded first serial number and whether the user information of the second information list is legal or not is judged again.
When the user information of the second information list is verified to be legal, the unlocking device corrects the local time or the system time of the unlocking device according to the time information corresponding to the second timestamp, and the unlocking device controls the door lock or other latches to unlock. The current frame displayed by the acquired dynamic two-dimensional code is rapidly identified for many times so as to acquire complete user information, and the problem that the identification time of the unlocking device is too long when the two-dimensional code image contains too much complex information is solved.
EXAMPLE III
Fig. 3 shows an unlocking device according to a third embodiment of the present invention. On the basis of the first or second embodiment, the embodiment of the present invention further provides an unlocking device 3, including:
the first detection module 301 is configured to detect a current frame displayed by the acquired dynamic two-dimensional code, and obtain a first sequence number, a first timestamp, and a first ciphertext; the sequence number of a new frame of two-dimensional code generated when the dynamic two-dimensional code is refreshed each time is updated, and the sequence number of the new frame of two-dimensional code comprises a timestamp updated according to the current time;
a first decryption module 302, configured to obtain a key for decrypting the first ciphertext according to the first timestamp, and decrypt the first ciphertext to obtain user information;
in an implementation example, before calculating a time difference between the time information corresponding to the first timestamp and a local time if the user information is verified to be legitimate, the apparatus further includes:
the first data judgment module is used for recording the user information in a first information list and judging whether the data recorded in the first information list is complete or not;
and the first acquisition module is used for re-acquiring and detecting the current frame displayed by the dynamic two-dimensional code to obtain a first sequence number, a first timestamp and a first ciphertext if the data recorded in the first information list is incomplete.
A time difference calculation module 303, configured to calculate a time difference between the time information corresponding to the first timestamp and local time if it is verified that the user information is valid;
in an implementation example, if it is verified that the user information is legal, the time difference between the time information corresponding to the first timestamp and the local time is calculated, and the time difference calculating module 303 includes:
and the time difference value calculating unit is used for calculating the time difference value between the time information corresponding to the first timestamp and the local time if the user information of the first information list is verified to be legal.
A reacquiring module 304, configured to reacquire the current frame displayed by the dynamic two-dimensional code if the time difference is greater than a preset threshold;
a second detection module 305, configured to detect the reacquired current frame to obtain a second sequence number, a second timestamp, and a second ciphertext;
a second decryption module 306, configured to obtain a key for decrypting the second ciphertext according to the second timestamp, and decrypt the second ciphertext to obtain the user information;
in an implementation example, before correcting the local time according to the time information corresponding to the second timestamp and unlocking if the second sequence number is different from the first sequence number and the user information is verified to be legitimate, the apparatus further includes:
the second data judgment module is used for recording the user information in a second information list and judging whether the data recorded in the second information list is complete or not; the user information comprises a user name or a password;
and the second acquisition module is used for re-acquiring and detecting the current display frame of the dynamic two-dimensional code to obtain a second sequence number, a second timestamp and a second ciphertext if the data recorded in the second information list are incomplete.
And a time correcting and unlocking module 307, configured to correct local time and unlock according to the time information corresponding to the second timestamp if the second serial number is different from the first serial number and the user information is verified to be legitimate.
In an implementation example, if the second sequence number is different from the first sequence number and the user information is verified to be legal, the time correcting and unlocking module 307 corrects the local time according to the time information corresponding to the second timestamp and unlocks the user information, and includes:
and the time correction and unlocking unit is used for correcting the local time and unlocking according to the time information corresponding to the second timestamp if the second serial number is different from the first serial number and the user information of the second information list is verified to be legal.
According to the unlocking device provided by the embodiment of the invention, a first sequence number, a first timestamp and a first ciphertext are obtained by detecting the collected current frame displayed by the dynamic two-dimensional code; the sequence number of a new frame of two-dimensional code generated when the dynamic two-dimensional code is refreshed each time is updated, and the sequence number of the new frame of two-dimensional code comprises a timestamp updated according to the current time; acquiring a key for decrypting the first ciphertext according to the first timestamp, and decrypting the first ciphertext to obtain user information; if the user information is verified to be legal, calculating a time difference value between the time information corresponding to the first timestamp and local time; if the time difference is larger than a preset threshold value, the current frame displayed by the dynamic two-dimensional code is collected again; detecting the newly acquired current frame to obtain a second sequence number, a second timestamp and a second ciphertext; acquiring a key for decrypting the second ciphertext according to the second timestamp, and decrypting the second ciphertext to obtain the user information; and if the second serial number is different from the first serial number and the user information is verified to be legal, correcting local time according to the time information corresponding to the second timestamp and unlocking. The generated dynamic two-dimensional code has different timestamps carried by the two-dimensional code image which is refreshed and displayed every frame. And when the local time difference value is detected to be larger than the preset threshold value, the current frame displayed by the dynamic two-dimensional code is re-collected again, and when the second sequence number of the re-collected two-dimensional code is different from the first sequence number and the user information carried by the two-dimensional code is verified to be legal, the local time is corrected and unlocked by detecting the time of the second timestamp obtained by the re-collected two-dimensional code. Additional setting or networking synchronization is not needed, and the user experience is improved.
Example four
The fourth embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the steps of the unlocking method in the first embodiment or the second embodiment are implemented.
Of course, the processor-executable instructions of the computer-readable storage medium provided in the embodiment of the present invention are not limited to the method operations described above, and may also perform related operations in the unlocking method provided in any embodiment of the present invention.
EXAMPLE five
An embodiment of the present invention further provides an unlocking system, including: a smart device and an unlocking device; wherein the content of the first and second substances,
and the unlocking device collects the dynamic two-dimensional code generated by the intelligent device and executes the unlocking method in the first embodiment or the second embodiment.
The unlocking device provided by the embodiment of the invention comprises a computer-readable storage medium of processor-executable instructions, and the processor-executable instructions are not limited to the operation of the method described above, and can also execute the relevant operation in the unlocking method provided by any embodiment of the invention.
EXAMPLE six
Fig. 4 is a schematic structural diagram of an intelligent door lock according to a sixth embodiment of the present invention. This intelligent lock 4 includes: a processor 41, a memory 42 and a computer program 43 stored in said memory 42 and executable on said processor 41, such as a program for an unlocking method. The processor 41 implements the steps in the above-described embodiment of the unlocking method, such as the steps S110 to S170 shown in fig. 1, when executing the computer program 43.
Illustratively, the computer program 43 may be partitioned into one or more modules that are stored in the memory 42 and executed by the processor 41 to accomplish the present application. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program 43 in the intelligent door lock. For example, the computer program 43 may be divided into a first detection module, a first decryption module, a time difference value calculation module, a reacquisition module, a second detection module, a second decryption module, and a time correction and decryption module, and each module has the following specific functions:
the first detection module is used for detecting the collected current frame displayed by the dynamic two-dimensional code to obtain a first serial number, a first timestamp and a first ciphertext; the sequence number of a new frame of two-dimensional code generated when the dynamic two-dimensional code is refreshed each time is updated, and the sequence number of the new frame of two-dimensional code comprises a timestamp updated according to the current time;
the first decryption module is used for acquiring a key for decrypting the first ciphertext according to the first timestamp and decrypting the first ciphertext to obtain user information;
the time difference value calculating module is used for calculating the time difference value between the time information corresponding to the first timestamp and the local time if the user information is verified to be legal;
the re-acquisition module is used for re-acquiring the current frame displayed by the dynamic two-dimensional code if the time difference value is greater than a preset threshold value;
the second detection module is used for detecting the newly acquired current frame to obtain a second sequence number, a second timestamp and a second ciphertext;
the second decryption module is used for acquiring a key for decrypting the second ciphertext according to the second timestamp and decrypting the second ciphertext to obtain the user information;
and the time correction and unlocking module is used for correcting the local time and unlocking according to the time information corresponding to the second timestamp if the second serial number is different from the first serial number and the user information is verified to be legal.
The intelligent door lock may include, but is not limited to, a processor 41, a memory 42, and a computer program 43 stored in the memory 42. Those skilled in the art will appreciate that fig. 4 is merely an example of an intelligent door lock, and does not constitute a limitation of an intelligent door lock, and may include more or fewer components than those shown, or some components in combination, or different components, for example, the apparatus may also include input-output devices, network access devices, buses, etc.
The Processor 41 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 42 may be an internal storage unit of the intelligent door lock, such as a hard disk or a memory of the intelligent door lock. The memory 42 may also be an external storage device, such as a plug-in hard disk provided on a Smart door lock, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like. Further, the memory 42 may also include both an internal memory unit and an external memory device of the smart door lock. The memory 42 is used for storing the computer program and other programs and data required for the unlocking method. The memory 42 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.

Claims (10)

1. An unlocking method is characterized in that a dynamic two-dimensional code is collected, and the method comprises the following steps:
detecting the collected current frame displayed by the dynamic two-dimensional code to obtain a first sequence number, a first timestamp and a first ciphertext; the sequence number of a new frame of two-dimensional code generated when the dynamic two-dimensional code is refreshed each time is updated, and the sequence number of the new frame of two-dimensional code comprises a timestamp updated according to the current time;
acquiring a key for decrypting the first ciphertext according to the first timestamp, and decrypting the first ciphertext to obtain user information;
if the user information is verified to be legal, calculating a time difference value between the time information corresponding to the first timestamp and local time;
if the time difference is larger than a preset threshold value, the current frame displayed by the dynamic two-dimensional code is collected again;
detecting the newly acquired current frame to obtain a second sequence number, a second timestamp and a second ciphertext;
acquiring a key for decrypting the second ciphertext according to the second timestamp, and decrypting the second ciphertext to obtain the user information;
and if the second serial number is different from the first serial number and the user information is verified to be legal, correcting local time according to the time information corresponding to the second timestamp and unlocking.
2. The unlocking method according to claim 1, before calculating a time difference between the time information corresponding to the first timestamp and a local time if the user information is verified to be legitimate, further comprising:
recording the user information in a first information list, and judging whether the data recorded in the first information list is complete or not;
and if the current frame is not complete, the current frame displayed by the dynamic two-dimensional code is collected again and detected, and a first sequence number, a first timestamp and a first ciphertext are obtained.
3. The unlocking method according to claim 1, wherein before correcting the local time according to the time information corresponding to the second timestamp and unlocking the mobile terminal if the second serial number is different from the first serial number and the user information is verified to be legal, the method comprises:
recording the user information in a second information list, and judging whether the data recorded in the second information list is complete or not; the user information comprises a user name or a password;
and if the current display frame of the dynamic two-dimensional code is not complete, the current display frame of the dynamic two-dimensional code is collected again and detected, and a second sequence number, a second timestamp and a second ciphertext are obtained.
4. The unlocking method according to claim 2, wherein if the user information is verified to be legal, calculating a time difference between the time information corresponding to the first timestamp and a local time includes:
and if the user information of the first information list is verified to be legal, calculating the time difference between the time information corresponding to the first timestamp and the local time.
5. The unlocking method according to claim 3, wherein if the second serial number is different from the first serial number and the user information is verified to be legal, then correcting the local time according to the time information corresponding to the second timestamp and unlocking the electronic device comprises:
and if the second sequence number is different from the first sequence number and the user information of the second information list is verified to be legal, correcting the local time according to the time information corresponding to the second timestamp and unlocking.
6. The unlocking method according to any one of claims 1 to 5, wherein after calculating a time difference between the time information corresponding to the first timestamp and a local time if the user information is verified to be legal, the method includes:
and if the time difference is smaller than a preset threshold value, unlocking.
7. An unlocking device, comprising:
the first detection module is used for detecting the current frame displayed by the acquired dynamic two-dimensional code to obtain a first serial number, a first timestamp and a first ciphertext; the sequence number of a new frame of two-dimensional code generated when the dynamic two-dimensional code is refreshed each time is updated, and the sequence number of the new frame of two-dimensional code comprises a timestamp updated according to the current time;
the first decryption module is used for acquiring a key for decrypting the first ciphertext according to the first timestamp and decrypting the first ciphertext to obtain user information;
the time difference value calculating module is used for calculating the time difference value between the time information corresponding to the first timestamp and the local time if the user information is verified to be legal;
the re-acquisition module is used for re-acquiring the current frame displayed by the dynamic two-dimensional code if the time difference value is greater than a preset threshold value;
the second detection module is used for detecting the newly acquired current frame to obtain a second sequence number, a second timestamp and a second ciphertext;
the second decryption module is used for acquiring a key for decrypting the second ciphertext according to the second timestamp and decrypting the second ciphertext to obtain the user information;
and the time correction and unlocking module is used for correcting the local time and unlocking according to the time information corresponding to the second timestamp if the second serial number is different from the first serial number and the user information is verified to be legal.
8. The unlocking device of claim 7, wherein the device further comprises:
and the second unlocking module is used for unlocking if the time difference value between the time information corresponding to the first timestamp and the local time is less than a preset threshold value.
9. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the unlocking method according to any one of claims 1 to 6.
10. An intelligent door lock, characterized by comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor, when executing the computer program, carries out the steps of the unlocking method according to any one of claims 1 to 6.
CN201910933095.5A 2019-09-29 2019-09-29 Unlocking method and device and storage medium Active CN110718004B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910933095.5A CN110718004B (en) 2019-09-29 2019-09-29 Unlocking method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910933095.5A CN110718004B (en) 2019-09-29 2019-09-29 Unlocking method and device and storage medium

Publications (2)

Publication Number Publication Date
CN110718004A true CN110718004A (en) 2020-01-21
CN110718004B CN110718004B (en) 2021-07-20

Family

ID=69211130

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910933095.5A Active CN110718004B (en) 2019-09-29 2019-09-29 Unlocking method and device and storage medium

Country Status (1)

Country Link
CN (1) CN110718004B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111427417A (en) * 2020-03-19 2020-07-17 珠海豹趣科技有限公司 Time obtaining method and device and electronic equipment
CN113593139A (en) * 2021-09-30 2021-11-02 浙江口碑网络技术有限公司 Express delivery cabinet information interaction method and device

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002350576A (en) * 2001-05-25 2002-12-04 Rhythm Watch Co Ltd Radio controlled clock for automobile
CN101133401A (en) * 2005-02-28 2008-02-27 富士通株式会社 Time-stamp device, time emendation method and time emendation program
US20130179692A1 (en) * 2012-01-11 2013-07-11 King Saud University Systems and methods for three-factor authentication
CN103606211A (en) * 2013-10-30 2014-02-26 小米科技有限责任公司 Method, equipment and system used for realization of intelligent entrance guard
CN104424497A (en) * 2013-09-10 2015-03-18 王越 Method and device for generating dynamic two-dimensional codes
CN105046775A (en) * 2015-07-14 2015-11-11 黄育斌 Device for unlocking time domain two-dimension code
CN204833402U (en) * 2015-07-21 2015-12-02 杭州晟元数据安全技术股份有限公司 Two -dimensional code developments trick lock
CN106131179A (en) * 2016-07-05 2016-11-16 林哲敏 The password Rights Management System of a kind of intelligent door lock and method
CN106898065A (en) * 2017-01-21 2017-06-27 云丁网络技术(北京)有限公司 A kind of method for unlocking of intelligent door lock
CN107479359A (en) * 2017-08-22 2017-12-15 北京智芯微电子科技有限公司 Scan the time service method and device of ciphering two-dimension code
CN109871923A (en) * 2019-02-19 2019-06-11 深圳市西克智能技术有限公司 Time-correcting method, terminal device and storage medium based on two dimensional code

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002350576A (en) * 2001-05-25 2002-12-04 Rhythm Watch Co Ltd Radio controlled clock for automobile
CN101133401A (en) * 2005-02-28 2008-02-27 富士通株式会社 Time-stamp device, time emendation method and time emendation program
US20130179692A1 (en) * 2012-01-11 2013-07-11 King Saud University Systems and methods for three-factor authentication
CN104424497A (en) * 2013-09-10 2015-03-18 王越 Method and device for generating dynamic two-dimensional codes
CN103606211A (en) * 2013-10-30 2014-02-26 小米科技有限责任公司 Method, equipment and system used for realization of intelligent entrance guard
CN105046775A (en) * 2015-07-14 2015-11-11 黄育斌 Device for unlocking time domain two-dimension code
CN204833402U (en) * 2015-07-21 2015-12-02 杭州晟元数据安全技术股份有限公司 Two -dimensional code developments trick lock
CN106131179A (en) * 2016-07-05 2016-11-16 林哲敏 The password Rights Management System of a kind of intelligent door lock and method
CN106898065A (en) * 2017-01-21 2017-06-27 云丁网络技术(北京)有限公司 A kind of method for unlocking of intelligent door lock
CN107479359A (en) * 2017-08-22 2017-12-15 北京智芯微电子科技有限公司 Scan the time service method and device of ciphering two-dimension code
CN109871923A (en) * 2019-02-19 2019-06-11 深圳市西克智能技术有限公司 Time-correcting method, terminal device and storage medium based on two dimensional code

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111427417A (en) * 2020-03-19 2020-07-17 珠海豹趣科技有限公司 Time obtaining method and device and electronic equipment
CN111427417B (en) * 2020-03-19 2023-08-22 珠海豹趣科技有限公司 Time acquisition method and device and electronic equipment
CN113593139A (en) * 2021-09-30 2021-11-02 浙江口碑网络技术有限公司 Express delivery cabinet information interaction method and device

Also Published As

Publication number Publication date
CN110718004B (en) 2021-07-20

Similar Documents

Publication Publication Date Title
AU2021202620B2 (en) Method of using one device to unlock another device
US9467293B1 (en) Generating authentication codes associated with devices
US7131009B2 (en) Multiple factor-based user identification and authentication
US9218473B2 (en) Creation and authentication of biometric information
EP3374913A1 (en) Public/private key biometric authentication system
CN110718004B (en) Unlocking method and device and storage medium
WO2015153559A1 (en) System and method for biometric key management
WO2016190903A2 (en) Method and apparatus for securing a mobile application
US10069822B2 (en) Authenticated network time for mobile device smart cards
CN110574030B (en) Updating biometric template protection keys
EP1472816A2 (en) Access system utilizing multiple factor identification and authentication
US20180183765A1 (en) Method of securing authentication in electronic communication
CN102932143B (en) Certification in digital interrogation device, encrypting and decrypting and tamper resistant method
CN110517389B (en) Method, device, equipment and storage medium for generating and verifying equipment password
CN110310392B (en) Vehicle unlocking method and device, computer equipment and storage medium
KR102601509B1 (en) Biometric public key system providing revocable credentials
EP3005644B1 (en) Linked registration
CN110766831B (en) Dynamic two-dimensional code generation method and device and storage medium
CN106921501B (en) intelligent password signature identity authentication method and system
US20210365531A1 (en) Method and electronic device for authenticating a user
CN115941183B (en) Biological information processing method and related device
CN116798153B (en) Access control authorization opening method and device
Darwis et al. Design and implementation of e-KTP (Indonesian electronic identity card) key management system
CN113315640B (en) Dynamic password verification method, intelligent door lock and storage medium
CN109779411B (en) Block chain-based coded lock unlocking method, device and equipment

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