Invention content
In view of this, a kind of information encryption and decryption method of present invention proposition and information encryption, decryption device, by using
The public key of hop count and destination node in routing information carries out dynamic encryption;Hop count information is obtained when decryption, then utilizes target
The private key of node is decrypted, therefore can solve how to use in safety there are when insecure user in ultraviolet light wireless network
Accomplish the encryption and decryption problem of information communication between family.
First, to achieve the above object, the present invention proposes a kind of information ciphering method, and the method comprising the steps of:
Routing information is sent to server and asks encrypted public key;The server is received according in the routing information
The public key that hop count and destination node marking information generate;The information area using the public key to sent information frame is added
It is close.
Optionally, described information frame includes the first relay node information, and the first relay node information is the road
The identification information of relay node included by diameter information.
Optionally, described information frame includes hop count device, and the hop count device is primary in the forwarding of described information frame
It is automatic later to add 1.
Optionally, the server according in the routing information hop count and destination node marking information generate
The process of public key can correspond to table according to preset hop count-public key to generate public key, wherein the hop count-public key corresponds to table packet
Correspondence containing each hop count and a public key of each node in network.
Optionally, the method further includes step:Encrypted described information frame is sent;At preset first
Between when being not received by the confirmation message corresponding to described information frame in threshold value, described information frame is retransmitted.
Optionally, the method further includes step:It is not received by preset sending times threshold value corresponding to described
When the confirmation message of information frame, it is transmitted the planning again in path, the transmission request is then repeated, receives public key, carries out
The step of encryption and transmission information frame.
In addition, to achieve the above object, the present invention also provides a kind of encryptions of information, including memory, processor and storage
On the memory and the information encipheror that can run on the processor, described information encipheror is by the processing
It is realized such as the step of above-mentioned information ciphering method when device executes.
The present invention also provides a kind of information decryption methods corresponding with described information encryption method, and the method comprising the steps of:
Encrypted information frame is received, the first relay node information of described information frame is obtained;By own node mark and institute
The node identification information stated in the first relay node information is compared;When own node mark is included in the first relaying section
When in point information, the hop count of the hop count device of described information frame is obtained;It is preset what own node stored according to the hop count
Hop count-private key correspond to and search corresponding private key in table;The information area of described information frame is decrypted using the private key.
Optionally, the method further includes step:When own node mark is not contained in the first relay node letter
When in breath, described information frame is forwarded.
Optionally, the information area that described information frame is decrypted using the private key is specifically included:When successful decryption, return
Multiple confirmation message is no longer forwarded described information frame to source node;When fail decryption when, described information frame is carried out
Forwarding.
In addition, to achieve the above object, the present invention also provides a kind of information decryption device, including memory, processor and
It is stored in the information decryption program that can be run on the memory and on the processor, described information decryption program is described
It is realized such as the step of above-mentioned information decryption method when processor executes.
Compared to the prior art, information encryption and decryption method proposed by the invention and information encryption, decryption device, lead to
It crosses and carries out dynamic encryption using the public key of hop count and destination node in routing information;Hop count information is obtained when decryption, it is then sharp
Be decrypted, therefore can be solved in ultraviolet light wireless network there are when insecure user with the private key of destination node, how
Accomplish the encryption and decryption problem of information communication between secured user.
Specific implementation mode
In order to make the purpose , technical scheme and advantage of the present invention be clearer, with reference to the accompanying drawings and embodiments, right
The present invention is further elaborated.It should be appreciated that described herein, specific examples are only used to explain the present invention, not
For limiting the present invention.Based on the embodiments of the present invention, those of ordinary skill in the art are not before making creative work
The every other embodiment obtained is put, shall fall within the protection scope of the present invention.
It should be noted that the description for being related to " first ", " second " etc. in the present invention is used for description purposes only, and cannot
It is interpreted as indicating or implying its relative importance or implicitly indicates the quantity of indicated technical characteristic.Define as a result, " the
One ", the feature of " second " can explicitly or implicitly include at least one of the features.In addition, the skill between each embodiment
Art scheme can be combined with each other, but must can be implemented as basis with those of ordinary skill in the art, when technical solution
Will be understood that the combination of this technical solution is not present in conjunction with there is conflicting or cannot achieve when, also not the present invention claims
Protection domain within.
As shown in fig.1, being each one optional application environment schematic diagram of embodiment of the present invention.
Present invention can apply to include but are not limited to ultraviolet light cordless communication network.In the present embodiment, the ring of application
Border be include ultraviolet light wireless network, which includes multiple node devices, and each node device is simultaneously
Encryption device and decryption device, can be used for as server.The node device can be mobile phone, notebook electricity
Brain, digit broadcasting receiver, PDA (personal digital assistant), PAD (tablet computer), navigation device, car-mounted device or mobile base
The fixed terminal of the movable equipment, and such as server and base-station stood etc. etc..In the present embodiment, it is set with encryption
Standby 5, decryption device 6 illustrates for server M.The server M is stored with the jump for corresponding to all nodes in the network
Number-public key corresponds to table.
As shown in fig.2, being the schematic diagram of the optional hardware structure of encryption device 5 one described in Fig. 1.In the present embodiment,
The encryption device 5 may include, but be not limited only to, and the first storage of connection can be in communication with each other by wired mode or wireless mode
Device 11, first processor 12, the first transmitting terminal 13 and the first receiving terminal 14.It should be pointed out that Fig. 2 is illustrated only with component
The encryption device 5 of 11-14, it should be understood that being not required for implementing all components shown, the implementation that can be substituted is more
Or less component.
Wherein, the first memory 11 includes at least a type of readable storage medium storing program for executing, the readable storage medium storing program for executing
Including flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memories etc.), random access storage device (RAM), quiet
State random access storage device (SRAM), electrically erasable programmable read-only memory (EEPROM), can be compiled read-only memory (ROM)
Journey read-only memory (PROM), magnetic storage, disk, CD etc..In some embodiments, the first memory 11 can be with
It is the internal storage unit of the encryption device 5, such as the hard disk or memory of the encryption device 5.In further embodiments,
The first memory 11 can also be to be equipped on the External memory equipment of the encryption device 5, such as the encryption device 5
Plug-in type hard disk, intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card dodge
Deposit card (Flash Card) etc..Certainly, the first memory 11 can also both include the storage inside list of the encryption device 5
Member also includes its External memory equipment.In the present embodiment, the first memory 11 is installed on the encryption commonly used in storage
The operating system and types of applications software of equipment 5, for example, information encipheror 200 program code etc..In addition, described first deposits
Reservoir 11 can be also used for temporarily storing the Various types of data that has exported or will export.
The first processor 12 can be central processing unit (Central in some embodiments
ProcessingUnit, CPU), controller, microcontroller, microprocessor or other data processing chips.The first processor
12 commonly used in controlling the overall operation of the encryption device 5, for example, execute with the mobile terminal carry out data interaction or
Communicate relevant control and processing etc..In the present embodiment, the first processor 12 is for running in the first memory 11
The program code of storage or processing data, such as operation described information encipheror 200 etc..
First transmitting terminal 13 includes but not limited to include:Electric signal is modulated into the modulation unit of optical signal, is encrypted
Unit, signal gain or amplifying unit.First transmitting terminal 13 is commonly used in the encryption device 5 needing the letter sent
Breath carries out coded modulation, and is launched in the form of optical signal.
First receiving terminal 14 includes but not limited to include:Signal gain or amplifying unit, by optical signal modulation at
The demodulating unit of electric signal, decryption unit.First receiving terminal 14, which is commonly used in the light for sending other node devices, to be believed
It number is demodulated and decoded to obtain raw information.
In the present embodiment, when being installed in the encryption device 5 and having run information encipheror 200, work as described information
When encipheror 200 is run, the encryption device 5 can be by being sent to server M by routing information, and acquisition is believed by the path
Then the public key corresponding to hop count and destination node marking information that breath includes is used for encryption information frame.In this way, realizing that dynamic adds
Close purpose ensures the safety of network communication.
As shown in fig.3, being the schematic diagram of the optional hardware structure of decryption device 6 one described in Fig. 1.In the present embodiment,
The decryption device 6 may include, but be not limited only to, and the second storage of connection can be in communication with each other by wired mode or wireless mode
Device 21, second processor 22, the second transmitting terminal 23 and the second receiving terminal 24.It should be pointed out that Fig. 3 is illustrated only with component
The decryption device 6 of 21-24, it should be understood that being not required for implementing all components shown, the implementation that can be substituted is more
Or less component.Decryption device 6 is similar to 5 hardware structure of encryption device, therefore, at the second memory 21, second
Device 22, the second transmitting terminal 23 and the second receiving terminal 24 is managed accordingly to handle with the first memory of the encryption device 5 11, first
Device 12, the first transmitting terminal 13 and the first receiving terminal 14 can realize similar function.
In the present embodiment, when being installed in the decryption device 6 and having run information decryption program 300, work as described information
When decryption program 300 is run, the decryption device 6 can obtain the jump in the information frame after receiving encrypted information frame
Then hop count in counter searches corresponding private key, then profit according in the hop count and hop count-private key table of itself storage
It is decrypted with private key.It is solved in this way, realize the encryption device 5 carrying out the information frame that dynamic encryption is crossed using hop count
It is close.
So far, oneself is through describing the application environment of the embodiment of the present invention and the hardware configuration of relevant device and function in detail.
In the following, above application environment and relevant device will be based on, each embodiment of the present invention is proposed.
First, the present invention proposes a kind of information encipheror 200.
As shown in fig.4, being the Program modual graph of 200 1 embodiment of information encipheror of the present invention.
In the present embodiment, described information encipheror 200 includes a series of calculating being stored on first memory 11
The letter of various embodiments of the present invention may be implemented when the computer program instructions are executed by first processor 12 in machine program instruction
The operation of encryption for information.In some embodiments, the specific operation realized based on the computer program instructions each section, it is described
Information encipheror 200 can be divided into one or more modules.For example, in Fig. 4, described information encipheror 200 can
To be divided into the first sending module 201, the first receiving module 202 and encrypting module 203.Wherein:
First sending module 201 asks encrypted public key for routing information to be sent to server.
Specifically, after the path transmitted is planned in encryption device 5, first sending module 201 is by the path
Information is sent to server M to ask corresponding encrypted public key.In the present embodiment, the routing information includes destination node
The information of identification information and the relay node passed through from source node to destination node.
First receiving module 202, for receiving the server according to the hop count and target in the routing information
The public key that node identification information generates.
Specifically, after the routing information is sent to server M by first sending module 201, server M is first
First the identification information of the destination node in routing information and all relay node numbers (i.e. hop count) are extracted, then by basis
Preset hop count-public key corresponds to public key of the table search corresponding to the identification information and the hop count of the destination node, wherein institute
It states hop count-public key and corresponds to the relation table that each hop count that table includes each node in network corresponds to a public key.In the present embodiment
In, the correspondence table of directly default hop count-public key is to save the time that server generates public key.In other embodiments,
One public key can be generated by a preset public key generating function according to different destination node marking information and hop count,
Certainly, the decrypting process next described can also generate a private key by a default private key generating function.Then it services
The public key is returned back to encryption device 5 by device M.First receiving module 202 of encryption device 5 then receives the public key.
The encrypting module 203 is encrypted for the information area using the public key to sent information frame.
First sending module 201 is additionally operable to send 203 encrypted information frame of the encrypting module.
Include the first relay node information and hop count device, the first relay node letter in the present embodiment, in described information frame
Breath is the identification information of the relay node included by the routing information, and the hop count device is primary in the forwarding of described information frame
It is automatic later to add 1.When first sending module 201 is not received by preset first time threshold corresponding to the letter
When ceasing the confirmation message of frame, described information frame is retransmitted.And it is not received by preset sending times threshold value pair
Should be when the confirmation message of described information frame, the encryption device 5 can also re-start the planning of transmission path, then repeat
The step of transmission for each module stated asks, receives public key, is encrypted and sends information frame.
By above procedure module 201-203, information encipheror 200 proposed by the invention can be by believing path
Breath is sent to server M, obtains by the routing information public key corresponding to the hop count for including and destination node marking information, then
For encryption information frame.In this way, realizing the purpose of dynamic encryption, ensure the safety of network communication.
As shown in fig.5, being the Program modual graph of 300 1 embodiment of information decryption program of the present invention.
In the present embodiment, described information decryption program 300 includes a series of calculating being stored on second memory 21
The letter of various embodiments of the present invention may be implemented when the computer program instructions are executed by second processor 22 in machine program instruction
The operation of encryption for information.In some embodiments, the specific operation realized based on the computer program instructions each section, it is described
Information decryption program 300 can be divided into one or more modules.For example, in Figure 5, described information decryption program 300 can
To be divided into the second receiving module 301, judgment module 302, deciphering module 303 and the second sending module 304.Wherein:
Second receiving module 301 obtains the first relay node of described information frame for receiving encrypted information frame
Information.
Specifically, encrypted information frame is wirelessly transmitted to the space in coverage area by encryption device 5.So
Afterwards, the second receiving module 301 of the decryption device 6 will receive the encrypted information frame, then obtain described information
The first relay node information in frame.
The judgment module 302, for identifying and the node identification in the first relay node information own node
Information is compared, to judge whether own node identification information is included in first relay node of described information frame
In information.
Specifically, the institute that the routing information is passed through is contained in the first relay node information of described information frame
There is the identification information of node.Described information frame is received in the second receiving module 301 and obtains the first relay node letter
After breath, the judgment module 302 is by the institute in the nodal information of itself of the decryption device 6 and the first relay node information
There is node identification information to be compared, to judge that own node identification information is included in the first relay node information
In.When the own node information is included in the first relay node information, then the decryption device 6 is the path
Node in information, and it is likely to be destination node, therefore the judgment module 302 also will continue to obtain and be jumped in described information frame
The hop count of counter.
The deciphering module 303, preset hop count-private key for being stored in own node according to the hop count correspond to table
It is middle to search corresponding private key, then utilize the information area of private key decryption described information frame.
Specifically, when the judgment module 302 judges that the own node identification information of the described information frame is included in
Continue the hop count of hop count device in acquisition described information frame when in the first relay node information.The deciphering module 303
Then corresponding private key can be searched in preset hop count-private key corresponds to table according to the hop count, the hop count-private key corresponds to table and is
The distinctive each hop count about the node of 6 own node of the decryption device corresponds to the correspondence table of a private key.The solution
After close module 303 finds the private key, the information area of described information frame is decrypted using the private key.Certainly, if institute
State decryption device 6 be the routing information on relay node when, the private key decryption cannot succeed;When the decryption device 6 is
When destination node, decryption can succeed.
Second sending module 304, for carrying out described information frame when the deciphering module 303 is decrypted not successfully
Forwarding.
Specifically, when the decryption device 6 is the relay node on the routing information, not destination node, therefore,
The deciphering module 303 of the decryption device 6 using the private key of hop count and own node to the information area of described information frame into
It cannot be successful when row decryption.At this point, the second sending module 304 of the decryption device 6 will turn described information frame
Hair.
In addition, when to judge that the own node mark of the decryption device 6 is not contained in described for the judgment module 302
When in the first relay node information of information frame, second sending module 304 can also forward described information frame.
By above procedure module 301-304, information decryption program 300 proposed by the invention can receive
After encrypted information frame, the hop count in the hop count device in the information frame is obtained, then according to the hop count and itself storage
Hop count-private key table in search corresponding private key, recycle private key to be decrypted.The encryption device 5 is utilized in this way, realizing
Hop count carries out the information frame that dynamic encryption is crossed and is decrypted.
In addition, the present invention also proposes a kind of information ciphering method.
As shown in fig.6, being the flow diagram of one embodiment of information ciphering method of the present invention.In the present embodiment, root
According to different demands, the execution sequence of the step in flow chart shown in fig. 6 can change, and certain steps can be omitted.
Routing information is sent to server and asks encrypted public key by step S500.
After encryption device 5 plans the path transmitted, the routing information is then sent to server M to ask
Corresponding encrypted public key.In the present embodiment, the routing information include destination node identification information and from source node to
The information for the relay node that destination node is passed through.
Step S502, receive the server according in the routing information hop count and destination node marking information generate
Public key.
Specifically, after the routing information being sent to server M, server M is first by the target in routing information
The identification information of node and all relay node numbers (i.e. hop count) extract, and then will be corresponded to according to preset hop count-public key
Table search corresponds to the public key of the identification information and the hop count of the destination node of the routing information, wherein the hop count-public affairs
Key corresponds to the relation table that each hop count that table includes each node in network corresponds to a public key.In the present embodiment, directly pre-
If the correspondence table of hop count-public key is to save the time that server generates public key.It in other embodiments, can also be according to not
Same destination node marking information and hop count generates a public key, certainly, next by a preset public key generating function
The decrypting process of description can also generate a private key by a default private key generating function.Then the public key is replied again
To encryption device 5, encryption device 5 then receives the public key.
Step S504, the information area using the public key to sent information frame are encrypted, then will be encrypted
Information frame is sent.
Specifically, the encryption device 5 sends encrypted information frame.In the present embodiment, described information frame
In include the first relay node information and hop count device, the relay node information be included by the routing information in
After the identification information of node, the hop count device is automatic after the forwarding of described information frame is primary to add 1.When preset first
When being not received by the confirmation message corresponding to described information frame in time threshold, described information frame is retransmitted.And
When being not received by the confirmation message corresponding to described information frame in preset sending times threshold value, the encryption device 5 can also
The planning of transmission path is re-started, above-mentioned transmission request is then repeated, receives public key, is encrypted and sends information frame
Step.
S500-S504 through the above steps, information ciphering method proposed by the invention can be by sending out routing information
It send to server M, obtains by the routing information public key corresponding to the hop count for including and destination node marking information, be then used for
Encryption information frame.In this way, realizing the purpose of dynamic encryption, ensure the safety of network communication.
In addition, corresponding to described information encryption method, the present invention also proposes a kind of information decryption method.
As shown in fig.7, being the flow diagram of one embodiment of information decryption method of the present invention.In the present embodiment, root
According to different demands, the execution sequence of the step in flow chart shown in Fig. 7 can change, and certain steps can be omitted.The solution
Decryption method is used to decrypt using the encrypted information frame of above-mentioned encryption method.
Step S600 receives encrypted information frame, obtains the first relay node information of described information frame.
Specifically, encrypted information frame is wirelessly transmitted to the space in coverage area by encryption device 5, so
Afterwards, the decryption device 6 will receive the encrypted information frame, then obtain the first relay node in described information frame
Information.
Own node is identified and is compared with the node identification information in the first relay node information by step S602
It is right, judge whether own node identification information is included in the first relay node information of described information frame.When itself
When whether node identification information is included in the first relay node information of described information frame, step S604 is carried out;Otherwise
Carry out step S608.
Specifically, the institute that the routing information is passed through is contained in the first relay node information of described information frame
There is the identification information of node.It, then will be described after receiving described information frame and obtaining the first relay node information
The nodal information of itself of decryption device 6 is compared with all node identification informations in the first relay node information, from
And judge whether own node identification information is included in the first relay node information.
Step S604 obtains the hop count in the hop count device of described information frame.
Specifically, when the own node information is included in the first relay node information, then the decryption is set
Standby 6 be the node on the routing information, and is likely to be destination node, therefore also will continue to obtain hop count in described information frame
The hop count of counter.
Step S606, the preset hop count-private key stored in own node according to the hop count are corresponded to search in table and be corresponded to
Private key, then using the private key decryption described information frame the information area.When successful decryption, flow terminates;Otherwise it carries out
Step S608.
Specifically, when judge the described information frame own node identification information be included in first relay node
Continue the hop count of hop count device in acquisition described information frame when in information.Then further according to the hop count in preset jump
Number-private key corresponds to and searches corresponding private key in table, and it is that 6 own node of the decryption device is peculiar that the hop count-private key, which corresponds to table,
Each hop count about the node correspond to a private key correspondence table.Then using the private key found to described information frame
The information area be decrypted.Certainly, if the decryption device 6 is the relay node on the routing information, the private key solution
It is close to succeed;When the decryption device 6 is destination node, decryption can succeed.
Described information frame is forwarded by step S608.
S600-S608 through the above steps, information decryption method proposed by the invention can receive encryption
Information frame after, obtain the hop count in the hop count device in the information frame, then according to the hop count and itself storage jump
Corresponding private key is searched in number-private key table, and private key is recycled to be decrypted.The encryption device 5 is utilized into hop count in this way, realizing
The information frame that dynamic encryption is crossed is carried out to be decrypted.
The embodiments of the present invention are for illustration only, can not represent the quality of embodiment.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side
Method can add the mode of required general hardware platform to realize by software, naturally it is also possible to by hardware, but in many cases
The former is more preferably embodiment.Based on this understanding, technical scheme of the present invention substantially in other words does the prior art
Going out the part of contribution can be expressed in the form of software products, which is stored in a storage medium
In (such as ROM/RAM, magnetic disc, CD), including some instructions are used so that a station terminal equipment (can be mobile phone, computer, clothes
Be engaged in device, air conditioner or the network equipment etc.) execute method described in each embodiment of the present invention.
It these are only the preferred embodiment of the present invention, be not intended to limit the scope of the invention, it is every to utilize this hair
Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills
Art field, is included within the scope of the present invention.