Specific embodiment
In order to which technical problems, technical solutions and advantageous effects to be solved by the present invention are more clearly understood, below in conjunction with
Accompanying drawings and embodiments, the present invention will be described in further detail.It should be appreciated that specific embodiment described herein is only used
To explain the present invention, it is not intended to limit the present invention.
Fig. 1 is the schematic diagram for the system that mobile terminal provided in an embodiment of the present invention and logging apparatus are constituted, for the ease of saying
Bright, only the parts related to this embodiment are shown.
As shown in Figure 1, the system includes mobile terminal 11 and logging apparatus 12 (121 to 12N).Wherein, mobile terminal 11 can
Think that laptop, tablet computer or mobile phone etc. have the terminal device of network access facility, logging apparatus 12 can be tool
There is the equipment of identity characteristic acquisition function.
The embodiment of the invention provides the binding method of a kind of mobile terminal and logging apparatus, Fig. 2 is that the embodiment of the present invention mentions
The flow chart of the binding method of the mobile terminal and logging apparatus of confession, as shown in Fig. 2, this method specifically include following steps S210 and
Step S220.
Step S210 using the logging apparatus in broadcast message search wireless network and establishes connection.
In the present embodiment, mobile terminal and logging apparatus can be made to be in the same wireless network.The wireless network can be with
It is third-party wireless network, such as the wireless network of company, cell or market, is also possible to be created by mobile terminal or logging apparatus
The wireless network built.
Fig. 3 is the flow chart for the method that mobile terminal provided in an embodiment of the present invention establishes connection with logging apparatus, this method
It can be a kind of preferred implementation of step S210.As shown in figure 3, this method comprises:
Step S310, mobile terminal send broadcast message, include IP address of mobile terminal and mobile terminal in broadcast message
Port numbers receive the logging apparatus of broadcast message by IP address of mobile terminal and mobile terminal port numbers, logging apparatus information are sent out
It send to mobile terminal, includes logging apparatus IP address, logging apparatus port numbers, sequence number and device model in logging apparatus information.
When mobile terminal wirelessly accesses any local area network, an Intranet of hotspot distribution can be obtained
IP address.It is communicated to be interacted with logging apparatus, mobile terminal opens a specific protocol port to provide data and hand over
Mutually service, wherein the identification number of the application software with network function is the port numbers of the protocol port.
Mobile terminal is after broadcast nature is arranged in its socket, to pass through User Datagram Protocol (User
Datagram Protocol, referred to as UDP) information broadcasts above-mentioned IP address and port numbers into the local area network being presently in,
So that all logging apparatus in local area network can receive the broadcast of IP address and port numbers based on the mobile terminal
Information.
The range that the IP address and port number information of mobile terminal can be broadcast to is broadcast domain, includes one in broadcast domain
Logging apparatus more than platform receives the broadcast frame from same mobile terminal.
Every logging apparatus possesses respective logging apparatus information, the including but not limited to device name of logging apparatus, equipment sequence
Number, MAC Address (Medium Access Control, physical address), device model, firmware version number, IP address and port numbers
Equal facility informations.Every logging apparatus using the IP address of the mobile terminal received and port numbers as the destination address of data packet and
Destination port, and the data packet back of logging apparatus information will be packaged with to mobile terminal.
Step S320, mobile terminal judge whether logging apparatus meets preset condition according to sequence number and device model.
Mobile terminal receives the logging apparatus information based on JSON data format that every logging apparatus transmits respectively.It will be every
After logging apparatus information is parsed, converted, shows into the screen of mobile terminal, carry out checking selection for user.By looking into
It sees the information such as sequence number and the device model in logging apparatus, can determine whether the logging apparatus meets preset requirement.
For example, mobile terminal receives two logging apparatus information, equipment Serial Number is respectively in two logging apparatus information
" 0785-956 " and " 0785-957 ".Since the equipment Serial Number " 0785-957 " of preset logging apparatus information is that user is practical
The information known, thus can according to the user's choice or according to the pre-stored logging apparatus match information of mobile terminal, by hand or
Automatically the corresponding logging apparatus information of the preset logging apparatus is filtered out from the two equipment Serial Numbers.
Step S330, after being determined for compliance with preset condition, mobile terminal according to logging apparatus IP address and logging apparatus port numbers,
It is wirelessly connected with logging apparatus.
From the qualified logging apparatus information filtered out, the IP address and port numbers of preset logging apparatus are obtained, and
Radio connection request is sent to its port.
Mobile terminal and logging apparatus are wirelessly connected after three-way handshake confirms with preset logging apparatus.
In the present embodiment, the information of all logging apparatus in broadcast domain is obtained by broadcast mechanism, and is screened out from it
The IP address and port numbers of actually required logging apparatus avoid user with needing the preparatory IP for checking and being manually entered logging apparatus
Location and port number information, reduce operation complexity.Since the IP address of every logging apparatus in local area network can dynamically change,
The logging apparatus information acquisition method provided through this embodiment can ensure that mobile terminal automatically updates connected logging apparatus
IP address, realize the Auto-reconnect to a default logging apparatus, monitoring control shape can be chronically at by maintaining logging apparatus
State.
Preferably, before being wirelessly connected with logging apparatus, mobile terminal can bind IP address of mobile terminal and shifting
Dynamic terminal prot number;And it monitors and whether is connect with logging apparatus.By monitoring, the company of mobile terminal and logging apparatus can be understood in real time
Connect situation.
Step S220, mobile terminal is interacted by Handshake Protocol with logging apparatus, and is sentenced according to the verification result of Handshake Protocol
Whether disconnected logging apparatus is matching unit.
Handshake Protocol can verify mobile terminal and whether logging apparatus uses same Encryption Algorithm, the one of the present embodiment
It in kind implementation, is encrypted by one end, simple Handshake Protocol can be realized in other end decryption, and steps are as follows:
Step 01, mobile terminal encrypts the first random parameter by the first Encryption Algorithm to obtain encrypted result, and will add
Close result is sent to logging apparatus, and logging apparatus decrypts encrypted result by the first Encryption Algorithm to obtain the second random parameter, and will
Second random parameter is sent to mobile terminal.
Random parameter is the parameter generated at random, such as Y=AX or Y=(A2-1)X3+2AX2In -0.5A, A or X are
For parameter, the output result of the algorithm can be determined by the random parameter.
Such as above-mentioned example, Y=AX is exactly an algorithm, and mobile terminal finds out Y by A and X, and A therein and Y is sent
To logging apparatus, logging apparatus is decrypted based on Y and A according to the algorithm of oneself, an available X.
Step 02, mobile terminal determines that logging apparatus is after determining that the first random parameter and the second random parameter are equal
With equipment.
Mobile terminal can carry out random number encrypting and encrypted result is sent to logging apparatus, and then logging apparatus can solve
It is close to be somebody's turn to do as a result, and feeding back to random number.If the random number of logging apparatus feedback is identical as the random number that mobile terminal generates, recognize
Identical Encryption Algorithm is used for mobile terminal and logging apparatus, and then confirms that the logging apparatus is the matching unit of mobile terminal.
In order to reach better secrecy effect, mobile terminal is interacted with logging apparatus, can be carried out by different algorithms more
It is secondary to shake hands.In another implementation of the present embodiment, by repeatedly shaking hands, more accurately whether logging apparatus can be judged
For the matching unit of mobile terminal, steps are as follows:
Step 01, mobile terminal generates encryption factor A and random number X.
Step 02, mobile terminal generates code key B using the second Encryption Algorithm.
In the present embodiment, the second Encryption Algorithm is the algorithm that code key B is generated according to encryption factor A.
Step 03, mobile device utilizes third Encryption Algorithm, is encryption code key with B, generates Y according to B and X encryption, and by A
Logging apparatus is sent to Y, wherein logging apparatus generates code key B using the second Encryption Algorithm, utilizes third Encryption Algorithm, then with B
To decrypt code key, X is generated according to B and Y decryption, using the 4th Encryption Algorithm, is encrypted according to X and generates X0, utilize the second encryption side
Method generates Y0 according to X0 and A encryption, and Y0 is sent to mobile device.
In this step, third Encryption Algorithm can be Advanced Encryption Standard (Advanced Encryption Standard,
Referred to as AES) algorithm using the encrypted result Y of random number X, the 4th Encryption Algorithm after code key B encrypted random number X, is obtained is record
Enter the non-reversible algorithm used when instrument encryption.
Step 04, mobile device utilizes third Encryption Algorithm, is decryption code key with B, generates X0 according to B and Y0 decryption.
Step 05, mobile device utilizes the 4th Encryption Algorithm, generates X1 according to X.
Mobile terminal determines that logging apparatus is matching unit after determining that X0 is equal with X1.That is mobile terminal and logging apparatus makes
With identical encryption Secret key arithmetic, aes algorithm and identical non-reversible algorithm.Thus it is confirmed that the logging apparatus is mobile terminal
Matching unit.
This process repeatedly encrypted can be called recognition methods of shaking hands, and Fig. 4 is knowledge provided in an embodiment of the present invention of shaking hands
The flow chart of other method, comprising the following steps:
Step S401, mobile device generates encryption factor A and random number X, and generates code key B according to A.
Step S402, mobile terminal are encryption code key with B, encrypt X by aes algorithm, obtain processing result Y.
A and Y are sent to logging apparatus by step S403, mobile terminal.
Step S404, logging apparatus generate code key B according to A and use AES identical with mobile terminal using B as decruption key
Algorithm decrypts encrypted result Y, obtains the random number X that above-mentioned mobile terminal generates.
Step S405, logging apparatus carry out calculation processing to random number X using non-reversible algorithm, obtain random number X in movement
Second processing data X0 in terminal.
Step S406, logging apparatus is using B as encryption key, by aes algorithm identical with mobile terminal to second processing number
It is encrypted according to X0, obtains encrypted result Y0.
Y0 is back to mobile terminal by step S407, logging apparatus.
Step S408, mobile terminal decrypt Y0 by aes algorithm and obtain X0.
Step S409, mobile terminal directly are encrypted to obtain X1 by non-reversible algorithm to random number X again
Step S410, mobile terminal judge whether X0 is equal to X1, so that it is determined that whether the logging apparatus matches.
Through this embodiment, can determine whether polyalgorithm used in mobile terminal and logging apparatus is all identical, if
It is that can then determine that mobile terminal is matched with logging apparatus.Operation of the present invention is easy, and is sentenced using the encryption and decryption of random parameter
Whether disconnected two sides Encryption Algorithm is consistent, and judgement whether matched to mobile terminal and logging apparatus can achieve very high accuracy.
The present invention also provides the binding device of a kind of mobile terminal and logging apparatus, Fig. 5 is provided in an embodiment of the present invention
The structural block diagram of the binding device of mobile terminal and logging apparatus, as shown in figure 5, the device includes connection unit 510, generation unit
520, interactive unit 530 and judging unit 540.
Connection unit 510 is used for using the logging apparatus in broadcast message search wireless network and establishes connection.
Interactive unit 520 is used to interact by Handshake Protocol with logging apparatus, and is judged according to the verification result of Handshake Protocol
Whether logging apparatus is matching unit.
Preferably, connection unit 510 includes: sending module, includes mobile whole for sending broadcast message, in broadcast message
IP address and mobile terminal port numbers are held, the logging apparatus for receiving broadcast message passes through IP address of mobile terminal and mobile terminal port
Number, logging apparatus information is sent to mobile terminal, includes logging apparatus IP address, logging apparatus port numbers, sequence in logging apparatus information
Number and device model;Judgment module, for judging whether logging apparatus meets preset condition according to sequence number and device model;Connection
Module, for according to logging apparatus IP address and logging apparatus port numbers, being carried out with logging apparatus wireless after being determined for compliance with preset condition
Connection.
Preferably, the binding device of mobile terminal and logging apparatus further include: binding unit, it is mobile for mobile terminal binding
IP address of terminal and mobile terminal port numbers;Whether monitoring unit connect for monitoring with logging apparatus.
Preferably, interactive unit 530 includes: the first generation module, and for generating the first random parameter, sending module is used
The first random parameter is encrypted to obtain encrypted result in passing through the first Encryption Algorithm, and encrypted result is sent to logging apparatus, is recorded
Enter instrument and encrypted result is decrypted to obtain the second random parameter by the first Encryption Algorithm, and the second random parameter is sent to movement
Terminal;First determining module, for after determining that the first random parameter and the second random parameter are equal, determining logging apparatus for matching
Equipment.
Preferably, interactive unit 530 includes: the second generation module, for generating encryption factor A and random number X;Third is raw
At module, for generating code key B using the second Encryption Algorithm;4th generation module, for utilizing third Encryption Algorithm, according to B
It is encrypted with X and generates Y, and A and Y are sent to typing instrument, wherein typing instrument generates B using the second Encryption Algorithm, utilizes the
Three Encryption Algorithm are generated X according to B and Y decryption, using the 4th Encryption Algorithm, are encrypted according to X and generate X0, calculated using the second encryption
Method generates Y0 according to X0 and B encryption, and Y0 is sent to mobile terminal;5th generation module, for being calculated using third encryption
Method generates X0 according to B and Y0 decryption;6th generation module generates X1 according to X for utilizing the 4th Encryption Algorithm;Second determines
Module, for after determining that X0 is equal with X1, determining that logging apparatus is matching unit.
It is apparent to those skilled in the art that for convenience of description and succinctly, only with above-mentioned each function
Can unit division progress for example, in practical application, can according to need and by above-mentioned function distribution by different functions
Unit is completed, i.e., the internal structure of device is divided into different functional unit or module, with complete it is described above whole or
Person's partial function.Each functional unit in embodiment can integrate in one processing unit, and it is independent to be also possible to each unit
It is physically present, can also be integrated in one unit with two or more units, above-mentioned integrated unit both can be using hard
The form of part is realized, can also be realized in the form of software functional units.In addition, the specific name of each functional unit is also
For the ease of mutually distinguishing, the protection scope being not intended to limit this application.The specific work process of unit in above-mentioned apparatus, can
With with reference to the corresponding process in aforementioned device embodiment, details are not described herein.
Those of ordinary skill in the art may be aware that list described in conjunction with the examples disclosed in the embodiments of the present disclosure
Member and algorithm steps can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions are actually
It is implemented in hardware or software, the specific application and design constraint depending on technical solution.Professional technician
Described function can be realized using different device to each specific application, but this realization is it is not considered that exceed
The scope of the present invention.
In embodiment provided by the present invention, it should be understood that disclosed device and device can pass through others
Mode is realized.For example, the apparatus embodiments described above are merely exemplary, for example, the division of module or unit, only
For a kind of logical function partition, there may be another division manner in actual implementation, such as multiple units or components can combine
Or it is desirably integrated into another system, or some features can be ignored or not executed.Another point, shown or discussed phase
Coupling or direct-coupling or communication connection between mutually can be through some interfaces, the INDIRECT COUPLING or communication of device or unit
Connection can be electrical property, mechanical or other forms.
Unit may or may not be physically separated as illustrated by the separation member, shown as a unit
Component may or may not be physical unit, it can and it is in one place, or may be distributed over multiple networks
On unit.It can some or all of the units may be selected to achieve the purpose of the solution of this embodiment according to the actual needs.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list
Member both can take the form of hardware realization, can also realize in the form of software functional units.
It, can if integrated unit is realized in the form of SFU software functional unit and when sold or used as an independent product
To be stored in a computer readable storage medium.Based on this understanding, the technical solution essence of the embodiment of the present invention
On all or part of the part that contributes to existing technology or the technical solution can be with the shape of software product in other words
Formula embodies, which is stored in a storage medium, including some instructions are used so that a calculating
It is real that machine equipment (can be personal computer, server or the network equipment etc.) or processor (processor) execute the present invention
Apply all or part of the steps of each embodiment device of example.And storage medium above-mentioned includes: USB flash disk, mobile hard disk, read-only storage
Device (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or light
The various media that can store program code such as disk.
The above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although with reference to the foregoing embodiments
Invention is explained in detail, those skilled in the art should understand that: it still can be to aforementioned each implementation
Technical solution documented by example is modified or equivalent replacement of some of the technical features;And these modification or
Replacement, the spirit and scope of each embodiment technical solution of the embodiment of the present invention that it does not separate the essence of the corresponding technical solution.
The above is merely preferred embodiments of the present invention, be not intended to limit the invention, it is all in spirit of the invention and
Made any modifications, equivalent replacements, and improvements etc., should all be included in the protection scope of the present invention within principle.