Disclosure of Invention
To at least partially solve the above technical problem, embodiments of the present invention aim to: a lock control method, system and storage medium based on Bluetooth communication technology are provided.
The technical scheme adopted by the embodiment of the invention is as follows:
in a first aspect, an embodiment of the present invention provides a lock control method based on a bluetooth communication technology, including the following steps:
acquiring an identity of a first mobile terminal, wherein the first mobile terminal is a mobile terminal establishing communication connection with a lockset for the first time;
sending a first unlocking authority and a first authorization authority to the first mobile terminal, wherein the first unlocking authority is used for enabling the first mobile terminal to obtain an unlocking authorization certificate, the first authorization authority is used for enabling the first mobile terminal to send a second unlocking authority to at least one second mobile terminal, and the second unlocking authority is used for enabling the second mobile terminal to obtain the unlocking authorization certificate;
acquiring an unlocking instruction and an unlocking authorization certificate;
and verifying the unlocking authorization voucher, and judging whether to execute the unlocking instruction according to a verification result.
Further, the step of acquiring the identity of the first mobile terminal specifically includes:
generating an initialization key, wherein the initialization key is used for initializing the lockset when a communication connection request of a mobile terminal is received for the first time;
when a communication connection request of a mobile terminal is received for the first time, acquiring an identity of the mobile terminal and recording the mobile terminal as a first mobile terminal;
and acquiring and storing the digital certificate or the public key generated by the first mobile terminal, wherein the digital certificate or the public key is used for verifying the unlocking authorization certificate.
Further, the step of verifying the unlocking authorization credential and determining whether to execute the unlocking instruction according to a verification result specifically includes:
verifying whether the unlocking authorization certificate is valid or not through a digital certificate or a public key stored in the lockset, if so, indicating that the unlocking authorization certificate is verified successfully, controlling an unlocking unit in the lockset to act, and executing the unlocking instruction; otherwise, the unlocking authorization voucher is verified unsuccessfully, and the alarm unit in the lockset is controlled to act without executing the unlocking instruction.
Further, the method also comprises the following steps:
acquiring a verification record of the unlocking authorization certificate and an identity of the mobile terminal corresponding to the verification record, and generating an unlocking record log;
and when receiving the query instruction, sending the unlocking record log to the first mobile terminal.
The embodiment of the invention also provides another lock control method based on the Bluetooth communication technology, which comprises the following steps:
sending a communication connection request to a lockset to obtain a first unlocking authority and a first authorization authority, wherein the first unlocking authority is used for enabling a first mobile terminal to obtain an unlocking authorization certificate, the first authorization authority is used for enabling the first mobile terminal to send a second unlocking authority to at least one second mobile terminal, and the second unlocking authority is used for enabling the second mobile terminal to obtain the unlocking authorization certificate;
acquiring an unlocking authorization certificate through a first unlocking authority, wherein the unlocking authorization certificate adopts a digital certificate or a public key signature;
generating a digital certificate or a public key and sending the digital certificate or the public key to a lockset, wherein the digital certificate or the public key is used for verifying the unlocking authorization certificate;
and sending an unlocking instruction and an unlocking authorization certificate to the lock, so that the lock controls the action of an unlocking unit in the lock after successfully verifying the unlocking authorization certificate, and executing the unlocking instruction.
Further, the method also comprises the following steps:
and sending a query instruction to the lockset to obtain an unlocking record log, wherein the unlocking record log comprises an unlocking authorization certificate verification record and an identity of the mobile terminal corresponding to the verification record.
The embodiment of the invention also provides another lock control method based on the Bluetooth communication technology, which comprises the following steps:
acquiring a second unlocking permission from the first mobile terminal;
acquiring an unlocking authorization certificate through a second unlocking authority, wherein the unlocking authorization certificate adopts a digital certificate or a public key signature;
and sending an unlocking instruction and an unlocking authorization certificate to the lock, so that the lock controls the action of an unlocking unit in the lock after successfully verifying the unlocking authorization certificate, and executing the unlocking instruction.
In a second aspect, an embodiment of the present invention provides a lock control system based on a bluetooth communication technology, including a lock, a first mobile terminal, and a second mobile terminal;
the lock includes:
the mobile terminal comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is used for receiving a communication connection request of the mobile terminal, and the mobile terminal comprises a first mobile terminal and a second mobile terminal;
the first authorization unit is used for sending a first unlocking authority and a first authorization authority to the first mobile terminal, wherein the first unlocking authority is used for enabling the first mobile terminal to obtain an unlocking authorization certificate, and the first authorization authority is used for enabling the first mobile terminal to send a second unlocking authority to at least one second mobile terminal;
the first acquisition unit is used for acquiring a digital certificate or a public key, an unlocking instruction, an unlocking authorization certificate and an identity of the mobile terminal;
the unlocking authorization voucher verification unit is used for verifying the unlocking authorization voucher and judging whether to execute the unlocking instruction according to a verification result;
the unlocking unit is used for controlling the lock to be unlocked to execute the unlocking instruction after the unlocking authorization voucher is verified successfully;
the warning unit is used for sending a warning signal to display that the unlocking instruction is refused to be executed after the unlocking authorization certificate fails to be verified;
the first mobile terminal includes:
the first communication request unit is used for sending a communication connection request to the lockset;
the second obtaining unit is used for obtaining a first unlocking authority and a first authorization authority, wherein the first unlocking authority is used for enabling the first mobile terminal to obtain an unlocking authorization certificate, and the first authorization authority is used for enabling the first mobile terminal to send a second unlocking authority to at least one second mobile terminal;
the second permission authorization unit is used for sending a second unlocking permission to the second mobile terminal, and the second unlocking permission is used for enabling the second mobile terminal to obtain an unlocking authorization certificate;
the first sending unit is used for sending the digital certificate or the public key, the unlocking instruction, the unlocking authorization certificate and the identity identification to the lockset;
the second mobile terminal includes:
the second communication request unit is used for sending a communication connection request to the lockset;
the third obtaining unit is used for obtaining a second unlocking authority, and the second unlocking authority is used for enabling the second mobile terminal to obtain an unlocking authorization certificate;
and the second sending unit is used for sending the unlocking instruction, the unlocking authorization certificate and the identity identification to the lockset.
Further, the tool to lock still includes: the unlocking log generating unit is used for generating an unlocking record log according to the verification record of the unlocking authorization certificate and the identity of the mobile terminal corresponding to the verification record;
the third sending unit is used for sending the unlocking record log to the first mobile terminal after the first obtaining unit obtains the query instruction;
the first sending unit of the first mobile terminal is also used for sending a query instruction to the lockset;
the first acquisition unit of the lockset is also used for acquiring a query instruction;
the second obtaining unit of the first mobile terminal is further configured to obtain the unlocking record log.
In a third aspect, an embodiment of the present invention provides a storage medium, in which processor-executable instructions are stored, and when the processor-executable instructions are executed by a processor, the processor-executable instructions are configured to execute the lock control method based on the bluetooth communication technology.
One or more of the above-described embodiments of the present invention have the following advantages: when the lockset with the initialized key establishes communication connection with a mobile terminal for the first time, a first unlocking authority for obtaining an unlocking authorization certificate and a first authorization authority for enabling the mobile terminal to send a second unlocking authority to other mobile terminals are sent to the mobile terminal, wherein the second unlocking authority is used for enabling a second mobile terminal to obtain the unlocking authorization certificate; the lock control system composed of the whole mobile terminal and the lock is simpler in structure, the unlocking permission can be issued and authenticated without a background server, compared with the prior art, the lock control system is low in risk of being maliciously attacked or being falsely used, the unlocking safety is improved, and meanwhile, the construction cost of the lock system is reduced.
Detailed Description
The invention is described in further detail below with reference to the figures and the specific embodiments. The step numbers in the following embodiments are provided only for convenience of illustration, the order between the steps is not limited at all, and the execution order of each step in the embodiments can be adapted according to the understanding of those skilled in the art.
Referring to fig. 1, an embodiment of the present invention provides a lock control method based on a bluetooth communication technology, including the following steps:
s1: acquiring an identity of a first mobile terminal, wherein the first mobile terminal is a mobile terminal establishing communication connection with a lockset for the first time;
s2: sending a first unlocking authority and a first authorization authority to the first mobile terminal, wherein the first unlocking authority is used for enabling the first mobile terminal to obtain an unlocking authorization certificate, the first authorization authority is used for enabling the first mobile terminal to send a second unlocking authority to at least one second mobile terminal, and the second unlocking authority is used for enabling the second mobile terminal to obtain the unlocking authorization certificate;
s3: acquiring an unlocking instruction and an unlocking authorization certificate;
s4: and verifying the unlocking authorization voucher, and judging whether to execute the unlocking instruction according to a verification result.
Further as a preferred embodiment, the step S1 of obtaining the identity of the first mobile terminal specifically includes:
s101: generating an initialization key, wherein the initialization key is used for initializing the lockset when a communication connection request of a mobile terminal is received for the first time;
s102: when a communication connection request of a mobile terminal is received for the first time, acquiring an identity of the mobile terminal and recording the mobile terminal as a first mobile terminal;
s103: and acquiring and storing the digital certificate or the public key generated by the first mobile terminal, wherein the digital certificate or the public key is used for verifying the unlocking authorization certificate.
Further, as a preferred embodiment, the step S4 of verifying the unlocking authorization ticket and determining whether to execute the unlocking instruction according to the verification result specifically includes:
s401: verifying whether the unlocking authorization certificate is valid or not through a digital certificate or a public key stored in the lockset, if so, indicating that the unlocking authorization certificate is verified successfully, controlling an unlocking unit in the lockset to act, and executing the unlocking instruction;
s402: otherwise, the unlocking authorization voucher is verified unsuccessfully, and the alarm unit in the lockset is controlled to act without executing the unlocking instruction.
Further as a preferred embodiment, the method further comprises the following steps:
s110: acquiring a verification record of the unlocking authorization certificate and an identity of the mobile terminal corresponding to the verification record, and generating an unlocking record log;
s120: and when receiving the query instruction, sending the unlocking record log to the first mobile terminal.
The embodiment of the invention completely describes the data processing flow when the lock control method based on the Bluetooth communication technology is applied to the lock, wherein the lock is provided with an initialization key during production, and the initialization key can be two-dimensional codes or numbers printed in the lock product package or specification. When the lockset is applied at first, an initialization request is sent by the mobile terminal in a Bluetooth communication mode according to the initialization key, so that the first mobile terminal is set as a main control terminal for the lockset. Specifically, the mobile terminal may be an intelligent device supported by a smart phone, a tablet computer, a POS machine, a vehicle-mounted computer, or the like, or having a bluetooth communication function. When the lockset is used for the first time, the lockset and the mobile terminal equipment are opened simultaneously, a communication connection request and an initialization request are initiated through the mobile terminal equipment, an initialization key verification process is started after the lockset receives the initialization request, the lockset completes initialization after the lockset passes the verification, the mobile terminal is identified as a first mobile terminal, and a digital certificate or a public key of the first mobile terminal is acquired and stored simultaneously, wherein the digital certificate or the public key is used for subsequent unlocking authority verification. And then sending the first unlocking authority and the first authorization authority to the first mobile terminal. The first unlocking authority is used for enabling the first mobile terminal to obtain an unlocking authorization certificate (generated in the first mobile terminal) signed by a digital certificate or a public key of the first mobile terminal, the digital certificate or the public key corresponding to the digital certificate or the public key signature of the first mobile terminal and obtained from the first mobile terminal is stored in the lockset, and the digital certificate or the public key signature, the digital certificate or the public key can be encrypted in an asymmetric encryption mode, a symmetric encryption mode and the like.
The first mobile terminal can obtain the unlocking authorization certificate signed by the digital certificate or the public key of the first mobile terminal through the first unlocking authority, and can continuously issue the unlocking authorization certificate signed by the digital certificate or the public key of the first mobile terminal to other mobile terminals through the first authorization authority, and the unlocking authorization certificate cannot be continuously issued without the first authorization authority. Through the hierarchical issuing mode of the authorization authority and the unlocking authority, the safety of the lockset during use can be ensured. Meanwhile, the unlocking authorization certificate for unlocking authentication and verification can be directly sent to a plurality of subordinate mobile terminals through the first mobile terminal, and a background server or a background center is not needed for exchanging authentication, so that communication resources and system architecture investment are saved.
The following detailed description is made of a specific process of the lock control method based on the bluetooth communication technology when applied to the lock unlocking authentication in the embodiment of the present invention:
after the lockset obtains the unlocking instruction and the unlocking authorization certificate, the unlocking authorization certificate is verified through the digital certificate or the public key stored in the lockset in the initialization process, if the verification is successful, the unlocking authorization certificate is legally authorized (namely, the unlocking authorization certificate is signed by the digital certificate or the public key of the first mobile terminal), the unlocking unit in the lockset is controlled to act to realize unlocking, and the unlocking instruction is executed; if the verification is unsuccessful, the unlocking authorization certificate is indicated to be not legally authorized (namely not subjected to the first mobile terminal digital certificate or public key signature), the unlocking instruction is invalid and is not executed, at the moment, the lockset keeps locking continuously, and the user is informed of the authentication failure through an alarm unit, wherein the alarm unit can be realized in a buzzer, a flash lamp and the like. The implementation method can simplify the step flow of the verification, the verification process can be directly expanded between the mobile terminal and the lockset, the transmission data is less, the verification speed is high, and the operation and the use of a user are facilitated.
Besides, the lock also has the function of inquiring the unlocking record, and the implementation principle is as follows: when the lock acquires the unlocking authorization certificate, the final verification result of the unlocking authorization certificate and the identity of the mobile terminal sending the unlocking authorization certificate are recorded, time information, frequency information and the like of the received unlocking authorization certificate can be further recorded, and finally, an unlocking record log is generated according to the information and can be synchronously inquired by the first mobile terminal. Specifically, the identity of the mobile terminal may be information such as a mobile phone number of the mobile terminal, a physical address of the mobile terminal, and the like. The method of the embodiment can be widely applied to various industries, in particular to industrial cabinet locks in the industries of electric power, water conservancy, petroleum, traffic, logistics, communication and the like.
Referring to fig. 2, an embodiment of the present invention further provides another lock control method based on a bluetooth communication technology, including the following steps:
s5: sending a communication connection request to a lockset to obtain a first unlocking authority and a first authorization authority, wherein the first unlocking authority is used for enabling a first mobile terminal to obtain an unlocking authorization certificate, the first authorization authority is used for enabling the first mobile terminal to send a second unlocking authority to at least one second mobile terminal, and the second unlocking authority is used for enabling the second mobile terminal to obtain the unlocking authorization certificate;
s6: acquiring an unlocking authorization certificate through a first unlocking authority, wherein the unlocking authorization certificate adopts a digital certificate or a public key signature;
s7: generating a digital certificate or a public key and sending the digital certificate or the public key to a lockset, wherein the digital certificate or the public key is used for verifying the unlocking authorization certificate;
s8: and sending an unlocking instruction and an unlocking authorization certificate to the lock, so that the lock controls the action of an unlocking unit in the lock after successfully verifying the unlocking authorization certificate, and executing the unlocking instruction.
Further as a preferred embodiment, the method further comprises the following steps:
s210: and sending a query instruction to the lockset to obtain an unlocking record log, wherein the unlocking record log comprises an unlocking authorization certificate verification record and an identity of the mobile terminal corresponding to the verification record.
Referring to fig. 3, an embodiment of the present invention further provides another lock control method based on a bluetooth communication technology, including the following steps:
s9: acquiring a second unlocking permission from the first mobile terminal;
s10: acquiring an unlocking authorization certificate through a second unlocking authority, wherein the unlocking authorization certificate adopts a digital certificate or a public key signature;
s11: and sending an unlocking instruction and an unlocking authorization certificate to the lock, so that the lock controls the action of an unlocking unit in the lock after successfully verifying the unlocking authorization certificate, and executing the unlocking instruction.
The embodiment of the invention completely describes the data processing flow when the lock control method based on the Bluetooth communication technology is applied to a first mobile terminal and a second mobile terminal, and the first mobile terminal is a mobile terminal which establishes communication connection with a lock for the first time and can be an intelligent device which supports or has a Bluetooth communication function, such as a smart phone, a tablet computer, a POS machine, a vehicle-mounted computer and the like, corresponding to the lock control method. When communication connection is established with the lockset for the first time, the first mobile terminal can acquire a first unlocking authority and a first authorization authority, and related information for unlocking verification can be further generated through the first unlocking authority, namely an unlocking authorization certificate signed by a digital certificate or a public key of the first mobile terminal corresponds to the unlocking authorization certificate, and the digital certificate or the public key of the first mobile terminal is stored in the lockset in the initialization process. The first mobile terminal can also issue a second unlocking authority to other mobile terminals through the first authorization authority, so that other mobile terminals can also obtain the unlocking authorization certificate signed by the digital certificate or the public key of the first mobile terminal through the second unlocking authority, and the second mobile terminal can also pass authentication and successfully open the lockset. In this embodiment, the first mobile terminal is equivalent to a central authorization terminal, and may grant the second unlocking right to other mobile terminals by using any one of a mobile network, a Wireless Local Area Network (WLAN), a Bluetooth (BT), a Near Field Communication (NFC), and the like. Through the hierarchical issuing mode of the unlocking authority, the safety of the lockset during use can be ensured, and the responsibility tracing is facilitated. The number of the mobile terminals receiving the second unlocking authority is greater than or equal to 1, and the types of the terminals can be various and are collectively called as second mobile terminals.
The data transmission flow of the first and second mobile terminals during the unlocking authority authentication is described as follows: after the mobile terminal approaches the lockset and enters a Bluetooth communication range, an unlocking instruction and an unlocking authorization certificate can be sent to the lockset, after the lockset receives the unlocking instruction, whether the unlocking authorization certificate is the unlocking authorization certificate signed by the first mobile terminal digital certificate or the public key prestored in the lockset is verified through the first mobile terminal digital certificate or the public key, and whether the unlocking instruction is executed or not is finally judged according to a verification result, wherein the specific verification process is as described above. In addition, the first mobile terminal can also acquire an unlocking record log by sending a query instruction to the lock, so that the information such as time information and personnel information (obtained by the identity of the mobile terminal) of unlocking at each time and whether suspicious personnel try to maliciously crack the lock can be checked.
Particularly, when the first mobile terminal sends the unlocking authorization certificate digitally signed by the first mobile terminal to the second mobile terminal, the effective time of the unlocking authorization certificate can be further set, so that the second mobile terminal only has the unlocking authority within a certain time period, and the safety and controllability of unlocking the lock are further ensured. The method of the embodiment can be widely applied to various industries, in particular to industrial cabinet locks in the industries of electric power, water conservancy, petroleum, traffic, logistics, communication and the like.
Referring to fig. 4, an embodiment of the present invention provides a lock control system based on a bluetooth communication technology, including a lock, a first mobile terminal, and a second mobile terminal;
the lock includes:
a receiving unit 101, configured to receive a communication connection request of a mobile terminal, where the mobile terminal includes a first mobile terminal and a second mobile terminal;
a first permission authorization unit 102, configured to send a first unlocking permission and a first authorization permission to the first mobile terminal, where the first unlocking permission is used to enable the first mobile terminal to obtain an unlocking authorization credential, and the first authorization permission is used to enable the first mobile terminal to send a second unlocking permission to at least one second mobile terminal;
a first obtaining unit 103, configured to obtain a digital certificate or a public key, an unlocking instruction, an unlocking authorization credential, and an identity of the mobile terminal;
an unlocking authorization certificate verification unit 104, configured to verify the unlocking authorization certificate, and determine whether to execute the unlocking instruction according to a verification result;
the unlocking unit 105 is used for controlling the lock to be unlocked to execute the unlocking instruction after the unlocking authorization certificate is successfully verified;
the warning unit 106 is configured to send a warning signal to display that execution of the unlocking instruction is denied after the unlocking authorization credential fails to be verified;
the first mobile terminal includes:
a first communication request unit 201, configured to send a communication connection request to a lock;
a second obtaining unit 202, configured to obtain a first unlocking right and a first authorization right, where the first unlocking right is used to enable a first mobile terminal to obtain an unlocking authorization credential, and the first authorization right is used to enable the first mobile terminal to send a second unlocking right to at least one second mobile terminal;
the second permission authorization unit 203 is configured to send a second unlocking permission to the second mobile terminal, where the second unlocking permission is used for enabling the second mobile terminal to obtain an unlocking authorization credential;
the first sending unit 204 is configured to send the digital certificate or the public key, the unlocking instruction, the unlocking authorization certificate, and the identity to the lock;
the second mobile terminal includes:
a second communication request unit 301, configured to send a communication connection request to the lock;
a third obtaining unit 302, configured to obtain a second unlocking right, where the second unlocking right is used to enable a second mobile terminal to obtain an unlocking authorization credential;
and the second sending unit 303 is configured to send an unlocking instruction, an unlocking authorization credential, and an identity to the lock.
As a further preferred embodiment, the lock further comprises: an unlocking log generating unit 107, configured to generate an unlocking log according to the verification record of the unlocking authorization credential and the identity of the mobile terminal corresponding to the verification record;
a third sending unit 108, configured to send the unlocking record log to the first mobile terminal after the first obtaining unit 103 obtains the query instruction;
the first sending unit 204 of the first mobile terminal is further configured to send a query instruction to the lock;
the first acquiring unit 103 of the lock is further configured to acquire a query instruction;
the second obtaining unit 202 of the first mobile terminal is further configured to obtain the unlocking record log.
The contents in the above method embodiments are all applicable to the present system embodiment, the functions specifically implemented by the present system embodiment are the same as those in the above method embodiment, and the beneficial effects achieved by the present system embodiment are also the same as those achieved by the above method embodiment.
Referring to fig. 5, a storage medium is further provided, in which instructions executable by the processor 401 are stored, and when the instructions executable by the processor 401 are executed by the processor 401, the lock control method based on the bluetooth communication technology is performed.
In an embodiment of the present invention, the storage medium is stored in a lock control device based on a bluetooth communication technology, and the lock control device based on the bluetooth communication technology includes:
at least one processor 401;
at least one memory 402 for storing at least one program;
when the at least one program is executed by the at least one processor 401, the at least one processor 401 is enabled to implement the lock control method based on the bluetooth communication technology.
The processor 401 may be composed of any one or more processor chips including a single chip microcomputer, an FPGA, a CPLD, a DSP, an ARM, and the like, and peripheral circuits and programs thereof. In the embodiment of the present invention, the storage medium used by the memory 402 may be, but is not limited to, an electric, magnetic, optical, infrared, or semiconductor system, apparatus, or device, and may also be a combination of any of the above forms. Specifically, may include, but is not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or a combination of any of the foregoing. The storage medium may be any tangible medium that can contain, or store a program for execution by the instruction execution system. The programs contained on the memory 402 may be transmitted using any suitable medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing. The code for the programs may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the C language or similar programming languages. The program may execute entirely on the user side, partly on the user side, as a stand-alone software package, partly on the user side, partly remotely, or entirely on the remote or server.
Similarly, the contents in the foregoing method embodiments are all applicable to this storage medium embodiment, the functions specifically implemented by this storage medium embodiment are the same as those in the foregoing method embodiments, and the advantageous effects achieved by this storage medium embodiment are also the same as those achieved by the foregoing method embodiments.
In the description herein, references to the description of "one embodiment," "another embodiment," or "certain embodiments," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
While embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that: various changes, modifications, substitutions and alterations can be made to the embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.